I am receiving the following error message in my job log:
217 $ docker run -e TWINE_USERNAME \ # collapsed multi-line command
218 docker: invalid reference format.
219 See 'docker run --help'.
223 ERROR: Job failed: exit code 125
Full log is available at https://gitlab.com/oxr463/buildbot_tyrian_theme/-/jobs/360851515#L217.
The .gitlab-ci.yml
job is as follows:
pypi:
type: deploy
variables:
TWINE_USERNAME: $TWINE_USERNAME
TWINE_PASSWORD: $TWINE_PASSWORD
before_script:
- |
docker run -v $(pwd):/opt/buildbot_tyrian_theme \
$CI_REGISTRY/oxr463/buildbot_tyrian_theme \
python setup.py bdist_wheel sdist --formats gztar
script:
- |
docker run -e TWINE_USERNAME \
-e TWINE_PASSWORD \
-v $(pwd):/opt/buildbot_tyrian_theme \
$CI_REGISTRY/oxr463/buildbot_tyrian_theme twine upload dist/*
only:
- tags
Source: https://gitlab.com/oxr463/buildbot_tyrian_theme/blob/master/.gitlab-ci.yml
This only occurs when running via GitLab CI/CD; the command works fine if ran locally.
Update:
Instead of a multi-line string for the script
command, I collapsed it down to a single line and it worked. However, I would still like to figure out why it was not working despite it passing the GitLab CI/CD linter.
References:
- Docker Docs: docker run - Set environment variables (-e, --env, --env-file)
- GitLab Docs: Passing environment variables to services
See also: