For whatever reason, line-breaks must be used regardless of string-block marker `|` or `>-`. Fix this. Also, support a fork/pull/MR model allowing contributors to run pipelines on their fork w/ push to their registry. In this case, images should be tagged by MR number to be helpful. Signed-off-by: Chris Evich <chris_gitlab@icuc.me>
33 lines
1014 B
YAML
33 lines
1014 B
YAML
---
|
|
|
|
stages:
|
|
- build
|
|
|
|
build:
|
|
stage: build
|
|
tags:
|
|
- docker
|
|
- linux
|
|
image:
|
|
name: gcr.io/kaniko-project/executor:v1.6.0-debug
|
|
entrypoint: ["/busybox/sh", "-c"]
|
|
variables:
|
|
BASE_TAG: latest
|
|
FLAVOR: stable
|
|
script:
|
|
- 'mkdir -p /kaniko/.docker'
|
|
- 'echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json'
|
|
- |
|
|
IMAGE_TAG="${CI_COMMIT_TAG:+${CI_COMMIT_TAG}}${CI_COMMIT_BRANCH:+${CI_COMMIT_BRANCH/main/latest}}";
|
|
if [[ -n "$CI_OPEN_MERGE_REQUESTS" ]]; then
|
|
IMAGE_TAG="mr${CI_MERGE_REQUEST_ID}";
|
|
fi
|
|
echo "Building/Pushing to: ${CI_REGISTRY_IMAGE}:${IMAGE_TAG}";
|
|
- |
|
|
/kaniko/executor \
|
|
--context $CI_PROJECT_DIR \
|
|
--dockerfile $CI_PROJECT_DIR/Containerfile \
|
|
--destination "${CI_REGISTRY_IMAGE}:${IMAGE_TAG}" \
|
|
--build-arg "BASE_TAG=$BASE_TAG" \
|
|
--build-arg "FLAVOR=$FLAVOR"
|