File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11pipeline {
2- agent any
3- stages {
4- stage(" BuildCode" ) {
2+ agent any
3+ environment {
4+ PRD = " PROD"
5+ DEV = " DEV"
6+ UAT = " ACC"
7+ }
8+ stages {
9+ stage (" Checkout" ){
10+ // agent "label_node"
11+ steps{
12+ script {
13+
14+ sh """
15+ rm -rf java-sample-app
16+ git clone https://github.com/crazy4devops/java-sample-app.git
17+ cd java-sample-app
18+ git checkout dev
19+ ls -lrt
20+ """
21+ }
22+ }
23+ }
24+ stage (" Build Source Code" ){
525 steps {
6- sh ' mvn clean install'
7- stash includes : ' **/target/*.jar' , name : ' app'
26+ script{
27+ sh """
28+ cd java-sample-app
29+ mvn clean install
30+ """
31+ }
832 }
9- }
10- stage( ' Unit-Test ' ) {
33+ }
34+ stage ( " Code Analysis " ) {
1135 steps {
12- sh ' mvn test'
36+ script {
37+ sh " cd java-sample-app;/opt/sonar/bin/sonar-scanner"
38+ }
1339 }
14- }
15- stage (' DeploymentStgs' ){
16- parallel {
17- stage (' Deploy To DEV' ) {
18- steps {
19-
20- // unstash 'getJars'
21- // sh 'ls -lrt'
22- sh ' mkdir -p ./dummy'
23- unstash ' app'
24- sh ' ls -lrt'
25- sh ' echo "Deploy into Prod"'
40+ }
2641
27- }
28- }
29-
30- stage (' Deploy To UAT' ) {
31- steps {
32- sh ' echo "Deploy into Prod"'
42+ stage (" Run Unit Test" ){
43+ steps {
44+ echo " Running Unit Test Cases"
45+ // script {
46+ // sh "mvn test"
3347
34- }
35- }
36- stage (' Deploy To Prod' ) {
37- steps {
38- sh ' echo "Deploy into Prod"'
48+ // }
49+ }
50+ }
51+ stage (" Deploy Dev" ){
52+ steps {
53+ echo " Deploying.....Dev"
54+ }
55+ }
56+ stage (" Deploy UAT" ){
57+ steps {
58+ echo " Deploying.....UAT"
59+ }
60+ }
3961
40- }
41- }
62+ stage (" Deploy PRD" ){
63+ input{
64+ message " Do you want to proceed for production deployment?"
4265 }
66+ steps {
67+ echo " Deploying.....PRD"
68+ }
69+ }
70+
4371 }
44-
45- }
4672}
You can’t perform that action at this time.
0 commit comments