Continuous Integration and Delivery With AWS Code Pipeline

Agenda: 

Introduction 

This article is intended to present a concise illustration of how to configure a CI/CD process for Mule Applications using AWS Source Code engines like AWS CodeCommit, CodeBuild, and CodePipeline.

Should-Have  

  1. MuleSoft Project with maven
  2. Mule enterprise credentials
    • AWS permission to:
      1. Create branches in repositories
      2. Execute git actions in repositories: pull, commit, merge, push.
      3. Configure mandatory roles for CodeBuild and CodePipeline
      4. Configure CodeBuild MuleSoft Project
      5. Configure CodePipeline

AWS CodeBuild Configuration

Create AWS CodeCommit repository for MuleSoft project: 

user groups

HTTPS git credentials

AWS CodePipeline Configuration

create build project 

source

environment image

buildspec

cloudwatch logs

codecommit

Shell
 




x


 
1
version: 0.1
2
env:
3
  variables:
4
    JAVA_HOME: "/usr/lib/jvm/java-8-openjdk-amd64"  
5
phases:
6
  pre_build:
7
    commands:
8
      - cp ./mulesoftmeetup/settings.xml /root/.m2/settings.xml      
9
      - cd mulesoftmeetup/
10
      - mvn clean test 
11
  build:
12
    commands:       
13
      - mvn package -DskipTests
14
  post_build:
15
    commands:      
16
      - mvn deploy -DmuleDeploy -DskipTests 
17
artifacts:
18
  files:
19
  - target/*.jar
20
  discard-paths: yes
21
cache:
22
  paths:
23
  - '/root/.m2/**/*'



XML
 




xxxxxxxxxx
1
34


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



Now are all set to build the application and log in with the user who is authorized to execute the build process in CodeBuild.

aws services

Once we execute the Build process, we can monitor the con dashboard or tail-logs to validate the status of execution.

codebuild

With the Tail log, we can see maven dependencies are being downloaded and build/deployment is successful.

build logs

runtime manager

Now we can build process to CI/CD process using AWS CodeCommit/CodeBuild.

 

 

 

 

Top