[damned-lies] feat: reuse staging container to build production



commit 059aaca7abb9621535b2fcc305a391ee871f947c
Author: Guillaume Bernard <associations guillaume-bernard fr>
Date:   Mon May 9 15:06:23 2022 +0200

    feat: reuse staging container to build production

 .gitlab-ci.yml | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 03481f06..f13997dc 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,15 +53,15 @@ variables:
     CURRENT_VCS_REF_NAME: "${CI_COMMIT_REF_NAME}"
     BUILT_IMAGE_NAME: "damned-lies-production:${CI_COMMIT_REF_NAME}"
     IMAGE_TAG: "${CI_REGISTRY_IMAGE}/damned-lies-production:${CI_COMMIT_REF_NAME}"
-    KIND_OF_IMAGE: "production"
+    KIND_OF_DEPLOYMENT: "production"
   script:
     - dnf install -y python3-jinja2-cli
-    - ./containers/production/render_configuration_templates.sh "${KIND_OF_IMAGE}"
-    - ./containers/production/build_buildah_production.sh "${KIND_OF_IMAGE}"
-    - buildah tag "${BUILT_IMAGE_NAME}-${KIND_OF_IMAGE}" "${IMAGE_TAG}-${KIND_OF_IMAGE}"
-    - buildah push "${IMAGE_TAG}-${KIND_OF_IMAGE}"
+    - ./containers/production/render_configuration_templates.sh "${KIND_OF_DEPLOYMENT}"
+    - ./containers/production/build_buildah_deployment.sh "${KIND_OF_DEPLOYMENT}"
+    - buildah tag "${BUILT_IMAGE_NAME}-${KIND_OF_DEPLOYMENT}" "${IMAGE_TAG}-${KIND_OF_DEPLOYMENT}"
+    - buildah push "${IMAGE_TAG}-${KIND_OF_DEPLOYMENT}"
   after_script:
-    - mv containers/production/${KIND_OF_IMAGE} configuration
+    - mv containers/production/${KIND_OF_DEPLOYMENT} configuration
   artifacts:
     paths:
       - configuration
@@ -222,9 +222,9 @@ code-string-changes:
 ##############################################################################
 ###################             Pre Deploy                 ###################
 ##############################################################################
-build_damned_lies_production:staging:
+build_container:staging:
   extends: .build_damned_lies_image
-  stage: pre_deploy
+  stage: build
   variables:
     KIND_OF_DEPLOYMENT: "staging"
   rules:
@@ -236,7 +236,7 @@ build_damned_lies_production:staging:
 ##############################################################################
 ###################               Deploy                   ###################
 ##############################################################################
-build_damned_lies_production:test:
+build_container:test:
   extends: .build_damned_lies_image
   stage: deploy
   variables:
@@ -247,11 +247,18 @@ build_damned_lies_production:test:
     - when: never
 
 
-build_damned_lies_production:production:
+build_container:production:
   extends: .build_damned_lies_image
   stage: deploy
   variables:
     KIND_OF_DEPLOYMENT: "production"
+    DAMNED_LIES_IMAGE_NAME: "${CI_REGISTRY_IMAGE}/damned-lies-production"
+    IMAGE_TAG: "${CI_REGISTRY_IMAGE}/damned-lies-production:${CI_COMMIT_REF_NAME}"
+  script:
+    - dnf install -y python3-jinja2-cli
+    - ./containers/production/render_configuration_templates.sh "${KIND_OF_DEPLOYMENT}"
+    - ./containers/production/build_buildah_replace_staging_with_production.sh
+    - buildah push "${IMAGE_TAG}-${KIND_OF_DEPLOYMENT}"
   rules:
     - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
       when: manual


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]