Azure DevOps + MuleSoft

Author: Akshata Sawant & Gaurav Dhimate

Azure DevOps Server is a Microsoft product that provides version control, reporting, requirements management, project management, automated builds, lab management, testing and release management capabilities. It covers the entire application lifecycle and enables DevOps capabilities.

In order to implement CI/CD pipeline in MuleSoft with Azure DevOps follow below steps:

Step 1: Make sure you have added mule-maven plugin deployment details in your pom.xml

<plugin>
  <groupId>org.mule.tools.maven</groupId>
  <artifactId>mule-maven-plugin</artifactId>
  <version>3.3.5</version>
  <extensions>true</extensions>
	<configuration>
		<cloudHubDeployment>
			<uri>https://anypoint.mulesoft.com</uri>
			<muleVersion>${app.runtime}</muleVersion>
			<username>${anypoint.username}</username>
			<password>${anypoint.password}</password>
		<businessGroup>${businessGroup}</businessGroup>
			<workers>${workers}</workers>
			<workerType>${workerType}</workerType>
			<region>us-west-1</region>
			<environment>${environment}</environment>
			<applicationName>${applicationName}</applicationName>
			<properties>
				<mule.env>${mule.env}</mule.env>
		<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>
<api.id>${ilg.api.version}</api.id>
	<anypoint.platform.config.analytics.agent.enabled>true</anypoint.platform.config.analytics.agent.enabled>
			</properties>
		</cloudHubDeployment>
					<executions>
						<execution>
							<id>deploy</id>
							<goals>
								<goal>deploy</goal>
							</goals>
							<configuration>
								<classifier>mule-application</classifier>
							</configuration>
						</execution>
					</executions>
					
                    		<classifier>mule-application</classifier>
                </configuration>
            </plugin>

Step 2: Login into your Azure DevOps account. There are 2 ways to create a pipeline.

Firstly you can go to the Pipelines tab and click a new pipeline 

Or you can go to you Repositories where you have your files and you’ll Build Pipeline option

Let’s create it using the Create pipeline option. 

Go to Pipeline and Create Pipeline

Select Classic Editor as it gives better customization.

Source:

You can select your source where your code is stored. In my case, it’s in Azure Repos.

Further, select your Team ProjectRepository and branch.

On selecting click continue.

Template:

Select Maven template.

This is the default screen you’ll see 

I’ll be removing all the three steps created under Agent job and customize it as per my requirement.

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

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 filesand add (+) Secure files.

On clicking + navigate to settings.xml

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

<server>
			<id>Exchange2</id>
			<username>guest-mule</username>
			<password>Mulesoft1</password>
		</server>

<profile>

        <id>Mule</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>Exchange2</id>
                <name>Exchange2</name>
                <url>https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/</url>
                <layout>default</layout>
                <releases>
                    <enabled>true</enabled>
                </releases>
                		   <snapshots>
                    <enabled>true</enabled>
               </snapshots>
            </repository>
        </repositories>
    </profile>

 Now the settings which we created needs to be selected as below in our step.

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

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

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

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

Now lets run the pipeline.

Once the pipeline gets completed excuted you will see below screen.

Conclusion:

We have successfully created CI/CD pipeline using Azure devops and deployed application to CloudHub.

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.