Add dry-run setting and docs.mf (#12)

also change:
- rename `PLUGIN_LOG` to `PLUGIN_LOG_LEVEL`
- update default value of `PLUGIN_REGISTRY`
This commit is contained in:
6543 2024-01-12 23:12:06 +01:00 committed by GitHub
parent 0036f361f0
commit d7173f4e49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 3 deletions

40
docs.md Normal file
View File

@ -0,0 +1,40 @@
---
name: Kaniko
authors: Woodpecker Authors
description: Plugin to build container images without root privileges
tags: [docker, podman, container, build]
containerImage: woodpeckerci/plugin-kaniko
containerImageUrl: https://hub.docker.com/r/woodpeckerci/plugin-kaniko
url: https://github.com/woodpecker-ci/plugin-kaniko
---
Settings can be defined using the `settings` option for woodpecker plugins. All available settings and their defaults are listed below.
## Settings
| Settings Name | Default | Description |
| ------------- | ----------------------------- | -------------------------------------------------- |
| `dry-run` | `false` | disables docker push |
| `repo` | _none_ | sets repository name for the image (can be a list) |
| `username` | _none_ | sets username to authenticates with |
| `password` | _none_ | sets password / token to authenticates with |
| `registry` | `https://index.docker.io/v1/` | sets docker registry to authenticate with |
| `dockerfile` | `Dockerfile` | sets dockerfile to use for the image build |
| `tags` | _none_ | sets repository tags to use for the image |
## Advanced Settings
| Settings Name | Default | Description |
| --------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
| `context` | `.` | sets the path of the build context to use |
| `build-args` | _none_ | sets custom build arguments for the build |
| `build-args-from-env` | _none_ | forwards environment variables as custom arguments to the build |
| `auto-tag` | `false` | if set generate .tags file, support format Major.Minor.Release or start with `v` docker tags: Major, Major.Minor, Major.Minor.Release and latest |
| `log-level` | `info` | set different log level |
| `target` | _none_ |
| `cache` | `false` | use a cache repo |
| `cache-repo` | _none_ | specify the cache repo |
| `cache-ttl` | _none_ | set the time to live for the cache |
| `skip-tls-verify` | `false` | ignore tls issues |
| `mirrors` | _none_ | set docker hub mirrors |
| `json-key` | _none_ | pass a json key to kaniko |

View File

@ -4,7 +4,7 @@ set -euo pipefail
export PATH="$PATH:/kaniko/"
REGISTRY=${PLUGIN_REGISTRY:-index.docker.io}
REGISTRY=${PLUGIN_REGISTRY:-https://index.docker.io/v1/}
if [ "${PLUGIN_USERNAME:-}" ] || [ "${PLUGIN_PASSWORD:-}" ]; then
DOCKER_AUTH=$(echo -n "${PLUGIN_USERNAME}:${PLUGIN_PASSWORD}" | base64 | tr -d "\n")
@ -27,7 +27,7 @@ fi
DOCKERFILE=${PLUGIN_DOCKERFILE:-Dockerfile}
CONTEXT=${PLUGIN_CONTEXT:-$PWD}
LOG=${PLUGIN_LOG:-info}
LOG=${PLUGIN_LOG_LEVEL:-info}
EXTRA_OPTS=""
if [[ -n "${PLUGIN_TARGET:-}" ]]; then
@ -92,7 +92,7 @@ if [ -n "${PLUGIN_TAGS:-}" ]; then
DESTINATIONS=$(echo "${PLUGIN_TAGS}" | tr ',' '\n' | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done)
elif [ -f .tags ]; then
DESTINATIONS=$(tr ',' '\n' < .tags | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done)
elif [ -n "${PLUGIN_REPO:-}" ]; then
elif [ -n "${PLUGIN_REPO:-}" ] && [ "${PLUGIN_DRY_RUN:-}" != "true" ]; then
DESTINATIONS="--destination=${REGISTRY}/${PLUGIN_REPO}:latest"
else
DESTINATIONS="--no-push"