使 tox/pip 识别与 Jenkins 一起部署的诗歌包的私有工件
Make tox/pip recognize a private artifactory for a poetry package deployed with Jenkins
我有一个 python 包,我想使用 Jenkins 和 tox 进行测试和构建。
但是,它依赖于我们私有工件中的一个包。尽管 poetry 正确地接受了它,但当 tox 启动时(并使用 pip over poetry 安装依赖项),它找不到包。
我的诗歌锁文件有
reference = "snakepit"
type = "legacy"
url = "https://our private artifactory
我的 Jenkinsfile 设置了 POETRY_HTTP_BASIC_PYPI_USERNAME
和 POETRY_HTTP_BASIC_PYPI_PASSWORD
,这允许在没有我的凭据的锁定文件中安装诗歌 url。
经过一些搜索,我似乎需要在 pyproject.toml 中扩展 legacy_tox_ini。现在看起来像:
legacy_tox_ini = """
[tox]
isolated_build = true
envlist = py36,py37,py38
indexserver =
default = https://pypi.python.org/simple
ourartifactory = https://{env:POETRY_HTTP_BASIC_PYPI_USERNAME}:{env:POETRY_HTTP_BASIC_PYPI_PASSWORD}@our artifactory url
[testenv]
deps =
pytest
pytest-cov
setenv =
SOME_ENV={env:SOME_ENV}
commands =
pytest tests
我还测试了将 :ourartifactory:problempackage 添加到此处的 deps,但这也无济于事。
如何让 pip 识别此设置中的私有神器?
最后整个 indexserver 和 deps 是不必要的,一个简单的
envVar(key: 'PIP_CONFIG_FILE', value: "/pypi-artifactory/pip.conf")
在 Jenkinsfile 中就足够了。当然,这需要您的 docker 图片具有正确的 pip.conf.
我有一个 python 包,我想使用 Jenkins 和 tox 进行测试和构建。 但是,它依赖于我们私有工件中的一个包。尽管 poetry 正确地接受了它,但当 tox 启动时(并使用 pip over poetry 安装依赖项),它找不到包。
我的诗歌锁文件有
reference = "snakepit"
type = "legacy"
url = "https://our private artifactory
我的 Jenkinsfile 设置了 POETRY_HTTP_BASIC_PYPI_USERNAME
和 POETRY_HTTP_BASIC_PYPI_PASSWORD
,这允许在没有我的凭据的锁定文件中安装诗歌 url。
经过一些搜索,我似乎需要在 pyproject.toml 中扩展 legacy_tox_ini。现在看起来像:
legacy_tox_ini = """
[tox]
isolated_build = true
envlist = py36,py37,py38
indexserver =
default = https://pypi.python.org/simple
ourartifactory = https://{env:POETRY_HTTP_BASIC_PYPI_USERNAME}:{env:POETRY_HTTP_BASIC_PYPI_PASSWORD}@our artifactory url
[testenv]
deps =
pytest
pytest-cov
setenv =
SOME_ENV={env:SOME_ENV}
commands =
pytest tests
我还测试了将 :ourartifactory:problempackage 添加到此处的 deps,但这也无济于事。
如何让 pip 识别此设置中的私有神器?
最后整个 indexserver 和 deps 是不必要的,一个简单的
envVar(key: 'PIP_CONFIG_FILE', value: "/pypi-artifactory/pip.conf")
在 Jenkinsfile 中就足够了。当然,这需要您的 docker 图片具有正确的 pip.conf.