7 Commits
0.3.1 ... 0.4.1

Author SHA1 Message Date
af1f7ea186 fix: destination lack 2019-10-28 07:44:21 +01:00
98dea6ec95 updates kaniko version to 0.10 2019-08-21 15:05:53 +02:00
c687409a35 adds build_args_from_env option 2019-08-20 19:06:12 +02:00
b6420cac1c only print of build env args excitst 2019-08-20 19:06:12 +02:00
f7259ac640 Enable use of .tags file for custom tagging 2019-08-06 10:54:47 +02:00
3da5de27d7 Allow skip-tls-verify option for testing 2019-08-05 15:42:35 +02:00
4340afa523 Add Ability To Skip Push
This adds the ability to build the image without pushing it by omitting
the `tags` and `repo` options.
2019-07-10 08:40:51 +02:00
3 changed files with 50 additions and 3 deletions

View File

@ -1,4 +1,4 @@
FROM gcr.io/kaniko-project/executor:debug-v0.9.0
FROM gcr.io/kaniko-project/executor:debug-v0.10.0
ENV HOME /root
ENV USER root

View File

@ -16,6 +16,7 @@ steps:
repo: registry.example.com/example-project
tags: ${DRONE_COMMIT_SHA}
cache: true
skip_tls_verify: false # set to true for testing registries ONLY with self-signed certs
build_args:
- COMMIT_SHA=${DRONE_COMMIT_SHA}
- COMMIT_AUTHOR_EMAIL=${DRONE_COMMIT_AUTHOR_EMAIL}
@ -43,6 +44,35 @@ steps:
from_secret: google-application-credentials
```
## Use `.tags` file for tagging
Similarily to official
[drone-docker](https://github.com/drone-plugins/drone-docker) plugin you can use
`.tags` file to embed some custom logic for creating tags for an image.
```yaml
kind: pipeline
name: default
steps:
- name: build
image: golang
commands:
- go get
- go build
- make versiontags > .tags
- name: publish
image: banzaicloud/drone-kaniko
settings:
registry: registry.example.com
repo: registry.example.com/example-project
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined
username:
from_secret: docker-username
password:
from_secret: docker-password
```
## Test that it can build
```bash

View File

@ -28,11 +28,16 @@ fi
DOCKERFILE=${PLUGIN_DOCKERFILE:-Dockerfile}
CONTEXT=${PLUGIN_CONTEXT:-$PWD}
LOG=${PLUGIN_LOG:-info}
EXTRA_OPTS=""
if [[ -n "${PLUGIN_TARGET:-}" ]]; then
TARGET="--target=${PLUGIN_TARGET}"
fi
if [[ "${PLUGIN_SKIP_TLS_VERIFY:-}" == "true" ]]; then
EXTRA_OPTS="--skip-tls-verify=true"
fi
if [[ "${PLUGIN_CACHE:-}" == "true" ]]; then
CACHE="--cache=true"
fi
@ -41,16 +46,28 @@ if [ -n "${PLUGIN_BUILD_ARGS:-}" ]; then
BUILD_ARGS=$(echo "${PLUGIN_BUILD_ARGS}" | tr ',' '\n' | while read build_arg; do echo "--build-arg=${build_arg}"; done)
fi
if [ -n "${PLUGIN_BUILD_ARGS_FROM_ENV:-}" ]; then
BUILD_ARGS_FROM_ENV=$(echo "${PLUGIN_BUILD_ARGS_FROM_ENV}" | tr ',' '\n' | while read build_arg; do echo "--build-arg ${build_arg}=$(eval "echo \$$build_arg")"; done)
fi
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=$(cat .tags| tr ',' '\n' | while read tag; do echo "--destination=${REGISTRY}/${PLUGIN_REPO}:${tag} "; done)
elif [ -n "${PLUGIN_REPO:-}" ]; then
DESTINATIONS="--destination=${REGISTRY}/${PLUGIN_REPO}:latest"
else
DESTINATIONS="--destination=${PLUGIN_REPO}:latest"
DESTINATIONS="--no-push"
# Cache is not valid with --no-push
CACHE=""
fi
/kaniko/executor -v ${LOG} \
--context=${CONTEXT} \
--dockerfile=${DOCKERFILE} \
${EXTRA_OPTS} \
${DESTINATIONS} \
${CACHE:-} \
${TARGET:-} \
${BUILD_ARGS:-}
${BUILD_ARGS:-} \
${BUILD_ARGS_FROM_ENV:-}