From 3186f9911cd7a09d5674c419602c7f5b315072d7 Mon Sep 17 00:00:00 2001 From: Kai Giokas Date: Tue, 8 Aug 2023 15:56:05 -0400 Subject: [PATCH 1/4] Add the gitlab-ci changes for protected branches --- .gitlab-ci.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76573f6..0be61f1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -23,6 +23,7 @@ setup: rules: - if: $CI_MERGE_REQUEST_ID + - if: $CI_COMMIT_REF_PROTECTED - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH artifacts: reports: @@ -30,7 +31,6 @@ setup: metrics: metrics.txt expire_in: 1 hour - test: stage: test image: python:alpine @@ -52,6 +52,29 @@ test: url: ${CI_ARTIFACTS_URL}/-/jobs/$CI_JOB_ID/artifacts/public/index.html deployment_tier: development + +branch: + stage: test + image: python:alpine + needs: + - setup + script: + - python -m pip install -r ./requirements.txt + - sphinx-build -avTEW -b html . ./public + # We're not saving this but it's here to look at just in case. + artifacts: + paths: + - public + expire_in: 1 day + rules: + - if: $CI_COMMIT_REF_PROTECTED + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + when: never + environment: + # Env for each MR + name: $CI_COMMIT_BRANCH + url: ${CI_ARTIFACTS_URL}/-/jobs/$CI_JOB_ID/artifacts/public/index.html + deployment_tier: development pages: stage: deploy image: python:alpine -- GitLab From 3d766ddfe8dba77358554b30ef6b55eff152a69c Mon Sep 17 00:00:00 2001 From: Kai Giokas Date: Tue, 8 Aug 2023 18:40:50 -0400 Subject: [PATCH 2/4] Fix name --- .gitlab-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0be61f1..211b054 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -72,9 +72,10 @@ branch: when: never environment: # Env for each MR - name: $CI_COMMIT_BRANCH + name: $CI_COMMIT_REF_SLUG url: ${CI_ARTIFACTS_URL}/-/jobs/$CI_JOB_ID/artifacts/public/index.html deployment_tier: development + pages: stage: deploy image: python:alpine -- GitLab From 7ba674537b23bff73fc1cc71477c8bef7d6667ad Mon Sep 17 00:00:00 2001 From: Kai Giokas Date: Tue, 8 Aug 2023 18:49:38 -0400 Subject: [PATCH 3/4] Make it a staging env --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 211b054..30c2747 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -74,7 +74,7 @@ branch: # Env for each MR name: $CI_COMMIT_REF_SLUG url: ${CI_ARTIFACTS_URL}/-/jobs/$CI_JOB_ID/artifacts/public/index.html - deployment_tier: development + deployment_tier: staging pages: stage: deploy -- GitLab From 39be085da33087de5633a2c92704d5f7dcbbc372 Mon Sep 17 00:00:00 2001 From: Kai Giokas Date: Tue, 8 Aug 2023 19:04:54 -0400 Subject: [PATCH 4/4] Fix the rules --- .gitlab-ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 30c2747..812a12b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,9 +67,7 @@ branch: - public expire_in: 1 day rules: - - if: $CI_COMMIT_REF_PROTECTED - - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - when: never + - if: $CI_COMMIT_REF_PROTECTED && $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH environment: # Env for each MR name: $CI_COMMIT_REF_SLUG -- GitLab