forked from tektoncd/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 1
/
release-pipeline.yaml
208 lines (207 loc) · 7.21 KB
/
release-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
# Copyright 2019-2024 The Tekton Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: dashboard-release
spec:
params:
- name: package
description: package to release
default: github.com/tektoncd/dashboard
- name: gitRevision
description: the git revision to release
- name: imageRegistry
description: The target image registry
default: gcr.io
- name: imageRegistryPath
description: The path (project) in the image registry
default: tekton-releases
- name: imageRegistryRegions
description: The target image registry regions
default: "us eu asia"
- name: imageRegistryUser
description: The user for the image registry credentials
default: "_json_key"
- name: versionTag
description: The X.Y.Z version that the artifacts should be tagged with
- name: releaseBucket
description: bucket where the release is stored. The bucket must be project specific.
default: gs://tekton-releases-nightly/dashboard
- name: releaseAsLatest
description: Whether to tag and publish this release as Pipelines' latest
default: "true"
- name: platforms
description: Platforms to publish for the images (e.g. linux/amd64,linux/arm64)
default: linux/amd64,linux/arm,linux/arm64,linux/s390x,linux/ppc64le
- name: koExtraArgs
description: Extra args to be passed to ko
default: "--preserve-import-paths"
- name: serviceAccountPath
description: The path to the service account file within the release-secret workspace
- name: serviceAccountImagesPath
description: The path to the service account file or credentials within the release-images-secret workspace
workspaces:
- name: workarea
description: The workspace where the repo will be cloned.
- name: release-secret
description: The secret that contains a service account authorized to push to the output bucket
- name: release-images-secret
description: The secret that contains a service account authorized to push to the image registry
results:
- name: commit-sha
description: the sha of the commit that was released
value: $(tasks.git-clone.results.commit)
- name: release-file
description: the URL of the release file
value: $(tasks.report-bucket.results.release)
- name: release-file-full
description: the URL of the release file
value: $(tasks.report-bucket.results.release-full)
tasks:
- name: git-clone
taskRef:
name: git-clone
workspaces:
- name: output
workspace: workarea
subpath: git
params:
- name: url
value: https://$(params.package)
- name: revision
value: $(params.gitRevision)
- name: precheck
runAfter: [git-clone]
taskRef:
name: dashboard-prerelease-checks
params:
- name: package
value: $(params.package)
- name: versionTag
value: $(params.versionTag)
- name: releaseBucket
value: $(params.releaseBucket)
workspaces:
- name: source-to-release
workspace: workarea
subpath: git
- name: build
runAfter: [precheck]
taskRef:
name: build-dashboard
workspaces:
- name: source
workspace: workarea
subpath: git
- name: publish-images
runAfter: [build]
taskRef:
name: publish-dashboard-release
params:
- name: package
value: $(params.package)
- name: versionTag
value: $(params.versionTag)
- name: imageRegistry
value: $(params.imageRegistry)
- name: imageRegistryPath
value: $(params.imageRegistryPath)
- name: imageRegistryUser
value: $(params.imageRegistryUser)
- name: imageRegistryRegions
value: $(params.imageRegistryRegions)
- name: releaseAsLatest
value: $(params.releaseAsLatest)
- name: serviceAccountPath
value: $(params.serviceAccountImagesPath)
- name: platforms
value: $(params.platforms)
- name: koExtraArgs
value: $(params.koExtraArgs)
workspaces:
- name: source
workspace: workarea
subpath: git
- name: output
workspace: workarea
subpath: bucket
- name: release-secret
workspace: release-images-secret
- name: publish-to-bucket
runAfter: [publish-images]
taskRef:
name: gcs-upload
workspaces:
- name: credentials
workspace: release-secret
- name: source
workspace: workarea
subpath: bucket
params:
- name: location
value: $(params.releaseBucket)/previous/$(params.versionTag)
- name: path
value: $(params.versionTag)
- name: serviceAccountPath
value: $(params.serviceAccountPath)
- name: publish-to-bucket-latest
runAfter: [publish-images]
when:
- input: "$(params.releaseAsLatest)"
operator: in
values: ["true"]
taskRef:
name: gcs-upload
workspaces:
- name: credentials
workspace: release-secret
- name: source
workspace: workarea
subpath: bucket
params:
- name: location
value: $(params.releaseBucket)/latest
- name: path
value: $(params.versionTag)
- name: serviceAccountPath
value: $(params.serviceAccountPath)
- name: report-bucket
runAfter: [publish-to-bucket]
params:
- name: releaseBucket
value: $(params.releaseBucket)
- name: versionTag
value: $(params.versionTag)
taskSpec:
params:
- name: releaseBucket
- name: versionTag
results:
- name: release
description: The full URL of the release file (read-only) in the bucket
type: string
- name: release-full
description: The full URL of the release file (read/write) in the bucket
type: string
steps:
- name: create-results
image: docker.io/library/alpine:3.20.3@sha256:beefdbd8a1da6d2915566fde36db9db0b524eb737fc57cd1367effd16dc0d06d
script: |
BASE_URL=$(echo "$(params.releaseBucket)/previous/$(params.versionTag)")
# If the bucket is in the gs:// return the corresponding public https URL
BASE_URL=$(echo ${BASE_URL} | sed 's,gs://,https://storage.googleapis.com/,g')
echo "${BASE_URL}/release.yaml" > $(results.release.path)
echo "${BASE_URL}/release-full.yaml" > $(results.release-full.path)