summaryrefslogtreecommitdiff
path: root/tcwg-start-container.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-01-04 07:26:05 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2021-01-04 07:34:11 +0000
commit49acfb8a50661b74f64352914b48b259be6bef38 (patch)
tree5ece50430bdecc8b0d326e461494a85093bad580 /tcwg-start-container.sh
parent7654f42e2d36c49b388abc653c5017170eea3ce1 (diff)
Docker image pull: Fix removing previously untagged images
... and update "pull" timestamps in tcwg-start-container.sh Change-Id: Ib5638a9fb22c341527443fd3ff2f8431f7aa1fe0
Diffstat (limited to 'tcwg-start-container.sh')
-rwxr-xr-xtcwg-start-container.sh25
1 files changed, 14 insertions, 11 deletions
diff --git a/tcwg-start-container.sh b/tcwg-start-container.sh
index 2c0efb2c..cc9b040b 100755
--- a/tcwg-start-container.sh
+++ b/tcwg-start-container.sh
@@ -8,6 +8,7 @@ convert_args_to_variables "$@"
shift "$SHIFT_CONVERTED_ARGS"
obligatory_variables container image
+declare container image
keep_existing="${keep_existing-true}"
verbose="${verbose-true}"
@@ -16,11 +17,22 @@ set -u
if $verbose; then set -x; fi
-# shellcheck disable=SC2154
+# See start-container-docker.sh for background on image stamp files.
+# Note that there is no need to track pull requests, since these happen
+# once a day anyway.
+stamp_dir=/home/shared/docker
+if ! [ -d "$stamp_dir" ]; then
+ sudo mkdir -p "$stamp_dir" || mkdir -p "$stamp_dir"
+ sudo chmod 0777 "$stamp_dir" || chmod 0777 "$stamp_dir"
+fi
+image_stamp="$stamp_dir/$(echo "$image" | tr "/:" "_")"
+
docker pull "$image"
+rm -f "$image_stamp.pull"
+touch "$image_stamp.pull"
+
rm_cnt=""
-# shellcheck disable=SC2154
if docker stats --no-stream "$container" >/dev/null 2>&1; then
case "$keep_existing" in
true) exit 0 ;;
@@ -53,15 +65,6 @@ docker run --rm $image start.sh > "$start_sh"
bash "$start_sh" "$@"
rm "$start_sh"
-# See start-container-docker.sh for background on image stamp files.
-# Note that there is no need to track pull requests, since these happen
-# once a day anyway.
-stamp_dir=/home/shared/docker
-if ! [ -d "$stamp_dir" ]; then
- sudo mkdir -p "$stamp_dir" || mkdir -p "$stamp_dir"
- sudo chmod 0777 "$stamp_dir" || chmod 0777 "$stamp_dir"
-fi
-image_stamp="$stamp_dir/$(echo "$image" | tr "/:" "_")"
rm -f "$image_stamp.use"
touch "$image_stamp.use"