Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion task/docker-build/0.1/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ spec:
description: Reference of the image docker will produce.
- name: builder_image
description: The location of the docker builder image.
default: docker.io/library/docker:stable@sha256:18ff92d3d31725b53fa6633d60bed323effb6d5d4588be7b547078d384e0d4bf #tag: stable
default: docker.io/library/docker@sha256:2658fda9e8779b94ea1581f4d25214dac9ed144b407902842e5328cce8f861f5 #tag: 29 (linux/amd64)
- name: dind_image
description: The location of the docker-in-docker image.
default: docker:dind
Expand All @@ -46,6 +46,41 @@ spec:
- name: IMAGE_DIGEST
description: Digest of the image just built.
steps:
- name: docker-info
image: $(params.builder_image)
env:
# Connect to the sidecar over TCP, with TLS.
- name: DOCKER_HOST
value: tcp://localhost:2376
# Verify TLS.
- name: DOCKER_TLS_VERIFY
value: '1'
# Use the certs generated by the sidecar daemon.
- name: DOCKER_CERT_PATH
value: /certs/client
# Retry cap for docker readiness
- name: MAX_RETRIES
value: "60"
workingDir: $(workspaces.source.path)
script: |
#!/bin/sh
set -e
i=0
max="${MAX_RETRIES:-60}"
until docker info >/dev/null 2>&1; do
i=$((i+1))
if [ "$i" -ge "$max" ]; then
echo "ERROR: Docker daemon did not become ready after ${max} attempts."
docker info || true
exit 1
fi
echo "Docker not ready yet (attempt ${i}/${max}); sleeping 1s..."
sleep 1
done
echo "Docker daemon is ready."
volumeMounts:
- mountPath: /certs/client
name: dind-certs
- name: docker-build
image: $(params.builder_image)
env:
Expand Down