我正在尝试构建一个管道,该管道将1.生成一个文件(jar),并2.使用第一个作业的输出构建一个Docker映像。按照this article's example的方法,我知道不能使用第一阶段来构建Docker映像,因为我正在构建的Maven容器没有Docker引擎。因此,我已经设置了第二份工作,但这意味着构建上下文不会共享。因此,我尝试使用PublishPipelineArtifact
任务(publish
步骤)然后通过DownloadPipelineArtifact
(Download
步骤)进行检索,但遇到以下失败({{1 }}是System.Debug
)。经过验证的代理不会阻塞,但由于任务似乎超时,因此并不真正知道如何进行调试。
true
我正在使用的最小管道配置文件(剔除了Java构建和Docker构建步骤):
##[debug]Evaluating condition for step: 'PublishPipelineArtifact'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
Starting: PublishPipelineArtifact
==============================================================================
Task : Publish pipeline artifact
Description : Publish (upload) a file or directory as a named artifact for the current run
Version : 1.2.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact
==============================================================================
Artifact name input: sampleTextFile
Uploading pipeline artifact from /home/mt/vsts/_work/45/s/publish-build-artifact/test.txt for build #11684
##[debug]Dedup parallelism: 192
##[error]One or more errors occurred. (A task was canceled.)
##[debug]Processed: ##vso[task.logissue type=error;]One or more errors occurred. (A task was canceled.)
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug] at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at Microsoft.VisualStudio.Services.BlobStore.Common.Telemetry.BlobStoreApplicationInsightsTelemetrySender..ctor(IAppTraceSource tracer, Uri baseAddress)
at Agent.Plugins.PipelineArtifact.DedupManifestArtifactClientFactory.CreateDedupManifestClient(AgentTaskPluginExecutionContext context, VssConnection connection, CancellationToken cancellationToken, BlobStoreClientTelemetry& telemetry)
at Agent.Plugins.PipelineArtifact.PipelineArtifactServer.UploadAsync(AgentTaskPluginExecutionContext context, Guid projectId, Int32 pipelineId, String name, String source, CancellationToken cancellationToken)
at Agent.Plugins.PipelineArtifact.PublishPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
at Agent.PluginHost.Program.Main(String[] args)
Finishing: PublishPipelineArtifact
答案 0 :(得分:0)
应该一直使用trigger:
- master
stages:
- stage: Build
jobs:
- job: FirstJob
pool:
name: my-pool
demands:
- docker
container:
image: 'maven:latest'
steps:
- publish: $(System.DefaultWorkingDirectory)/publish-build-artifact/test.txt
artifact: sampleTextFile
- job: SecondJob
dependsOn: FirstJob
condition: succeeded()
pool:
name: my-pool
demands:
- docker
steps:
- download: current
artifact: sampleTextFile
task而不是PublishBuildArtifacts
task。