From 9edb755d8cec66fb3dc7ddee985958c493763da1 Mon Sep 17 00:00:00 2001 From: sfrancois Date: Wed, 14 Feb 2024 13:44:50 +0100 Subject: [PATCH 1/2] feat(docker): ajoute les stages de build docker selon les environnements --- templates/build-docker.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 templates/build-docker.yml diff --git a/templates/build-docker.yml b/templates/build-docker.yml new file mode 100644 index 0000000..92e9162 --- /dev/null +++ b/templates/build-docker.yml @@ -0,0 +1,43 @@ +.build-docker: + extends: .nexus + script: + - > + docker build + --pull + --quiet + --cache-from $PATRINAT_REGISTRY/$CI_IMAGE:$TAG_CACHE + --tag $PATRINAT_REGISTRY/$CI_IMAGE:$TAG + . + - docker push $PATRINAT_REGISTRY/$CI_IMAGE:$TAG + +🐳 image-test: + extends: .build-docker + stage: push + rules: + - if: '$CI_COMMIT_BRANCH =~ /^(?:sprint|(?:hot)?fix(?:es)?|feature)-.+/' + variables: + TAG_BUILD: test + TAG_CACHE: test + +🐳 image-preprod: + extends: .build-docker + stage: push + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + - if: $CI_COMMIT_TAG + when: never + variables: + TAG_BUILD: preprod + TAG_CACHE: preprod + +🐳 image-prod: + extends: .build-docker + stage: push + rules: + - if: $CI_COMMIT_TAG + variables: + TAG_BUILD: $CI_COMMIT_REF_NAME + TAG_CACHE: latest + after_script: + - docker tag $PATRINAT_REGISTRY/$CI_IMAGE:$CI_COMMIT_REF_NAME $PATRINAT_REGISTRY/$CI_IMAGE:latest + - docker push $PATRINAT_REGISTRY/$CI_IMAGE:latest -- GitLab From f8fffd231cce9a4f110f3b71887e346bd1a79448 Mon Sep 17 00:00:00 2001 From: sfrancois Date: Wed, 14 Feb 2024 13:45:31 +0100 Subject: [PATCH 2/2] =?UTF-8?q?feat(portainer):=20ajoute=20les=20stages=20?= =?UTF-8?q?de=20d=C3=A9ploiement=20via=20webhook=20selon=20les=20environne?= =?UTF-8?q?ments?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/deploy-portainer.yml | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 templates/deploy-portainer.yml diff --git a/templates/deploy-portainer.yml b/templates/deploy-portainer.yml new file mode 100644 index 0000000..04c7455 --- /dev/null +++ b/templates/deploy-portainer.yml @@ -0,0 +1,38 @@ +.deploy: + image: curlimages/curl-base:latest + stage: deploy + variables: + GIT_STRATEGY: none + tags: + - docker-deploy + script: + - curl -XPOST "${DEPLOY_WEBHOOK}" + +🎆 deploy-test: + extends: .deploy + needs: [ "🐳 image-test" ] + environment: + name: staging + url: https://"$TEST_SERVER_URL" + rules: + - if: '$CI_COMMIT_BRANCH =~ /^(?:sprint|(?:hot)?fix(?:es)?|feature)-.+/' + +🎆 deploy-preprod: + extends: .deploy + needs: [ "🐳 image-preprod" ] + environment: + name: preproduction + url: https://"$PREPPROD_SERVER_URL" + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + - if: $CI_COMMIT_TAG + when: never + +🎆 deploy-prod: + extends: .deploy + needs: [ "🐳 image-prod" ] + environment: + name: production + url: https://"$PROD_SERVER_URL" + rules: + - if: $CI_COMMIT_TAG -- GitLab