Sushruth
Sushruth

Reputation: 155

Move/Deploy individual service/project folder to different environments in a Git Mono repo

Currently, we are going with mono repo approach for our services in azure devops(Git). One issue we are facing is since its a single repository we are unable to move a single service at a time to different environments.

For example, we have Service 1 (still in development) Service 2 (still in development) Service 3 (ready for qa)

Our use case is we need to move only Service 3 related code to qa or higher environments. Each service has few feature branches which our associated to that service. After the development of the feature we would merge it into a dev branch.

One approach we thought of when moving only a service is cherry-picking commits from initial, but as you see that might be very tedious approach.

So I wanted to know is there a way to move only the service/project folder to different environments. Are there any best practices we need to flow when maintaining a mono repo.

Upvotes: 0

Views: 196

Answers (1)

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51143

We don't have build-in option to get only part of the repository in Azure DevOps pipeline.

As a workaround, you could choose disable the "Get sources" step and get only the source you want by manually executing the according git commands in a script.

To disable the default "Get Sources" just specify none in the checkout statement:

- checkout: none

And then get only part of the repo with git sparse-checkout.

More details you could refer answers in below link: Checkout part of a branch in Azure DevOps Pipelines (GetSources)

Finally you could also set corresponding CI trigger and target environment in CD release. Or use multiple stage pipeline.

Upvotes: 1

Related Questions