You are touching a common challenge in software development and deployment practices, especially when it comes to manage code changes across different environments like DEV, UAT and PROD within ADF through CI/CD pipelines.
I will break it in 3 parts :
Your source control (in your case Azure DevOps repository) is key to managing your code across different environments. The best practice is to have a branching strategy that supports your development and release workflow. For ADF and similar services, you might consider the following:
- Main Branch: all code in this branch should be production-ready
- DEV Branch: Where developers merge their feature branches and perform initial tests
- Release Branches: Temporary branches created from the main or development branch to prepare for a release to UAT or PROD
Directly making changes in UAT or PROD is not recommended because it bypasses the CI/CD process, making the source control out of sync with your deployed environments. You may face some issues like ;
- Changes made directly in UAT or PROD won't be tracked in source control, leading to discrepancies
- Any deployments from the main branch after direct changes in UAT or PROD will overwrite those changes
- Different configurations/code between environments can cause unexpected behaviors or bugs.
What do EXPERTS recommend ?
- For changes that are still under review or testing, use feature toggles to enable or disable functionality without affecting the main codebase.
- Use parameter files or environment variables to manage different configurations for each environment without altering the code.
- If an urgent fix is required in PROD, create a hotfix branch from the main, make the necessary changes, and then follow your CI/CD process to deploy. Once deployed, merge the hotfix branch back into the main branch.
Finally, your CI/CD pipelines should be configured to handle deployments across all environments smoothly. This includes:
- make sure that your tests are run at each stage of the pipeline to catch issues early.
- Implement manual approval steps before deploying to UAT and especially to PROD to control what gets released.
- Store your pipeline definitions in source control to track changes and maintain consistency across environments.
Read more :
https://learn.microsoft.com/en-us/azure/data-factory/continuous-integration-delivery
https://learn.microsoft.com/fr-fr/azure/data-factory/continuous-integration-delivery-improvements