forked from konflux-ci/build-definitions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpush.yaml
219 lines (208 loc) · 7.69 KB
/
push.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
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
name: build-definitions-bundle-push
annotations:
pipelinesascode.tekton.dev/on-event: "push"
pipelinesascode.tekton.dev/on-target-branch: "main"
pipelinesascode.tekton.dev/task: "[task/update-infra-deployments/0.1/update-infra-deployments.yaml, task/git-clone/0.1/git-clone.yaml, .tekton/tasks/buildah.yaml, task/slack-webhook-notification/0.1/slack-webhook-notification.yaml, .tekton/tasks/ec-checks.yaml]"
pipelinesascode.tekton.dev/max-keep-runs: "5"
spec:
params:
- name: git-url
value: "{{ repo_url }}"
- name: revision
value: "{{ revision }}"
- name: slack-webhook-notification-team
value: "integration-slack-alerts"
pipelineSpec:
params:
- description: 'Source Repository URL'
name: git-url
type: string
- description: 'Revision of the Source Repository'
name: revision
type: string
- name: slack-webhook-notification-team
default: ""
type: string
tasks:
- name: clone-repository
params:
- name: url
value: $(params.git-url)
- name: revision
value: "$(params.revision)"
- name: depth
value: "0"
taskRef:
name: git-clone
workspaces:
- name: output
workspace: workspace
- name: ec-task-checks
runAfter:
- clone-repository
taskRef:
name: ec-checks
workspaces:
- name: source
workspace: workspace
- name: build-container
params:
- name: IMAGE
value: quay.io/konflux-ci/appstudio-utils:{{ revision }}
- name: CONTEXT
value: appstudio-utils
runAfter:
- clone-repository
taskRef:
name: buildah
workspaces:
- name: source
workspace: workspace
- name: build-bundles
params:
- name: revision
value: "$(params.revision)"
runAfter:
- build-container
- ec-task-checks
workspaces:
- name: source
workspace: workspace
taskSpec:
params:
- name: revision
type: string
steps:
- name: build-bundles-konflux-ci
image: quay.io/konflux-ci/appstudio-utils:{{ revision }}
workingDir: $(workspaces.source.path)/source
command: ["./hack/build-and-push.sh"]
env:
- name: QUAY_NAMESPACE
value: konflux-ci/tekton-catalog
- name: BUILD_TAG
value: "$(params.revision)"
- name: SKIP_BUILD
value: "1"
- name: SKIP_INSTALL
value: "1"
- name: OUTPUT_TASK_BUNDLE_LIST
value: $(workspaces.source.path)/task-bundle-list-konflux-ci
- name: OUTPUT_PIPELINE_BUNDLE_LIST
value: $(workspaces.source.path)/pipeline-bundle-list-konflux-ci
- name: build-bundles-redhat-appstudio
image: quay.io/konflux-ci/appstudio-utils:{{ revision }}
workingDir: $(workspaces.source.path)/source
command: ["./hack/build-and-push.sh"]
env:
- name: QUAY_NAMESPACE
value: redhat-appstudio-tekton-catalog
- name: BUILD_TAG
value: "$(params.revision)"
- name: SKIP_BUILD
value: "1"
- name: SKIP_INSTALL
value: "1"
- name: OUTPUT_TASK_BUNDLE_LIST
value: $(workspaces.source.path)/task-bundle-list-appstudio
- name: OUTPUT_PIPELINE_BUNDLE_LIST
value: $(workspaces.source.path)/pipeline-bundle-list-appstudio
volumeMounts:
- mountPath: /root/.docker/config.json
subPath: .dockerconfigjson
name: quay-secret
- name: update-acceptable-bundles
image: quay.io/konflux-ci/appstudio-utils:{{ revision }}
workingDir: $(workspaces.source.path)/source
env:
- name: REVISION
value: "$(params.revision)"
- name: GIT_URL
value: "$(params.git-url)"
script: |
#!/bin/bash
set -euo pipefail
DATA_BUNDLE_REPO=quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles
DATA_BUNDLE_TAG=$(date '+%s')
export DATA_BUNDLE_REPO DATA_BUNDLE_TAG
list=()
for f in "$@"; do
[[ -f "$f" ]] && list+=("$f")
done
.tekton/scripts/build-acceptable-bundles.sh "${list[@]}"
echo -n "${DATA_BUNDLE_TAG}" > acceptable_bundle_tag
args:
- $(workspaces.source.path)/task-bundle-list-konflux-ci
- $(workspaces.source.path)/pipeline-bundle-list-konflux-ci
- $(workspaces.source.path)/task-bundle-list-appstudio
- $(workspaces.source.path)/pipeline-bundle-list-appstudio
- name: copy-acceptable-bundle-to-appstudio
image: quay.io/konflux-ci/appstudio-utils:{{ revision }}
workingDir: $(workspaces.source.path)/source
script: |
#!/bin/bash
set -euo pipefail
DATA_BUNDLE_REPO=quay.io/konflux-ci/tekton-catalog/data-acceptable-bundles
DATA_BUNDLE_TAG=$(<acceptable_bundle_tag)
DATA_BUNDLE_RH_APPSTUDIO=quay.io/redhat-appstudio-tekton-catalog/data-acceptable-bundles
skopeo copy \
"docker://$DATA_BUNDLE_REPO:$DATA_BUNDLE_TAG" \
"docker://$DATA_BUNDLE_RH_APPSTUDIO:$DATA_BUNDLE_TAG"
skopeo copy \
"docker://$DATA_BUNDLE_REPO:$DATA_BUNDLE_TAG" \
"docker://$DATA_BUNDLE_RH_APPSTUDIO:latest"
volumeMounts:
- mountPath: /root/.docker/config.json
subPath: .dockerconfigjson
name: quay-secret
volumes:
- name: quay-secret
secret:
secretName: redhat-appstudio-tekton-catalog-build-definitions-pull-secret
workspaces:
- name: source
- name: update-infra-repo
runAfter:
- build-bundles
params:
- name: ORIGIN_REPO
value: $(params.git-url)
- name: REVISION
value: $(params.revision)
- name: SCRIPT
value: |
sed -i -E 's/[0-9a-f]{40}/$(params.revision)/g' components/build-service/base/build-pipeline-config/build-pipeline-config.yaml
taskRef:
name: update-infra-deployments
workspaces:
- name: workspace
description: Workspace containing arbitrary artifacts used during the pipeline run.
finally:
- name: slack-webhook-notification
taskRef:
name: slack-webhook-notification
when:
- input: $(params.slack-webhook-notification-team)
operator: notin
values: [""]
- input: $(tasks.status)
operator: in
values: ["Failed"]
params:
- name: message
value: ":x: Tekton pipelineRun $(context.pipelineRun.name) failed"
- name: key-name
value: $(params.slack-webhook-notification-team)
workspaces:
- name: workspace
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi