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

Add the ability to pass token/password to hub-tool using CLI switches or environment vars #176

Open
slmingol opened this issue May 12, 2021 · 3 comments
Labels
enhancement New feature or request

Comments

@slmingol
Copy link

slmingol commented May 12, 2021

Description
Add the ability to pass token/password to hub-tool using CLI switches or environment vars. Other CLI's like docker do this for comparison.

$ hub-tool/hub-tool login <user> --password-stdin <<<$(echo "password")

Do something similar with LastPass's CLI

$ docker login -u $(lpass show --username 'dockeruser') --password-stdin <<<$(lpass show --password 'dockerpass')

References

@silvin-lubecki silvin-lubecki added the enhancement New feature or request label May 12, 2021
@rsaffi
Copy link

rsaffi commented Jul 13, 2021

I tried this (very hacky) workaround (I'm using ubuntu-latest on my GitHub Actions runner):

          /usr/bin/expect <(cat << EOF
          spawn /tmp/hub-tool login ${{ secrets.DOCKERHUB_USERNAME }}
          expect "\033\[0;34mPassword: \033\[0m"
          send "${{ secrets.DOCKERHUB_TOKEN }}\n"
          interact
          EOF
          )

But it's failing, most likely due to "Password: " being printed with colors. I tested locally and this WORKS on my machine even without the ANSI colors codes, but not on GitHub Actions' runner. :-(

@rsaffi
Copy link

rsaffi commented Jul 14, 2021

What I ended up doing, for now (but sucessfully): built the ~/.docker/config.json by hand. For the JWT token, I get it with a cURL request directly to the API. 🤷🏻‍♂️
Then I can use hub-tool, as it's much easier than talking to the API directly.

@c-w
Copy link

c-w commented Jan 3, 2022

I have a patch for this in #198 which enables providing the Docker Hub password using the DOCKER_PASSWORD environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants