In this guided hand on CICD project, you will be creating a Java web application through Azure DevOps
Section1 – Steps to create a Maven Pipeline for Java based application
Login to DevOps portal: dev.azure.com and enter login details
- Create + sign to start creating a “new project” on the portal
- Fill in the details as needed for your new project
- An overview inside DevOps after the project is successfully created
- Click on Repos and upload your code or import it. If you have a code on existing GIT repo, you can choose clone option for the code to be available
- Navigate to code location and verify that the code is successfully uploaded and available
Until here we have our code-files ready in our repo to proceed further with creating a build pipeline. In the next section, we’ll look into how to create a build pipeline using a classic editor.
Section 2 – Create a build pipeline in Azure DevOps
What is Azure pipeline ?
Azure Pipeline is a cloud service that we can use to build and test our code project automatically.
- Click on select classic editor
- Now you will be prompted to choose the source location of your code. I have chosen Azure repos as my code exist there. You can choose your source accordingly
- In the Select a template screen, select Empty job. A job is a collection of steps that are runs in a sequence for the defined environment
Section 3 – Add tasks to the pipeline
We will now add new tasks to perform specific jobs and configure to run in a sequence
- Click + sign next to Agent job 1
- Select task and continue to add them as per the sequence defined in the image
- Configure respective tasks for your build definition as described in the below images
- Configure path to publish and click save and queue
- Click run
- After clicking run, the job is queued and will be executed one the agent gets available
- Images showing running of the job and successful completion
- Click on summary to verify the job status – as success. Notice that it reflects 1 published, it is the artefact which will be used during release pipeline
Section 4 – Create Release Pipeline
- Navigate to Pipeline on the left side menu and select Releases >>> click New Release Pipeline
- Select a Template > Empty Job
- Add a new stage to your empty build pipeline
- Enter the text as desired
- Click on pipeline and select “Add an Artifact”, select the values as appropriate from the drop down on the right
- Click Add to select Artifact
- Click on the + sign and add the tasks as shown in the picture
Tasks to add: ARM template Deployment and Deploy Azure App Service
- Provide details as requested
- Subscription : Your subscription
- App type : Web app on Linux
- ARM connection manager details from the drop down
- Click on 3 dots and navigate to Drop artefact location
- Choose the template file. Click of to populate the path
- Web app deployment details: Copy and paste the details in the override template parameters section. You can update the same per your requirement after selecting 3 dots as well
-webAppName mydemo-javaapp -hostingPlanName mydemo-javaapp-plan -appInsightsLocation “West Europe” -sku “P1v2 Premium”
- Select task “Deploy Azure App Service”, enter the details as appropriate
- Ensure WAR file is selected
- Save your release. Click OK
- Create Release and watch on screen progress for deployment
- Watch on screen for the process and process to finish
- Navigate to Azure portal and verify that the relevant services are provisioned
- In Azure Portal, click the URL and VOILA!! You have done it
Thank you for reading. I hope you’ll find the post useful.