diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml new file mode 100644 index 0000000..c92a45c --- /dev/null +++ b/.woodpecker/build.yaml @@ -0,0 +1,20 @@ +when: + - event: pull_request + +steps: + # PR gate: build the CA-baked plugin image only, no push. buildah runs + # unprivileged in-cluster, so use the vfs storage driver + chroot isolation. + - name: build + image: quay.io/buildah/stable + commands: + - "buildah build --isolation chroot --storage-driver vfs -t plugin-docker-buildx:${CI_COMMIT_SHA} ." + backend_options: + kubernetes: + serviceAccountName: plugin-docker-buildx + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2 diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml new file mode 100644 index 0000000..88f54b1 --- /dev/null +++ b/.woodpecker/release.yaml @@ -0,0 +1,36 @@ +when: + - event: tag + ref: refs/tags/v* + +steps: + # Build the CA-baked plugin image and push it to artifactapi's docker-internal + # registry. buildah runs unprivileged in-cluster (vfs + chroot isolation). + # + # Push is credential-less: the in-cluster runner already has push access to the + # artifactapi docker-internal registry (same pattern as autobackup-operator / + # jellyfin-ha). --tls-verify=false is a deliberate bootstrap: THIS image is what + # teaches k8s buildx to trust artifactapi's internal CA, so its own push cannot + # yet rely on that trust. + # + # Commands are quoted: woodpecker templates ${CI_COMMIT_TAG} into the raw YAML + # before parsing, so an unquoted "-t $${IMG}:${CI_COMMIT_TAG} ." can collapse to + # "... -t $${IMG}: ." and YAML then reads the "colon-space" as a map key. + - name: release + image: quay.io/buildah/stable + environment: + IMG: artifactapi.k8s.syd1.au.unkin.net/docker-internal/plugin-docker-buildx + commands: + - "buildah build --isolation chroot --storage-driver vfs -t $${IMG}:${CI_COMMIT_TAG} ." + - "buildah tag --storage-driver vfs $${IMG}:${CI_COMMIT_TAG} $${IMG}:latest" + - "buildah push --storage-driver vfs --tls-verify=false $${IMG}:${CI_COMMIT_TAG}" + - "buildah push --storage-driver vfs --tls-verify=false $${IMG}:latest" + backend_options: + kubernetes: + serviceAccountName: plugin-docker-buildx + resources: + requests: + memory: 512Mi + cpu: 1 + limits: + memory: 2Gi + cpu: 2 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a2ee409 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM docker.io/woodpeckerci/plugin-docker-buildx:latest +# buildkit reads this to trust artifactapi's internal-CA registry on push +COPY unkin-ca.crt /etc/docker/certs.d/artifactapi.k8s.syd1.au.unkin.net/ca.crt +# fallback: system trust store (docker login / other code paths) +COPY unkin-ca.crt /usr/local/share/ca-certificates/unkin-ca.crt +RUN cat /usr/local/share/ca-certificates/unkin-ca.crt >> /etc/ssl/certs/ca-certificates.crt || true diff --git a/README.md b/README.md index a1b6372..5d29b46 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,30 @@ # plugin-docker-buildx -Woodpecker plugin-docker-buildx image with the internal Vault-PKI CA baked in (trusts artifactapi) \ No newline at end of file +A drop-in rebuild of `woodpeckerci/plugin-docker-buildx` with the internal +Vault-PKI CA baked in. + +## Why + +The stock `woodpeckerci/plugin-docker-buildx` image does not trust artifactapi's +internal CA, so k8s Woodpecker buildx jobs cannot push to +`artifactapi.k8s.syd1.au.unkin.net/docker-internal/*` — buildkit needs +`/etc/docker/certs.d//ca.crt` inside the plugin container, and the k8s +backend has no way to inject it. + +This image copies the `vault-ca-cert` bundle (root + intermediate) into that path +plus the system trust store, so pipelines can `settings.registry: +artifactapi.k8s.syd1.au.unkin.net` and push over TLS. + +## Published as + +`artifactapi.k8s.syd1.au.unkin.net/docker-internal/plugin-docker-buildx:` (and `:latest`) + +## Bootstrap + +This image is itself built and pushed by **buildah** (`.woodpecker/release.yaml`), +not by buildx, using `buildah push --tls-verify=false`. buildah is used precisely +because it sidesteps the buildx CA-trust problem that this image exists to fix — +its own push therefore cannot rely on that trust yet. + +Once published, point Woodpecker docker-buildx steps at this image instead of the +upstream one to push to the docker-internal registry. diff --git a/unkin-ca.crt b/unkin-ca.crt new file mode 100644 index 0000000..58d7a5a ---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