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

Username and password flags are ignored in non-interactive mode #1736

Closed
2 tasks done
Shadow53 opened this issue Aug 14, 2023 · 2 comments · Fixed by #1737
Closed
2 tasks done

Username and password flags are ignored in non-interactive mode #1736

Shadow53 opened this issue Aug 14, 2023 · 2 comments · Fixed by #1737
Labels
bug Something isn't working

Comments

@Shadow53
Copy link

Bug Description

When using the maturin CLI in Gitlab CI to upload wheels to GitLab PyPI, we are using the following command:

maturin upload --repository-url "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi" --username gitlab-ci-token --password  "${CI_JOB_TOKEN}" $WHEELS

But we get the error

🎛️ Running in non-interactive mode on CI
💥 maturin failed
  Caused by: Credentials not found and non-interactive mode is enabled

As best as I can tell, this is caused by this bit of code that will exit with an error if in non-interactive mode, without first checking if username and password were provided via CLI flags or env vars.

I think this should check if both are set (e.g. if let (Some(username), Some(password)) = (username, password) {} before checking if in non-interactive mode.

For now, we are working around this by providing the username/password on CLI and setting $CI to something other than true (to work around maturin auto-enabling non-interactive mode), as it looks like we cannot use token-based auth with GitLab (all of the docs use username/password).

Your maturin version (maturin --version)

1.2.1

Your Python version (python -V)

3.9.17

Your pip version (pip -V)

23.0.1

What bindings you're using

pyo3

Does cargo build work?

  • Yes, it works

If on windows, have you checked that you aren't accidentally using unix path (those with the forward slash /)?

  • Yes

Steps to Reproduce

  1. Create a project on GitLab that uses Maturin
  2. In CI, use maturin build to build one or more wheels
  3. Attempt to upload to GitLab's Package Registry using the command provided above
@Shadow53 Shadow53 added the bug Something isn't working label Aug 14, 2023
@messense
Copy link
Member

Thanks for the report, pull requests are welcome to fix this. Otherwise I'll find time to fix it later.

@BatmanAoD
Copy link

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants