简体   繁体   中英

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.

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM