# Official docker image. image: docker:dind services: - docker:dind stages: - quality - test - compile - build-image - deploy - test-deploy .code-quality: stage: code-quality image: maven:3.9.6-eclipse-temurin-21-alpine variables: SONAR_USER_HOME: "${CI_PROJECT_DIR}/.sonar" GIT_DEPTH: "0" cache: key: "${CI_JOB_NAME}" paths: - .sonar/cache script: - mvn clean install - mvn sonar:sonar verify -DskipTests=true -Dmaven.test.failure.ignore=true -Dsonar.projectKey=$PROJECT_KEY -Dsonar.host.url=$SONAR_URL -Dsonar.login=$SONAR_TOKEN -Dsonar.java.binaries=**/* allow_failure: true .test: stage: test image: maven:latest script: - mvn test artifacts: paths: - target/surefire-reports/TEST-*.xml reports: junit: - target/surefire-reports/TEST-*.xml .compile: stage: compile image: maven:3.9.6-eclipse-temurin-21-alpine cache: key: milicom paths: - ../.m2/repository script: - echo $CI_COMMIT_MESSAGE - echo $CI_COMMIT_REF_NAME - mvn package -Drevision=$CI_PIPELINE_IID -DskipTests artifacts: paths: - ./target/*.jar .stg-build-image: stage: build-image script: - echo ${PROJECT_CONTAINER_IMAGE} - docker build -f ./src/main/docker/dockerfile -t ${PROJECT_CONTAINER_IMAGE} . - docker tag ${PROJECT_CONTAINER_IMAGE} $NEXUS_REGISTER_SERVER/${PROJECT_CONTAINER_IMAGE} - docker login -u $CI_LON_REGISTRY_USER -p $CI_LON_REGISTRY_PASSWORD $NEXUS_REGISTER_SERVER - docker push $NEXUS_REGISTER_SERVER/${PROJECT_CONTAINER_IMAGE} - docker rmi ${PROJECT_CONTAINER_IMAGE} .deploy: stage: deploy image: dtzar/helm-kubectl variables: NAMESPACE: default POD_ENV: development K8S_ENV_DEPLOY: deployment.yml dependencies: [] script: - sed -i "s/PROJECT_NAME/$POD_NAME/g" $K8S_ENV_DEPLOY - sed -i "s~CONTAINER_IMAGE~$PROJECT_CONTAINER_IMAGE~g" $K8S_ENV_DEPLOY - sed -i "s/APP_ENV/$POD_ENV/g" $K8S_ENV_DEPLOY - sed -i "s/APP_ID/$POD_NAME/g" $K8S_ENV_DEPLOY - sed -i "s/APP_PORT/8080/g" $K8S_ENV_DEPLOY - kubectl apply -f $K8S_ENV_DEPLOY -n $NAMESPACE variables: IMG_REPOSITORY: $NEXUS_REGISTER_SERVER PROJECT_KEY: checksuscribers-orchestator-api CI_DISABLE_CACHE: "true" POD_NAME: $CI_PROJECT_NAME AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID_MIC AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY_MIC AWS_DEFAULT_REGION: $AWS_DEFAULT_REGION PROJECT_CONTAINER_IMAGE: longinus/${CI_PROJECT_NAME}:${VERSION} #$CI_PIPELINE_ID VERSION: stg-v1.0.1 # Deprecated -> Use commit sha as tag for dev/test environments ### STAGES CLOUD .cloud-code-quality: only: - develop extends: - .code-quality .cloud-unit-test: only: - develop - feature/performanceEntityResponseWrapper extends: - .test cloud-compile: only: - develop extends: - .compile cloud-build-image: only: - develop extends: - .stg-build-image #Deployment en lon-bo development deploy-bo-dev: before_script: - export KUBECONFIG=${KUBECONFIG_BO} # tags: # - longinus-bo-dev only: - develop extends: - .deploy