diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-07 12:08:17 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-09-07 12:08:17 +0300 |
commit | 444f662b8d8cbe47a8f3fa1db6ed926d64f3def3 (patch) | |
tree | a6529bfe443562d7a1762be4ef6749fb6a95631a /doc/user/packages/pypi_repository | |
parent | f675c7d41d6b934d5b34998160b0ea95cc30598b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/user/packages/pypi_repository')
-rw-r--r-- | doc/user/packages/pypi_repository/index.md | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/doc/user/packages/pypi_repository/index.md b/doc/user/packages/pypi_repository/index.md index 8e3a5f6eb5f..2b30fd9209a 100644 --- a/doc/user/packages/pypi_repository/index.md +++ b/doc/user/packages/pypi_repository/index.md @@ -302,20 +302,10 @@ Successfully installed mypypipackage-0.0.1 ## Using GitLab CI with PyPI packages -NOTE: **Note:** -`CI_JOB_TOKEN`s are not yet supported for use with PyPI. +> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/11678) in GitLab 13.4. To work with PyPI commands within [GitLab CI/CD](./../../../ci/README.md), you can use -[environment variables](./../../../ci/variables/README.md#custom-environment-variables) -to access your authentication tokens in your commands. - -Set up environment variables for `TWINE_PASSWORD` and `TWINE_USERNAME` using either: - -- A [personal access token](../../../user/profile/personal_access_tokens.md) and your GitLab username. -- A [deploy token](./../../project/deploy_tokens/index.md) and its associated deploy token username. - -You can now access your `TWINE_USERNAME` and `TWINE_PASSWORD` using any `twine` command in your -`.gitlab-ci.yml` file. +`CI_JOB_TOKEN` in place of the personal access token or deploy token in your commands. For example: @@ -326,5 +316,18 @@ run: script: - pip install twine - python setup.py sdist bdist_wheel - - TWINE_PASSWORD=${TWINE_PASSWORD} TWINE_USERNAME=${TWINE_USERNAME} python -m twine upload --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/* + - TWINE_PASSWORD=${CI_JOB_TOKEN} TWINE_USERNAME=gitlab-ci-token python -m twine upload --repository-url https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/packages/pypi dist/* +``` + +You can also use `CI_JOB_TOKEN` in a `~/.pypirc` file that you check into GitLab: + +```ini +[distutils] +index-servers = + gitlab + +[gitlab] +repository = https://gitlab.com/api/v4/projects/${env.CI_PROJECT_ID}/packages/pypi +username = gitlab-ci-token +password = ${env.CI_JOB_TOKEN} ``` |