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

Task skopeo-copy ignores $HOME/.docker/config.json with credentials #1211

Open
guillermomolina opened this issue Oct 27, 2023 · 0 comments
Open

Comments

@guillermomolina
Copy link

As far as I could investigate, the secrets annotated with "tekton.dev/docker-#" are used to create the file $HOME/.docker/config.json with the credentials for each of the registries.

The Task buildah push correctly loads the credentials, but the Task skopeo-copy does seem to ignore it.

Expected Behavior

[prepare] 2023/10/27 10:25:21 Entrypoint initialization

[place-scripts] 2023/10/27 10:25:22 Decoded script /tekton/scripts/script-0-qbznn

[skopeo-copy] Getting image source signatures
[skopeo-copy] Copying blob sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[skopeo-copy] Copying config sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[skopeo-copy] Writing manifest to image destination

Actual Behavior

[prepare] 2023/10/27 10:25:21 Entrypoint initialization

[place-scripts] 2023/10/27 10:25:22 Decoded script /tekton/scripts/script-0-qbznn

[skopeo-copy] Getting image source signatures
[skopeo-copy] Copying blob sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[skopeo-copy] Copying config sha256:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
[skopeo-copy] time="2023-10-27T10:26:35Z" level=fatal msg="writing manifest: uploading manifest XXXXXX to hub.integracio.sys/base/YYYY/ZZZZZZZ: unauthorized: unauthorized to access repository: base/YYYY/ZZZZZZZ, action: push: unauthorized to access repository: base/YYYY/ZZZZZZZ, action: push"

Steps to Reproduce the Problem

apiVersion: v1
kind: ServiceAccount
metadata:
  name: build-bot
secrets:
  - name: registry-credentials
---
apiVersion: v1
kind: Secret
metadata:
  name: registry-credentials
  annotations:
    tekton.dev/docker-0: https://hub.integracio.sys
type: kubernetes.io/basic-auth
stringData:
  username: ZZZZZ
  password: XXXXX
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  generateName: skopeo-copy-
spec:
  taskRef:
    name: skopeo-copy
  params:
    - name: srcImageURL
      value: docker://hub.integracio.sys/base/YYYY/ZZZZZZZ:JJJJJJ
    - name: destImageURL
      value: docker://hub.integracio.sys/base/YYYY/ZZZZZZZ:XXXXXX
    - name: srcTLSverify
      value: "false"
    - name: destTLSverify
      value: "false"
  serviceAccountName: build-bot
  workspaces:
    - name: images-url
      emptyDir: {}

Additional Info

It can be fixed with:

63:            skopeo copy "${sourceDest[@]}" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)" --authfile ${HOME}/.docker/config.json

72:          skopeo copy "$(params.srcImageURL)" "$(params.destImageURL)" --src-tls-verify="$(params.srcTLSverify)" --dest-tls-verify="$(params.destTLSverify)" --authfile ${HOME}/.docker/config.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant