I am working on Azure DevOps Release pipeline. The first task in the release pipeline is a Powershell task. This task has a Powershell Script Inline. The below is the content of the task:
steps:
- powershell: |
$repo = '$(Release.TriggeringArtifact.Alias)'
switch ( $repo )
{
_repo-health { $result = 'Health' }
}
$result
$Repo_Name = $result
Write-Output "$Repo_Name"
displayName: 'PowerShell Script'
So, from the above task via Powershell script I am trying to fetch the Repository name using predefined variables and assign it to a variable.
The second task in the pipeline is a Powershell task with a Powershell script with the below content -
# Write your PowerShell commands here.
Write-Output "$Repo_Name"
So, when I am trying to print "$Repo_Name" in the same task it is printing, but if I am trying to print or fetch the variable value in the another task or stage in the same pipeline I am not able to print it. So need help here.