Skip to content

Unable to pass pypi credentials to poetry running in Gitlab CI #3599

@dromer

Description

@dromer

We have several projects that use poetry for project management and tox for CI and that require access to our private pypi repository in Gitlab for packages.

Our pyproject.toml has:

[[tool.poetry.source]]
name = "mygitlab"
url = "https://mygitlab.com/api/v4/projects/411/packages/pypi/simple"
priority = "supplemental"

I've tried setting in tox.ini:

commands_pre =
    poetry config http-basic.mygitlab __token__ {env:CI_JOB_TOKEN}

Or in .gitlab-ci.yml:

variables:
  POETRY_HTTP_BASIC_MYGITLAB_PASSWORD: ${CI_JOB_TOKEN}
  POETRY_HTTP_BASIC_MYGITLAB_USERNAME: __token__

With either in tox.ini:

pass_env = 
    POETRY_HTTP_BASIC_MYGITLAB_PASSWORD
    POETRY_HTTP_BASIC_MYGITLAB_USERNAME

or

set_env =
    POETRY_HTTP_BASIC_MYGITLAB_PASSWORD="{env:POETRY_HTTP_BASIC_MYGITLAB_PASSWORD}"
    POETRY_HTTP_BASIC_MYGITLAB_USERNAME="{env:POETRY_HTTP_BASIC_MYGITLAB_USERNAME}"

These strategies seem to work locally, but not when running in Gitlab.

Does anyone have any suggestions how to properly run poetry inside of tox, on Gitlab, with access to a private repo?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions