forked from rosbo/terraform-provider-google-ci
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ci.yml
202 lines (188 loc) · 6.61 KB
/
ci.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# These resource types are here until the PRs get merged in upstream. :)
resource_types:
- name: git-branch
type: docker-image
source:
repository: ((dockerhub-account.username))/concourse-git-resource
tag: v0.1.7
- name: github-pull-request
type: docker-image
source:
repository: ((dockerhub-account.username))/concourse-github-pr-resource
tag: v0.1.1
resources:
- name: magic-modules
type: git-branch
source:
uri: [email protected]:((github-account.username))/magic-modules.git
private_key: ((repo-key.private_key))
- name: magic-modules-new-prs
type: github-pull-request
source:
repo: ((github-account.username))/magic-modules
private_key: ((repo-key.private_key))
access_token: ((github-account.password))
only_mergeable: true
authorship_restriction: true
- name: terraform-intermediate
type: git-branch
source:
uri: [email protected]:((github-account.username))/terraform-provider-google.git
private_key: ((repo-key.private_key))
- name: ci
type: git
source:
uri: [email protected]:((github-account.username))/terraform-provider-google-ci.git
branch: master
private_key: ((repo-key.private_key))
- name: mm-approved-prs
type: github-pull-request
source:
repo: ((github-account.username))/magic-modules
private_key: ((repo-key.private_key))
access_token: ((github-account.password))
only_mergeable: true
require_review_approval: true
- name: nmckinley-pr
type: docker-image
source:
repository: ((dockerhub-account.username))/concourse-github-pr-resource
username: ((dockerhub-account.username))
password: ((dockerhub-account.password))
- name: terraform-pr
type: github-pull-request
source:
repo: terraform-providers/terraform-provider-google
private_key: ((repo-key.private_key))
access_token: ((github-account.password))
label: autogenerated
jobs:
- name: mm-generate
plan:
- aggregate:
- get: magic-modules
resource: magic-modules-new-prs
version: every
# trigger: true
params:
submodules: [build/terraform]
- get: ci
# consumes: ci, magic-modules (detached HEAD)
# produces: magic-modules-branched (new branch, with submodule)
- task: branch-magic-modules
file: ci/magic-modules/branch.yml
# consumes: ci, magic-modules-branched
# produces: terraform-generated
- task: generate-terraform
file: ci/magic-modules/generate-terraform.yml
# Puts 'terraform-generated' into the robot's fork.
- put: terraform-intermediate
params:
repository: terraform-generated
branch_file: magic-modules-branched/branchname
only_if_diff: true
# consumes: ci, magic-modules-branched
# produces: magic-modules-submodules
- task: point-to-submodules
file: ci/magic-modules/point-to-submodules.yml
params:
# This needs to match the username for the 'terraform-intermediate' resource.
GH_USERNAME: ((github-account.username))
# This 'put' needs to go below all the submodules because it has a commit which
# points to those submodules.
- put: magic-modules
params:
repository: magic-modules-submodules
branch_file: magic-modules-branched/branchname
only_if_diff: true
- name: terraform-test
plan:
- aggregate:
- get: ci
- get: magic-modules
version: every
# trigger: true
params:
submodules: [build/terraform]
passed: [mm-generate]
- task: test
file: ci/unit-tests/task.yml
- name: create-prs
plan:
- get: ci
- get: magic-modules
version: every
# trigger: true
params:
submodules: [build/terraform]
passed: [terraform-test, mm-generate]
- get: mm-initial-pr
resource: magic-modules-new-prs
passed: [mm-generate]
version: every
- task: create-pr
file: ci/magic-modules/create-pr.yml
params:
GITHUB_TOKEN: ((github-account.password))
TERRAFORM_REPO: ((github-account.username))/terraform-provider-google
on_failure:
put: magic-modules-new-prs
params:
status: failure
path: mm-initial-pr
- put: magic-modules
params:
branch_file: mm-initial-pr/.git/branch
repository: magic-modules
only_if_diff: true
- put: magic-modules-new-prs
params:
status: success
path: mm-initial-pr
comment: magic-modules-with-comment/pr_comment
- name: merge-prs
plan:
- get: mm-approved-prs
- get: ci
- task: merge-and-update
file: ci/magic-modules/merge.yml
params:
CREDS: ((repo-key.private_key))
- put: magic-modules
params:
repository: mm-output
branch_file: mm-approved-prs/.git/branch
only_if_diff: true
- put: mm-approved-prs
params:
path: mm-output
status: success
merge:
method: squash
commit_msg: mm-output/commit_message
- name: create-pr-image
plan:
- get: ci
- put: nmckinley-pr
params:
build: ci/containers/pull-request
- name: test-terraform-pr
plan:
- aggregate:
- get: ci
- get: terraform
resource: terraform-pr
version: every
trigger: true
- task: test
file: ci/unit-tests/test-terraform.yml
on_failure:
put: terraform-pr
params:
path: terraform-pr
status: failure
on_success:
put: terraform-pr
params:
path: terraform-pr
status: success