Kamsiinov
Kamsiinov

Reputation: 1490

VSTS, how to always get to artifact directory?

I can get to the artifact location by hard coding it: $(System.DefaultWorkingDirectory)\_Testing-CI\test\

But can I somehow get the source alias and artifact name from some variables in the release?

Upvotes: 1

Views: 4348

Answers (2)

jcansdale
jcansdale

Reputation: 305

It looks like it is now possible to use $(Release.PrimaryArtifactSourceAlias). This would mean your artifact drop is at: $(System.DefaultWorkingDirectory)/$(Release.PrimaryArtifactSourceAlias)/drop

Upvotes: 16

Jayendran
Jayendran

Reputation: 10950

It is currently not possible to get the source alias name/Artifact name from the environment variable.

As of now, you need to specify the Artifact alias name in order to access the artifact related information.

E.g, Release.Artifacts.{alias}.DefinitionName

General Artifact variables

Primary Artifact Variables

As per here

You can use the default variables in two ways - as parameters to tasks in a release pipeline or in your scripts.

You can directly use a default variable as an input to a task. For example, to pass Release.Artifacts.{Artifact alias}.DefinitionName for the artifact source whose alias is ASPNET4.CI to a task, you would use $(Release.Artifacts.ASPNET4.CI.DefinitionName). enter image description here

To use a default variable in your script, you must first replace the . in the default variable names with _. For example, to print the value of artifact variable Release.Artifacts.{Artifact alias}.DefinitionName for the artifact source whose alias is ASPNET4.CI in a Powershell script, you would use $env:RELEASE_ARTIFACTS_ASPNET4_CI_DEFINITIONNAME

enter image description here

Note that the original name of the artifact source alias, ASPNET4.CI, is replaced by ASPNET4_CI

You can upvote this feedback in order to achieve your request

Upvotes: 0

Related Questions