зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1318466 - Fix image_builder to fail if docker socket returns 404. r=dustin
MozReview-Commit-ID: sgjfYiAqtT --HG-- extra : rebase_source : a8433a408d774225a04245f4127e15dd8e4530cf
This commit is contained in:
Родитель
98ef2aa49c
Коммит
01036edcf4
|
@ -1 +1 @@
|
|||
1.0.0
|
||||
1.1.0
|
||||
|
|
|
@ -37,23 +37,27 @@ test -f "$CONTEXT_FILE" || raise_error "Context file wasn't created"
|
|||
# Post context tar-ball to docker daemon
|
||||
# This interacts directly with the docker remote API, see:
|
||||
# https://docs.docker.com/engine/reference/api/docker_remote_api_v1.18/
|
||||
curl -s \
|
||||
curl -s --fail \
|
||||
-X POST \
|
||||
--header 'Content-Type: application/tar' \
|
||||
--data-binary "@$CONTEXT_FILE" \
|
||||
--unix-socket /var/run/docker.sock "http:/build?t=$IMAGE_NAME:$HASH" \
|
||||
| tee /tmp/docker-build.log \
|
||||
| jq -r '.status + .progress, .stream[:-1], .error | select(. != null)'
|
||||
| jq -jr '(.status + .progress, .error | select(. != null) + "\n"), .stream | select(. != null)'
|
||||
|
||||
# Exit non-zero if there is error entries in the log
|
||||
if cat /tmp/docker-build.log | jq -se 'add | .error' > /dev/null; then
|
||||
raise_error "Image build failed: `cat /tmp/docker-build.log | jq -rse 'add | .error'`";
|
||||
fi
|
||||
|
||||
# Get image from docker daemon
|
||||
# Get image from docker daemon (try up to 10 times)
|
||||
# This interacts directly with the docker remote API, see:
|
||||
# https://docs.docker.com/engine/reference/api/docker_remote_api_v1.18/
|
||||
curl -s \
|
||||
-X GET \
|
||||
--unix-socket /var/run/docker.sock "http:/images/$IMAGE_NAME:$HASH/get" \
|
||||
| zstd -3 -c -o /home/worker/workspace/artifacts/image.tar.zst
|
||||
count=0
|
||||
while ! curl -s --fail -X GET \
|
||||
--unix-socket /var/run/docker.sock "http:/images/$IMAGE_NAME:$HASH/get" \
|
||||
| zstd -3 -c -o /home/worker/workspace/artifacts/image.tar.zst; do
|
||||
((c++)) && ((c==10)) && echo 'Failed to get image from docker' && exit 1;
|
||||
echo 'Waiting for image to be ready';
|
||||
sleep 5;
|
||||
done
|
||||
|
|
Загрузка…
Ссылка в новой задаче