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

poetry publish - prompting for password during CI builds #1843

Closed
2 tasks done
nackjicholson opened this issue Jan 7, 2020 · 11 comments
Closed
2 tasks done

poetry publish - prompting for password during CI builds #1843

nackjicholson opened this issue Jan 7, 2020 · 11 comments
Labels
kind/bug Something isn't working as expected

Comments

@nackjicholson
Copy link

nackjicholson commented Jan 7, 2020

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • [] If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: macos catalina
  • Poetry version: 1.0.0

Issue

poetry publish seems to be looking for a password that should exist, but can't be found. Perhaps it's not being stored properly by poetry config, or perhaps it's not being looked for in the right location.

On local macos:

Contents of my auth.toml, leftover from when I was on 0.12.13

[http-basic]
[http-basic.my-pypi]
username = "foo"
password = "bar"

Then I run poetry config http-basic.my-pypi foo bar

and the password poofs from the file.

[http-basic]
[http-basic.my-pypi]
username = "foo"

Locally on macos this is fine, because apparently the password is stored in the keychain app and poetry will ask for permission to pull it out of there when it needs to.

On travisci

before_deploy:
- poetry config http-basic.my-pypi $USER_VAR $PASS_VAR

there is no keychain app, so I'm seeing a poetry publish call hang on a Password: prompt because I presume in the absence of a Keychain-ish app the password isn't being saved anywhere that poetry can pull it from.

I saw this possibly related PR #1788
Would that code fix this problem? If so, we could use a patch release because currently 1.0.0 is breaking the ability to publish of packages from Travis CI where it's necessary to rely on the poetry config http-basic.my-pypi $U $P command to set auth values that poetry publish knows how to lookup.

@nackjicholson nackjicholson added the kind/bug Something isn't working as expected label Jan 7, 2020
@danieltahara
Copy link

danieltahara commented Jan 7, 2020

I am seeing broken password behavior as well, in two different ways on two different versions (on Ubuntu xenial, python 3.6)

== 1.0.0:

$ poetry config repositories.ZZZZ https://ZZZZ/simple
$ poetry config http-basic.ZZZZ $XXXX $YYYY
...

Building clogger (4.2.0)

 - Building sdist

 - Built clogger-4.2.0.tar.gz

Publishing clogger (4.2.0) to XXXX

Password:

This hangs, despite the initial configuration.

Similarly, when I use the SCREAM_CASE environment variables: POETRY_HTTP_BASIC_YYYY_USERNAME/PASSWORD, it does not work.

@mwmisner
Copy link
Contributor

mwmisner commented Jan 7, 2020

Wanted to drop in and note that I am seeing this same issue inconsistently as well. We have poetry setup in our AWS Code Build system. On three builds that were run at the same time two succeeded and one failed.

This only appears for us when we go to version 1.0.0. We have not reproduced this issue on 0.12.17. (Our current work around is to version lock to 0.12.17)

I was thinking that it might be related to: 1600 But it appears adding the environment Variable "PYTHONIOENCODING" to "utf-8". Did not change the behavior.

This is how we set the credentials:

  • poetry config http-basic.repo_name username "$SECURE_PASSWORD"
    - poetry config repositories.repo_name https://private_repo.com/repo

This is how the error is presenting itself to us:

[Container] 2020/01/07 21:45:01 Running command poetry publish -r repo_name 
Publishing package (2020.01.07.09.45.01) to repo_name 
Password: /usr/local/lib/python3.7/getpass.py:91: GetPassWarning: Can not control echo on the terminal. 
 passwd = fallback_getpass(prompt, stream) 
Warning: Password input may be echoed. 

[EOFError] 

[Container] 2020/01/07 21:45:02 Command did not exit successfully poetry publish -r repo_name exit status 1 
[Container] 2020/01/07 21:45:02 Phase complete: BUILD State: FAILED 

@willronchetti
Copy link

willronchetti commented Jan 9, 2020

Can report I am seeing the same behavior with our builds on Travis. Link to the build: https://travis-ci.org/4dn-dcic/utils/builds/634790461

Python = 3.5.6
Poetry version = 1.0.0
On Travis instance type travis-ci-sardonyx-xenial

Relevant Log

$ poetry config http-basic.pypi $PYPI_USER $PYPI_PASSWORD
dpl_0
1.19s$ rvm $(travis_internal_ruby) --fuzzy do ruby -S gem install dpl
Successfully installed dpl-1.10.14
1 gem installed
dpl.1
Installing deploy dependencies
Successfully installed dpl-script-1.10.14
1 gem installed
dpl.2
Preparing deploy
Cleaning up git repository with `git stash --all`. If you need build artifacts for deployment, set `deploy.skip_cleanup: true`. See https://docs.travis-ci.com/user/deployment#Uploading-Files-and-skip_cleanup.
Saved working directory and index state WIP on (no branch): ede5622 Fix docs build (#55)
Deploying application
Building dcicutils (0.9.0)
 - Building sdist
 - Built dcicutils-0.9.0.tar.gz
 - Building wheel
 - Built dcicutils-0.9.0-py3-none-any.whl
Publishing dcicutils (0.9.0) to PyPI
Password:

@nackjicholson nackjicholson changed the title poetry config does not save repository password to auth.toml poetry publish - prompting for password during CI builds Jan 9, 2020
@tomzx
Copy link
Contributor

tomzx commented Jan 10, 2020

The issue is likely to be the one reported in #1600. Having only the chainer and fail keyring backends leads to the password not being stored anywhere and no error being produced, other than poetry asking for the password again when required (which is not the behavior prior to the introduction of the keyring).

You can confirm this by looking at the file ~/.config/pypoetry/auth.toml that gets created with the proper username, but without any password.

This issue seems resolved with poetry>=1.0.1.

@willronchetti
Copy link

For anyone looking at this looking for an immediate solution without updating, you can pass the username and password to poetry publish manually like below (see here) which works.

poetry publish --username=<username> --password=<password>

@eliasmistler
Copy link

#1600 is fixed now, so this issue might be resolved, too -- can you upgrade to 1.0.2 and see whether you still have the issue?

@nackjicholson
Copy link
Author

Screenshot from 2020-01-17 14-13-25
Screenshot from 2020-01-17 14-30-08

Looks like it works with 1.0.2!
Doing this in my travis config:

before_install:
  # Install with vendored dependencies, so they don't interact with our project's dependencies
  - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py > /tmp/get-poetry.py
  - python /tmp/get-poetry.py -y --version 1.0.2
  - export PATH=$HOME/.poetry/bin:$PATH

@ypicard
Copy link

ypicard commented Dec 23, 2021

Is this really fixed? I still see the same behavior.
Poetry version: 1.1.12

With:

poetry config repositories.name https://...
poetry config http-basic.name user "token"

Bitbucket Pipelines complains:

/usr/lib/python3.7/getpass.py:91: GetPassWarning: Can not control echo on the terminal.
  passwd = fallback_getpass(prompt, stream)
Warning: Password input may be echoed.
  EOFError
  
  at /usr/lib/python3.7/getpass.py:148 in _raw_input
      144│         stream.flush()
      145│     # NOTE: The Python C API calls flockfile() (and unlock) during readline.
      146│     line = input.readline()
      147│     if not line:
    → 148│         raise EOFError
      149│     if line[-1] == '\n':
      150│         line = line[:-1]
      151│     return line
      152│ 
2021-12-23T06:11:56.332123804Z stderr P Please set a password for your new keyring: 

@chollid
Copy link

chollid commented Feb 2, 2022

I have the exact same issue as @ypicard above.

      144│         stream.flush()
      145│     # NOTE: The Python C API calls flockfile() (and unlock) during readline.
      146│     line = input.readline()
      147│     if not line:
    → 148│         raise EOFError
      149│     if line[-1] == '\n':
      150│         line = line[:-1]
      151│     return line
      152│

I'm seeing this while running materialize in a docker container. I'm unable to stay within the bash shell of my working docker container because this error keeps restarting materialize.

@RobinFrcd
Copy link

Same issue in docker build here, on python:3.9-slim on version 1.1.14 .

Copy link

github-actions bot commented Mar 1, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

10 participants