Skip to content
Snippets Groups Projects
Commit e415a751 authored by DarwinJS's avatar DarwinJS
Browse files

Converted to var

parent f3d3cf4f
Branches
Tags 2.2.13
No related merge requests found
......@@ -23,11 +23,13 @@ where `<VERSION>` is the latest released tag or `main`.
| ----- | ------------- | ----------- | ----------- |
| `stage` | build | CI Component Input | The CI Stage to run the component in. |
| `KANIKO_CONTAINER_TAG` | `v1.23.0-debug` | CI Component Input | MUST be a debug container to have the required shell for GitLab CI. |
| `KANIKO_DOCKERFILE` | `Dockerfile` | CI Component Input | Override if Dockerfile is not in the root of the project. |
| `KANIKO_REGISTRIES` | `github` | CI Component Input | Any combination of 'gitlab,dockerhub'. |
| `KANIKO_COMP_DISABLED` | `` | CI Variable | Set to 'true' to disable. Useful when this is an component included in another component. |
| `KANIKO_DOCKERFILE` | `Dockerfile` | CI Variable | Override: if Dockerfile has another pathname or to repeatedly use component to build many dockerfiles in a project. |
| `CI_COMPONENT_DEBUG` | `` | CI Variable | Set to 'true' to see more verbose component output. GitLabs standard CI_DEBUG_TRACE=true also triggers this trace. |
Note: KANIKO_DOCKERFILE must be a CI variable in order for the component to be called multiple times. Component Inputs only allow one value per include.
#### Dockerhub
If you are deploying to dockerhub, you must also set these variables and be sure to use the scope indicated.
When pushing to the projects GitLab registry, all these variables are automatically set.
......@@ -45,9 +47,9 @@ You can also use the example dockerhub job in this component to extend the compo
build-for-my-custom-registry:
extends: .build_with_kaniko
rules:
- if: '"$[[ inputs.KANIKO_REGISTRIES | expand_vars ]]" =~ "/.*dockerhub.*/"'
- if: '"$[[ inputs.KANIKO_REGISTRIES | expand_vars ]]" =~ "/.*mycustomreg.*/"'
exists:
- $[[ inputs.KANIKO_DOCKERFILE | expand_vars ]]
- $KANIKO_DOCKERFILE
stage: build
environment:
......@@ -61,6 +63,31 @@ build-for-my-custom-registry:
| CI Variable | CI_REGISTRY_PASSWORD | yourpassword | No | Yes | push-to-my-custom |
| CI Variable | CI_REGISTRY_USER | Yourdockeruserid | No | No | push-to-my-custom |
#### Multiple Docker File Processing
This example is only building to the GitLab registry
```yaml
build_Dockerfile1:
extends: .build_with_kaniko
variables:
KANIKO_DOCKERFILE: Docker1
rules:
- if: '"$[[ inputs.KANIKO_REGISTRIES | expand_vars ]]" =~ "/.*gitlab.*/"'
exists:
- $KANIKO_DOCKERFILE
build_Dockerfile2:
extends: .build_with_kaniko
variables:
KANIKO_DOCKERFILE: Docker2
rules:
- if: '"$[[ inputs.KANIKO_REGISTRIES | expand_vars ]]" =~ "/.*gitlab.*/"'
exists:
- $KANIKO_DOCKERFILE
```
#### Cross References and Documentation
......
......@@ -4,8 +4,6 @@ spec:
default: build
KANIKO_CONTAINER_TAG:
default: v1.23.0-debug #must be a debug container to have the required shell for GitLab CI
KANIKO_DOCKERFILE:
default: 'Dockerfile' #relative path in $CI_PROJECT_DIR
KANIKO_REGISTRIES:
default: 'gitlab' #Any combination of 'gitlab,dockerhub'
---
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment