我正在尝试将一些数据从一个管道运行保存到另一个管道运行。基本上我的管道是这样工作的:
- 首先下载数据(如果存在)(数据是一个包含数字的文本文件)
- 运行一个脚本,该脚本将使用该数据(如果存在),并生成一些新的数据
- 发布新数据
运行脚本并发布文件,我可以在管道报告中看到,有一个已发布的工件,其中包含正确的文件。
但是,下载文件总是失败,它只是说:
##[error]Artifact CheckWebsiteState was not found for build 10470.
Finishing: Download artifact
这是我正在使用的 YAML 脚本:
name: $(Date:yyyyMMdd)$(Rev:-r)
trigger: none
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: CheckWebsite
jobs:
- job: Run
steps:
- download: current
artifact: CheckWebsiteState
displayName: 'Download artifact'
continueOnError: true
- task: AWSShellScript@1
displayName: CheckWebsite
inputs:
filePath: '$(System.DefaultWorkingDirectory)/scripts/check-website.sh'
arguments: '$(Pipeline.Workspace)'
- publish: $(Pipeline.Workspace)
artifact: CheckWebsiteState
displayName: 'Publish artifact'
知道可能是什么问题吗?
最佳答案
我相信您正在尝试从错误的管道下载工件。您不需要指定当前,而是需要提供正确的管道资源标识符。例如,假设我想从管道 A 模板中下载在管道 B 中发布的工件。我的模板如下所示。
trigger: none
# You need to define the pipeline resource correctly before you can download from it.
# You will need to be careful to ensure the pipeline build you want gets selected
# My definition below will select the most recent, successful pipeline run from pipeline B
# against the main branch, that has had a `ScriptReady` build tag added. You can use a
# tag to ensure the right pipeline build is being selected
resources:
pipelines:
- pipeline: pipelineB
source: pipelines/pipelineB
brain: main
tags:
- ScriptReady
stages:
- stage: CheckWebsite
jobs:
- job: Run
steps:
- download: pipelineB
artifact: CheckWebsiteState
displayName: 'Download artifact'
continueOnError: true
关于azure - 无法下载在先前版本中生成的工件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/76748863/