Author: Kishori Patil
- CI/CD enables developers to deliver code changes frequently and reliably without error.
- In CI/CD we can create build pipelines and Release pipelines.
- Build pipeline is the tool chain which collects the latest changes from the repository and the branch and creates a package to a location which can later be picked up by the release pipeline.
- Release pipelines in Azure Pipelines help your team continuously deliver software to your customers at a faster pace and with lower risk. You can fully automate the testing and delivery of your software in multiple stages all the way to production. Or, set up semi-automated processes with approvals and on-demand deployments.
Creating Release pipeline:
Before starting setup for the release pipeline, we need to create a build pipeline. Artifacts created by the build pipeline will be used by the release pipeline. To create a build pipeline please check this blog: Azure CI/CD Build Pipeline.
1. For Release pipeline, Go to Release and click on +New which will create a new release pipeline.
2. Start with an empty job.
3. In this, first change the name of the release pipeline.
4. Click on “Add an Artifact” and select “Source” for pipeline as name of your build pipeline name.(mule-cicd-demo). Then add the Source alias as _SOURCE_CODE. Then click on Add.
5. Click on the symbol you can see on “_SOURCE_CODE”. Enable the continuous deployment as well as pull request trigger.
6. In the pull request trigger select branches for which deployment will be done.
7. Click on the stage 1 and rename it to deploy to dev.
8. Then click on 1job, 0 task which will open window as follow:
9. Add tasks – Download secure file, PowerShell Script and Maven to Agent job.
10. In Download secure file, select your settings.xml file. To create and add a setting.xml file in Azure refer to this Blog.
11. In PowerShell Script, select inline type and add script as shown in the screenshot below:
12. In maven select Maven POM file path, add maven goal mule:deploy and add options as shown in screenshot:
13. Now configure the pre deployment conditions. After release, enable Artifact filters, pull request deployment.
14. In Artifact filters, Add a _SOURCE_CODE. After adding _SOURCE_CODE select only the dev branch.
15. Now click on + Add stage and select clone stage. Rename it to deploy to qa.
16. Select pre deployment conditions and click on after release.
17. Enable Artifact filters and Add a _SOURCE_CODE. After adding _SOURCE_CODE select only the qa branch.
18. Repeat the same steps for creating stage deploy to prod with selecting _SOURCE_CODE of the main branch.
19. You can also add approvers for prod deployment as follows.
20. According to your need you can link the variable groups in variables as follows. You can also add pipeline variables for this pipeline. We have created a variable group name dev in the Pipelines > Library, where all required variables are added with values for dev environment. Similarly qa, prod and common Variable groups are also created and linked to the respective stages.
21. Finally click on save and your release pipeline is created.
22. To start CI/CD you need to commit something on any branch of the repository for which build and release pipelines are created. This will deploy your applications to their respective environments.
- https://docs.mulesoft.com/runtime-manager/continuous-deployment https://www.mulesoft.com/resources/api/continuous-integration-continuous-delivery