gpt4 book ai didi

Azure Devops 从 Docker 内的 Azure Artifacts 安装 Python 包

转载 作者:行者123 更新时间:2023-12-03 13:47:27 31 4
gpt4 key购买 nike

我正在尝试从 Azure Artifacts 安装 pip 包作为 Docker 镜像的一部分(使用 Docker@2 任务),但无论我尝试什么都不起作用。

无论我尝试什么,Docker 内的 pip 似乎都无法针对 Azure Artifacts 进行身份验证。我最接近的是

RUN pip install keyring artifacts-keyring
ENV ARTIFACTS_KEYRING_NONINTERACTIVE_MODE true
RUN pip install <> --index-url https://pkgs.dev.azure.com/<>/_packaging/<>/pypi/simple/

但在我的 Azure DevOps 中,我不断得到

ERROR: Could not find a version that satisfies the requirement <> (from versions: none)
ERROR: No matching distribution found for <>

另外 - Azure 文档对此似乎非常糟糕,如果我切换 ENV ARTIFACTS_KEYRING_NONINTERACTIVE_MODE false 它会提示我的 Azure DevOps 管道进行交互身份验证,这不是我想要的。

如何自动安装在 Azure Artifacts 中发布的 Python 包作为我的 Azure Pipeline Docker 任务的一部分?

最佳答案

How can I install a Python package published in Azure Artifacts as part of my Azure Pipeline Docker task automatically?

我们可以使用PipAuthenticate填充 PIP_EXTRA_INDEX_URL 环境变量的任务:

It authenticates with your artifacts feed and per the docs, will store the location of a config file that can be used to connect in the PYPIRC_PATH environment variable.

然后将其传递到构建参数中:

arguments: --build-arg INDEX_URL=$(PIP_EXTRA_INDEX_URL)

你可以查看这个文档Consuming Azure Pipelines Python artifact feeds in Docker了解更多详细信息。

希望这有帮助。

关于Azure Devops 从 Docker 内的 Azure Artifacts 安装 Python 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61099159/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com