|
1 | 1 | pipeline { |
2 | | - agent { |
3 | | - label 'slave1' |
4 | | -} |
5 | | - |
| 2 | + agent any |
6 | 3 | stages { |
7 | | - // stage('Git checkout') { |
8 | | - // steps { |
9 | | - // echo 'We are now checking out the git repository' |
10 | | - // git 'https://github.com/rohith-marigowda/javaProject.git' |
11 | | - // } |
12 | | - // } |
13 | | - // stage('Build project') { |
14 | | - // steps { |
15 | | - // echo 'Build the above code using maven' |
16 | | - // sh 'mvn clean install' |
17 | | - // } |
18 | | - // } |
19 | | - // stage('Push artifactory') { |
20 | | - // steps { |
21 | | - // echo 'Once the package is created using build tools, push the artifactory to nexus or jfrogg' |
22 | | - // echo 'Note: We are not pushing any of our artifacts into maven remote repository' |
23 | | - // } |
24 | | - // } |
25 | | - |
26 | | - //stage('Deploy') { |
27 | | - //steps { |
28 | | - // echo 'deploy the artifactories into the environments' |
29 | | - // sh 'sudo cp /home/ec2-user/jenkins/workspace/cicd/target/*.war /opt/apache*/webapps/' |
30 | | - // } |
31 | | - // } |
32 | | - |
33 | | - stage('Master Branch Job') { |
34 | | - when { |
35 | | - branch 'master' |
36 | | - } |
| 4 | + stage('Git checkout') { |
37 | 5 | steps { |
38 | 6 | echo 'We are now checking out the git repository' |
39 | 7 | git 'https://github.com/rohith-marigowda/javaProject.git' |
40 | 8 | } |
41 | | - |
| 9 | + } |
| 10 | + stage('Build project') { |
42 | 11 | steps { |
43 | | - echo 'Build the above code using maven' |
| 12 | + echo 'Build the above code using maven' |
44 | 13 | sh 'mvn clean install' |
45 | 14 | } |
46 | | - |
47 | | - steps { |
48 | | - echo 'deploy the artifactories into the master environments' |
49 | | - sh 'sudo cp /home/ec2-user/jenkins/workspace/cicd_master/target/*.war /opt/apache*/webapps/' |
| 15 | + } |
| 16 | + stage('Push artifactory') { |
| 17 | + steps { |
| 18 | + echo 'Once the package is created using build tools, push the artifactory to nexus or jfrogg' |
| 19 | + echo 'Note: We are not pushing any of our artifacts into maven remote repository' |
| 20 | + } |
| 21 | + } |
| 22 | + |
| 23 | + stage('Deploy') { |
| 24 | + steps { |
| 25 | + echo 'deploy the artifactories into the environments' |
| 26 | + sh 'sudo cp /home/ec2-user/jenkins/workspace/cicd/target/.war /opt/apache/webapps/' |
| 27 | + } |
50 | 28 | } |
51 | 29 | } |
52 | | - } |
53 | 30 | } |
0 commit comments