我创建了一个 PoC Azure 管道来在提要中创建一个包,如下所示:
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.7'
addToPath: true
architecture: 'x64'
displayName: 'Deploy Python 3.7'
- script: |
python -m pip install --upgrade pip
pip install twine
displayName: 'Install dependencies'
- script: |
python setup.py sdist
displayName: 'Package creation'
- task: TwineAuthenticate@1
inputs:
artifactFeed: 'Project/Feed'
displayName: 'Set Artifact Authentiation'
- script: 'twine upload -r Feed --config-file $(PYPIRC_PATH) dist/*'
displayName: 'Publish Artifact'
我正在尝试使用以下命令在我的笔记本电脑(不是 Azure)上的 docker 实例中进行 pip 安装:
FROM python:3.7.9-buster
ADD . /package-consumer/
RUN wget https://packages.microsoft.com/config/debian/10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb
RUN apt-get update && apt-get install -y apt-transport-https && apt-get install -y dotnet-sdk-5.0
RUN pip install keyring artifacts-keyring
RUN pip install --index-url=https://pkgs.dev.azure.com/Org/Project/_packaging/Feed/pypi/simple/ Package
CMD cd /package-consumer && python Consume/UsePackages.py
正如预期的那样,我得到了
[Minimal] [CredentialProvider]DeviceFlow: https://pkgs.dev.azure.com/causewayltd/Mobile/_packaging/Mobile/pypi/simple/
[Minimal] [CredentialProvider]ATTENTION: User interaction required.
**********************************************************************
To sign in, use a web browser to open the page https://microsoft.com/devicelogin and enter the code **** to authenticate.
**********************************************************************
[Error] [CredentialProvider]Device flow authentication failed. User was presented with device flow, but didn't react within 90 seconds.
我尝试了各种设置等ENV ARTIFACTS_KEYRING_NONINTERACTIVE_MODE true
。一切都无济于事。
甚至可以在非 Azure docker 容器中安装 Azure 包。如果是这样,怎么做?任何帮助表示赞赏。
PS - 我已经在网上搜索过,但似乎无法获得如何实现上述目标的明确答案。谢谢