From f845be733ff1976b4f8f2df4baf51e4c850e9259 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Fri, 4 Nov 2022 23:45:28 +0000 Subject: [PATCH 1/3] Update .gitlab-ci.yml --- .gitlab-ci.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db516f1..8dcb6e3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,6 @@ stages: - - plan - - apply + - lint + - build - destroy include: @@ -9,7 +9,7 @@ include: file: 'terraform.yml' plan: - stage: plan + stage: lint variables: WORKDIR: $CI_PROJECT_DIR/terraform ARGUMENTS: -var=pm_password=$pm_password -var=pm_api_url=$pm_api_url -var-file=terraform.tfvars @@ -17,7 +17,23 @@ plan: extends: .terraform_plan only: changes: - - terraform/* + - terraform/* + rules: + - if: $CI_PIPELINE_SOURCE == "merge_request_event" + +apply: + stage: build + variables: + WORKDIR: $CI_PROJECT_DIR/terraform + ARGUMENTS: -var=pm_password=$pm_password -var=pm_api_url=$pm_api_url -var-file=terraform.tfvars + allow_failure: false + extends: .terraform_apply + only: + changes: + - terraform/* + rules: + - if: '$CI_COMMIT_BRANCH == "main"' + #apply: # stage: apply From 7a9cb0536894536ec9ea7677fdce281f3f275238 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Fri, 4 Nov 2022 23:47:07 +0000 Subject: [PATCH 2/3] Update .gitlab-ci.yml --- .gitlab-ci.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8dcb6e3..3132fa0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,9 +15,6 @@ plan: ARGUMENTS: -var=pm_password=$pm_password -var=pm_api_url=$pm_api_url -var-file=terraform.tfvars allow_failure: false extends: .terraform_plan - only: - changes: - - terraform/* rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" @@ -33,6 +30,10 @@ apply: - terraform/* rules: - if: '$CI_COMMIT_BRANCH == "main"' + changes: + compare_to: refs/heads/main + paths: + - '/terraform/*' #apply: From 83ee13c615614e5bd6aa96dfc9a13b2b052464b9 Mon Sep 17 00:00:00 2001 From: DeveloperDurp Date: Fri, 4 Nov 2022 23:47:26 +0000 Subject: [PATCH 3/3] Update .gitlab-ci.yml --- .gitlab-ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3132fa0..2b6400a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -24,10 +24,7 @@ apply: WORKDIR: $CI_PROJECT_DIR/terraform ARGUMENTS: -var=pm_password=$pm_password -var=pm_api_url=$pm_api_url -var-file=terraform.tfvars allow_failure: false - extends: .terraform_apply - only: - changes: - - terraform/* + extends: .terraform_apply rules: - if: '$CI_COMMIT_BRANCH == "main"' changes: