Adjust the pattern used to generate CI_JOB_TOKEN to avoid dashes
Following support request internal support ticket 325575
When using poetry config http-basic
with a CI_JOB_TOKEN
, occasionally a NoSuchOptionException
occurs. This sounds like sometimes, the CI_JOB_TOKEN
string starts with a -
.
This could be considered a bug in either Poetry's code or a feature request for GitLab to adjust the pattern used to generate CI_JOB_TOKEN
s.
Poetry folks discussed the problem in poetry#2889 & poetry#4853.
Steps to reproduce
- Dockerfile with
RUN poetry config http-basic.gitlab-pypi "$ENV_PYPI_GITLAB_USER" "$ENV_PYPI_GITLAB_PASSWORD"
- the Poetry problem can also be reproduced directly with
poetry config http-basic "someuser" "-sometoken"
.
- the Poetry problem can also be reproduced directly with
-
.gitlab-ci.yml
file withdocker build --build-arg PYPI_GITLAB_USER=gitlab-ci-token --build-arg PYPI_GITLAB_PASSWORD=${CI_JOB_TOKEN}
- Rerunning the CI job until a
CI_JOB_TOKEN
is generated that starts with a-
.
Workaround
- use double
-
in the poetry command-
poetry config -- http-basic gitlab-ci-token $CI_JOB_TOKEN
.
-
- Using deploy tokens, instead of
CI_JOB_TOKEN
s
Edited by James Heimbuck