14
votes

Is it possible to configure an Azure DevOps pipeline to look for the azure-pipelines.yaml file in a custom location?

We're using a mono-repo source control architecture for our current work with different packages held under packages/<package-name> and only one of them needs an Azure DevOps pipeline, so ideally we'd like to have the YAML configuration stored with the package rather than at the root of the repo, but I can't find any options for this in the DevOps portal. This is definitely configurable in other similar services like AWS CodeBuild.

6

6 Answers

12
votes

yes you can do that, when creating the build use old UI wizard, if you already have a build in place, you can open its settings>variables (or triggers) and then navigate to the YAML section and under YAML file path you can change it

click the ... on the build edit page next to the Run button:

enter image description here

7
votes

The YAML file from a subfolder may be chosen on the third step of pipeline creation wizard.

enter image description here

6
votes

The UI has changed a bit so it's now under the Settings sub menu of the pipeline:

Pipeline settings

enter image description here

This solution also works for the cases when you simply want to rename the YAML file to whatever you believe is more appropriate rather than default azure-pipelines.yml. For instance, you might have several builds in the same repo: build_asp_net.yml, build_docker_image.yml, etc.

2
votes

While creating a pipeline just click on default file name (azure-pipelines.yaml) and this will make it a text editable and rename location/folder path according to your need.

enter image description here

0
votes

Looks like you can! But only if you configure your build correctly in the first place and click 'use classic editor', then select a YAML project. Any projects that have been configured via the newer wizard expect the YAML file in the root and can't be changed.

This blog post describes the process, though the UI has changed slightly since it was written.

0
votes

Navigate to project / pipelines / YAML section