@@ -13,18 +13,20 @@ pipeline {
1313 stage(' Checkout for Build (dev)' ) {
1414 steps {
1515 dir(' /home/ec2-user/JavaCalculator' ) {
16- git url : ' https://github.com/Etimdevops/JavaCalculator.git' , branch : ' dev'
16+ // Checkout the dev branch for building the application
17+ git url : ' https://github.com/Etimdevops/JavaCalculator.git' , branch : ' dev' , poll : false
1718 }
1819 }
1920 }
2021
2122 stage(' Build (dev)' ) {
2223 steps {
2324 dir(' /home/ec2-user/JavaCalculator' ) {
25+ // Run the build playbook with inventory from the master branch
2426 ansiblePlaybook credentialsId : ' JenkinsAns' ,
2527 disableHostKeyChecking : true ,
2628 installation : ' Ansible' ,
27- inventory : ' hosts.ini' ,
29+ inventory : ' /home/ec2-user/JavaCalculator/ hosts.ini' ,
2830 playbook : ' 01-build.yml'
2931 }
3032 }
@@ -33,18 +35,20 @@ pipeline {
3335 stage(' Checkout for Test (qa)' ) {
3436 steps {
3537 dir(' /home/ec2-user/JavaCalculator' ) {
36- git url : ' https://github.com/Etimdevops/JavaCalculator.git' , branch : ' qa'
38+ // Checkout the qa branch for running tests
39+ git url : ' https://github.com/Etimdevops/JavaCalculator.git' , branch : ' qa' , poll : false
3740 }
3841 }
3942 }
4043
4144 stage(' Run Tests (qa)' ) {
4245 steps {
4346 dir(' /home/ec2-user/JavaCalculator' ) {
47+ // Run the test playbook with inventory from the master branch
4448 ansiblePlaybook credentialsId : ' JenkinsAns' ,
4549 disableHostKeyChecking : true ,
4650 installation : ' Ansible' ,
47- inventory : ' hosts.ini' ,
51+ inventory : ' /home/ec2-user/JavaCalculator/ hosts.ini' ,
4852 playbook : ' 02-test.yml'
4953 }
5054 }
0 commit comments