-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Let the user pass a secret for on git API resolver
We were previously only allowing using a secret from the global configmap, which mean every users on the cluster would have to use the same git value (which could be a security issue). We now let the user use their own token on their own namespace with the optional "token" and (even more optional) "tokenKey" params. The fallback will still be the global configmap. Added a bit logic to make sure we are caching secrets only when user use the token from global configmap. Since we can't ensure for local secrets on namespace may be rotated often. Signed-off-by: Chmouel Boudjnah <[email protected]>
- Loading branch information
Showing
5 changed files
with
149 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
examples/v1/pipelineruns/no-ci/git-resolver-custom-secret.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
apiVersion: tekton.dev/v1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: git-resolver- | ||
spec: | ||
workspaces: | ||
- name: output # this workspace name must be declared in the Pipeline | ||
volumeClaimTemplate: | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce # access mode may affect how you can use this volume in parallel tasks | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
pipelineSpec: | ||
workspaces: | ||
- name: output | ||
tasks: | ||
- name: task1 | ||
workspaces: | ||
- name: output | ||
taskRef: | ||
resolver: git | ||
params: | ||
- name: url | ||
value: https://github.com/tektoncd/catalog.git | ||
- name: pathInRepo | ||
value: /task/git-clone/0.7/git-clone.yaml | ||
- name: revision | ||
value: main | ||
# my-secret-token should be created in the namespace where the | ||
# pipelinerun is created and contain a GitHub personal access | ||
# token in the token key of the secret. | ||
- name: token | ||
value: my-secret-token | ||
- name: tokenKey | ||
value: token | ||
params: | ||
- name: url | ||
value: https://github.com/tektoncd/catalog | ||
- name: deleteExisting | ||
value: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters