Skip to content
Snippets Groups Projects
Unverified Commit b317c0be authored by Timo Furrer's avatar Timo Furrer
Browse files

Support `rules` in `plan` job

Changelog: added
parent 7f649dad
No related branches found
No related tags found
No related merge requests found
......@@ -169,6 +169,11 @@ include:
state_name: $[[ inputs.state_name ]]
artifacts_access: $[[ inputs.plan_artifacts_access ]]
var_file: $[[ inputs.var_file ]]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.
- local: '/templates/apply.yml'
inputs:
as: '$[[ inputs.job_name_prefix ]]apply'
......
......@@ -87,6 +87,13 @@ spec:
default: ''
type: string
description: 'Path to a variables files relative to root_dir.'
rules:
# FIXME: eventually, we'll want to define `null` as the default,
# but this is NOT support yet, see
# https://gitlab.com/gitlab-org/gitlab/-/issues/440468
default: []
type: array
description: 'Defines the `rules` of the job.'
---
......@@ -106,11 +113,7 @@ spec:
- $TF_ROOT/$[[ inputs.plan_name ]].cache
reports:
terraform: $TF_ROOT/$[[ inputs.plan_name]].json
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.
rules: $[[ inputs.rules ]]
cache:
key: "$__CACHE_KEY_HACK"
paths:
......
......@@ -143,6 +143,11 @@ include:
state_name: $[[ inputs.state_name ]]
artifacts_access: $[[ inputs.plan_artifacts_access ]]
var_file: $[[ inputs.var_file ]]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.
- local: '/templates/apply.yml'
inputs:
as: '$[[ inputs.job_name_prefix ]]apply'
......
......@@ -148,6 +148,11 @@ include:
artifacts_access: $[[ inputs.plan_artifacts_access ]]
destroy: true
var_file: $[[ inputs.var_file ]]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.
- local: '/templates/destroy.yml'
inputs:
as: '$[[ inputs.job_name_prefix ]]destroy'
......
......@@ -136,3 +136,8 @@ include:
state_name: $[[ inputs.state_name ]]
artifacts_access: $[[ inputs.artifacts_access ]]
var_file: $[[ inputs.var_file ]]
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
- if: $CI_OPEN_MERGE_REQUESTS # Don't add it to a *branch* pipeline if it's already in a merge request pipeline.
when: never
- if: $CI_COMMIT_BRANCH # If there's no open merge request, add it to a *branch* pipeline instead.
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