diff --git a/internal/provider/oci/upload.go b/internal/provider/oci/upload.go index 156e2f308..d116e3aeb 100644 --- a/internal/provider/oci/upload.go +++ b/internal/provider/oci/upload.go @@ -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")) cacheImageRef := strings.ReplaceAll(target, "{{hash}}", hash) fmt.Fprintf(os.Stderr, "Upload %s content to oci image %s\n", folder, cacheImageRef) diff --git a/tekton/cache-fetch.yaml b/tekton/cache-fetch.yaml index 8fe9a3809..c000e3097 100644 --- a/tekton/cache-fetch.yaml +++ b/tekton/cache-fetch.yaml @@ -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: | @@ -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[*])"] diff --git a/tekton/cache-upload.yaml b/tekton/cache-upload.yaml index 4f8c70785..0aade255d 100644 --- a/tekton/cache-upload.yaml +++ b/tekton/cache-upload.yaml @@ -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) @@ -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