Commit b80e78d2 authored by Simon Reis's avatar Simon Reis
Browse files

updated .gitlab-ci.yml

parent dc77f9fc
variables:
FF_USE_FASTZIP: "true" # enable fastzip - a faster zip implementation that also supports level configuration.
ARTIFACT_COMPRESSION_LEVEL: default
CACHE_COMPRESSION_LEVEL: default
ARTIFACT_COMPRESSION_LEVEL: fastest
CACHE_COMPRESSION_LEVEL: fastest
TRANSFER_METER_FREQUENCY: 5s # will display transfer progress every 5 seconds for artifacts and remote caches.
MAVEN_OPTS: "-Djava.awt.headless=true -Dmaven.repo.local=${CI_PROJECT_DIR}/.m2/repository/"
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version"
......@@ -57,10 +57,12 @@ stages:
tag="$CI_COMMIT_TAG"
fi
- echo current tag ${tag}
# Get (source) branch when tagging
- CI_SOURCE_BRANCH=$(git for-each-ref | grep $CI_COMMIT_SHA | grep origin | sed "s/.*\///" | tr '[:upper:]' '[:lower:]')
- echo CI_SOURCE_BRANCH $CI_SOURCE_BRANCH
- REGISTRY_IMAGE_BASE="$CI_REGISTRY_IMAGE/$CI_SOURCE_BRANCH/$IMG_NAME"
- FINAL_REGISTRY_IMAGE="$CI_REGISTRY_IMAGE/$CI_SOURCE_BRANCH/$IMG_NAME:${tag}"
- echo "CI_SOURCE_BRANCH=$CI_SOURCE_BRANCH" >> dockerimage.env
- echo "FINAL_REGISTRY_IMAGE=$FINAL_REGISTRY_IMAGE" >> dockerimage.env
- echo "REGISTRY_IMAGE_BASE=$REGISTRY_IMAGE_BASE" >> dockerimage.env
- echo "IMAGE_TAG=$tag" >> dockerimage.env
......@@ -96,7 +98,7 @@ build-main:
- changes:
- gfsBackendService/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
test-main:
......@@ -117,7 +119,7 @@ test-main:
- changes:
- gfsBackendService/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-main:
......@@ -140,7 +142,7 @@ sonarqube-main:
- changes:
- gfsBackendService/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-flyway:
......@@ -158,7 +160,7 @@ docker-build-flyway:
exists:
- gfsBackendService/Dockerfile_Flyway
if: $CI_PROJECT_NAME == "gridfailureinformation.backend"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-main:
......@@ -179,7 +181,7 @@ docker-build-main:
exists:
- gfsBackendService/Dockerfile_GitLab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
########################################################################################################################
# Address Import
......@@ -206,7 +208,7 @@ build-address-import:
- changes:
- addressImport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
#-----------------------------------------------------------------------------------------------------------------------
test-address-import:
......@@ -231,7 +233,7 @@ test-address-import:
- changes:
- addressImport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-address-import:
......@@ -254,7 +256,7 @@ sonarqube-address-import:
- changes:
- addressImport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-address-import:
......@@ -275,7 +277,7 @@ docker-build-address-import:
exists:
- addressImport/Dockerfile_Gitlab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
########################################################################################################################
# Mail Export
......@@ -300,7 +302,7 @@ build-mail-export:
- changes:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
#-----------------------------------------------------------------------------------------------------------------------
test-mail-export:
......@@ -325,7 +327,7 @@ test-mail-export:
- changes:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-mail-export:
......@@ -348,7 +350,7 @@ sonarqube-mail-export:
- changes:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-mail-export:
......@@ -369,7 +371,7 @@ docker-build-mail-export:
exists:
- mailExport/Dockerfile_Gitlab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
########################################################################################################################
# SAMO Interface
......@@ -394,7 +396,7 @@ build-samo:
- changes:
- SAMO-Interface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
#-----------------------------------------------------------------------------------------------------------------------
test-samo:
......@@ -419,7 +421,7 @@ test-samo:
- changes:
- SAMO-Interface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-samo:
......@@ -442,7 +444,7 @@ sonarqube-samo:
- changes:
- SAMO-Interface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-samo:
......@@ -463,7 +465,7 @@ docker-build-samo:
exists:
- SAMO-Interface/Dockerfile_GitLab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.samo"
########################################################################################################################
......@@ -489,7 +491,7 @@ build-saris:
- changes:
- SARIS-Interface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
#-----------------------------------------------------------------------------------------------------------------------
test-saris:
......@@ -514,7 +516,7 @@ test-saris:
- changes:
- SARIS-Interface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-saris:
......@@ -537,7 +539,7 @@ sonarqube-saris:
- changes:
- SARIS-Interface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-saris:
......@@ -558,7 +560,7 @@ docker-build-saris:
exists:
- SARIS-Interface/Dockerfile_GitLab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.saris"
########################################################################################################################
......@@ -584,7 +586,7 @@ build-stoerungsauskuenfte:
- changes:
- stoerungsauskunftInterface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
test-stoerungsauskuenfte:
......@@ -609,7 +611,7 @@ test-stoerungsauskuenfte:
- changes:
- stoerungsauskunftInterface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-stoerungsauskuenfte:
......@@ -633,7 +635,7 @@ sonarqube-stoerungsauskuenfte:
- changes:
- stoerungsauskunftInterface/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-stoerungsauskuenfte:
......@@ -654,7 +656,7 @@ docker-build-stoerungsauskuenfte:
exists:
- stoerungsauskunftInterface/Dockerfile_GitLab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
......@@ -664,6 +666,7 @@ docker-build-stoerungsauskuenfte:
image: alpine:3.14.0
cache: {}
variables:
ONLY_MASTER: "false"
GIT_STRATEGY: none
DEPLOYMENT_FILE: fileDefaultVarPlaceholder
YAML_IMAGE_NAME: image
......@@ -676,7 +679,12 @@ docker-build-stoerungsauskuenfte:
- git config --global user.email "gitlab@gitlab.com"
- git config --global user.name "GitLab CI/CD"
script:
- echo "CI_SOURCE_BRANCH=$CI_SOURCE_BRANCH"
- ls -l
- |
if [[ "$CI_SOURCE_BRANCH" != "master" && "$ONLY_MASTER" == "true" ]]; then
exit 0;
fi
- cat ${DEPLOYMENT_FILE}
- echo FINAL_REGISTRY_IMAGE ${FINAL_REGISTRY_IMAGE}
- echo APP_NAME ${APP_NAME}
......@@ -692,7 +700,7 @@ docker-build-stoerungsauskuenfte:
#-----------------------------------------------------------------------------------------------------------------------
# Upload Artefakte BE
#-----------------------------------------------------------------------------------------------------------------------
upload_artefacts:
.upload_artefacts:
stage: Upload
image: alpine:3.14.0
rules:
......@@ -758,22 +766,24 @@ deploy-qa-flyway:
stage: Deploy-Flyway
extends: .deploy-script
variables:
ONLY_MASTER: "true"
YAML_APP_NAME: gfi-be
YAML_IMAGE_NAME: imageDatabase
DEPLOYMENT_FILE: deployment/applications/values-gfi-qa.yaml
dependencies:
- docker-build-flyway
rules:
- if: $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_BRANCH == "master" && $CI_PROJECT_NAME == "gridfailureinformation.backend"
changes:
- Dockerfile_Flyway
- src/main/resources/db/migration/*
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
deploy-qa-main:
stage: Deploy-Main
extends: .deploy-script
variables:
ONLY_MASTER: "true"
YAML_APP_NAME: gfi-be
DEPLOYMENT_FILE: deployment/applications/values-gfi-qa.yaml
dependencies:
......@@ -781,13 +791,14 @@ deploy-qa-main:
rules:
- changes:
- gfsBackendService/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend" && $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG
if: $CI_COMMIT_BRANCH == "master" && $CI_PROJECT_NAME == "gridfailureinformation.backend"
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend"
deploy-qa-address-import:
stage: Deploy-Address-Import
extends: .deploy-script
variables:
ONLY_MASTER: "true"
YAML_APP_NAME: gfi-address-import
DEPLOYMENT_FILE: deployment/applications/values-gfi-qa.yaml
dependencies:
......@@ -796,12 +807,13 @@ deploy-qa-address-import:
- changes:
- addressImport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport" && $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.addressimport"
deploy-qa-mail-export:
stage: Deploy-Mail-Export
extends: .deploy-script
variables:
ONLY_MASTER: "true"
YAML_APP_NAME: gfi-mail-export
DEPLOYMENT_FILE: deployment/applications/values-gfi-qa.yaml
dependencies:
......@@ -810,12 +822,13 @@ deploy-qa-mail-export:
- changes:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport" && $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport"
.deploy-qa-stoerungsauskunft-interface:
deploy-qa-stoerungsauskunft-interface:
stage: Deploy-Stoerungsauskuenfte
extends: .deploy-script
variables:
ONLY_MASTER: "true"
YAML_APP_NAME: gfi-stoerungsauskunft
DEPLOYMENT_FILE: deployment/applications/values-gfi-qa.yaml
dependencies:
......@@ -826,7 +839,7 @@ deploy-qa-mail-export:
exists:
- stoerungsauskunftInterface/Dockerfile_GitLab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft" && $CI_COMMIT_BRANCH == "master"
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG && $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft"
#------------------------------
# Deploy - DEV-Environment
......@@ -841,7 +854,7 @@ deploy-dev-flyway:
dependencies:
- docker-build-flyway
rules:
- if: $CI_COMMIT_BRANCH == "DEVELOP"
- if: $CI_PROJECT_NAME == "gridfailureinformation.backend" && $CI_COMMIT_BRANCH == "DEVELOP"
changes:
- Dockerfile_Flyway
- src/main/resources/db/migration/*
......@@ -885,7 +898,7 @@ deploy-dev-mail-export:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.mailexport" && $CI_COMMIT_BRANCH == "DEVELOP"
.deploy-dev-stoerungsauskunft-interface:
deploy-dev-stoerungsauskunft-interface:
stage: Deploy-Stoerungsauskuenfte
extends: .deploy-script
variables:
......@@ -896,15 +909,12 @@ deploy-dev-mail-export:
rules:
- changes:
- stoerungsauskunftInterface/**/*
exists:
- stoerungsauskunftInterface/Dockerfile_GitLab
if: $CI_PROJECT_NAME == "gridfailureinformation.backend.interface.stoerungsauskunft" && $CI_COMMIT_BRANCH == "DEVELOP"
#------------------------------
# Release
#------------------------------
release_job:
.release_job:
stage: Release
image: registry.gitlab.com/gitlab-org/release-cli:latest
needs:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment