VOOZH about

URL: https://dzone.com/articles/deploying-mulesoft-using-azure-devops

⇱ Deploying MuleSoft Using Azure DevOps


Related

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Deploying MuleSoft Using Azure DevOps

Deploying MuleSoft Using Azure DevOps

This article introduces Azure DevOps and provides a step-by-step guide on how to deploy MuleSoft with Azure DevOps.

Likes
Comment
Save
40.2K Views

Join the DZone community and get the full member experience.

Join For Free

Continuous Integration and Continuous Delivery (CI/CD) have become common practices in developing high-quality applications because they promote scaling and shorten the time between coding and deployment.

Mulesoft is a popular integration platform that streamlines data integration across disparate systems. The predefined APIs have support for all types of applications where data can be unlocked between legacy systems, applications, and cloud devices. This highly networked MuleSoft Anypoint platform enables smarter and faster decision-making abilities in an organization. Azure DevOps, on the other hand, provides version control, reporting, requirements management, project management, automated builds, lab management, testing, and release management capabilities. In short, it covers the entire software development lifecycle and enables organizations to automate the software delivery process. The variety of services leverages the collaboration and development of any project.

By combining Azure DevOps with Mulesoft, organizations can leverage the CI/CD pipeline by streamlining the process of development and delivery. This not only increases the efficiency of the process but also considerably reduces risk due to error.


Azure CI/CD

How to Deploy MuleSoft With Azure DevOps

Here we are going to see how to implement CI/CD pipeline for MuleSoft application using Azure DevOps.

Step 1: Mule-Maven Plugin Configuration

Make sure you have added the Mule-Maven plugin in your pom.xml

XML




x
39


1
<plugin>
2
  <groupId>org.mule.tools.maven</groupId>
3
  <artifactId>mule-maven-plugin</artifactId>
4
  <version>3.3.1</version>
5
  <extensions>true</extensions>
6
<configuration>
7
<cloudHubDeployment>
8
<uri>https://anypoint.mulesoft.com</uri>
9
<muleVersion>${app.runtime}</muleVersion>
10
<username>${anypoint.username}</username>
11
<password>${anypoint.password}</password>
12
<businessGroup>${businessGroup}</businessGroup>
13
<workers>${workers}</workers>
14
<workerType>${workerType}</workerType>
15
<region>us-west-1</region>
16
<environment>${environment}</environment>
17
<applicationName>${applicationName}</applicationName>
18
<properties>
19
<mule.env>${mule.env}</mule.env>
20
<encrypt.key>${encrypt.key}</encrypt.key><anypoint.platform.client_id>${anypoint.platform.client_id}</anypoint.platform.client_id><anypoint.platform.client_secret>${anypoint.platform.client_secret}</anypoint.platform.client_secret>
21
<api.id>${ilg.api.version}</api.id>
22
<anypoint.platform.config.analytics.agent.enabled>true</anypoint.platform.config.analytics.agent.enabled>
23
</properties>
24
</cloudHubDeployment>
25
<executions>
26
<execution>
27
<id>deploy</id>
28
<goals>
29
<goal>deploy</goal>
30
</goals>
31
<configuration>
32
<classifier>mule-application</classifier>
33
</configuration>
34
</execution>
35
</executions>
36

 
37
                   <classifier>mule-application</classifier>
38
                </configuration>
39
            </plugin>



The <cloudHubDeployment> tag of the Mule Maven plugin defines the attributes of your deployable. So, let's see what each of these properties tells us about the deployment onto CloudHub

  • uri: Mulesoft Anypoint platform URL
  • muleVersion: Mulesoft version to be used for deployment(e.g. 4.2.3).
  • username: Username for Anypoint platform
  • password: Password for Anypoint platform
  • businessGroup: Business group of the Anypoint platform under which you want to deploy your application
  • workers: The number of workers to be assigned to the application. This is used for horizontal scaling
  • workerType: The number of vCores to be assigned to the application. This is used for vertical scaling
  • region: Region to be used while deploying the application
  • environment: Environment onto which application needs to be deployed
  • applicationName: Application name to be deployed
  • properties: Provide here all the properties which are required by application at deployment time i.e. encryption key

Step 2: Create a New Pipeline

Log in to your Azure DevOps account. There are two ways to create a pipeline. First, you can go to the Pipelines tab and click a new pipeline.

Creating a new pipeline


Or, you can go to your repositories where you have your files and select the Build Pipeline option.

Build pipeline from repositories


So, let's create it using the Create pipeline option. Go to Pipeline and Create Pipeline.

Creating pipeline


Step 3: Select Classic Editor

Now, select Classic Editor as it gives better customization.

Using classic editor


Step 4: Select Source

You can select your source where your code is stored. In my case, it’s in Azure Repos. Further, select your Team Project, Repository and branch. Then, click continue.

Continue

Step 5: Select Maven Template

Now, Select the Maven template.

Maven template


This is the default screen you’ll see.

Default screen


I’ll be removing all the three steps created under the Agent job and customize it according to my requirements.

Customization


Step 6: Download Secure File

Firstly, I am adding “Download secure file.” I’ll be using it to download settings.xml.

Download secure file


But to download and use secure file in our pipeline, we need to store our file somewhere. In order to add settings.xml, go to Pipelines → Library → Secure files and add (+) Secure files. Then navigate to settings.xml:

Settings.xml


Make sure your settings.xml has the below server and profile added under the respective tags.

XML




xxxxxxxxxx
1
27


1
<server>
2
<id>Exchange2</id>
3
<username>guest-mule</username>
4
<password>Mulesoft1</password>
5
</server>
6

 
7
<profile>
8

 
9
        <id>Mule</id>
10
        <activation>
11
            <activeByDefault>true</activeByDefault>
12
        </activation>
13
        <repositories>
14
            <repository>
15
                <id>Exchange2</id>
16
                <name>Exchange2</name>
17
                <url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
18
                <layout>default</layout>
19
                <releases>
20
                    <enabled>true</enabled>
21
                </releases>
22
                  <snapshots>
23
                    <enabled>true</enabled>
24
               </snapshots>
25
            </repository>
26
        </repositories>
27
 </profile>



Now the settings that we created need to be selected, as shown below.

Selecting settings


Step 7: Create Reference Name

Now let’s create a reference name “mulesoftSettingsFile” for this settings file, which we will use later in maven goals. 

Creating reference name


Step 8: Add Maven

Let’s add the next step in the Agent job, which will be Maven. 

Adding Maven


In Options, we have given the secure settings file a reference name, which we created in the previous step.

Providing reference name


Step 9: Add Variables

We require "username" and "password" for the Anypoint platform to be provided at build time, so lets create two variables for them and pass it into the Maven setup for deployment. 

Add variable


Step 10: Save and Deploy

Now let’s add the final Step, which will be performed by our Agent

Package deploy


Now let's run the pipeline. We can either save the pipeline using "Save" or save it and run using the "Save and run" option.

Saving the pipeline


Once the pipeline is executed, you will see the below screen.

Finalize job


And you will be able to see the application deployed onto CloudHub. We can add more steps into the CI/CD pipeline like code analysis, testing, and report generation. Thus, we have successfully created a CI/CD pipeline using Azure DevOps and deployed an application to CloudHub.

azure DevOps Pipeline (software) MuleSoft application Continuous Integration/Deployment

Opinions expressed by DZone contributors are their own.

Related

  • Mule 4 Continuous Integration Using Azure DevOps
  • Testing Serverless Functions
  • Using Azure DevOps Pipeline With Gopaddle for No-Code Kubernetes Deployments
  • Release Pipeline Using Azure DevOps

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

Let's be friends: