0

I am using the AWS CLI task to deploy a Lambda layer. The build pipeline upstream looks like this:

enter image description here

It zips up the code, publishes the artifact and then downloads that artifact.

Now in the release pipeline I'm deploying that artifact via an AWS CLI command. The release pipeline looks like this:

enter image description here

I'm trying to figure out a way to dynamically get the current working directory so I don't need to hardcode it. In the options and parameters section you can see I'm trying to use $(Pipeline.Workspace) but it doesn't resolve correctly.

Is this possible?

2 Answers 2

1

Correct me if I am wrong, but I looks like you are running this in Azure Release? Not Pipelines?

If that is the case I think the variable you are looking for is $(Release.PrimaryArtifactSourceAlias) .

See the section of the document that talks about release specific variables: https://learn.microsoft.com/en-us/azure/devops/pipelines/release/variables?view=azure-devops&tabs=batch#default-variables---release

Sign up to request clarification or add additional context in comments.

Comments

0

Yes. This is completely achievable.

From your screenshot, you are using the Release Pipeline to deploy the Artifacts.

In your situation, the $(Pipeline.Workspace) can only be used in Build Pipeline.

Refer to this doc: Classic release and artifacts variables

You can use the variable: $(System.ArtifactsDirectory) or $(System.DefaultWorkingDirectory)

The directory to which artifacts are downloaded during deployment of a release. The directory is cleared before every deployment if it requires artifacts to be downloaded to the agent. Same as Agent.ReleaseDirectory and System.DefaultWorkingDirectory.

1 Comment

This doesn't quite work, it resolves to the working directory but doesn't include the path to where the artifacts are stored.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.