Keep tarball and release properties for release
The installer file created by the package role can not be scanned by
JFrog XRAY due to it being an incompatible artifact type. In order for
the artifact to be scanned, it needs to be in one of the supported
formats.
This change updates package role to keep the tarball if the packaging
is run by release job in order to make scanning of artifacts possible.
In addition to keeping the tarball around, release job records release
metadata in release.properties file. This file is needed to be included
in tarball and installer file in order to make the traceability better.
Please note that both of these operations take effect if the release
metadata file /tmp/release.properties exists. This file is only created
by release job on Jenkins and does not exist for manual builds so there
is not change for manual packaging.
Change-Id: I3189806fc7a45b63328dc7236c94119f2ee9e295
diff --git a/playbooks/roles/package/files/build.sh b/playbooks/roles/package/files/build.sh
index c28264d..fa801b8 100755
--- a/playbooks/roles/package/files/build.sh
+++ b/playbooks/roles/package/files/build.sh
@@ -48,7 +48,13 @@
cat /tmp/decompress.sh "$OFFLINE_PKG_FILE" > "$OFFLINE_INSTALLER_FILE"
chmod +x "$OFFLINE_INSTALLER_FILE"
-# remove intermediate offline pkg file
-rm -rf "$OFFLINE_PKG_FILE"
+# NOTE (fdegir): if the packaging is run by release job, that job stored release
+# metadata in release.properties file. If this file exists, we need to keep tarball
+# as that must be uploaded for further delivery. The reason for this is that the
+# installer can not be scanned by XRAY
+if [[ ! -f "/tmp/release.properties" ]]; then
+ # remove intermediate offline pkg file
+ rm -rf "$OFFLINE_PKG_FILE"
+fi
# vim: set ts=2 sw=2 expandtab: