Skip to content

Commit

Permalink
SRVKP-6442 - use a common environment varibale cred-store for all typ…
Browse files Browse the repository at this point in the history
…es of providers.
  • Loading branch information
pramodbindal committed Sep 23, 2024
1 parent a5cfffb commit f62bb3a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
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.Println("DOCKER_CONFIG : ", os.Getenv("DOCKER_CONFIG"))

Check failure on line 23 in internal/provider/oci/upload.go

View workflow job for this annotation

GitHub Actions / go

use of `fmt.Println` forbidden by pattern `^(fmt\.Print(|f|ln)|print|println)$` (forbidigo)
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

0 comments on commit f62bb3a

Please sign in to comment.