Automatically generate buildkit config with registry CA file (#17)

Fixes #14

Buildkit config is actually TOML file not JSON - https://docs.docker.com/engine/reference/commandline/buildx_create/#config

Tested using `lafriks/plugin-docker-buildx:latest` image built with these changes

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://codeberg.org/woodpecker-plugins/plugin-docker-buildx/pulls/17
Reviewed-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lafriks@noreply.codeberg.org>
Co-committed-by: Lauris BH <lafriks@noreply.codeberg.org>
This commit is contained in:
Lauris BH
2022-09-27 22:33:05 +02:00
committed by 6543
parent 64aed54d14
commit 8a0424c7a5
3 changed files with 46 additions and 11 deletions

12
docs.md
View File

@@ -15,7 +15,15 @@ Woodpecker CI plugin to build multiarch Docker images with buildx. This plugin i
- Build without push
- Use custom registries
- Build based on existing tags when needed.
- Build based on existing tags when needed
It will automatically generate buildkit configuration to use custom CA certificate if following conditions are met:
- Setting `buildkit_config` is not set
- Custom `registry` value is provided
- File exists `/etc/docker/certs.d/<registry-value>/ca.crt`
> NB! To mount custom CA you can use Woodpecker CI runner configuration environment `WOODPECKER_BACKEND_DOCKER_VOLUMES` with value `/etc/ssl/certs:/etc/ssl/certs:ro,/etc/docker/certs.d:/etc/docker/certs.d:ro`. And have created file `/etc/docker/certs.d/<registry-value>/ca.crt` with CA certificate on runner server host.
## Settings
@@ -86,7 +94,7 @@ Woodpecker CI plugin to build multiarch Docker images with buildx. This plugin i
| `experimental` | `false` | enables docker daemon experimental mode
| `debug` | `false` | enables verbose debug mode for the docker daemon
| `daemon_off` | `false` | disables the startup of the docker daemon
| `buildkit_config` | *none* | sets content of the docker buildkit json config
| `buildkit_config` | *none* | sets content of the docker [buildkit TOML config](https://github.com/moby/buildkit/blob/master/docs/buildkitd.toml.md)
| `context` | `.` | sets the path of the build context to use
| `default_tags`/`auto_tag` | `false` | generates tag names automatically based on git branch and git tag
| `default_suffix"`/`auto_tag_suffix`| *none* | generates tag names with the given suffix