DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Mule Application Deployment to Cloudhub Using Connected App
  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Achieving Micro-frontend Architecture Using Angular Elements

Trending

  • A Hands-On ABAP RESTful Programming Model Guide
  • How to Write for DZone Publications: Trend Reports and Refcards
  • Master-Class: Understanding Database Replication (Single, Multi, and Leaderless)
  • When Snowflake Lies to You: Understanding False Failures in dbt Pipelines
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Deployment
  4. CI/CD Using Maven With Connected Applications in Anypoint Platform for Runtime Fabric

CI/CD Using Maven With Connected Applications in Anypoint Platform for Runtime Fabric

Define the essential arrangements and actions to practice Connected Apps instead of the common User/Password (Anypoint credential) in a CICD pipeline.

By 
Sadik Ali user avatar
Sadik Ali
·
Dec. 10, 20 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
9.0K Views

Join the DZone community and get the full member experience.

Join For Free

Objective 

The objective of this article is to define the essential arrangements and actions to practice Connected Apps instead of the common User/Password (Anypoint credential) in a CICD pipeline.

Connected Apps help users authorize their access without sharing sensitive credentials or giving full authority of their accounts to third people and Users can also withdraw introduction to them at any time. These Apps will use a Client ID and Secret that will allow them to do some actions, for instance, deploy, publish assets to Exchange, apply/promote policies, etc. But they will not be able to login into the platform.

Prerequisites 

  •   Access to BitBucket Server and project repo configured in BitBucket tool.
  •   Bamboo should have access to MuleSoft Platform APIs.
  •   Maven version 3.x.x installed and configured in Bamboo (alternative is to use maven wrapper)
  •  Create Connected APP and copy client_id and secret to be configured maven CICD process which is associated with the Bamboo tool.

CI/CD Process 

To follow the below approach, the user has to design API in the Design center then to publish in exchange. Once it is published in exchange, the developer imports API from Design Center in Anypoint studio to implement business logic and commit code to BitBucket repository.

Once code is committed in the BitBucket repository, the CICD process will execute and operate with the sequence as defined in the below pic...

 

As API is designed and published in exchange and customized code has been committed in the repository. Now, we need to configure the plan and deployment environment in Bamboo once associated with the BitBucket repository.

Below steps for Bamboo tool to perform steps #4,#5, #6,#7 and #8.

Configure Build Step as Below

Configure Deployment Environment and associate with plan as above...

Initiate Deployment Environment Configuration


Configure steps in Task [SandBox]


Command Configured in Task 

Task - Script for login (To get token using connected app credentials.)    

Shell
 




x


 
1
echo $'\n' >>  anypointrtf-repo/src/main/resources/config-${bamboo.dev.sdlc.env}.properties
2
echo 'token='$(curl -s "https://anypoint.mulesoft.com/accounts/api/v2/oauth2/token" -X POST -H "Content-Type: application/json"  -d '{"grant_type": "client_credentials", "client_id": ${bamboo.app.client.id}, "client_secret":${bamboo.app.client.secret}}' | sed -n 's|.*"access_token":"\([^"]*\)".*|\1|p')  >> anypointrtf-repo/src/main/resources/config-${bamboo.dev.sdlc.env}.properties



Create API Instance

Shell
 




xxxxxxxxxx
1


 
1
clean package -Papi -Dtoken=${bamboo.inject.token} -DorgId=${bamboo.orgId} -Dversion=${bamboo.inject.apiVersion} -DenvId=${bamboo.dev.sdlc.env} -DassetId=${bamboo.inject.assetId} -DassetVersion=${bamboo.inject.assetVersion} -Dpolicy=${bamboo.inject.policy} -DapiImplUri=${bamboo.inject.implUri} -DapiProxyUri=${bamboo.inject.proxyUri} -DapiType=${bamboo.inject.apiType} -DdeploymentType=RF -DapiInstanceLabel=${bamboo.inject.apiInstanceLabel} -Dpackaging=pom -DbasicSlaMaxReq=${bamboo.inject.basicSlaMaxReq} -DgoldSlaMaxReq=${bamboo.inject.goldSlaMaxReq} -DplatinumSlaMaxReq=${bamboo.inject.platinumSlaMaxReq} -DnewVersion=1.0.${bamboo.buildNumber}



Install and Deploy Application

Shell
 




xxxxxxxxxx
1


 
1
deploy -Pdeploy -DmuleDeploy -DnewVersion=1.0.${bamboo.buildNumber} -DclientId=${bamboo.client.id.dev} -Dsecret=${bamboo.client.secret.dev} -Dcpu=${bamboo.inject.cpu} -Dmemory=${bamboo.inject.memory} -DreplicationFactor=${bamboo.inject.replicationFactor} -DclusteringEnabled=${bamboo.inject.clusteringEnabled} -Dartifact.env=${bamboo.artifact.sdlc.env} -DrtfName=${bamboo.inject.rtfName} -Dprovider=${bamboo.rtf.provider.dev} -Dtoken=${bamboo.inject.token} -Denv=${bamboo.sdlc.sandbox} -DapiId=${bamboo.inject.api.id} -Dpackaging=mule-application



Once the above steps are done, the configuration is done. Start plan execution to publish the application to exchange which is required for Runtime Fabric application. 

Once the plan executed is successful, you will able to see green status of build-in bamboo.


Now, MuleSoft application artifacts will be published to exchange.


Now in the final stage of deployment in the configured environment. Execute the process manually or self trigger.

Once Deploy profile executed with success, we will able see in API manager and Runtime Manager that application is deployed and API status changed to activated state.

API Manager (API Status changed to Active)


Runtime Manager (Application status will be in Running  state)

BitBucket Bambo CICI RTF Connected app

Thanks.

Continuous Integration/Deployment application Apache Maven app Deployment environment

Opinions expressed by DZone contributors are their own.

Related

  • Mule Application Deployment to Cloudhub Using Connected App
  • Delivering Your Code to the Cloud With JFrog Artifactory and GitHub Actions
  • Automating Developer Workflows and Deployments on Heroku and Salesforce
  • Achieving Micro-frontend Architecture Using Angular Elements

Partner Resources

×

Comments

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

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook