Add more info to generated blob data 92/91092/4
authorTomáš Levora <t.levora@partner.samsung.com>
Tue, 9 Jul 2019 13:33:48 +0000 (15:33 +0200)
committerTomáš Levora <t.levora@partner.samsung.com>
Fri, 20 Sep 2019 16:02:56 +0000 (18:02 +0200)
Changed the way of storing nexus image information to nexus.ver in built
blob

Added information about OOM commit from which was the used onap docker
images list generated

Added information about oom/offline-installer commit used to build the
nexus blob

Example of the resulting nexus.ver in the nexus_data:

nexus_image=sonatype/nexus3:3.15.2
nexus_image_digest=sha256:5d3600fd5cf27c3a789e7d4a3ce9448086d73a4247a118d8cdcdbabb1aff4ff7
used_image_list0=custom_docker_images.list
used_image_list1=onap_docker_images.list
used_image_list2=rke_docker_images.list
oom_repo_commit=106dbc9a0224a3259f1eaf24d4bcc8571ed591ab
installer_repo_commit=574255919970ffaf506c08d3eeaea8d6d7656236

Issue-ID: OOM-1969

Change-Id: Id824f97079fbd578cdc7af1ad959e95a52fe1d2c
Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
build/build_nexus_blob.sh

index 51ab05e..f964bf9 100755 (executable)
@@ -333,7 +333,13 @@ chown 200:200 ${NEXUS_DATA_DIR}
 chmod 777 ${NEXUS_DATA_DIR}
 
 # Save Nexus version to prevent/catch data incompatibility
-docker images --no-trunc | grep sonatype/nexus3 | awk '{ print $1":"$2" "$3}' > ${NEXUS_DATA_DIR}/nexus.ver
+# Adding commit informations to have link to data from which the blob was built
+cat >> ${NEXUS_DATA_DIR}/nexus.ver << INFO
+nexus_image=$(docker image ls ${NEXUS_IMAGE} --no-trunc --format "{{.Repository}}:{{.Tag}}\nnexus_image_digest={{.ID}}")
+$(for INDEX in ${!NXS_DOCKER_IMG_LISTS[@]}; do printf 'used_image_list%s=%s\n' "$INDEX" "$(sed 's/^.*\/\(.*\)$/\1/' <<< ${NXS_DOCKER_IMG_LISTS[$INDEX]})"; done)
+$(sed -n 's/^.*OOM\ commit\ /oom_repo_commit=/p' ${NXS_DOCKER_IMG_LISTS[@]})
+installer_repo_commit=$(git --git-dir="${LOCAL_PATH}/../.git" rev-parse HEAD)
+INFO
 
 # Start the Nexus
 NEXUS_CONT_ID=$(docker run -d --rm -v ${NEXUS_DATA_DIR}:/nexus-data:rw --name ${NEXUS_DOMAIN} ${PUBLISHED_PORTS} ${NEXUS_IMAGE})