Hands on DevSecOps Coaching that is provided on AWS and Azure Cloud platforms. Contact Coach AK at devops.coaching@gmail.com for more info. You can also reach out to Coach AK at +1(469) 733-5248
Jenkins is popular open source Continuous integration tool. It was written entirely in Java. Jenkins is a self-contained automation server used for automating builds, tests and deployment.
See below the steps for configuring Jenkins to automate the build and deployment for the Java Web project we already set up in BitBucket into
Make sure you configure maven installation under Jenkins-->manage Jenkins-> Global Tool Configuration. under maven installation. enter Maven3 as name and check install automatically option.
Also install deploy to container, Jacoco plugins under Jenkins --> Manage Jenkins --> Manage plug-ins
Click on Available, type Deploy to container, select it. enter Jacoco, select it. Click on Install without restart.
Deploy to container
JaCoCo
Click on without restart.
steps to automate MyWebApp project in Jenkins:
1. Login to Jenkins. Click on New item.
2. Enter an item name --> select Free style project. enter name as myFirstAutomateJob. click OK.
3. under source code mgmt, click git. enter Bitbucket URL Click on your repo, Copy the url from the browser. Paste the url as Repository URL below.
under credentials --> click Add- > select Jenkins --> enter your Bitbucket username and App password. DO NOT use BitBucket password as it is removed from March 1st, 2022. Click to here to learn how to generate App Password in Bitbucket. Add description as my SCM credentials.
4. select that from drop down.
5. Enter main as branch specifier or which ever branch you want to check out.
6. under build trigger click on poll scm, enter this value to check
select Maven3 from drop down and goal as clean install
8. Click on advanced, enter the path of POM file as --> MyWebApp/pom.xml
9. click on Add post build action, select Record Jacoco Code coverage report
10. click on Add post build action, select deploy war/ear to container.
for WAR/EAR files enter as **/*.war
in WAR/EAR files, leave context path empty
11. click on Add container , select Tomcat 9.x
12. click on add credentials, enter tomcatas user name and password as password.
select it from drop down.
13. tomcat url should be --> http://your_public_dns_name:8080
click Apply, click Save
click on build now..It should build.
if there is any error, please check the console output. Most of the common error would be checking the path of Maven installation, valid credentials for GitHub or Tomcat. Also make sure you install the plug-ins.
After successful deployment, please make sure you check the output in Tomcat by going to browser and enter below URL
If you want to execute some commands during boot up(launch), you can execute it easily by loading script in user data section during EC2 launch. Bootstrap scripts run only once - when the instance is instantiated for the 1st time.
Please follow the below steps to create an EC2 instance. We will be installing Java, Maven and Jenkins during boot up.
How to create EC2 instance in AWS console?
What is EC2 instance?
It is virtual server provided by AWS. We will be using this EC2 to setup Jenkins. Please follow the below steps to create an EC2 instance.
GitHub is popular Git based SCM, hosted on cloud for storing and sharing code amongst developers. Using GitHub with Visual Studio Code lets you share your source code and collaborate with other developers right within your editor.
There are many ways to integrate with GitHub, using the website or using Git client(CLI) or using VS Code as well. We will be learning how to integrate with GitHub from VS Code. Git Support is provided out-of-the-box in VS Code.