Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRVKP-6442 - use a common environment variable cred-store for all providers #53

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions internal/provider/oci/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ import (
)

func Upload(_ context.Context, hash, target, folder string, insecure bool) error {
credStore := os.Getenv("CRED_STORE")
if credStore != "" {
os.Setenv("DOCKER_CONFIG", os.Getenv("CRED_STORE"))
fmt.Fprintf(os.Stdout, "DOCKER_CONFIG is set to %s \n", os.Getenv("DOCKER_CONFIG"))
}
cacheImageRef := strings.ReplaceAll(target, "{{hash}}", hash)
fmt.Fprintf(os.Stderr, "Upload %s content to oci image %s\n", folder, cacheImageRef)

Expand Down
8 changes: 8 additions & 0 deletions tekton/cache-fetch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ spec:
The path where to find the google credentials. If left empty, it is ignored.
type: string
default: ""
- name: cred-store
description: |
The path where to find the creds to download cache files . If left empty, it is ignored.
type: string
default: ""
results: # Any result to "publish" ?
- name: fetched
description: |
Expand All @@ -53,6 +58,9 @@ spec:
value: $(params.insecure)
- name: GOOGLE_APPLICATION_CREDENTIALS
value: $(params.googleCredentialsPath)
- name: CRED_STORE
value: $(params.cred-store)

# FIXME: use a released version once something is released :)
image: ghcr.io/openshift-pipelines/tekton-caches/cache:latest
args: ["$(params.patterns[*])"]
Expand Down
10 changes: 9 additions & 1 deletion tekton/cache-upload.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ spec:
The path where to find the google credentials. If left empty, it is ignored.
type: string
default: ""
- name: cred-store
description: |
The path where to find the creds to upload cache files . If left empty, it is ignored.
type: string
default: ""
env:
- name: PARAM_TARGET
value: $(params.target)
Expand All @@ -63,8 +68,11 @@ spec:
value: $(params.force-cache-upload)
- name: GOOGLE_APPLICATION_CREDENTIALS
value: $(params.googleCredentialsPath)
- name: CRED_STORE
value: $(params.cred-store)
# FIXME: use a released version once something is released :)
image: ghcr.io/openshift-pipelines/tekton-caches/cache:latest
image: ko://github.com/openshift-pipelines/tekton-caches/cmd/cache
# image: ghcr.io/openshift-pipelines/tekton-caches/cache:latest
args: ["$(params.patterns[*])"]
script: |
#!/usr/bin/env sh
Expand Down