Azure devops &引用;值不能为空错误";在PublishPipelineArtifact任务中
我尝试在我的第一个yaml管道中使用PublishPipelineArtifact任务,但无论我尝试什么,都会出现以下错误:Azure devops &引用;值不能为空错误";在PublishPipelineArtifact任务中,azure-devops,azure-pipelines,Azure Devops,Azure Pipelines,我尝试在我的第一个yaml管道中使用PublishPipelineArtifact任务,但无论我尝试什么,都会出现以下错误: Starting: PublishPipelineArtifact ============================================================================== Task : Publish pipeline artifact Description : Publish (upload) a
Starting: PublishPipelineArtifact
==============================================================================
Task : Publish pipeline artifact
Description : Publish (upload) a file or directory as a named artifact for the current run
Version : 1.0.0
Author : Microsoft Corporation
Help : Publish (upload) a file or directory as a named artifact for the current run. Published artifacts can be downloaded in other jobs, stages, or pipelines using the "Download pipeline artifact" task.
==============================================================================
##[error]Value cannot be null.
Parameter name: PublishPipelineArtifact (ecdc45f6-832d-4ad9-b52b-ee49e94659be/1.0.0)
Finishing: PublishPipelineArtifact
目前,这是我的yml文件中的发布任务:
trigger: none
variables:
# agent/environment variables
- group: VARS_AGENT
stages:
- stage: build
jobs:
# ------------------------------------------------------------------------------------------------------------------------------
#- job: 'artifacts_debug'
# ------------------------------------------------------------------------------------------------------------------------------
- job: 'artifacts_debug'
displayName: 'Debug pipeline artifacts'
workspace:
clean: all
pool:
name: '$(AgentPoolName)'
demands:
- msbuild
- visualstudio
steps:
# show artifact staging dir contents
- script: 'echo test > "$(Build.ArtifactStagingDirectory)\test.txt" '
displayName: 'Create dummy file'
- script: 'dir "$(Build.ArtifactStagingDirectory)" /s /b '
displayName: 'Show artifact staging contents'
- script: 'echo AgentPoolName=$(AgentPoolName) /s /b '
displayName: 'Echo AgentPoolName variable content'
#publish artifacts ("new" pipeline artifacts but can't get it to work)
- task: PublishPipelineArtifact@1
inputs:
path: '$(Build.ArtifactStagingDirectory)'
artifact: Db
我做错了什么?ArtifactStagingDirectory中的\db文件夹存在,并且不是空的。变量组VARS_代理正确解析,在调试“echo”步骤中显示预期值。刚刚看到您使用的是“path”参数。 在这个例子中,它被称为“targetPath”:
刚才看到您正在使用一个“path”参数。 在这个例子中,它被称为“targetPath”:
根据jay的评论,问题应该由代理版本而不是错误的YAML引起。现在,最新版本是2.155.1,但是Jay的代理版本是2.150
将代理版本升级到最新版本后,错误消失。根据jay的评论,问题应该由代理版本而不是错误的YAML引起。现在,最新版本是2.155.1,但是Jay的代理版本是2.150
将代理版本升级到最新版本后,错误消失。您使用哪个代理?主持?还是你的自托管代理?看起来你的YAML没有错误,这都是我的工作。你能在这里分享完成的YAML吗?包括一些关键变量值,例如
$(AgentPoolName)
。自托管windows代理(版本:2.150.3)。我从YAML中剥离了所有内容,直到我以下面的内容结束,但我仍然得到同样的错误(请参阅问题中更新的YAML定义),感谢您的分享。我用自托管代理(2.155.1)在我这边测试了你的YAML代码,一切正常。你能再次尝试升级你的代理版本吗?嗨@MerlinLiang MSFT,确实升级(我在2.150.x上)解决了这个问题。谢谢你使用哪种代理?主持?还是你的自托管代理?看起来你的YAML没有错误,这都是我的工作。你能在这里分享完成的YAML吗?包括一些关键变量值,例如$(AgentPoolName)
。自托管windows代理(版本:2.150.3)。我从YAML中剥离了所有内容,直到我以下面的内容结束,但我仍然得到同样的错误(请参阅问题中更新的YAML定义),感谢您的分享。我用自托管代理(2.155.1)在我这边测试了你的YAML代码,一切正常。你能再次尝试升级你的代理版本吗?嗨@MerlinLiang MSFT,确实升级(我在2.150.x上)解决了这个问题。谢谢感谢您指出这一点,但是targetPath的参数没有帮助。有趣的是,该页面上的代码示例提到了“targetPath”,但下面几行的参数文档中有“path”。更新:升级代理后,发布工作正常,path
和targetPath
都是有效的seems@JayReally是的,targetpath和path是相等的。谢谢你指出这一点,但是,targetPath的参数没有帮助。有趣的是,该页面上的代码示例提到了“targetPath”,但下面几行的参数文档中有“path”。更新:升级代理后,发布工作正常,path
和targetPath
都是有效的seems@JayReally是的,targetpath与path相等。
# Publish pipeline artifact
# Publish (upload) a file or directory as a named artifact for the current run
- task: PublishPipelineArtifact@1
inputs:
#targetPath: '$(Pipeline.Workspace)'
#artifact: # Optional