ci: refine job and stage managment

This commit is contained in:
Rainer Killinger
2022-06-30 14:45:44 +02:00
parent 389df797ad
commit e9ec49a772

View File

@@ -89,17 +89,10 @@ ci:
services:
- docker:dind
script:
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
- export VERSION=$(echo -n "$CI_BUILD_REF_NAME" | cut -c 2-)
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
- export IMAGETAG_VERSION=$IMAGETAG_BASE:$VERSION
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_VERSION -t $IMAGETAG_CORE_VERSION .
- docker push $IMAGETAG_BASE
- echo "YOU SHOULD OVERRIDE THIS SECTION"
- exit 1
only:
- /(^v[0-9]+\.[0-9]+\.[0-9]+$|^master$|^develop$)/
- master
tags:
- gitlab-org-docker
@@ -130,25 +123,48 @@ ci:
tags:
- gitlab-org-docker
#.build_template_f-u: &build_template_f-u
# before_script:
# - Do what you gotta do
# tags:
# - gitlab-org-docker
.publish_version_template: &publish_version_template
script:
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
- export VERSION=$(echo -n "$CI_BUILD_REF_NAME" | cut -c 2-)
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
- export IMAGETAG_VERSION=$IMAGETAG_BASE:$VERSION
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_VERSION -t $IMAGETAG_CORE_VERSION .
- docker push $IMAGETAG_BASE
.publish_branch_template: &publish_branch_template
script:
- export CORE_VERSION=$(openstapps-projectmanagement get-used-version @openstapps/core)
- export IMAGETAG_BASE=$CI_REGISTRY_IMAGE/$CI_BUILD_REF_NAME
- export IMAGETAG_CORE_VERSION=$IMAGETAG_BASE:core-$CORE_VERSION
- export IMAGETAG_LATEST=$IMAGETAG_BASE:latest
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- docker build -t $IMAGETAG_LATEST -t $IMAGETAG_CORE_VERSION .
- docker push $IMAGETAG_BASE
# Jobs joining anchor templates with automatic publishing behaviour
# ! The jobname must end with ":" followed by the name for the registry branch
publish:generic:
image:version:
<<: *publish_template_auto
<<: *publish_version_template
only:
- /^v[0-9]+\.[0-9]+\.[0-9]+$/
#publish:f-u:
# <<: *publish_template_auto
# <<: *build_template_f-u
image:master:
<<: *publish_template_auto
<<: *publish_branch_template
only:
- master
image:develop:
<<: *publish_template_auto
<<: *publish_branch_template
only:
- develop
# Jobs joining anchor templates with manual publishing behaviour
custom:generic:
image:branch:
<<: *publish_template_manual
#custom:f-u:
# <<: *publish_template_manual
# <<: *build_template_f-u