3

Is there any way to keep the pipeline file separately in a different repo than the one in source code?

So that, we can maintain all the pipelines related data in a separate repository but the pipeline should detect changes from the main repo.

Example:

I have a repo my-code-base and instead of creating pipeline in my-code-base, I will create a separate repo my-infra and save the pipeline files there.

But in the pipeline I should set the code should be picked from my-code-base.

Please suggest.

If it works, we can save all the azure devops CI/CD pipelines in my organization to be maintained separately.

Sara June
  • 389
  • 4
  • 15

2 Answers2

4

I am definitely no ADO expert but isn't the point of Pipelines that they go "hand-in-hand" with the codebase that they deploy, which is why they go into the same Repo?
Basically, Our Friends in Redmond have assumed that every Application will need to be deployed subtly differently from every other Application so, by default, the [unique] deployment pipeline for every Application "lives" with that Application.

Nothing like "Standardisation".

Phill W.
  • 1,336
  • 7
  • 7
1

I'm not an Azure expert, but it looks like it's possible:

The following combinations of checkout steps are supported.

No checkout steps: The default behavior is as if checkout: self were the first step, and the current repository is checked out.

A single checkout: none step - No repositories are synced or checked out.

A single checkout: self step - The current repository is checked out.

A single checkout step that isn't self or none - The designated repository is checked out instead of self.

Multiple checkout steps - Each designated repository is checked out to a folder named after the repository, unless a different path is specified in the checkout step. To check out self as one of the repositories, use checkout: self as one of the checkout steps.

So I'd guess you can track your pipelines repo to ensure that it gets monitored, and alter the checkout targets in the file to pull the target repository?

shearn89
  • 3,143
  • 2
  • 14
  • 39
  • 2
    But it seems, it won't detect the changes from the source code repository, it is only detecting changes in the repository where the pipeline file is saved. – Sara June Dec 23 '21 at 09:18
  • 1
    Looks like it does: `You can trigger a pipeline when an update is pushed to the self repository or to any of the repositories declared as resources. This is useful, for instance, in the following scenarios:` from the same page – shearn89 Dec 23 '21 at 09:40
  • 1
    It is not able to access any repositories or clone it. Can you give a sample pipeline you tried. – Sara June Dec 23 '21 at 11:05
  • 1
    I've not tried it myself, but the documentation certainly makes it sound like you can configure a Trigger to monitor both repositories that you are interested in. I'll see if can do some testing after work and paste in an example pipeline. – shearn89 Dec 23 '21 at 11:14