Update README to woodpecker plugin
This commit is contained in:
parent
5b97227384
commit
7b8ff603f4
53
README.md
53
README.md
@ -1,25 +1,22 @@
|
|||||||
# drone-kaniko
|
# plugin-kaniko
|
||||||
|
|
||||||
A thin shim-wrapper around the official [Google Kaniko](https://cloud.google.com/blog/products/gcp/introducing-kaniko-build-container-images-in-kubernetes-and-google-container-builder-even-without-root-access) Docker image to make it behave like the [Drone Docker plugin](http://plugins.drone.io/drone-plugins/drone-docker/).
|
A thin shim-wrapper around the official [Google Kaniko](https://cloud.google.com/blog/products/gcp/introducing-kaniko-build-container-images-in-kubernetes-and-google-container-builder-even-without-root-access) Docker image to make it behave similar to the [Woodpecker Docker Buildx](https://woodpecker-ci.org/plugins/Docker%20Buildx) plugin.
|
||||||
|
|
||||||
Example .drone.yml for Drone 1.0 (pushing to Docker Hub):
|
Example `.woodpecker.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: publish
|
- name: publish
|
||||||
image: banzaicloud/drone-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
settings:
|
settings:
|
||||||
registry: registry.example.com # if not provided index.docker.io is supposed
|
registry: registry.example.com # if not provided index.docker.io is used
|
||||||
repo: registry.example.com/example-project
|
repo: registry.example.com/example-project
|
||||||
tags: ${DRONE_COMMIT_SHA}
|
tags: ${CI_COMMIT_SHA}
|
||||||
cache: true
|
cache: true
|
||||||
skip_tls_verify: false # set to true for testing registries ONLY with self-signed certs
|
skip_tls_verify: false # set to true for testing registries ONLY with self-signed certs
|
||||||
build_args:
|
build_args:
|
||||||
- COMMIT_SHA=${DRONE_COMMIT_SHA}
|
- COMMIT_SHA=${CI_COMMIT_SHA}
|
||||||
- COMMIT_AUTHOR_EMAIL=${DRONE_COMMIT_AUTHOR_EMAIL}
|
- COMMIT_AUTHOR_EMAIL=${CI_COMMIT_AUTHOR_EMAIL}
|
||||||
username:
|
username:
|
||||||
from_secret: docker-username
|
from_secret: docker-username
|
||||||
password:
|
password:
|
||||||
@ -29,16 +26,13 @@ steps:
|
|||||||
Pushing to GCR:
|
Pushing to GCR:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: publish
|
- name: publish
|
||||||
image: banzaicloud/drone-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
settings:
|
settings:
|
||||||
registry: gcr.io
|
registry: gcr.io
|
||||||
repo: example.com/example-project
|
repo: example.com/example-project
|
||||||
tags: ${DRONE_COMMIT_SHA}
|
tags: ${CI_COMMIT_SHA}
|
||||||
cache: true
|
cache: true
|
||||||
json_key:
|
json_key:
|
||||||
from_secret: google-application-credentials
|
from_secret: google-application-credentials
|
||||||
@ -46,14 +40,10 @@ steps:
|
|||||||
|
|
||||||
## Use `.tags` file for tagging
|
## Use `.tags` file for tagging
|
||||||
|
|
||||||
Similarily to official
|
Similarily to [Woodpecker Docker Buildx Plugin](https://woodpecker-ci.org/plugins/Docker%20Buildx)
|
||||||
[drone-docker](https://github.com/drone-plugins/drone-docker) plugin you can use
|
you can use `.tags` file to embed some custom logic for creating tags for an image.
|
||||||
`.tags` file to embed some custom logic for creating tags for an image.
|
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
@ -62,11 +52,11 @@ steps:
|
|||||||
- go build
|
- go build
|
||||||
- make versiontags > .tags
|
- make versiontags > .tags
|
||||||
- name: publish
|
- name: publish
|
||||||
image: banzaicloud/drone-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
settings:
|
settings:
|
||||||
registry: registry.example.com
|
registry: registry.example.com
|
||||||
repo: registry.example.com/example-project
|
repo: registry.example.com/example-project
|
||||||
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined
|
# tags: ${CI_COMMIT_SHA} <= it must be left undefined
|
||||||
username:
|
username:
|
||||||
from_secret: docker-username
|
from_secret: docker-username
|
||||||
password:
|
password:
|
||||||
@ -78,9 +68,6 @@ steps:
|
|||||||
Set `auto_tag: true`.
|
Set `auto_tag: true`.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
kind: pipeline
|
|
||||||
name: default
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: golang
|
image: golang
|
||||||
@ -88,12 +75,12 @@ steps:
|
|||||||
- go get
|
- go get
|
||||||
- go build
|
- go build
|
||||||
- name: publish
|
- name: publish
|
||||||
image: banzaicloud/drone-kaniko
|
image: woodpeckerci/plugin-kaniko
|
||||||
settings:
|
settings:
|
||||||
registry: registry.example.com
|
registry: registry.example.com
|
||||||
repo: registry.example.com/example-project
|
repo: registry.example.com/example-project
|
||||||
auto_tag: true # higher priority then .tags file
|
auto_tag: true # higher priority then .tags file
|
||||||
# tags: ${DRONE_COMMIT_SHA} <= it must be left undefined to use auto_tag
|
# tags: ${CI_COMMIT_SHA} <= it must be left undefined to use auto_tag
|
||||||
username:
|
username:
|
||||||
from_secret: docker-username
|
from_secret: docker-username
|
||||||
password:
|
password:
|
||||||
@ -103,7 +90,7 @@ steps:
|
|||||||
## Test that it can build
|
## Test that it can build
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -it --rm -w /src -v $PWD:/src -e PLUGIN_USERNAME=${DOCKER_USERNAME} -e PLUGIN_PASSWORD=${DOCKER_PASSWORD} -e PLUGIN_REPO=banzaicloud/drone-kaniko-test -e PLUGIN_TAGS=test -e PLUGIN_DOCKERFILE=Dockerfile.test banzaicloud/drone-kaniko
|
docker run -it --rm -w /src -v $PWD:/src -e PLUGIN_USERNAME=${DOCKER_USERNAME} -e PLUGIN_PASSWORD=${DOCKER_PASSWORD} -e PLUGIN_REPO=woodpeckerci/plugin-kaniko-test -e PLUGIN_TAGS=test -e PLUGIN_DOCKERFILE=Dockerfile.test woodpeckerci/plugin-kaniko
|
||||||
```
|
```
|
||||||
|
|
||||||
## Test that caching works
|
## Test that caching works
|
||||||
@ -122,7 +109,7 @@ Add the following lines to plugin.sh's final command and build a new image from
|
|||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker build -t banzaicloud/drone-kaniko .
|
docker build -t woodpeckerci/plugin-kaniko .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -136,11 +123,11 @@ docker run -v $PWD:/cache gcr.io/kaniko-project/warmer:latest --verbosity=debug
|
|||||||
Run the builder (on the host network to be able to access the registry, if any specified) with mounting the local disk cache, this example pushes to Docker Hub:
|
Run the builder (on the host network to be able to access the registry, if any specified) with mounting the local disk cache, this example pushes to Docker Hub:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --net=host -it --rm -w /src -v $PWD:/cache -v $PWD:/src -e PLUGIN_USERNAME=${DOCKER_USERNAME} -e PLUGIN_PASSWORD=${DOCKER_PASSWORD} -e PLUGIN_REPO=banzaicloud/drone-kaniko-test -e PLUGIN_TAGS=test -e PLUGIN_DOCKERFILE=Dockerfile.test -e PLUGIN_CACHE=true banzaicloud/drone-kaniko
|
docker run --net=host -it --rm -w /src -v $PWD:/cache -v $PWD:/src -e PLUGIN_USERNAME=${DOCKER_USERNAME} -e PLUGIN_PASSWORD=${DOCKER_PASSWORD} -e PLUGIN_REPO=woodpeckerci/plugin-kaniko-test -e PLUGIN_TAGS=test -e PLUGIN_DOCKERFILE=Dockerfile.test -e PLUGIN_CACHE=true woodpeckerci/plugin-kaniko
|
||||||
```
|
```
|
||||||
|
|
||||||
The very same example just pushing to GCR instead of Docker Hub:
|
The very same example just pushing to GCR instead of Docker Hub:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run --net=host -it --rm -w /src -v $PWD:/cache -v $PWD:/src -e PLUGIN_REGISTRY=gcr.io -e PLUGIN_REPO=paas-dev1/drone-kaniko-test -e PLUGIN_TAGS=test -e PLUGIN_DOCKERFILE=Dockerfile.test -e PLUGIN_CACHE=true -e PLUGIN_JSON_KEY="$(<$HOME/google-application-credentials.json)" banzaicloud/drone-kaniko
|
docker run --net=host -it --rm -w /src -v $PWD:/cache -v $PWD:/src -e PLUGIN_REGISTRY=gcr.io -e PLUGIN_REPO=paas-dev1/kaniko-test -e PLUGIN_TAGS=test -e PLUGIN_DOCKERFILE=Dockerfile.test -e PLUGIN_CACHE=true -e PLUGIN_JSON_KEY="$(<$HOME/google-application-credentials.json)" woodpeckerci/plugin-kaniko
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user