Home > Software engineering >  Deduplicate "exclude" paths in Azure Devops YML pipelines
Deduplicate "exclude" paths in Azure Devops YML pipelines

Time:04-04

I'm writing an Azure Devops pipeline for a GitHub repository and it will include both a trigger on the main branch, and also builds for pr. Both of them will use the same exclude paths. Here's what the start of my yaml file looks like:

trigger:
  branches:
   include:
     - main
  paths:
    exclude:
      - '.gitignore'
      - '.vscode/*.*'
      - '*.md'
      - 'LICENSE'
      # etc.

pr:
  branches:
    include:
      - main
  paths:
    exclude:
      - '.gitignore'
      - '.vscode/*.*'
      - '*.md'
      - 'LICENSE'
      # etc.

Now the issue is that the exclude list can grow quite specific and extended, I expect up to 20ish items in my real world scenarios.

Is there a way to deduplicate that list? Can you use variables or templates or some other feature to factor that list out somewhere?

CodePudding user response:

Is there a way to deduplicate that list? Can you use variables or templates or some other feature to factor that list out somewhere?

I am afraid there is no such a way to deduplicate trigger filter list at this moment.

That is because the triggers should be defined in the main yaml azure pipeline instead of the nested template yaml.

You could add your request for this feature on our UserVoice site (enter image description here

  • Related