From f759581157e2e39e36f234ae49f1b0ba609c0b70 Mon Sep 17 00:00:00 2001 From: Romain Thouvenin Date: Tue, 2 Apr 2024 11:42:54 +0200 Subject: [PATCH] Move build job to a common template --- .gitlab-ci.yml | 37 ++----------------------------------- 1 file changed, 2 insertions(+), 35 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 58868d0..7179d91 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,6 +7,8 @@ stages: include: - template: Security/SAST.gitlab-ci.yml - template: Security/Secret-Detection.gitlab-ci.yml + - project: mobicoop/v3/gitlab-templates + file: /ci/release.build-job.yml ############## # TEST STAGE # @@ -28,38 +30,3 @@ test: rules: - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH || $CI_COMMIT_MESSAGE =~ /--check/ || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' when: always - -############### -# BUILD STAGE # -############### - -build: - stage: build - image: docker:20.10.22 - variables: - DOCKER_TLS_CERTDIR: '' - services: - - docker:dind - rules: - - if: $CI_COMMIT_TAG - variables: - VERSION: $CI_COMMIT_TAG - - if: $CI_COMMIT_BRANCH =~ /^release/ || $CI_PIPELINE_SOURCE == "web" - variables: - VERSION: $CI_COMMIT_BRANCH - before_script: - - echo -n $CI_REGISTRY_PASSWORD | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY - script: - - docker pull $CI_REGISTRY_IMAGE:latest || true - - > - docker build - --pull - --cache-from $CI_REGISTRY_IMAGE:latest - --tag $CI_REGISTRY_IMAGE:$VERSION - . - - docker push $CI_REGISTRY_IMAGE:$VERSION - - > - if [ $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH ]; then - docker tag $CI_REGISTRY_IMAGE:$VERSION $CI_REGISTRY_IMAGE:latest - docker push $CI_REGISTRY_IMAGE:latest - fi