2024-07-27 01:16:31 +02:00
|
|
|
when:
|
|
|
|
- event: push
|
2024-07-27 23:19:14 +02:00
|
|
|
path:
|
|
|
|
- 'keycloak/**'
|
|
|
|
- '.woodpecker/keycloak.yaml'
|
2024-07-27 01:16:31 +02:00
|
|
|
- event: cron
|
|
|
|
cron: daily
|
|
|
|
|
|
|
|
# Manually set a workspace path, so we can use it literally, without using
|
|
|
|
# ${CI_WORKSPACE}, when running kaniko, since using ${CI_WORKSPACE} doesn't work.
|
|
|
|
# https://github.com/woodpecker-ci/woodpecker/issues/3982
|
|
|
|
workspace:
|
|
|
|
path: src
|
|
|
|
|
|
|
|
# Use matrix to set KEYCLOAK_VERSION instead of setting the KEYCLOAK_VERSION as
|
|
|
|
# an environment variable in the build-images step, since string substitution
|
|
|
|
# doesn't work for custom environment variables.
|
|
|
|
# https://github.com/woodpecker-ci/woodpecker/issues/3983
|
|
|
|
# Also because global environment variables aren't a thing.
|
|
|
|
matrix:
|
|
|
|
KEYCLOAK_VERSION:
|
|
|
|
- 25.0
|
|
|
|
IMAGE_NAME:
|
|
|
|
- git.hamburg.ccc.de/ccchh/oci-images/keycloak
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: setup-image-path
|
|
|
|
image: alpine
|
|
|
|
commands:
|
|
|
|
- mkdir /woodpecker/images
|
2024-08-10 19:16:52 +02:00
|
|
|
|
2024-07-27 01:16:31 +02:00
|
|
|
- name: build-image
|
|
|
|
image: gcr.io/kaniko-project/executor
|
|
|
|
entrypoint:
|
|
|
|
- /kaniko/executor
|
|
|
|
- --context=dir:///woodpecker/src/keycloak
|
|
|
|
- --dockerfile=./Containerfile
|
|
|
|
- --build-arg=TAG=${KEYCLOAK_VERSION}
|
|
|
|
- --destination=${IMAGE_NAME}:${KEYCLOAK_VERSION}
|
|
|
|
- --no-push
|
|
|
|
- --tar-path=/woodpecker/images/keycloak.tar
|
2024-08-10 19:16:52 +02:00
|
|
|
|
2024-07-27 01:16:31 +02:00
|
|
|
- name: publish-image
|
|
|
|
image: alpine
|
|
|
|
secrets:
|
|
|
|
- GIT_API_TOKEN
|
|
|
|
commands:
|
|
|
|
- apk -u add crane
|
|
|
|
- crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN
|
2024-08-10 19:16:52 +02:00
|
|
|
- crane push /woodpecker/images/keycloak.tar $IMAGE_NAME:$KEYCLOAK_VERSION-$CI_COMMIT_BRANCH
|
|
|
|
|
|
|
|
- name: tag-version
|
|
|
|
image: alpine
|
|
|
|
when:
|
|
|
|
- branch: main
|
|
|
|
secrets:
|
|
|
|
- GIT_API_TOKEN
|
|
|
|
commands:
|
|
|
|
- apk -u add crane
|
|
|
|
- crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN
|
|
|
|
- crane tag $IMAGE_NAME:$KEYCLOAK_VERSION-$CI_COMMIT_BRANCH $KEYCLOAK_VERSION
|
|
|
|
|
|
|
|
- name: tag-latest
|
2024-07-27 01:16:31 +02:00
|
|
|
image: alpine
|
|
|
|
when:
|
|
|
|
- branch: main
|
2024-08-10 19:16:52 +02:00
|
|
|
evaluate: 'KEYCLOAK_VERSION == "25.0"'
|
2024-07-27 01:16:31 +02:00
|
|
|
secrets:
|
|
|
|
- GIT_API_TOKEN
|
|
|
|
commands:
|
|
|
|
- apk -u add crane
|
|
|
|
- crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN
|
2024-08-10 19:16:52 +02:00
|
|
|
- crane tag $IMAGE_NAME:$KEYCLOAK_VERSION-$CI_COMMIT_BRANCH latest
|