1

I am doing one DevOps exercise, where I am maintaining the Code for different projects within an Azure DevOps Repo (one folder for one Project).Need to create single Release Pipeline for all.

I am trying to create a release pipeline, where I am using Artifact source as DevOps repo (because I am directly deploying ARM template, which do not require to be build). Now, I need to trigger release for change in that particular ARM folder (i.e. if change is done to Project 2).It should not be triggered, if I am doing change in Project1.

How can I achieve it?

It is feasible with Build Pipeline, becuase there we can add Path filter for respective folder. I did and that is working as expected, i.e. if I change in Project 1, only corresponding Build 1 will be triggered.

I am using classis editor for Azure DevOps release pipeline. And I do not see any option for Path filter while enabling CD trigger.

Gopesh
  • 195
  • 1
  • 3
  • 17

1 Answers1

2

There is no such out of the box solution and you need to handle it manually to detect changes in like here

$files=$(git diff HEAD HEAD~ --name-only)
$temp=$files -split ' '
$count=$temp.Length
echo "Total changed $count files"
For ($i=0; $i -lt $temp.Length; $i++)
{
  $name=$temp[$i]
  echo "this is $name file"
  if ($name -like "SubFolderA/*")
    {
      Write-Host "##vso[task.setvariable variable=MicroserviceAUpdated]True"
    }
}

then you can use this variable in custom condition on specific deployment task.

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • 1
    Thanks for the answer. it worked for me. Just adding one more point here, the value for variable cannot be used with in the same task (where this script executed.....it will remain to default). It will be true for all downstream tasks and can be used there only. .....I was just trying to print it's value in same task of script and it was giving False everytime. But when I did print by adding new task, it was True. It took few hours from me to understand this. – Gopesh Nov 28 '20 at 11:08
  • Sorry, that I didn't mention this. And I'm glad you solved your issue! – Krzysztof Madej Nov 28 '20 at 11:31