从 Azure Pipelines 请求有关 Azure Artifact 连接的帮助。
我的 Azure Pipeline 正在从 docker 文件构建映像,并且“需求”文件包含要安装 pip 的软件包列表。在管道中,我使用 PipAuthenticate@1 任务对我的 Azure Artifacts 源进行身份验证,并且身份验证成功,并且 URL 作为参数传递给 docker 文件。
但是,我可以看到这些软件包是从外部链接安装的,但没有下载到我的工件提要中。
工件提要“testartifact”当前是空的,因此它可以正确地转到外部链接来下载包。但我希望该包随后保存在“testartifact”提要中,以便下一个 docker build 直接从 testartifact 提要中获取包。我的假设正确吗?如果是这样,如果由于包没有保存到我的工件中而导致代码中缺少某些内容,您能否提供帮助。
这是 Azure Pipeline yaml 文件和 docker 文件。还附上了包下载的日志。
谢谢你的时间!
pool:
vmImage: 'ubuntu-latest'
# Set variables
variables:
imageversion: 1.0
artifactFeed: testartifact
stages:
- stage: DevDeploy
jobs:
- job: DevBuildandPushImage
steps:
- bash: echo DevDeploy
- task: PipAuthenticate@1
displayName: 'Pip Authenticate'
inputs:
artifactFeeds: $(artifactFeed)
onlyAddExtraIndex: true
- bash: echo "##vso[task.setvariable variable=artifactoryUrl;]$PIP_EXTRA_INDEX_URL"
- bash: echo $PIP_EXTRA_INDEX_URL
- task: Docker@2
inputs:
containerRegistry: 'testcontaineregistry'
repository: 'testrepository'
command: 'build'
Dockerfile: '**/dockerfile'
arguments: '--build-arg PIP_EXTRA_URL=$(PIP_EXTRA_INDEX_URL)'
dockerfile 的一部分
ARG PIP_EXTRA_URL
ENV PIP_EXTRA_INDEX_URL=$PIP_EXTRA_URL
RUN echo 'PIP_EXTRA_INDEX_URL'$PIP_EXTRA_INDEX_URL
# Install Python Packages & Requirements
COPY requirements requirements
RUN pip3 install -r requirements --extra-index-url $PIP_EXTRA_URL
日志的一部分
2020-07-16T17:39:05.0301632Z Step 8/28 : RUN echo 'PIP_EXTRA_INDEX_URL'$PIP_EXTRA_INDEX_URL
2020-07-16T17:39:05.4787725Z PIP_EXTRA_INDEX_URLhttps://build:***@XXXXXXX.pkgs.visualstudio.com/_packaging/testartifact/pypi/simple
2020-07-16T17:39:06.1264997Z Step 9/28 : COPY requirements requirements
2020-07-16T17:39:07.0309036Z Step 10/28 : RUN pip3 install -r requirements --extra-index-url $PIP_EXTRA_URL
2020-07-16T17:39:08.3873873Z Collecting pypyodbc (from -r requirements (line 1))
2020-07-16T17:39:08.7139882Z Downloading https://files.pythonhosted.org/packages/ea/48/bb5412846df5b8f97d42ac24ac36a6b77a802c2778e217adc0d3ec1ee7bf/pypyodbc-1.3.5.2.zip
2020-07-16T17:39:08.9900873Z Collecting pyodbc (from -r requirements (line 2))
2020-07-16T17:39:09.2421266Z Downloading https://files.pythonhosted.org/packages/81/0d/bb08bb16c97765244791c73e49de9fd4c24bb3ef00313aed82e5640dee5d/pyodbc-4.0.30.tar.gz (266kB)
2020-07-16T17:39:09.4960835Z Collecting xlrd (from -r requirements (line 3))
2020-07-16T17:39:09.6500787Z Downloading https://files.pythonhosted.org/packages/b0/16/63576a1a001752e34bf8ea62e367997530dc553b689356b9879339cf45a4/xlrd-1.2.0-py2.py3-none-any.whl (103kB)
2020-07-16T17:39:09.6782714Z Collecting pandas (from -r requirements (line 4))
2020-07-16T17:39:10.2506552Z Downloading https://files.pythonhosted.org/packages/c0/95/cb9820560a2713384ef49060b0087dfa2591c6db6f240215c2bce1f4211c/pandas-1.0.5-cp36-cp36m-manylinux1_x86_64.whl (10.1MB)
2020-07-16T17:39:11.4371150Z Collecting datetime (from -r requirements (line 5))
2020-07-16T17:39:11.6083120Z Downloading https://files.pythonhosted.org/packages/73/22/a5297f3a1f92468cc737f8ce7ba6e5f245fcfafeae810ba37bd1039ea01c/DateTime-4.3-py2.py3-none-any.whl (60kB)
2020-07-16T17:39:11.6289946Z Collecting azure-storage-blob (from -r requirements (line 6))