Configure Jenkins to create freestyle jobs to automate build and
deployments.
SonarQube
JaCoCo
6. Build --> Add build step --> invoke top level maven targets -->
7. Click on advanced, enter the path of POM file as --> MyWebApp/pom.xml
Pre-requisites:
1. Make sure you configure maven installation under Jenkins-->manage Jenkins-> Global Tool Configuration. under maven installation. enter Maven3 as name, enter path of maven installation --> /usr/share/maven and uncheck install automatically option.
2. Also install SonarQube scanner, deploy to container, Jacoco plugins under Jenkins --> Manage Jenkins --> Manage plug-ins
Click on Available, type Sonarqube, select SonarQube scanner. Click on Install without restart.
SonarQube
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 or GitHub, select
repo you created from lab exercise # 2, click on Clone or download
and select HTTPS Url.
Copy it.
under credentials --> click Add- > select Jenkins --> enter your GitHub username and password
6. Build --> Add build step --> invoke top level maven targets -->
select Maven3 from drop down and goal as clean install
8. add Post build action - select archive the artifacts
enter the below value:(ignore if you get any error in red color)
**/*.war
there may be some errors in red, but ignore it.
9. click on Add post build action, select Record Jacoco Code coverage report
This is how you automate the builds and deployments using Jenkins and migrate applications to AWS.
You can watch the video of this lab here:
10. click on Add post build action, select deploy war/ear to conta iner
enter the same value
in WAR/EAR files, leave context path empty
11. click on Add container , select Tomcat 8.x
12. click on add credentials, enter tomcat as user name and password as password.
select it from drop down.
After successful deployment, please make sure you check the output in Tomcat by going to browser and enter below URL
This is how you automate the builds and deployments using Jenkins and migrate applications to AWS.
You can watch the video of this lab here:
No comments:
Post a Comment