VOOZH about

URL: https://dzone.com/articles/continuous-integration-and-delivery-with-aws-code

โ‡ฑ Continuous Integration and Delivery With AWS Code Pipeline


Related

  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Continuous Integration and Delivery With AWS Code Pipeline

Continuous Integration and Delivery With AWS Code Pipeline

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.

By Dec. 04, 20 ยท Analysis
Likes
Comment
Save
11.6K Views

Join the DZone community and get the full member experience.

Join For Free

Agenda: 

  • Introduction    
  • Should-Have    
  • AWS CodeBuild configuration
  • AWS CodePipeline configuration

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: 

  • Login with Admin user in AWS console:
  • Once successful login, find CodeCommit.
  • Open CodeCommit and create a repository for the required MuleSoft project. For instance, below, one sample project repository is created in CodeCommit.
  • With repository: Multiple branches created as per requirement..go to the branch in MuleMeetup.
  • With Admin user in console, Identity and Access Management (IAM) section and create a user who is authorized to perform a pull, commit, merge, push on MuleMeetup repository.
    • Create a user group:
    • Create user and assign role and associate with a group created in the above step โ€” these steps to segregate users into a group to assign roles based on roles and responsibilities.             
  • Generate HTTPS Git credentials for AWS CodeCommit for the IAM user and download it; it will authenticate the user to act on codes in the repository.

AWS CodePipeline Configuration

  • Now, all configurations are done to start building CodeBuild.
    • Go to CodeBuild with Admin login in the console and look for CodeBuild tool in the console panel.
    •   Create Buildproject process. As we are not using AWS Bucket here and deploying code cloudhub hence bucket configuration is not required in this article. 
      • Follow the below entries while configuring the process as below:
  • Now login with IAM user as created in the above step and checkout code in Anypoint Studio.
    • Open CodeCommit tool and go to respective repository and branch to clone associate studio code to clone URL.

    • Follow files and folders in the project as recommended by CodeBuild as below.
  • Buildspec.yml โ†’ Code with instructions for the pipeline phases execution. It will cover the different phases in this guide.
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/**/*'



  • pom.xml โ†’ POM configuration file of the Mule app.
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.

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

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

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

AWS Continuous Integration/Deployment Pipeline (software) Delivery (commerce) Integration

Opinions expressed by DZone contributors are their own.

Related

  • Securing and Monitoring Your Data Pipeline: Best Practices for Kafka, AWS RDS, Lambda, and API Gateway Integration
  • Streamlining AWS Lambda Deployments
  • Testcontainers: From Zero To Hero [Video]
  • AppOps with Kubernetes and Devtron - The Perfect Fit

Partner Resources

ร—

Comments

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

Let's be friends: