Azure-devops-docs: Artifact name cannot be a variable

Created on 12 Jul 2019  Â·  16Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

Doing something like this will not work. It gives an error ##[error]Value cannot be null. Parameter name: hashAndAlgorithm

- download: current
  artifact: $(someVariable)

Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-cictech devopprod doc-bug

All 16 comments

Hi Izzmo, have you tried using ${{ variables['someVariable'] }} ?

@Izzmo Thank you for the question.

My apologies on the delay, this issue has been assigned to the author.

This should work, but there may be a product bug. @willsmythe

@Izzmo Thank you for the question.

My apologies on the delay, this issue has been assigned to the author.

That did not work. It's throwing this error, below. I assume it's because I'm not in a template.

117639: "/build.yml (Line: 158, Col: 17): Unexpected value ''"

however parameters work if you're using a template: ${{parameters.somParam }}

@johnterickson is there anyone from your team who can look into this?

@Izzmo It works in my case, but the variable needs to be declared in the YAML global scope, not in the job.

@Izzmo Can you share the whole log from the task failure?

I will get you this soon.. sorry I need to recreate this as it's pretty old and we went a different direction.

There was someone who recreated this the other day @johnterickson but it looks like they deleted their comment?

- download: current
  artifact: '$(artifactName)'

Works for me, declaration up top is:
variables:

  • group: 'variables-lab-core'
    and the variable group contains:
    Name: artifactName
    Value: arm_templates_labcore_infra
    If you have spaces or the likes in your variable you might need to escape the $(Variable) with encasing quotes/double quotes
    https://docs.octoprint.org/en/master/configuration/yaml.html

@johnterickson
I'm trying to convert a pipeline from build completion triggers to pipeline triggers. I have this task in my YAML (it's actually inside a yaml template that's called from the main YAML file):

- download: images
  artifact: '$(az.pipeline.images.artifacts)'
  patterns: '$(az.pipeline.images.artifacts)/artifactInfo.txt'

az.pipeline.images.artifacts is a variable declared in the UI (and NOT marked as settable at queue time).

Full output from task:

##[debug]Evaluating condition for step: 'Download'
##[debug]Evaluating: SucceededNode()
##[debug]Evaluating SucceededNode:
##[debug]=> True
##[debug]Result: True
Starting: Download
==============================================================================
Task         : Download pipeline artifact
Description  : Download a named artifact from a pipeline to a local path
Version      : 1.2.4
Author       : Microsoft Corporation
Help         : Download a named artifact from a pipeline to a local path
==============================================================================
Download from the specified build: #29781926
Download artifact to: /home/vsts/work/1/images/core-linux
##[debug]Dedup parallelism: 192
Information, ApplicationInsightsTelemetrySender will correlate events with X-TFS-Session cdc7a0fe-c14b-4025-96ca-845e046141c4
Information, ApplicationInsightsTelemetrySender did not correlate any events with X-TFS-Session cdc7a0fe-c14b-4025-96ca-845e046141c4
##[error]Value cannot be null. (Parameter 'hashAndAlgorithm')
##[debug]Processed: ##vso[task.logissue type=error;]Value cannot be null. (Parameter 'hashAndAlgorithm')
##[debug]Processed: ##vso[task.complete result=Failed;]
##[debug]   at Microsoft.VisualStudio.Services.BlobStore.Common.DedupIdentifier.Create(HashAndAlgorithm hashAndAlgorithm)
   at Microsoft.VisualStudio.Services.BlobStore.Common.DedupIdentifier.Create(String valueIncludingAlgorithm)
   at Agent.Plugins.PipelineArtifact.PipelineArtifactServer.DownloadAsync(AgentTaskPluginExecutionContext context, PipelineArtifactDownloadParameters downloadParameters, DownloadOptions downloadOptions, CancellationToken cancellationToken)
   at Agent.Plugins.PipelineArtifact.DownloadPipelineArtifactTaskV1.ProcessCommandInternalAsync(AgentTaskPluginExecutionContext context, CancellationToken token)
   at Agent.PluginHost.Program.Main(String[] args)
Finishing: Download

@damonbarry What's this REST endpoint dump for build 29781926? (fill in the curly brackets)

https://dev.azure.com/{organization}/{project}/_apis/build/builds/{buildId}/artifacts?api-version=5.1
{
  "count": 2,
  "value": [
    {
      "id": 56368784,
      "name": "core-linux",
      "source": "94d73d66-1c7a-5d82-2913-9d2cb8aa138c",
      "resource": {
        "type": "Container",
        "data": "#/43189012/core-linux",
        "properties": {
          "localpath": "/home/vsts/work/1/b/publish",
          "artifactsize": "535715705"
        },
        "url": "https://dev.azure.com/msazure/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/build/builds/29781926/artifacts?artifactName=core-linux&api-version=5.1",
        "downloadUrl": "https://dev.azure.com/msazure/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/build/builds/29781926/artifacts?artifactName=core-linux&api-version=5.1&%24format=zip"
      }
    },
    {
      "id": 56370914,
      "name": "core-windows",
      "source": "2d2b3007-3c5c-5840-9bb0-2b1ea49925f3",
      "resource": {
        "type": "Container",
        "data": "#/43189012/core-windows",
        "properties": {
          "localpath": "C:\\agent\\_work\\5\\b\\publish",
          "artifactsize": "742296354"
        },
        "url": "https://dev.azure.com/msazure/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/build/builds/29781926/artifacts?artifactName=core-windows&api-version=5.1",
        "downloadUrl": "https://dev.azure.com/msazure/b32aa71e-8ed2-41b2-9d77-5bc261222004/_apis/build/builds/29781926/artifacts?artifactName=core-windows&api-version=5.1&%24format=zip"
      }
    }
  ]
}

@willsmythe -- please look into this issue.

@Izzmo Thank you for your feedback. The new version of the article will go live shortly. Also if you are using a variable name for artifact then you should use a single quotation mark:
exp: artifact: '$(someVariable)'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

letmaik picture letmaik  Â·  3Comments

csutorasr picture csutorasr  Â·  3Comments

dannyvv picture dannyvv  Â·  3Comments

EM1L picture EM1L  Â·  3Comments

cijujoseph picture cijujoseph  Â·  3Comments