-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathpipeline.yaml
242 lines (228 loc) · 7.18 KB
/
pipeline.yaml
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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# Copyright 2021 VMware, Inc.
# SPDX-License-Identifier: BSD-2-Clause
---
resource_types:
- name: helm-chart
type: registry-image
source:
repository: harbor-repo.vmware.com/dockerhub-proxy-cache/jghiloni/helm-chart-resource
tag: v0.1.1
username: ((harbor.username))
password: ((harbor.token))
- name: pull-request
type: docker-image
source:
repository: harbor-repo.vmware.com/dockerhub-proxy-cache/teliaoss/github-pr-resource
tag: v0.23.0
username: ((harbor.username))
password: ((harbor.token))
- name: github-release
type: docker-image
source:
repository: harbor-repo.vmware.com/dockerhub-proxy-cache/concourse/github-release-resource
tag: 1.6.4
username: ((harbor.username))
password: ((harbor.token))
resources:
- name: source
type: git
icon: github
source:
uri: [email protected]:vmware-tanzu/asset-relocation-tool-for-kubernetes.git
private_key: ((github.private_key))
branch: main
ignore_paths:
- ci/Dockerfile
- ci/pipeline.yaml
- name: pull-requests
type: pull-request
icon: github
check_every: 1m
source:
repository: vmware-tanzu/asset-relocation-tool-for-kubernetes
access_token: ((github.access_token))
- name: test-image-source
type: git
icon: github
source:
uri: [email protected]:vmware-tanzu/asset-relocation-tool-for-kubernetes.git
private_key: ((github.private_key))
branch: main
paths:
- ci/Dockerfile
- name: test-image
type: docker-image
icon: docker
source:
repository: harbor-repo.vmware.com/tanzu_isv_engineering/relok8s-test-image
username: ((harbor.username))
password: ((harbor.token))
- name: docker-image
type: registry-image
icon: docker
source:
# Image being built on every new release by our release workflow in Github
# https://github.com/vmware-tanzu/asset-relocation-tool-for-kubernetes/actions/workflows/goreleaser.yml
repository: ghcr.io/vmware-tanzu/asset-relocation-tool-for-kubernetes
- name: nginx-chart
type: helm-chart
icon: kubernetes
source:
repository_url: https://charts.bitnami.com/bitnami
chart: nginx
jobs:
- name: build-test-image
plan:
- get: test-image-source
trigger: true
- put: test-image
params:
build: test-image-source
dockerfile: test-image-source/ci/Dockerfile
tag_as_latest: true
- name: test
plan:
- in_parallel:
- get: test-image
passed:
- build-test-image
trigger: true
- get: source
trigger: true
- task: run-lint
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: lint
- task: run-unit-tests
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: test-units
- task: run-feature-tests
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: test-features
- task: run-external-tests
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: test-external
REGISTRY_SERVER: harbor-repo.vmware.com
REGISTRY_USERNAME: ((harbor-private.username))
REGISTRY_PASSWORD: ((harbor-private.token))
- name: relocate-chart
plan:
- in_parallel:
- get: docker-image
trigger: true
- get: nginx-chart
- task: relocate
image: docker-image
config:
platform: linux
params:
REGISTRY_SERVER: harbor-repo.vmware.com
REGISTRY_USERNAME: ((harbor-private.username))
REGISTRY_PASSWORD: ((harbor-private.token))
inputs:
- name: nginx-chart
outputs:
- name: rewritten-chart
run:
path: bash
args:
- -exc
- |
docker-login.sh "${REGISTRY_SERVER}" "${REGISTRY_USERNAME}" "${REGISTRY_PASSWORD}"
cat > image-patterns.yaml <<EOF
---
- "{{ .image.registry }}/{{ .image.repository }}:{{ .image.tag }}"
- "{{ .cloneStaticSiteFromGit.image.registry }}/{{ .cloneStaticSiteFromGit.image.repository }}:{{ .cloneStaticSiteFromGit.image.tag }}"
- "{{ .ldapDaemon.image.registry }}/{{ .ldapDaemon.image.repository }}:{{ .ldapDaemon.image.tag }}"
- "{{ .metrics.image.registry }}/{{ .metrics.image.repository }}:{{ .metrics.image.tag }}"
EOF
relok8s chart move nginx-chart/*.tgz \
--yes \
--image-patterns image-patterns.yaml \
--registry "${REGISTRY_SERVER}" \
--repo-prefix tanzu_isv_engineering_private
mv *.relocated.tgz rewritten-chart/chart.tgz
- task: print-diff
image: docker-image
config:
platform: linux
inputs:
- name: nginx-chart
- name: rewritten-chart
run:
path: bash
args:
- -exc
- |
# NOTE: The leading ! is because it is an error condition if there are no differences in the two files
! diff --context=3 \
<(tar xzfO nginx-chart/*.tgz nginx/values.yaml) \
<(tar xzfO rewritten-chart/chart.tgz nginx/values.yaml)
- name: test-pull-request
serial: true
plan:
- in_parallel:
- get: test-image
passed:
- build-test-image
- get: source
resource: pull-requests
trigger: true
version: every
params:
integration_tool: rebase
on_success:
put: pull-requests
inputs: detect
params:
path: source
status: pending
on_failure:
put: pull-requests
inputs: detect
params:
path: source
context: merge-conflict
status: failure
- do:
- task: run-lint
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: lint
- task: run-unit-tests
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: test-units
- task: run-feature-tests
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: test-features
- task: run-external-tests
image: test-image
file: source/ci/tasks/test.yaml
params:
MAKE_TARGET: test-external
REGISTRY_SERVER: harbor-repo.vmware.com
REGISTRY_USERNAME: ((harbor-private.username))
REGISTRY_PASSWORD: ((harbor-private.token))
on_failure:
put: pull-requests
inputs: detect
params:
path: source
status: failure
- put: pull-requests
inputs: detect
params:
path: source
status: success