Save docker images based on list 77/79277/2
authorTomáš Levora <t.levora@partner.samsung.com>
Wed, 27 Feb 2019 16:00:25 +0000 (17:00 +0100)
committerTomáš Levora <t.levora@partner.samsung.com>
Thu, 28 Feb 2019 08:44:28 +0000 (09:44 +0100)
Save all docker images to tarballs based on list instead of saving all
local registry to prevent not necessary images in the package

Issue-ID: OOM-1683

Change-Id: Iaf4e092ff124f753d50be876d6ab564c7f349ddc
Signed-off-by: Tomáš Levora <t.levora@partner.samsung.com>
build/creating_data/save-docker-images.sh
build/download_offline_data_by_lists.sh

index f4a5d3c..4c76455 100755 (executable)
@@ -27,7 +27,8 @@ if [ "$IS_COMMON_FUNCTIONS_SOURCED" != YES ] ; then
     . "${LOCAL_PATH}"/"${RELATIVE_PATH}"/common-functions.sh
 fi
 
-IMG_DIR="$1"
+LIST="${1}"
+IMG_DIR="${2}"
 
 if [[ -z "$IMG_DIR" ]]; then
     IMG_DIR="./images"
@@ -55,13 +56,11 @@ save_image() {
 
 echo "Save all images"
 line=1
-lines=$(docker images|grep -v 'IMAGE ID'|wc -l)
+lines=$(wc -l ${LIST})
 while read -r image; do
     echo "== pkg #$line of $lines =="
 
-    name=$(echo $image|awk '{print $1}')
-    tag=$(echo $image|awk '{print $2}')
-    save_image "$name:$tag"
+    save_image "${image}"
     line=$((line+1))
 
-done <<< "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s\n", $1, $2)}'|column -t)"
+done < "${LIST}"
index b7acb4a..5555d20 100755 (executable)
@@ -59,7 +59,7 @@ echo "[Step $((CURR++))/$TOTAL Build own nginx image]"
 $CTOOLS/create_nginx_image/01create-image.sh
 
 echo "[Step $((CURR++))/$TOTAL Save docker images from docker cache to tarfiles]"
-$CTOOLS/save-docker-images.sh "${DATA_DIR}/offline_data/docker_images_for_nexus"
+$CTOOLS/save-docker-images.sh "${LISTS_DIR}/${TAG}-docker_images.list" "${DATA_DIR}/offline_data/docker_images_for_nexus"
 
 echo "[Step $((CURR++))/$TOTAL move infra related images to infra folder]"
 mkdir -p "${DATA_DIR}/offline_data/docker_images_infra"