Skip to content

Commit 1f53210

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 2bbd219 commit 1f53210

File tree

3 files changed

+20
-6
lines changed

3 files changed

+20
-6
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ spec:
1919
- name: imageRegistryRegions
2020
description: The target image registry regions
2121
default: "us eu asia"
22+
- name: imageRegistryUser
23+
description: The user for the image registry credentials
24+
default: _json_key
2225
- name: versionTag
2326
description: The X.Y.Z version that the artifacts should be tagged with
2427
- name: releaseBucket
@@ -38,11 +41,15 @@ spec:
3841
default: linux/amd64,linux/arm,linux/arm64,linux/s390x,linux/ppc64le,windows/amd64
3942
- name: serviceAccountPath
4043
description: The path to the service account file within the release-secret workspace
44+
- name: serviceAccountImagesPath
45+
description: The path to the service account file or credentials within the release-images-secret workspace
4146
workspaces:
4247
- name: workarea
4348
description: The workspace where the repo will be cloned.
4449
- name: release-secret
45-
description: The secret that contains a service account authorized to push to the imageRegistry and to the output bucket
50+
description: The secret that contains a service account authorized to push to the output bucket
51+
- name: release-images-secret
52+
description: The secret that contains a service account authorized to push to the imageRegistry
4653
results:
4754
- name: commit-sha
4855
description: the sha of the commit that was released
@@ -157,12 +164,12 @@ spec:
157164
value: $(params.imageRegistry)
158165
- name: imageRegistryPath
159166
value: $(params.imageRegistryPath)
160-
- name: imageRegistryRegions
161-
value: $(params.imageRegistryRegions)
167+
- name: imageRegistryUser
168+
value: $(params.registryUser)
162169
- name: releaseAsLatest
163170
value: $(params.releaseAsLatest)
164171
- name: serviceAccountPath
165-
value: $(params.serviceAccountPath)
172+
value: $(params.serviceAccountImagesPath)
166173
- name: platforms
167174
value: $(params.publishPlatforms)
168175
workspaces:
@@ -173,7 +180,7 @@ spec:
173180
workspace: workarea
174181
subpath: bucket
175182
- name: release-secret
176-
workspace: release-secret
183+
workspace: release-images-secret
177184
timeout: 2h
178185
- name: publish-to-bucket
179186
runAfter: [publish-images]

0 commit comments

Comments
 (0)