CI/CD Mulesoft Code Builder

Mule Application CI/CD Deployment Architecture

Overview

GitHub pipeline architecture for the MuleSoft application, detailing the automated build, test, and deployment workflows using GitHub Actions and Anypoint Platform.


Architecture Diagram

Deployment Architecture


Pipeline Components

1Source Control – GitHub Repository

Sample https://github.com/chandanrjit/server-info-ch04-20231128

The Mule project is hosted on GitHub with a structured branching strategy:

  • Feature/Bugfix Branches → Development work
  • Development Branch → Integration environment
  • Main Branch → Production-ready code

CI Pipeline (Continuous Integration)

Workflow: ci-build.yml

Triggers: – Pull requests to main or development branches – Pushes to feature/** or bugfix/** branches

Build & Test Job ( Test not added as part of training )

Validates code quality and functionality before merging:

  • Checkout code from repository
  • Setup JDK 17 (Temurin distribution)
  • Configure Maven cache for faster builds
  • Compile application (mvn clean compile)
  • Execute unit tests (mvn test)
  • Package Mule application JAR
  • Upload build artifacts (5-day retention)

Artifact Output: server-info-1.7.4-mule-application.jar

Code Quality Job

Runs parallel security and validation checks:

  • 🔍 XML configuration validation using xmllint
  • 🔍 Security scanning for sensitive data
  • 🔍 Detection of hardcoded passwords, secrets, API keys

CD Pipeline (Continuous Deployment)

Workflow: deploy-cloudhub2.yml

Triggers: – Push to main or development branches – Manual workflow dispatch with environment selection (dev/test/prod)

Deployment Stages

Stage 1: Version Management

Automated semantic versioning based on Git history:

Version Format: major.minor.commitCount
Example: 1.7.245
  • Extracts current version from pom.xml
  • Calculates commit count from repository history
  • Updates pom.xml with new version
  • Ensures unique version for each deployment

Stage 2: Build & Configuration

Environment setup and credential management:

  • Setup JDK 17 with Maven caching
  • Configure Maven settings.xml with Anypoint credentials
  • Authenticate using Connected App (Client ID/Secret)
  • Prepare deployment configuration

Secrets Used:ANYPOINT_CLIENT_ID_DEVANYPOINT_CLIENT_SECRET_DEVANYPOINT_ORG_IDANYPOINT_ENV_ID_DEV

Stage 3: Publish to Anypoint Exchange

Artifact publication to MuleSoft’s asset repository:

mvn clean deploy -DskipTests -DskipMuleDeploy \  -Danypoint.orgId=d29ffee3-8e4b-4f13-bb0c-ea5ca175c2a9
  • Publishes versioned artifact to Exchange
  • Makes application available for reuse across organization
  • Skips CloudHub deployment in this phase

Stage 4: Deploy to CloudHub 2.0

Production deployment with high availability configuration:

mvn deploy -DmuleDeploy \  -Dcloudhub.environment=Sandbox \  -Dcloudhub.applicationName=server-info-dev \  -Dcloudhub.target="Cloudhub-US-West-1" \  -Dcloudhub.replicas=2 \  -Dcloudhub.vCores=0.1

Deployment Configuration:

ParameterValue
EnvironmentSandbox (DEV)
Application Nameserver-info-dev
RegionUS-West-1
Replicas2 (High Availability)
vCores per Replica0.1
Business GroupCloud01Group0404Group04

Anypoint Platform Integration

Anypoint Exchange

Central repository for API assets and Mule applications:

  • Stores versioned application artifacts
  • Enables asset discovery and reuse
  • Maintains deployment history
  • Supports organizational governance

CloudHub 2.0 – DEV Environment

Deployment URL: https://server-info-dev.us-w2.cloudhub.io

Infrastructure:Region: US-West-1 (Low latency for West Coast users) – Environment Type: Sandbox – High Availability: 2 replicas for zero-downtime deployments – Resource Allocation: 0.1 vCore per replica (suitable for dev/test workloads)

Replica Architecture:

┌─────────────────┐    ┌─────────────────┐
│   Replica 1     │    │   Replica 2     │
│   (0.1 vCore)   │    │   (0.1 vCore)   │
│                 │    │                 │
│  server-info    │    │  server-info    │
│  application    │    │  application    │
└─────────────────┘    └─────────────────┘
         │                      │
         └──────────┬───────────┘
                    │
              Load Balancer

Technology Stack

Runtime Environment

ComponentVersion/Type
Java17 (Eclipse Temurin)
Mule Runtime4.10.1
Build ToolApache Maven
CI/CD PlatformGitHub Actions

Maven Configuration

<properties>
  <maven.compiler.source>17</maven.compiler.source>
  <maven.compiler.target>17</maven.compiler.target>
  <mule.version>4.10.1</mule.version>
</properties>

Maven Options: -Xmx3072m (3GB heap for large builds)



Workflow Execution Flow

Developer Push/PR
       ↓
CI: Build & Test (Parallel)
       ├─→ Build Job (compile, test, package)
       └─→ Quality Job (validate, scan)
       ↓
Code Review & Merge
       ↓
CD: Deploy Pipeline
       ├─→ Version Management
       ├─→ Build & Configure
       ├─→ Publish to Exchange
       └─→ Deploy to CloudHub 2.0
       ↓
Live on CloudHub (2 replicas)

Environment Configuration

Current Environments

EnvironmentBranchCloudHub EnvURL
DEVdevelopmentSandboxserver-info-dev.us-w2.cloudhub.io
TESTmain(Not configured)
PRODmain(Not configured)

Note: TEST and PROD environments can be added by extending the workflow with additional jobs and environment-specific secrets.


Monitoring & Observability

Build Artifacts

  • Artifacts retained for 5 days
  • Naming convention: mule-application-pr-{number/sha}
  • Downloadable from GitHub Actions UI

Deployment Logs

Available in: – GitHub Actions workflow logs – Anypoint Runtime Manager – CloudHub application logs


Conclusion

The pipeline ensures consistent, repeatable deployments while maintaining code quality and security standards throughout the software delivery lifecycle.


References


Leave a Comment