3
votes

I'm having problems with the 'Publish Pipeline Artifact' task when running a release pipeline in Azure DevOps.

The error I get is Build Id is not valid

The value in the output matches the BUILD_BUILDID in 'Initialize job', which is also the latest commit id of the repo.

I'm a bit confused as 'buildid' is a system variable which is not modifiable by the user.

I'm not sure if the rest of the job is relevant, but runs as follows:

1. Node.js tool installer (10.x)
2. npm (install)
3. Command line (webpack)
4. Copy files (to build.artifactstagingdirectory)
5. Archive files (to $(Build.ArtifactStagingDirectory)/client.zip)
6. Publish Pipeline Artifacts ($(Build.ArtifactStagingDirectory)/client.zip) - error

Publish Pipeline Artifact log:

2021-01-08T08:40:21.7105147Z ##[debug]Evaluating: succeeded()
2021-01-08T08:40:21.7105624Z ##[debug]Evaluating succeeded:
2021-01-08T08:40:21.7106468Z ##[debug]=> True
2021-01-08T08:40:21.7107158Z ##[debug]Result: True
2021-01-08T08:40:21.7108186Z ##[section]Starting: Publish Pipeline Artifact
2021-01-08T08:40:21.7116705Z ==============================================================================
2021-01-08T08:40:21.7117060Z Task         : Publish Pipeline Artifacts
2021-01-08T08:40:21.7117393Z Description  : Publish (upload) a file or directory as a named artifact for the current run
2021-01-08T08:40:21.7117701Z Version      : 1.2.3
2021-01-08T08:40:21.7117942Z Author       : Microsoft Corporation
2021-01-08T08:40:21.7118290Z Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/publish-pipeline-artifact
2021-01-08T08:40:21.7118679Z ==============================================================================
2021-01-08T08:40:22.0764350Z Artifact name was not inserted for publishing.
2021-01-08T08:40:22.1092880Z ##[error]Build Id is not valid: 4ce1b383822c01dd4fbcde57d575bf562dd54e6a
2021-01-08T08:40:22.1103924Z ##[debug]Processed: ##vso[task.logissue type=error;]Build Id is not valid: 4ce1b383822c01dd4fbcde57d575bf562dd54e6a
2021-01-08T08:40:22.1105538Z ##[debug]Processed: ##vso[task.complete result=Failed;]
2021-01-08T08:40:22.1197640Z ##[debug]   at Agent.Plugins.PipelineArtifact.PublishPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
   at Agent.PluginHost.Program.Main(String[] args)
2021-01-08T08:40:22.1258400Z ##[section]Finishing: Publish Pipeline Artifact

Can someone point me in a direction? This error doesn't seem to be very common (as far as online searches go) which makes me think I'm doing something fundamentally wrong. For what it's worth, I'm trying to build a project using webpack to deploy to an on-prem server (which seems like it should have been quite a straightforward task).

1
Are you sure that you do that on ` release pipeline`? It is not allowed to use publish pipeline or build artifact on release pipeline.Krzysztof Madej
Ah, that's helpful to know - is there anywhere which states this? or is it implied?Phil Pill
I just saw this right at at the top of the docs: "Use this task in a pipeline to publish your artifacts(note that publishing is NOT supported in release pipelines. It is supported in multi-stage pipelines, build pipelines, and yaml pipelines)." docs.microsoft.com/en-us/azure/devops/pipelines/tasks/utility/… Thanks @KrzysztofMadejPhil Pill
I converted our comments into reply. Please consider marking is as answer and upvoting it.Krzysztof Madej

1 Answers

5
votes

Publishing pipeline and build artifacts is not supported for release piepline. Thus you simply can't do this here. (as it is written in docs)

Use this task in a pipeline to publish your artifacts(note that publishing is NOT supported in release pipelines. It is supported in multi-stage pipelines, build pipelines, and yaml pipelines).