-
Notifications
You must be signed in to change notification settings - Fork 1
/
jobs.jsonnet
52 lines (52 loc) · 1.19 KB
/
jobs.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
plan(cloud, env, workspace):: {
image: {
name: 'hashicorp/terraform:light',
},
stage: 'plan',
script: [
'cd ' + cloud + '/' + env,
'terraform init',
'terraform workspace select ' + workspace,
'terraform plan -out plan.tfplan',
],
allow_failure: false,
rules: [
{
'if': '$COMMIT_REF_NAME == $DEFAULT_BRANCH',
changes: [cloud + '/' + env + '/**/*'],
},
{
'if': '$PIPELINE_SOURCE == "merge_request_event"',
changes: [cloud + '/' + env + '/**/*'],
},
],
artifacts:
{
name: env,
paths: [cloud + '/' + env + '/plan.tfplan'],
},
},
apply(cloud, env, workspace):: {
image: {
name: 'hashicorp/terraform:light',
},
stage: 'apply',
script: [
'cd ' + cloud + '/' + env,
'terraform init',
'terraform workspace select ' + workspace,
'terraform apply plan.tfplan',
],
allow_failure: false,
rules: [
{
'if': '$COMMIT_REF_NAME == $DEFAULT_BRANCH',
changes: [cloud + '/' + env + '/**/*'],
when: 'manual',
allow_failure: true,
},
],
needs: ['plan:' + workspace],
},
}