diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-03-22 08:40:25 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2021-03-22 14:30:51 +0000 |
commit | 8f2393f9dfbbbcfac8bda35e279fd0024d0092c6 (patch) | |
tree | 8e1c6cb96cd155a336f158eca538cf7f29b30405 /start-container-docker.sh | |
parent | 28611f0a7c709c885c1e92fcee677a9cdc6b9480 (diff) |
start-container-docker.sh: Move workaround for dockerhub's limits
... to dockerfiles.git/tcwg-base/tcwg-host/docker-wrapper .
Our workaround to dockerhub's pull limits in start-container-docker.sh
works well, but with one exception -- it doesn't properly work when
container is started on a remote host, which we do a lot in
tcwg-benchmark-* jobs.
To solve this we migrate workaround logic to docker wrapper script,
and add a new docker command for it -- "maybepull".
Change-Id: I131f1adc56052164a76c5dfaf9d07a4d2f24ec43
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-x | start-container-docker.sh | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh index f7a7f45f..71dec51f 100755 --- a/start-container-docker.sh +++ b/start-container-docker.sh @@ -222,33 +222,6 @@ esac image=linaro/ci-${container_arch}-tcwg-build-ubuntu:${distro} -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 - -# We use two stamp files per image: -# - $image_stamp.pull -- time of last image pull -# - $image_stamp.use -- time of last image use -image_stamp="$stamp_dir/$(echo "$image" | tr "/:" "_")" - -# We attempt to run all our builds using current versions of docker images. -# Unfortunately, now that dockerhub limits pull requests, we need to be more -# considerate to when we pull the image or attempt to use a local copy. -# Also note that "docker run" below will automatically pull the image if there -# is no local copy. -pull_image=false - -# For starters, let's try to pull images once a day. This guarantees -# that any change to master docker images will be deployed within a day. -pull_if_older_than=$(($(date +%s) - 1*24*60*60)) -# Use negative comparison to handle non-existent stamp files. -if ! [ "$(stat -c %Z "$image_stamp.pull" 2>/dev/null)" \ - -gt $pull_if_older_than ] 2>/dev/null; then - pull_image=true -fi - # Avoid connexion sharing because of race conditions with parallel # builds SSH="ssh -S none" @@ -257,16 +230,9 @@ SSH="ssh -S none" # foo bar docker <...> # Instead of: # "foo bar docker" <...> -DOCKER="$dryruncmd $SSH $session_host docker" - -if $pull_image; then - $DOCKER pull $image || ssh_error $? - # Remove the stamp to avoid permission issues (we have rwx permissions - # for all on the directory, so we can always remove a file, but only - # owner can modify files. - rm -f "$image_stamp.pull" - touch "$image_stamp.pull" -fi +DOCKER="$dryruncmd $SSH $session_host docker-wrapper" + +$DOCKER maybepull $image || ssh_error $? SECURITY="--cap-add=SYS_PTRACE" # We need this because of a bug in libgo's configure script: @@ -409,11 +375,6 @@ if $ssh_info; then ssh_info_opt="ssh_host=${user}$session_host ssh_port=$session_port" fi -# Update the time of image use, so that we don't remove the image in -# tcwg-cleanup-stale-containers. -rm -f "$image_stamp.use" -touch "$image_stamp.use" - # Restore stdout/stderr exec 1>&3 2>&4 |