This commit is contained in:
Stephan Schnabel 2025-06-07 16:55:01 +02:00
parent f09b6486f9
commit db4412c876
Signed by: stephan.schnabel
SSH key fingerprint: SHA256:99zuzxNGFb5/5P+E/O7ONU2qhUojUe/D8rIPTW+9Xp0
10 changed files with 89 additions and 85 deletions

View file

@ -7,12 +7,12 @@
[![prs](https://img.shields.io/gitea/pull-requests/open/woodpecker/buildctl?gitea_url=https%3A%2F%2Fgit.kokuwa.io)](https://git.kokuwa.io/woodpecker/buildctl/pulls)
[![issues](https://img.shields.io/gitea/issues/open/woodpecker/buildctl?gitea_url=https%3A%2F%2Fgit.kokuwa.io)](https://git.kokuwa.io/woodpecker/buildctl/issues)
A [Woodpecker CI](https://woodpecker-ci.org) plugin for [buildctl](https://github.com/moby/buildkit) to build container images using a remote buildkit instance.
A [Woodpecker CI](https://woodpecker-ci.org) plugin for [buildctl](https://github.com/moby/buildkit) to build container images using a remote buildkit host.
Also usable with Gitlab, Github or locally, see examples for usage.
## Features
- preconfigure buildctl parameters
- preconfigured for [reproduceable builds](https://github.com/moby/buildkit/blob/master/docs/build-repro.md)
- runnable with local docker daemon
## Example
@ -23,13 +23,15 @@ Woodpecker:
steps:
buildctl:
image: kokuwaio/buildctl
depends_on: []
settings:
no-warnings: true
format: json
when:
event: pull_request
path: [.buildctl.yaml, "**/*.y*ml"]
name:
- registry.example.org/foo:latest
- registry.example.org/foo:0.0.1
annotation:
org.opencontainers.image.title: My Image
org.opencontainers.image.description: A description.
platform: [linux/amd64, linux/arm64]
auth: {from_secret: AUTH}
```
Gitlab:
@ -40,34 +42,45 @@ buildctl:
needs: []
image: kokuwaio/buildctl
variables:
PLUGIN_NO_WARNINGS: true
PLUGIN_FORMAT: json
PLUGIN_ADDR: tcp://0.8.1.5:1234
PLUGIN_NAME: registry.example.org/foo:latest,registry.example.org/foo:0.0.1
PLUGIN_PLATFORM: linux/amd64,linux/arm64
PLUGIN_AUTH: '{"auths":{"registry.example.org":{"auth":"changeMe}}}'
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
changes: [.buildctl.yaml, "**/*.y*ml"]
```
CLI:
CLI (will reuse docker credentials of current user):
```bash
docker run --rm --volume=$(pwd):$(pwd):ro --workdir=$(pwd) kokuwaio/buildctl --no-warnings --format=json
PLUGIN_ADDR=tcp://0.8.1.5:1234
PLUGIN_NAME=registry.example.org/foo:latest,registry.example.org/foo:0.0.1
PLUGIN_PLATFORM=linux/amd64,linux/arm64
docker run --rm --user=$(id -u) --volume=$HOME:$HOME:ro --workdir=$PWD --env=PLUGIN_ADDR --env=PLUGIN_NAME --env=PLUGIN_PLATFORM kokuwaio/buildctl
```
## Settings
| Settings Name | Environment | Default | Description |
| --------------| ------------------ | --------- | -------------------------------------------------------------------- |
| `config-file` | PLUGIN_CONFIG_FILE | `none` | Configuration file to use, if none is configured [default](https://buildctl.readthedocs.io/en/stable/configuration.html) is used |
| `strict` | PLUGIN_STRICT | `true` | Fail on warnings |
| `no-warnings` | PLUGIN_NO_WARNINGS | `false` | Output only error level problems |
| `format` | PLUGIN_FORMAT | `colored` | Format for parsing output: parsable, standard, colored, github, auto |
| Settings Name | Environment | Default | Description |
| ------------------- | ------------------------ | ---------------- | ----------------------------------------------------------------------------------------------- |
| `addr` | PLUGIN_ADDR | `$BUILDKIT_HOST` | Buildkit host to use. |
| `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. |
| `platform` | PLUGIN_PLATFORM | `none` | Target platform for container image. |
| `source-epoch-date` | PLUGIN_SOURCE_DATE_EPOCH | `0` | Target platform for container image. |
| `name` | PLUGIN_NAME | `none` | Images names where to push the image. |
| `annotation` | PLUGIN_ANNOTATION | `none` | Annotations (also known as labels) to add to image |
| `auth` | PLUGIN_AUTH | `none` | Auth for private registries, see [](https://github.com/moby/buildkit?tab=readme-ov-file#output) |
| `push` | PLUGIN_PUSH | `true` | Push images if output names are set. |
## Alternatives
| Image | Comment | amd64 | arm64 |
| ----------------------------------------------------------------------------------- | --------------------------------- |:-----:|:-----:|
| [kokuwaio/buildctl](https://hub.docker.com/r/kokuwaio/buildctl) | Woodpecker plugin | [![size](https://img.shields.io/docker/image-size/kokuwaio/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/kokuwaio/buildctl) | [![size](https://img.shields.io/docker/image-size/kokuwaio/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/kokuwaio/buildctl) |
| [pipelinecomponents/buildctl](https://hub.docker.com/r/pipelinecomponents/buildctl) | not a Woodpecker plugin | [![size](https://img.shields.io/docker/image-size/pipelinecomponents/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/pipelinecomponents/buildctl) | [![size](https://img.shields.io/docker/image-size/pipelinecomponents/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/pipelinecomponents/buildctl) |
| [giantswarm/buildctl](https://hub.docker.com/r/giantswarm/buildctl) | not a Woodpecker plugin | [![size](https://img.shields.io/docker/image-size/giantswarm/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/giantswarm/buildctl) | [![size](https://img.shields.io/docker/image-size/giantswarm/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/giantswarm/buildctl) |
| [cytopia/buildctl](https://hub.docker.com/r/sdesbure/buildctl) | not a Woodpecker plugin, outdated | [![size](https://img.shields.io/docker/image-size/cytopia/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/cytopia/buildctl) | [![size](https://img.shields.io/docker/image-size/cytopia/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/cytopia/buildctl) |
| [sdesbure/buildctl](https://hub.docker.com/r/sdesbure/buildctl) | not a Woodpecker plugin, outdated | [![size](https://img.shields.io/docker/image-size/sdesbure/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/sdesbure/buildctl) | [![size](https://img.shields.io/docker/image-size/sdesbure/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/sdesbure/buildctl) |
| Image | Comment | amd64 | arm64 |
| --------------------------------------------------------------- | --------------------------------- |:-----:|:-----:|
| [kokuwaio/buildctl](https://hub.docker.com/r/kokuwaio/buildctl) | Woodpecker plugin | [![size](https://img.shields.io/docker/image-size/kokuwaio/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/kokuwaio/buildctl) | [![size](https://img.shields.io/docker/image-size/kokuwaio/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/kokuwaio/buildctl) |
| [moby/buildkit](https://hub.docker.com/r/moby/buildkit) | not a Woodpecker plugin | [![size](https://img.shields.io/docker/image-size/moby/buildkit?arch=amd64&label=)](https://hub.docker.com/repository/docker/moby/buildkit) | [![size](https://img.shields.io/docker/image-size/moby/buildkit?arch=arm64&label=)](https://hub.docker.com/repository/docker/moby/buildkit) |
| [nordseth/buildctl](https://hub.docker.com/r/nordseth/buildctl) | not a Woodpecker plugin | [![size](https://img.shields.io/docker/image-size/nordseth/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/nordseth/buildctl) | [![size](https://img.shields.io/docker/image-size/nordseth/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/nordseth/buildctl) |
| [shopstic/buildctl](https://hub.docker.com/r/shopstic/buildctl) | not a Woodpecker plugin, outdated | [![size](https://img.shields.io/docker/image-size/shopstic/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/shopstic/buildctl) | [![size](https://img.shields.io/docker/image-size/shopstic/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/shopstic/buildctl) |
| [agisoft/buildctl](https://hub.docker.com/r/agisoft/buildctl) | not a Woodpecker plugin, outdated | [![size](https://img.shields.io/docker/image-size/agisoft/buildctl?arch=amd64&label=)](https://hub.docker.com/repository/docker/agisoft/buildctl) | [![size](https://img.shields.io/docker/image-size/agisoft/buildctl?arch=arm64&label=)](https://hub.docker.com/repository/docker/agisoft/buildctl) |