Skip to content

Commit a5c95d4

Browse files
committed
Support separate bucket and image reg creds
The current release pipeline assumes that the same credentials are used to authenticate to the cloud storage service as well as to the container registry. This enables having independent credentials. It also enables using PAT based auth for the container registry by making the user configurable (instead of _json_key which works with gcr). Signed-off-by: Andrea Frittoli <[email protected]>
1 parent bb43cf2 commit a5c95d4

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

tekton/publish.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ spec:
3030
default: linux/amd64,linux/arm,linux/arm64,linux/s390x,linux/ppc64le,windows/amd64
3131
- name: serviceAccountPath
3232
description: The name of the service account path within the release-secret workspace
33+
- name: registryUser
34+
description: Username to be used to login to the container registry
35+
default: "_json_key"
3336
workspaces:
3437
- name: source
3538
description: >-
@@ -50,6 +53,8 @@ spec:
5053
value: "$(workspaces.release-secret.path)/$(params.serviceAccountPath)"
5154
- name: CONTAINER_REGISTRY
5255
value: "$(params.imageRegistry)/$(params.imageRegistryPath)"
56+
- name: CONTAINER_REGISTRY_USER
57+
value: "$(params.registryUser)"
5358
- name: REGIONS
5459
value: "$(params.imageRegistryRegions)"
5560
- name: OUTPUT_RELEASE_DIR
@@ -68,7 +73,7 @@ spec:
6873
6974
# Login to the container registry
7075
DOCKER_CONFIG=$(cat ${CONTAINER_REGISTRY_CREDENTIALS} | \
71-
crane auth login -u _json_key --password-stdin $(params.imageRegistry) 2>&1 | \
76+
crane auth login -u ${CONTAINER_REGISTRY_USER} --password-stdin $(params.imageRegistry) 2>&1 | \
7277
sed 's,^.*logged in via \(.*\)$,\1,g')
7378
7479
# Auth with account credentials for all regions.

tekton/release-cheat-sheet.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ the pipelines repo, a terminal window and a text editor.
6262
--serviceaccount=release-right-meow \
6363
--param=gitRevision="${TEKTON_RELEASE_GIT_SHA}" \
6464
--param=serviceAccountPath=release.json \
65+
--param=serviceAccountImagesPath=release.json \
6566
--param=versionTag="${TEKTON_VERSION}" \
6667
--param=releaseBucket=gs://tekton-releases/pipeline \
6768
--workspace name=release-secret,secret=release-secret \
69+
--workspace name=release-images-secret,secret=release-secret \
6870
--workspace name=workarea,volumeClaimTemplateFile=workspace-template.yaml \
6971
--tasks-timeout 2h \
7072
--pipeline-timeout 3h

tekton/release-pipeline.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ spec:
1616
- name: imageRegistryPath
1717
description: The path (project) in the image registry
1818
default: tekton-releases
19+
- name: imageRegistryUser
20+
description: The user for the image registry credentials
21+
default: _json_key
1922
- name: versionTag
2023
description: The X.Y.Z version that the artifacts should be tagged with
2124
- name: releaseBucket
@@ -35,11 +38,15 @@ spec:
3538
default: linux/amd64,linux/arm,linux/arm64,linux/s390x,linux/ppc64le,windows/amd64
3639
- name: serviceAccountPath
3740
description: The path to the service account file within the release-secret workspace
41+
- name: serviceAccountImagesPath
42+
description: The path to the service account file or credentials within the release-images-secret workspace
3843
workspaces:
3944
- name: workarea
4045
description: The workspace where the repo will be cloned.
4146
- name: release-secret
42-
description: The secret that contains a service account authorized to push to the imageRegistry and to the output bucket
47+
description: The secret that contains a service account authorized to push to the output bucket
48+
- name: release-images-secret
49+
description: The secret that contains a service account authorized to push to the imageRegistry
4350
results:
4451
- name: commit-sha
4552
description: the sha of the commit that was released
@@ -154,10 +161,12 @@ spec:
154161
value: $(params.imageRegistry)
155162
- name: imageRegistryPath
156163
value: $(params.imageRegistryPath)
164+
- name: imageRegistryUser
165+
value: $(params.registryUser)
157166
- name: releaseAsLatest
158167
value: $(params.releaseAsLatest)
159168
- name: serviceAccountPath
160-
value: $(params.serviceAccountPath)
169+
value: $(params.serviceAccountImagesPath)
161170
- name: platforms
162171
value: $(params.publishPlatforms)
163172
workspaces:
@@ -168,7 +177,7 @@ spec:
168177
workspace: workarea
169178
subpath: bucket
170179
- name: release-secret
171-
workspace: release-secret
180+
workspace: release-images-secret
172181
timeout: 2h
173182
- name: publish-to-bucket
174183
runAfter: [publish-images]

0 commit comments

Comments
 (0)