From 53a486264fd4c78e56c0d301cb1505b72717d3a1 Mon Sep 17 00:00:00 2001 From: Stephan Schnabel Date: Tue, 17 Jun 2025 21:03:44 +0200 Subject: [PATCH] a --- .woodpecker/build.yaml | 11 +++++------ README.md | 4 ++++ entrypoint.sh | 4 ++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index 057cbe8..d18fdb8 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -1,14 +1,9 @@ -when: - instance: ci.kokuwa.io - repo: woodpecker/buildctl - event: [manual, push, pull_request] - branch: main - path: [.woodpecker/build.yaml, Dockerfile, Dockerfile.dockerignore, entrypoint.sh] steps: build: image: kokuwaio/buildctl + pull: true settings: &settings name: registry.kokuwa.io/kokuwaio/buildctl:ci-${CI_PIPELINE_NUMBER} auth: @@ -16,6 +11,10 @@ steps: username: {from_secret: kokuwa_io_username} password: {from_secret: kokuwa_io_password} platform: [linux/amd64, linux/arm64] + build-args: + NPM_CONFIG_REGISTRY: + FOO: bar + CCC: null annotation: org.opencontainers.image.title: Buildctl WoodpeckerCI Plugin org.opencontainers.image.description: A WoodpeckerCI plugin for buildctl to build container images using a remote builtkitd instance. diff --git a/README.md b/README.md index 1f0a5c1..32eab59 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,9 @@ steps: annotation: org.opencontainers.image.title: My Image org.opencontainers.image.description: A description. + build-args: + NPM_CONFIG_REGISTRY: # reused from ci env + FOO: bar platform: [linux/amd64, linux/arm64] auth: registry.example.org: @@ -75,6 +78,7 @@ docker run --rm --user=$(id -u) --volume=$HOME:$HOME:ro --workdir=$PWD --env=PLU | `frontend` | PLUGIN_FRONTEND | `dockerfile.v0` | Only dockerfile frontend supported right now | | `context` | PLUGIN_CONTEXT | `$PWD` | Context directory to use for build | | `dockerfile` | PLUGIN_DOCKERFILE | `Dockerfile` | Dockerfile to use. | +| `build-args` | PLUGIN_BUILD_ARGS | `none` | Build args to pass to build | | `platform` | PLUGIN_PLATFORM | `none` | Target platform for container image. | | `source-epoch-date` | PLUGIN_SOURCE_DATE_EPOCH | `0` | Timestamp to use for reproduceable builds. | | `name` | PLUGIN_NAME | `none` | Images names where to push the image. | diff --git a/entrypoint.sh b/entrypoint.sh index 76543bc..342474a 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -37,6 +37,10 @@ fi COMMAND+=" --frontend=$BUILDCTL_FRONTEND" COMMAND+=" --local=context=$BUILDCTL_CONTEXT" COMMAND+=" --local=dockerfile=$BUILDCTL_DOCKERFILE" +if [[ -n "${PLUGIN_BUILD_ARGS:-}" ]]; then + env|sort + OUTPUT+="$(echo "$PLUGIN_BUILD_ARGS" | jq --join-output 'keys[] as $k|",annotation.\($k)=\(.[$k])"')" +fi if [[ -n "${PLUGIN_PLATFORM:-}" ]]; then COMMAND+=" --opt=platform=$PLUGIN_PLATFORM" fi