organize the image publishing/tagging process better
Every image gets pushed with a unique version-branch tag by default and then the version and latest tags get only tagged from the main branch and the main branch and the desired version respectively.
This commit is contained in:
parent
6783e974b9
commit
2906ee45d8
2 changed files with 32 additions and 9 deletions
|
@ -28,6 +28,7 @@ steps:
|
|||
image: alpine
|
||||
commands:
|
||||
- mkdir /woodpecker/images
|
||||
|
||||
- name: build-image
|
||||
image: gcr.io/kaniko-project/executor
|
||||
entrypoint:
|
||||
|
@ -38,6 +39,7 @@ steps:
|
|||
- --destination=${IMAGE_NAME}:${KEYCLOAK_VERSION}
|
||||
- --no-push
|
||||
- --tar-path=/woodpecker/images/keycloak.tar
|
||||
|
||||
- name: publish-image
|
||||
image: alpine
|
||||
secrets:
|
||||
|
@ -45,16 +47,27 @@ steps:
|
|||
commands:
|
||||
- apk -u add crane
|
||||
- crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN
|
||||
- crane push /woodpecker/images/keycloak.tar $IMAGE_NAME:$KEYCLOAK_VERSION
|
||||
- name: tag-branch-and-latest
|
||||
- crane push /woodpecker/images/keycloak.tar $IMAGE_NAME:$KEYCLOAK_VERSION-$CI_COMMIT_BRANCH
|
||||
|
||||
- name: tag-version
|
||||
image: alpine
|
||||
when:
|
||||
- branch: main
|
||||
- evaluate: 'KEYCLOAK_VERSION == "25.0"'
|
||||
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
|
||||
- crane tag $IMAGE_NAME:$KEYCLOAK_VERSION latest
|
||||
- crane tag $IMAGE_NAME:$KEYCLOAK_VERSION-$CI_COMMIT_BRANCH $KEYCLOAK_VERSION
|
||||
|
||||
- name: tag-latest
|
||||
image: alpine
|
||||
when:
|
||||
- branch: main
|
||||
evaluate: 'KEYCLOAK_VERSION == "25.0"'
|
||||
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 latest
|
||||
|
|
|
@ -48,9 +48,20 @@ steps:
|
|||
commands:
|
||||
- apk -u add crane
|
||||
- crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN
|
||||
- crane push /woodpecker/images/nextcloud.tar $IMAGE_NAME:$NEXTCLOUD_VERSION
|
||||
- crane push /woodpecker/images/nextcloud.tar $IMAGE_NAME:$NEXTCLOUD_VERSION-$CI_COMMIT_BRANCH
|
||||
|
||||
- name: tag-branch-and-latest
|
||||
- name: tag-version
|
||||
image: docker.io/library/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:$NEXTCLOUD_VERSION-$CI_COMMIT_BRANCH $NEXTCLOUD_VERSION
|
||||
|
||||
- name: tag-latest
|
||||
image: docker.io/library/alpine
|
||||
when:
|
||||
- branch: main
|
||||
|
@ -60,5 +71,4 @@ steps:
|
|||
commands:
|
||||
- apk -u add crane
|
||||
- crane auth login git.hamburg.ccc.de -u woodpecker -p $GIT_API_TOKEN
|
||||
- crane tag $IMAGE_NAME:$NEXTCLOUD_VERSION $CI_COMMIT_BRANCH
|
||||
- crane tag $IMAGE_NAME:$NEXTCLOUD_VERSION latest
|
||||
- crane tag $IMAGE_NAME:$NEXTCLOUD_VERSION-$CI_COMMIT_BRANCH latest
|
||||
|
|
Loading…
Reference in a new issue