azure - 无法下载在先前版本中生成的工件

标签 azure azure-pipelines persistence

我正在尝试将一些数据从一个管道运行保存到另一个管道运行。基本上我的管道是这样工作的:

  • 首先下载数据(如果存在)(数据是一个包含数字的文本文件)
  • 运行一个脚本,该脚本将使用该数据(如果存在),并生成一些新的数据
  • 发布新数据

运行脚本并发布文件,我可以在管道报告中看到,有一个已发布的工件,其中包含正确的文件。

但是,下载文件总是失败,它只是说:

##[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/

相关文章:

Azure, "Incoming client certificates"选项去哪里了?

javascript - 我们可以直接将Windows Azure移动服务与BLOB存储连接起来吗?

azure - 在Azure KQL中划分多个查询的结果

node.js - 如何使用 Docker 在我的 CI 中运行 jshint

java - 非 Windows 中的 Appdata

azure - Save-AzureRmVMImage 强制创建无效的 blob 容器名称

azure - 如何在azure devops api服务中传递具有多个值的对象参数

Azure Build.SourceVersionMessage 在管道任务级别返回 Null

java - PersistenceUnit vs PersistenceContext

java - 具有不同数据库的 JPA 实体 - 主数据库的注释,辅助数据库的 XML