/
pipeline-pr.yml
189 lines (177 loc) · 4.76 KB
/
pipeline-pr.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
resource_types:
- name: pull-request
type: docker-image
source:
repository: teliaoss/github-pr-resource
aws-config: &aws-config
access_key_id: ((aws-key-id))
secret_access_key: ((aws-key-secret))
test-bucket: &test-bucket
<< : *aws-config
bucket: ((default-cicd-bucket))
region_name: eu-west-1
resources:
# leave the build config on master
# to prevent people from modifying the build plan from a PR.
- name: github-machete-master
type: git
source:
uri: https://github.com/Bit-Clouded/aws-machete.git
# input build.
- name: github-machete-pr
type: pull-request
check_every: 24h
webhook_token: ((webhook-token))
source:
repository: Bit-Clouded/aws-machete
access_token: ((github-access-token))
- name: golang-build
type: registry-image
source:
repository: golang
tag: alpine
# bin output
- name: s3-artifact
type: s3
source:
<< : *test-bucket
regexp: aws-machete/bin/s3-(.*)
initial_path: aws-machete/bin/s3-aaa
- name: cloudformation-artifact
type: s3
source:
<< : *test-bucket
regexp: aws-machete/bin/cloudformation-(.*)
initial_path: aws-machete/bin/cloudformation-aaa
# docker input
- name: golang-cli
# we are separating the cli base image from the build base image.
# this allows us to pinpoint if an issue caused by the image affects the build or the run time.
type: registry-image
source:
repository: golang
tag: alpine
- name: builder-task
type: registry-image
source:
repository: concourse/builder-task
- name: pr-image
type: registry-image
source:
repository: bitcloudedci/aws-machete
username: ((dh-username))
password: ((dh-password))
- name: container-pr-semver
type: semver
source:
<< : *test-bucket
key: aws-machete/semver-pr-0.0
initial_version: 0.0.0
jobs:
- name: github-pr-set-status
public: true
plan:
- get: github-machete-pr
trigger: true
version: every
- put: github-machete-pr
params:
path: github-machete-pr
status: pending
- name: build-s3
public: true
plan:
- get: golang-build
trigger: false
- get: github-machete-pr
trigger: true
passed: ['github-pr-set-status']
- get: github-machete-master
trigger: false
- task: build
image: golang-build
file: github-machete-master/src/build-task.yml
vars:
input: github-machete-pr
bin-name: s3
build-path: src/s3
on_failure:
put: github-machete-pr
params:
path: github-machete-pr
status: failure
- put: s3-artifact
params:
file: bin/s3-*
acl: public-read
- name: build-cloudformation
public: true
plan:
- get: golang-build
trigger: false
- get: github-machete-pr
trigger: true
passed: ['github-pr-set-status']
- get: github-machete-master
trigger: false
- task: build
image: golang-build
file: github-machete-master/src/build-task.yml
vars:
input: github-machete-pr
bin-name: cloudformation
build-path: src/cloudformation
on_failure:
put: github-machete-pr
params:
path: github-machete-pr
status: failure
- put: cloudformation-artifact
params:
file: bin/cloudformation-*
acl: public-read
- name: docker-build
public: true
plan:
- get: container-pr-semver
trigger: false
params: {pre: pr}
- get: cloudformation-artifact
passed: ['build-cloudformation']
trigger: true
- get: s3-artifact
passed: ['build-s3']
trigger: true
- get: github-machete-pr
passed: ['github-pr-set-status']
trigger: false
- get: golang-cli
trigger: false
params:
format: oci
- get: builder-task
trigger: false
- task: assemble
image: builder-task
file: github-machete-pr/docker/build-task.yml
privileged: true
vars:
repository: bitcloudedci/aws-machete
docker-semver: container-pr-semver
dockerfile: github-machete-pr
on_failure:
put: github-machete-pr
params:
path: github-machete-pr
status: failure
- put: pr-image
params:
image: image/image.tar
additional_tags: container-pr-semver/number
- put: container-pr-semver
params:
file: container-pr-semver/number
- put: github-machete-pr
params:
path: github-machete-pr
status: success