FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit bcd389c5 authored by Ryan Kowalewski's avatar Ryan Kowalewski :man_dancing:
Browse files

Merge branch 'tweak-tf-pipline-rules' into 'master'

terraform-pipeline: remove duplicate jobs

See merge request !47
parents 807e487d e3ea5995
No related branches found
Tags v2.2.0
1 merge request!47terraform-pipeline: remove duplicate jobs
......@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [2.2.1] - 2023-06-15
### Modified
- `terraform-pipeline.yml`: remove duplicate jobs between commits and merge requests.
## [2.2.0] - 2023-06-08
### Added
......
......@@ -71,6 +71,14 @@ variables:
TERRAFORM_DEPLOY_VERSION: "1.4"
TF_DATA_DIR: ${CI_PROJECT_DIR}/terraform_data
# Rules which only run test jobs on commit pipelines if there is not an active MR. This avoids duplicate jobs being
# created.
.test-job-rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
when: never
- if: "$CI_COMMIT_BRANCH || $CI_COMMIT_TAG"
# This job generates a plan and stores it as an artifact for consumption by a related apply job. It uses the
# -detailed-exitcode flag to enable the additional exit code 2, meaning that the plan executed successfully but
# that changes are required (see https://developer.hashicorp.com/terraform/cli/commands/plan#detailed-exitcode).
......@@ -136,9 +144,7 @@ terraform-validate:
rules:
- if: $TERRAFORM_VALIDATE_DISABLED
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- if: $CI_PIPELINE_SOURCE == "push"
- !reference [.test-job-rules]
tags:
- $GKE_RUNNER_TAG
needs: []
......@@ -151,9 +157,7 @@ terraform-fmt:
rules:
- if: $TERRAFORM_FMT_DISABLED
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- if: $CI_PIPELINE_SOURCE == "push"
- !reference [.test-job-rules]
tags:
- $GKE_RUNNER_TAG
needs: []
......@@ -183,9 +187,7 @@ tflint:
rules:
- if: $TFLINT_DISABLED
when: never
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: never
- if: $CI_PIPELINE_SOURCE == "push"
- !reference [.test-job-rules]
tags:
- $GKE_RUNNER_TAG
needs: []
......@@ -204,7 +206,7 @@ tfsec:
rules:
- if: $TFSEC_DISABLED
when: never
- if: $CI_PIPELINE_SOURCE == "push"
- !reference [.test-job-rules]
tags:
- $GKE_RUNNER_TAG
allow_failure: true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment