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

Merge branch 'master' into 'master'

[PM] initial commit platform-maintainer

See merge request !1
parents 0a76182f e7014b45
variables:
FF_USE_FASTZIP: "true" # enable fastzip - a faster zip implementation that also supports level configuration.
ARTIFACT_COMPRESSION_LEVEL: default
CACHE_COMPRESSION_LEVEL: default
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"
SONAR_USER_HOME: ${CI_PROJECT_DIR}/.sonar # Defines the location of the analysis task cache
GIT_DEPTH: 0 # Tells git to fetch all the branches of the project, required by the analysis task
DOCKER_BUILDKIT: 1 # With BuildKit, you don't need to pull the remote images before building since it caches each build layer in your image registry. Then, when you build the image, each layer is downloaded as needed during the build.
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
stages:
########################################################################################################################
# Parallel Stages
########################################################################################################################
- Build
- Test
- Sonarqube
- Dockerimage #Secure #Jobs flyway-build-main / docker-build-main
########################################################################################################################
# Non-Parallel Deploy-Stages
########################################################################################################################
- Deploy-Flyway
- Deploy-Main
- Deploy-Address-Import
- Deploy-Mail-Export
- Deploy-Stoerungsauskuenfte
#image: maven:3.6.3-jdk-11
########################################################################################################################
# Common stages/scripts
########################################################################################################################
.docker-build-script:
image: docker:20.10.7-git
services:
- docker:dind
before_script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script:
- echo PROJECT_DIR $PROJECT_DIR
- cd ./$PROJECT_DIR
- ls -l
- |
if [[ "$CI_COMMIT_TAG" == "" ]]; then
tag="sha-${CI_COMMIT_SHORT_SHA}"
else
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 "FINAL_REGISTRY_IMAGE=$FINAL_REGISTRY_IMAGE" >> dockerimage.env
- echo current FINAL_REGISTRY_IMAGE ${FINAL_REGISTRY_IMAGE}
- docker build --pull -f $DOCKER_FILE -t "$FINAL_REGISTRY_IMAGE" -t "$REGISTRY_IMAGE_BASE" --cache-from "$REGISTRY_IMAGE_BASE" --build-arg BUILDKIT_INLINE_CACHE=1 .
- docker push "$REGISTRY_IMAGE_BASE" --all-tags
artifacts:
reports:
dotenv: $PROJECT_DIR/dockerimage.env
########################################################################################################################
# Main
########################################################################################################################
#-----------------------------------------------------------------------------------------------------------------------
build-main:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./gfsBackendService/target/
script:
- cd ./gfsBackendService
- mvn clean package -DskipTests=true
artifacts:
paths:
- ./gfsBackendService/target/*.jar
expire_in: 1d
# rules:
# - changes:
# - gfsBackendService/**/*
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
test-main:
#-----------------------------------------------------------------------------------------------------------------------
stage: Test
image: maven:3.6-jdk-11
script:
- cd ./gfsBackendService
- mvn test -Dskip.asciidoc=true
artifacts:
paths:
- ./gfsBackendService/target/
# - ./gfsBackendService/src/
reports:
junit:
- ./gfsBackendService/target/surefire-reports/TEST-*.xml
rules:
- changes:
- gfsBackendService/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-main:
#-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
script:
- cd ./gfsBackendService
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
dependencies:
- test-main
rules:
- changes:
- gfsBackendService/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-flyway:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-flyway"
PROJECT_DIR: "gfsBackendService"
DOCKER_FILE: "Dockerfile_Flyway"
needs: []
# rules:
# - changes:
# - gfsBackendService/src/main/resources/db/migration/*
# exists:
# - gfsBackendService/Dockerfile_Flyway
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-main:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-main"
PROJECT_DIR: "gfsBackendService"
DOCKER_FILE: "Dockerfile_GitLab"
needs:
- job: build-main
# - job: test-main
# artifacts: false
# rules:
# - changes:
# - gfsBackendService/**/*
# exists:
# - gfsBackendService/Dockerfile_GitLab
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend"
########################################################################################################################
# Address Import
########################################################################################################################
#-----------------------------------------------------------------------------------------------------------------------
build-address-import:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./addressImport/target/
script:
- cd ./addressImport
- mvn clean package -DskipTests=true
artifacts:
paths:
- ./addressImport/target/*.jar
expire_in: 1d
# rules:
# - changes:
# - addressImport/**/*
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.addressimport"
#-----------------------------------------------------------------------------------------------------------------------
test-address-import:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Test
cache:
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./addressImport/target/
script:
- cd ./addressImport
- mvn test
artifacts:
paths:
- ./addressImport/target/
- ./addressImport/src/
reports:
junit:
- ./addressImport/target/surefire-reports/TEST-*.xml
rules:
- changes:
- addressImport/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.addressimport"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-address-import:
#-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
script:
- cd ./addressImport
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
dependencies:
- test-address-import
rules:
- changes:
- addressImport/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.addressimport"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-address-import:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-address-import"
PROJECT_DIR: "addressImport"
DOCKER_FILE: "Dockerfile_Gitlab"
needs:
- job: build-address-import
# - job: test-address-import
# artifacts: false
# rules:
# - changes:
# - addressImport/**/*
# exists:
# - addressImport/Dockerfile_Gitlab
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.addressimport"
########################################################################################################################
# Mail Export
########################################################################################################################
#-----------------------------------------------------------------------------------------------------------------------
build-mail-export:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./mailExport/target/
script:
- cd ./mailExport
- mvn clean package -DskipTests=true
artifacts:
paths:
- ./mailExport/target/*.jar
# rules:
# - changes:
# - mailExport/**/*
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.mailexport"
#-----------------------------------------------------------------------------------------------------------------------
test-mail-export:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Test
cache:
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./mailExport/target/
script:
- cd ./mailExport
- mvn test -Dskip.asciidoc=true
artifacts:
paths:
- ./mailExport/target/
- ./mailExport/src/
reports:
junit:
- ./mailExport/target/surefire-reports/TEST-*.xml
rules:
- changes:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.mailexport"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-mail-export:
#-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
script:
- cd ./mailExport
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
dependencies:
- test-mail-export
rules:
- changes:
- mailExport/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.mailexport"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-mail-export:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-mail-export"
PROJECT_DIR: "mailExport"
DOCKER_FILE: "Dockerfile_Gitlab"
needs:
- job: build-mail-export
# - job: test-mail-export
# artifacts: false
# rules:
# - changes:
# - mailExport/**/*
# exists:
# - mailExport/Dockerfile_GitLab
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.mailexport"
########################################################################################################################
# SAMO Interface
########################################################################################################################
#-----------------------------------------------------------------------------------------------------------------------
build-samo:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./SAMO-Interface/target/
script:
- cd ./SAMO-Interface
- mvn clean package -DskipTests=true
artifacts:
paths:
- ./SAMO-Interface/target/*.jar
# rules:
# - changes:
# - SAMO-Interface/**/*
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.samo"
#-----------------------------------------------------------------------------------------------------------------------
test-samo:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Test
cache:
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./SAMO-Interface/target/
script:
- cd ./SAMO-Interface
- mvn test -Dskip.asciidoc=true
artifacts:
paths:
- ./SAMO-Interface/target/
- ./SAMO-Interface/src/
reports:
junit:
- ./SAMO-Interface/target/surefire-reports/TEST-*.xml
rules:
- changes:
- SAMO-Interface/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.samo"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-samo:
#-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
script:
- cd ./SAMO-Interface
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
dependencies:
- test-samo
rules:
- changes:
- SAMO-Interface/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.samo"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-samo:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-samo-interface"
PROJECT_DIR: "SAMO-Interface"
DOCKER_FILE: "Dockerfile_GitLab"
needs:
- job: build-samo
# - job: test-samo
# artifacts: false
# rules:
# - changes:
# - SAMO-Interface/**/*
# exists:
# - SAMO-Interface/Dockerfile_GitLab
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.samo"
########################################################################################################################
# SARIS Interface
########################################################################################################################
#-----------------------------------------------------------------------------------------------------------------------
build-saris:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./SARIS-Interface/target/
script:
- cd ./SARIS-Interface
- mvn clean package -DskipTests=true
artifacts:
paths:
- ./SARIS-Interface/target/*.jar
# rules:
# - changes:
# - SARIS-Interface/**/*
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.saris"
#-----------------------------------------------------------------------------------------------------------------------
test-saris:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Test
cache:
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./SARIS-Interface/target/
script:
- cd ./SARIS-Interface
- mvn test -Dskip.asciidoc=true
artifacts:
paths:
- ./SARIS-Interface/target/
- ./SARIS-Interface/src/
reports:
junit:
- ./SARIS-Interface/target/surefire-reports/TEST-*.xml
rules:
- changes:
- SARIS-Interface/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.saris"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-saris:
#-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
script:
- cd ./SARIS-Interface
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
dependencies:
- test-saris
rules:
- changes:
- SARIS-Interface/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.saris"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-saris:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-saris-interface"
PROJECT_DIR: "SARIS-Interface"
DOCKER_FILE: "Dockerfile_GitLab"
needs:
- job: build-saris
# - job: test-saris
# artifacts: false
# rules:
# - changes:
# - SARIS-Interface/**/*
# exists:
# - SARIS-Interface/Dockerfile_GitLab
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.saris"
########################################################################################################################
# Störungsauskünfte
########################################################################################################################
#-----------------------------------------------------------------------------------------------------------------------
build-stoerungsauskuenfte:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Build
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./stoerungsauskunftInterface/target/
script:
- cd ./stoerungsauskunftInterface
- mvn clean package -DskipTests=true
artifacts:
paths:
- ./stoerungsauskunftInterface/target/*.jar
# rules:
# - changes:
# - stoerungsauskunftInterface/**/*
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
test-stoerungsauskuenfte:
#-----------------------------------------------------------------------------------------------------------------------
image: maven:3.6-jdk-11
stage: Test
cache:
paths:
- ${CI_PROJECT_DIR}/.m2/repository/
- ./stoerungsauskunftInterface/target/
script:
- cd ./stoerungsauskunftInterface
- mvn test -Dskip.asciidoc=true
artifacts:
paths:
- ./stoerungsauskunftInterface/target/
- ./stoerungsauskunftInterface/src/
reports:
junit:
- ./stoerungsauskunftInterface/target/surefire-reports/TEST-*.xml
rules:
- changes:
- stoerungsauskunftInterface/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
sonarqube-stoerungsauskuenfte:
#-----------------------------------------------------------------------------------------------------------------------
stage: Sonarqube
image:
name: sonarsource/sonar-scanner-cli:4.6
entrypoint: [""]
cache:
key: ${CI_JOB_NAME}
paths:
- .sonar/cache
script:
- echo ${CI_PROJECT_DIR}
- cd ./stoerungsauskunftInterface
- sonar-scanner -Dsonar.qualitygate.wait=true
allow_failure: true
dependencies:
- test-stoerungsauskuenfte
rules:
- changes:
- stoerungsauskunftInterface/**/*
if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
docker-build-stoerungsauskuenfte:
#-----------------------------------------------------------------------------------------------------------------------
stage: Dockerimage
extends: .docker-build-script
variables:
IMG_NAME: "gfi-stoerungsauskunft-interface"
PROJECT_DIR: "stoerungsauskunftInterface"
DOCKER_FILE: "Dockerfile_GitLab"
needs:
- job: build-stoerungsauskuenfte
# - job: test-stoerungsauskuenfte
# artifacts: false
# rules:
# - changes:
# - stoerungsauskunftInterface/**/*
# exists:
# - stoerungsauskunftInterface/Dockerfile_GitLab
# if: $CI_PROJECT_NAME == "gridFailureInformation.backend.interface.stoerungsauskunft"
#-----------------------------------------------------------------------------------------------------------------------
# Deploy
#-----------------------------------------------------------------------------------------------------------------------
.deploy-script:
image: alpine:3.14.0
cache: {}
variables:
GIT_STRATEGY: none
GITLAB_REPO_URL: openkonsequenz/qa/deployment.git
DEPLOYMENT_FOLDER: apps/gridfailureinformation/$DEPLOYMENT_SUB_FOLDER
before_script:
- apk add --no-cache git curl bash coreutils