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

ko task uses config.json instead of .dockerconfigjson #1192

Open
salaboy opened this issue Sep 3, 2023 · 4 comments
Open

ko task uses config.json instead of .dockerconfigjson #1192

salaboy opened this issue Sep 3, 2023 · 4 comments

Comments

@salaboy
Copy link

salaboy commented Sep 3, 2023

Expected Behavior

The ko task should use the .dockerconfigjson to set credentials for ko

When creating a secret with:

kubectl create secret docker-registry docker-credentials --docker-server=https://index.docker.io/v1/ --docker-username=<username> --docker-password=<password> --docker-email=<email>

You get a secret with spec.data -> .dockerconfigjson not config.json. This causes ko to not know which credentials to use.

This requires the tekton ko tasks to rename and move the .dockerconfigjson mounted into a volume to ~/.docker/config.json

Actual Behavior

It looks for a config.json key inside the secret

Steps to Reproduce the Problem

  1. create a secret with the command specified above
  2. try to use the ko task to publish a container to docker hub

Additional Info

This kind of issues are really frustrating for newbies and also for experienced people .. it is not easy to debug.
Related to this issue, is the fact that if any of the credentials have sensitive characters like $ when creating the secret these characters will not be escaped and they will fail the encoding leading to situations where the credentials sent to docker hub are wrong. It might be good to have some docs around that to save people time.

@salaboy
Copy link
Author

salaboy commented Sep 3, 2023

This can also be solved by extending the task with the DOCKER_CONFIG parameter.. which allows us to set up the path for the .docker/config.json file, still we will need to rename the file to config.json

@HWiese1980
Copy link

What is the status here? How's this not solved yet?

@vdemeester
Copy link
Member

It has not been solved yet because of maintainers time. Essentially, the idea would be to bump the Task to a 0.2 and use scripts to do something similar to what we do here.

For what is worth, I created a Task that is an "evolution" of the ko Task present here : https://github.com/shortbrain/golang-tasks/tree/main/go-ko-image.

@rajatrj16
Copy link

Similar issue with creating vaultstaticsecret type .dockerconfigjson does not allow key config.json but only supports .dockerconfigjson.

I tried the above manipulation in the task to rename to config.json but it does not validate auth while pushing.

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

4 participants