From bf71af730ef794343836300d2d398587e1b2b0f8 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 19:10:19 +0530 Subject: [PATCH 001/148] Update Jenkinsfile --- Jenkinsfile | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f69540..876ef49 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -87,8 +87,22 @@ spec: } } } + + stage('Build') { + //GIT_BRANCH = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() + when { expression {!(env.GIT_BRANCH =~ /feature/ )}} + steps { + sh 'I am executing build' + } + } + stage('Deploy') { + when { expression {!(env.GIT_BRANCH =~ /feature/ )}} + steps { + echo "I am executing Deploy" + } + } - stage('Deploy Dev') { + /* stage('Deploy Dev') { when { branch 'dev'} steps { echo "I am executing Deploy the artifact from Archiva to target dev environment. My artifact has a unique name which is automatically generated and deployed to target dev environment" @@ -103,7 +117,7 @@ spec: echo "I am executing Smoke Test on target dev environment post deployment" echo 'Work in progress' } - } + } */ } } } From 8b6055064c64626eb85c78dd81484b83b0a79005 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 19:15:33 +0530 Subject: [PATCH 002/148] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 876ef49..2e5477a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -98,7 +98,8 @@ spec: stage('Deploy') { when { expression {!(env.GIT_BRANCH =~ /feature/ )}} steps { - echo "I am executing Deploy" + echo "I am executing Deploy" + echo "Deploy" } } From 7c033575e99099b377020a637a34d8af7d78446c Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 19:33:58 +0530 Subject: [PATCH 003/148] Create hello --- hello | 1 + 1 file changed, 1 insertion(+) create mode 100644 hello diff --git a/hello b/hello new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/hello @@ -0,0 +1 @@ +hello From ea638230b66ff4588b8456eaf9eaa6ea1d4b6660 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:01:40 +0530 Subject: [PATCH 004/148] Update hello --- hello | 1 + 1 file changed, 1 insertion(+) diff --git a/hello b/hello index ce01362..d0e08a8 100644 --- a/hello +++ b/hello @@ -1 +1,2 @@ hello +hi From 3db6aeb77d7a5c70b8bedf309d91c1f34ee44011 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:02:25 +0530 Subject: [PATCH 005/148] Update hello From 89a1ef4f3cae6a852ee2890d8f36cad14b321fca Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:04:54 +0530 Subject: [PATCH 006/148] Update Jenkinsfile --- Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2e5477a..bc7d5a9 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,8 +29,9 @@ spec: } stages { + parallel { stage('check_gradle_version') { - parallel { + steps { container('gradle') { sh 'gradle -v' From 40b81eadb0501f19a8b4e9f071e457df1d00db64 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:13:20 +0530 Subject: [PATCH 007/148] Update Jenkinsfile --- Jenkinsfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bc7d5a9..1d509b7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -59,7 +59,8 @@ spec: } } } - } + } + } stage('Code Quality') { steps { @@ -122,4 +123,4 @@ spec: } */ } } -} + From d752e3a81c0566fe592643911cdf862cc3ee2cb1 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:16:35 +0530 Subject: [PATCH 008/148] Update Jenkinsfile --- Jenkinsfile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile b/Jenkinsfile index 1d509b7..6494377 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -29,7 +29,9 @@ spec: } stages { + stage ('test') { parallel { + stage('check_gradle_version') { steps { @@ -61,6 +63,7 @@ spec: } } } + } stage('Code Quality') { steps { From 550a99ce02085939714c70a66aac2afb7e09c3b9 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 20 Jan 2021 20:20:37 +0530 Subject: [PATCH 009/148] Update Jenkinsfile --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6494377..bdee826 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,7 +82,7 @@ spec: } } - stage('Publish Package') { + /* stage('Publish Package') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { From 0db947e9eef8f558668f9051dcddce0aef307355 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 21 Jan 2021 18:47:31 +0530 Subject: [PATCH 010/148] Update Jenkinsfile --- Jenkinsfile | 158 ++++++++++++++++++---------------------------------- 1 file changed, 53 insertions(+), 105 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index bdee826..15fa628 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,129 +1,77 @@ pipeline { - environment { + environment { PROJECT_ID = "sd-devops" APP_NAME = "sample-java-app" CLUSTER_NAME = "cluster-1" CLUSTER_ZONE = "us-central1-a" CREDENTIALS_ID = "sd-devops" - } + } //agent any 2 - agent { - kubernetes { - label 'SpringBootRestApp' - defaultContainer 'jnlp' - yaml """ -apiVersion: v1 -kind: Pod -metadata: -labels: - component: ci -spec: - containers: - - name: gradle - image: gradle:3.5-jdk8-alpine - command: - - cat - tty: true -""" -} + agent { + kubernetes { + label 'SpringBootRestApp' + defaultContainer 'jnlp' + yaml "" + " + apiVersion: v1 + kind: Pod + metadata: + labels: + component: ci + spec: + containers: + -name: gradle + image: gradle: 3.5 - jdk8 - alpine + command: + -cat + tty: true "" + " + } } - - stages { - stage ('test') { - parallel { - - stage('check_gradle_version') { - - steps { - container('gradle') { - sh 'gradle -v' - sh 'echo workspace is $WORKSPACE' - sh "ls -la ${pwd()}" - sh 'chmod 777 * ' - sh './gradlew compileJava' - } - } - } - - - stage('Unit Test') { - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName:'Sonarqube') { - echo 'I am executing unit test' - sh "ls -la ${pwd()}" - sh 'mvn -f sample-java-app/pom.xml clean package' - - - - } + stages { + stage('test') { + parallel { + stage('check_gradle_version') { + steps { + container('gradle') { + sh 'gradle -v' + sh 'echo workspace is $WORKSPACE' + sh "ls -la ${pwd()}" + sh 'chmod 777 * ' + sh './gradlew compileJava' + } + } + } + stage('Unit Test') { + steps { + container('gradle') { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing unit test' + sh "ls -la ${pwd()}" + sh 'mvn -f sample-java-app/pom.xml clean package' + } + } + } } } } - } - } - } - - stage('Code Quality') { + } + stage('Code Quality') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName:'Sonarqube') { - echo 'I am executing code quality using sonarqube' + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing code quality using sonarqube' sh 'mvn -f sample-java-app/pom.xml sonar:sonar' } sleep(60) timeout(time: 1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - } + } } } - } - } - - /* stage('Publish Package') { - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=http://35.188.92.10/repository/snapshots/' - } - } - } - } - - stage('Build') { - //GIT_BRANCH = sh(returnStdout: true, script: 'git rev-parse --abbrev-ref HEAD').trim() - when { expression {!(env.GIT_BRANCH =~ /feature/ )}} - steps { - sh 'I am executing build' - } - } - stage('Deploy') { - when { expression {!(env.GIT_BRANCH =~ /feature/ )}} - steps { - echo "I am executing Deploy" - echo "Deploy" - } - } - - /* stage('Deploy Dev') { - when { branch 'dev'} - steps { - echo "I am executing Deploy the artifact from Archiva to target dev environment. My artifact has a unique name which is automatically generated and deployed to target dev environment" - echo "Work in progress" - } - } - - - stage('Smoke Test'){ - when { branch 'dev'} - steps { - echo "I am executing Smoke Test on target dev environment post deployment" - echo 'Work in progress' } - } */ + } } } - From ab61dc718779815ac222dc66b8490225fc8fe84f Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 21 Jan 2021 18:57:07 +0530 Subject: [PATCH 011/148] Update Jenkinsfile --- Jenkinsfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 15fa628..9c1272e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -11,8 +11,7 @@ pipeline { kubernetes { label 'SpringBootRestApp' defaultContainer 'jnlp' - yaml "" - " + yaml """ apiVersion: v1 kind: Pod metadata: @@ -24,8 +23,8 @@ pipeline { image: gradle: 3.5 - jdk8 - alpine command: -cat - tty: true "" - " + tty: true + """ } } stages { From 64419ac5bb95913045567ae6016d6db3191361a0 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 21 Jan 2021 20:02:36 +0530 Subject: [PATCH 012/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 107 ++++++++++++++++++++++-------------------------- 1 file changed, 50 insertions(+), 57 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index fae095e..68bae43 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,4 +1,3 @@ - pipeline { environment { PROJECT_ID = "sd-devops" @@ -30,77 +29,71 @@ spec: } stages { - stage('check_gradle_version') { - steps { - container('gradle') { - sh 'gradle -v' - sh 'echo workspace is $WORKSPACE' - sh "ls -la ${pwd()}" - sh 'chmod 777 * ' - sh './gradlew compileJava' - } - } - } - - - stage('Unit Test') { - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName:'Sonarqube') { - echo 'I am executing unit test' - sh "ls -la ${pwd()}" - sh 'mvn -f sample-java-app/pom.xml clean package' - - - - } + stage('check_gradle_version') { + steps { + container('gradle') { + sh 'gradle -v' + sh 'echo workspace is $WORKSPACE' + sh "ls -la ${pwd()}" + sh 'chmod 777 * ' + sh './gradlew compileJava' } } } - } - - stage('Code Quality') { + stage('Unit Test') { + steps { + container('gradle') { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing unit test' + sh "ls -la ${pwd()}" + sh 'mvn -f sample-java-app/pom.xml clean package' + } + } + } + } + } + + stage('Code Quality') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName:'Sonarqube') { - echo 'I am executing code quality using sonarqube' + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing code quality using sonarqube' sh 'mvn -f sample-java-app/pom.xml sonar:sonar' } sleep(60) timeout(time: 1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - } + } } } - } - } - - stage('Publish Package') { - steps { - container('gradle') { + } + } + + stage('Publish Package') { + steps { + container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' + echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' - } - } - } - } - - /* stage('Deploy Dev') { - when { branch 'dev'} - steps { - echo "I am executing Deploy the artifact from Archiva to target dev environment. My artifact has a unique name which is automatically generated and deployed to target dev environment" - echo "Work in progress" - } - } - stage('Smoke Test'){ - when { branch 'dev'} - steps { - echo "I am executing Smoke Test on target dev environment post deployment" - echo 'Work in progress' + } } - } */ + } } + /* stage('Deploy Dev') { + when { branch 'dev'} + steps { + echo "I am executing Deploy the artifact from Archiva to target dev environment. My artifact has a unique name which is automatically generated and deployed to target dev environment" + echo "Work in progress" + } + } + stage('Smoke Test'){ + when { branch 'dev'} + steps { + echo "I am executing Smoke Test on target dev environment post deployment" + echo 'Work in progress' + } + } */ +} } From df5d51765fbb093a2e386802fb300c3db42b27ef Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 17:11:26 +0530 Subject: [PATCH 013/148] Create hihello --- hihello | 1 + 1 file changed, 1 insertion(+) create mode 100644 hihello diff --git a/hihello b/hihello new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/hihello @@ -0,0 +1 @@ +hello From 5c4fc8577715f317039e8966b1e2c9f80c68c4a2 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 17:39:21 +0530 Subject: [PATCH 014/148] Create project.properties --- project.properties | 1 + 1 file changed, 1 insertion(+) create mode 100644 project.properties diff --git a/project.properties b/project.properties new file mode 100644 index 0000000..d50c1c0 --- /dev/null +++ b/project.properties @@ -0,0 +1 @@ +branch_name:feature From 4b3490eff64aa81f9ec4aa5adc525a3b21ad84db Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 17:41:05 +0530 Subject: [PATCH 015/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index d50c1c0..f6aac57 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -branch_name:feature +branch_name=feature From cfcd424a7b70d9fce70e19e6666bead7f30db12c Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 20:18:55 +0530 Subject: [PATCH 016/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index f6aac57..bc7826f 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -branch_name=feature +deploy=true From 6dd2e143f01abbea38d57269f0695aee9201578d Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 20:34:26 +0530 Subject: [PATCH 017/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index bc7826f..ff14346 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy=true +deploy= From a359ecb83b4e139b5bcdb8a87148b07b99b77acb Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:27:37 +0530 Subject: [PATCH 018/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index ff14346..bc7826f 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy= +deploy=true From 95c22647c4e73adfbdadb5680f5247e96a1e272a Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:34:59 +0530 Subject: [PATCH 019/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index bc7826f..ff14346 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy=true +deploy= From b9200ded9de6bad878992de6f2eb3d91ccf64314 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:42:04 +0530 Subject: [PATCH 020/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index ff14346..bc7826f 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy= +deploy=true From f8bcbb3844c5accd04d5f03f655e2a7053099813 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:43:16 +0530 Subject: [PATCH 021/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index bc7826f..ff14346 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy=true +deploy= From 5ec84700342d345f2b7ef85545ac0fbc54ddcee7 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Fri, 22 Jan 2021 22:56:00 +0530 Subject: [PATCH 022/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index ff14346..bc7826f 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy= +deploy=true From d383c04843cae9079fa555ca1fee712f9b4a9a47 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:22:09 +0530 Subject: [PATCH 023/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index bc7826f..055e3de 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy=true +deploy:true From d120a76115b182b3834b87f2a1b9f3251a7b96fb Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:26:57 +0530 Subject: [PATCH 024/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 055e3de..bc7826f 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy:true +deploy=true From 6ed37bf0c85ab33ebdae8fe1a4561d3840182d6d Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:34:05 +0530 Subject: [PATCH 025/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index bc7826f..909a08c 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy=true +deploy=false From 5d1af845c42cc02dc6aa8805cdb3491b2b5294a5 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 12:39:23 +0530 Subject: [PATCH 026/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 909a08c..bc7826f 100644 --- a/project.properties +++ b/project.properties @@ -1 +1 @@ -deploy=false +deploy=true From 7ef2d110e4fb09adfdf89fb44f3d2a598b2fcaab Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 17:01:35 +0530 Subject: [PATCH 027/148] Update project.properties --- project.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project.properties b/project.properties index bc7826f..8232dd0 100644 --- a/project.properties +++ b/project.properties @@ -1 +1,3 @@ deploy=true +dev1=lxapp.2378 +dev2=lxapp.62576 From da8891487ef5f1264679f9bf3dbe44cc5f40b46e Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 17:50:07 +0530 Subject: [PATCH 028/148] Update project.properties --- project.properties | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/project.properties b/project.properties index 8232dd0..d783620 100644 --- a/project.properties +++ b/project.properties @@ -1,3 +1,2 @@ deploy=true -dev1=lxapp.2378 -dev2=lxapp.62576 +servers=lxapp.2378 lxapp.656 lxapp.5376 From e3948b98afd6546e9908335454ef9d948405c0da Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 17:54:48 +0530 Subject: [PATCH 029/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index d783620..0c999e7 100644 --- a/project.properties +++ b/project.properties @@ -1,2 +1,2 @@ deploy=true -servers=lxapp.2378 lxapp.656 lxapp.5376 +servers="lxapp.2378 lxapp.656 lxapp.5376" From 9190bd65b749b3ea9ac4292bcb813e565b9cbc7e Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 17:58:08 +0530 Subject: [PATCH 030/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 0c999e7..c09c61f 100644 --- a/project.properties +++ b/project.properties @@ -1,2 +1,2 @@ deploy=true -servers="lxapp.2378 lxapp.656 lxapp.5376" +servers='lxapp.2378 lxapp.656 lxapp.5376' From 31dc454cc8839ee4a364fb3ee7c5b504f6ef6aeb Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Mon, 25 Jan 2021 18:01:00 +0530 Subject: [PATCH 031/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index c09c61f..d783620 100644 --- a/project.properties +++ b/project.properties @@ -1,2 +1,2 @@ deploy=true -servers='lxapp.2378 lxapp.656 lxapp.5376' +servers=lxapp.2378 lxapp.656 lxapp.5376 From b1398d2fb55fa0e56c1d62055e65376a9f727b94 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 18:31:58 +0530 Subject: [PATCH 032/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index d783620..d3d6d58 100644 --- a/project.properties +++ b/project.properties @@ -1,2 +1,2 @@ -deploy=true +feature_deploy=true servers=lxapp.2378 lxapp.656 lxapp.5376 From 45169a7698fda72e3ca542be53a35b172a7f8840 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 18:43:54 +0530 Subject: [PATCH 033/148] Create Jenkins_Tweak --- Jenkins_Tweak | 91 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 Jenkins_Tweak diff --git a/Jenkins_Tweak b/Jenkins_Tweak new file mode 100644 index 0000000..6dae304 --- /dev/null +++ b/Jenkins_Tweak @@ -0,0 +1,91 @@ +pipeline { +agent { + kubernetes { + label 'SpringBootRestApp' + defaultContainer 'jnlp' + yaml """ +apiVersion: v1 +kind: Pod +metadata: +labels: + component: ci +spec: + containers: + - name: gradle + image: gradle:3.5-jdk8-alpine + command: + - cat + tty: true +""" +} + } + + stages { + + stage('SCM Checkout') { + steps { + + + + //git branch: 'feature', credentialsId: 'git_creds', url: 'https://github.com/sdgcpsb/SpringBootRestApp.git' + + script { + propfile = readProperties(file: './project.properties') + println ("reading properties ...") +println ("branch_name:"+ propfile['deploy']) + + } + + } + + + + } + + + + stage ("Deploy") { + steps { + container ('gradle') { + sh ''' + + deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` + + + if test "$deploy" = true + then + echo " im deploying" + else + echo "no need" + fi + + server_list=`cat project.properties | grep "servers" | cut -d'=' -f2 ` + echo $server_list + for server in $server_list + + do + + echo $server + done + + + + ''' + + + + } + } + } + stage ("use env vars") { + steps { + sh "printenv | sort" + echo "BUILD_NUMBER = ${env.BUILD_NUMBER}" + echo "BRANCH_NAME = ${env.BRANCH_NAME}" + } + } + + + } +} + From f441eed1d86ae023fc61196395152ba5629762fe Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 18:49:10 +0530 Subject: [PATCH 034/148] Update Jenkins_Tweak --- Jenkins_Tweak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkins_Tweak b/Jenkins_Tweak index 6dae304..90eae58 100644 --- a/Jenkins_Tweak +++ b/Jenkins_Tweak @@ -27,14 +27,14 @@ spec: - //git branch: 'feature', credentialsId: 'git_creds', url: 'https://github.com/sdgcpsb/SpringBootRestApp.git' + /* //git branch: 'feature', credentialsId: 'git_creds', url: 'https://github.com/sdgcpsb/SpringBootRestApp.git' script { propfile = readProperties(file: './project.properties') println ("reading properties ...") println ("branch_name:"+ propfile['deploy']) - } + } */ } From de09e2537d59a74f5b66d4ba17d1fed8b8cd71ee Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 18:53:37 +0530 Subject: [PATCH 035/148] Update Jenkins_Tweak --- Jenkins_Tweak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkins_Tweak b/Jenkins_Tweak index 90eae58..619e108 100644 --- a/Jenkins_Tweak +++ b/Jenkins_Tweak @@ -1,5 +1,7 @@ pipeline { -agent { + + //agent any 2 + agent { kubernetes { label 'SpringBootRestApp' defaultContainer 'jnlp' From b8765c199e7725ac86dd4cecfd707c8f67934e40 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 19:02:39 +0530 Subject: [PATCH 036/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 68bae43..d850f16 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -70,8 +70,48 @@ spec: } } } - - stage('Publish Package') { + stage ("Deploy") { + steps { + container ('gradle') { + sh ''' + + deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` + + + if test "$deploy" = true + then + echo " im deploying" + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' + sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + else + echo "no need" + fi + + server_list=`cat project.properties | grep "servers" | cut -d'=' -f2 ` + echo $server_list + + for server in $server_list + + do + + echo $server + done + + + + ''' + } + } + } + stage ("use env vars") { + steps { + sh "printenv | sort" + echo "BUILD_NUMBER = ${env.BUILD_NUMBER}" + echo "BRANCH_NAME = ${env.BRANCH_NAME}" + } + } + /* stage('Publish Package') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { @@ -80,7 +120,9 @@ spec: } } } - } + } */ + + /* stage('Deploy Dev') { when { branch 'dev'} steps { From b0939139976b9d4940fa4529e1c393e67ec01759 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 19:09:03 +0530 Subject: [PATCH 037/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d850f16..aea56ab 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -83,7 +83,7 @@ spec: echo " im deploying" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' else echo "no need" fi From 65245def16acb3f148bd24c3540a700c0eb19c0b Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 19:14:24 +0530 Subject: [PATCH 038/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index aea56ab..a698c31 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -81,9 +81,9 @@ spec: if test "$deploy" = true then echo " im deploying" - withMaven(maven: 'MAVEN-3.6.3') { + /* withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' */ else echo "no need" fi From dae77e3bd4e42acdd6f06b90b4ad8d401d8ecaab Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 19:19:36 +0530 Subject: [PATCH 039/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index a698c31..96566fc 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -81,9 +81,10 @@ spec: if test "$deploy" = true then echo " im deploying" - /* withMaven(maven: 'MAVEN-3.6.3') { + withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' */ + 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + } else echo "no need" fi From 858cd959c3f6374d3d388e614b436e86f599438f Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 20:16:13 +0530 Subject: [PATCH 040/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 96566fc..d0fa883 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -83,7 +83,7 @@ spec: echo " im deploying" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/ } else echo "no need" From b6b8627634f4dd153a81d9cffa2ee39113272720 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 20:27:18 +0530 Subject: [PATCH 041/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d0fa883..2e432fc 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -83,7 +83,8 @@ spec: echo " im deploying" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/ + ls -lart + "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } else echo "no need" From 9a0fa257b36ee2658be4b7527efafdd31379a231 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 22:01:57 +0530 Subject: [PATCH 042/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 2e432fc..54a8f58 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -81,11 +81,8 @@ spec: if test "$deploy" = true then echo " im deploying" - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - ls -lart - "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" - } + ls -lart + else echo "no need" fi From df790739cdc66679f243286f1b84363997a1cdc1 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 22:20:11 +0530 Subject: [PATCH 043/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 54a8f58..bc6eda8 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -81,7 +81,10 @@ spec: if test "$deploy" = true then echo " im deploying" - ls -lart + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' + `mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/ ` + } else echo "no need" From 49236aca3d71ffdefd4d1e686b810d99f4dc5cdf Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 27 Jan 2021 22:46:52 +0530 Subject: [PATCH 044/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index bc6eda8..e9f38fd 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -83,7 +83,7 @@ spec: echo " im deploying" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - `mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/ ` + } else From 88602869e02eb28c8e21e9f24902a8e75e5b0805 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:02:26 +0530 Subject: [PATCH 045/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index e9f38fd..7f9533a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -81,11 +81,12 @@ spec: if test "$deploy" = true then echo " im deploying" + ''' withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' } - + sh ''' else echo "no need" fi From 7cc3d3e5fb2f329de5628d97d010147e9a69b6d9 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:12:08 +0530 Subject: [PATCH 046/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7f9533a..127a582 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -70,7 +70,7 @@ spec: } } } - stage ("Deploy") { + /* stage ("Deploy") { steps { container ('gradle') { sh ''' @@ -106,7 +106,22 @@ spec: ''' } } - } + } */ + + stage ("Deploy") { + steps { + container ('gradle') { + script { + propfile = readProperties(file: './project.properties') + println ("deploy:"+ propfile['feature_deploy']) + println ("reading properties ...") +println ("branch_name:"+ propfile['feature_deploy']) + + + } + } + } + stage ("use env vars") { steps { sh "printenv | sort" From 4856b004808237746a511a6eee38df635a1abb16 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:13:33 +0530 Subject: [PATCH 047/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 127a582..151c56d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -116,7 +116,7 @@ spec: println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") println ("branch_name:"+ propfile['feature_deploy']) - + } } } From 9fd423be1717d36948aa5a67d665b9dffc291a56 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:22:05 +0530 Subject: [PATCH 048/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 151c56d..b33322f 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -115,7 +115,16 @@ spec: propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") -println ("branch_name:"+ propfile['feature_deploy']) + if($deploy==true){ + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' + + } + else + echo "no need" + } + +//println ("branch_name:"+ propfile['feature_deploy']) } } From ebd0d0a46f24e861f51afabd9b36c2a74df74057 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:23:56 +0530 Subject: [PATCH 049/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index b33322f..484dd8e 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -120,8 +120,7 @@ spec: echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' } - else - echo "no need" + } //println ("branch_name:"+ propfile['feature_deploy']) From 76b8891d400f95de0b8985325ed08b996731c1c8 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:29:49 +0530 Subject: [PATCH 050/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 484dd8e..b7c8448 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -115,7 +115,7 @@ spec: propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - if($deploy==true){ + if($propfile==true){ withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' From 29dfb2ff3d1c919ea283fbcb54aa99ac8a0f7d57 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:30:31 +0530 Subject: [PATCH 051/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index b7c8448..cded9d1 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -54,7 +54,7 @@ spec: } } - stage('Code Quality') { + /* stage('Code Quality') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { @@ -69,7 +69,7 @@ spec: } } } - } + } */ /* stage ("Deploy") { steps { container ('gradle') { From 0bda1daeab08e429c596d3d8e03dd31c99dbaf76 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:35:26 +0530 Subject: [PATCH 052/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index cded9d1..44fe64b 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -111,7 +111,7 @@ spec: stage ("Deploy") { steps { container ('gradle') { - script { + /*script { propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") @@ -119,12 +119,25 @@ spec: withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - } + } } //println ("branch_name:"+ propfile['feature_deploy']) - } + } */ + + deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` + + + if test "$deploy" = true + then + echo " im deploying" + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' + else + echo "no need" + fi + } } From 934cb4d39c8a1a7da2276394ce746aa6daf33d99 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:37:28 +0530 Subject: [PATCH 053/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 44fe64b..bfe1797 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -134,6 +134,7 @@ spec: echo " im deploying" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' + } else echo "no need" fi From e1b320196267901a65af2cc03bf658daa13db1e3 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:39:22 +0530 Subject: [PATCH 054/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index bfe1797..e56bd4b 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -126,7 +126,7 @@ spec: //println ("branch_name:"+ propfile['feature_deploy']) } */ - deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` + sh 'deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` ' if test "$deploy" = true From 1d8a0dbd233e662e1a645b412d663173d7b086a8 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:41:30 +0530 Subject: [PATCH 055/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index e56bd4b..609b1f5 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -111,33 +111,23 @@ spec: stage ("Deploy") { steps { container ('gradle') { - /*script { + script { propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - if($propfile==true){ + echo $propfile + /* if($propfile==true){ withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' } - } + } */ //println ("branch_name:"+ propfile['feature_deploy']) - } */ + } - sh 'deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` ' - - - if test "$deploy" = true - then - echo " im deploying" - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - } - else - echo "no need" - fi + } From 203a795c78bca6bf3f51f717653b06e4429752b3 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 14:47:15 +0530 Subject: [PATCH 056/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 609b1f5..a16a28d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -115,7 +115,7 @@ spec: propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - echo $propfile + echo propfile /* if($propfile==true){ withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' From fca78dac432946e6bcfc439e4c6f14174535fdcb Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 16:42:49 +0530 Subject: [PATCH 057/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index a16a28d..c8f329e 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -112,10 +112,10 @@ spec: steps { container ('gradle') { script { - propfile = readProperties(file: './project.properties') + /* propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - echo propfile + echo propfile */ /* if($propfile==true){ withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' @@ -123,6 +123,13 @@ spec: } } */ + + when { + expression { return readFile('project.properties').contains('feature_deploy=true') } + echo "hi" +} + } + //println ("branch_name:"+ propfile['feature_deploy']) } From 8d9da174b2c1e4578c1d63aa59f5e2d4842fdd2b Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 16:44:31 +0530 Subject: [PATCH 058/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index c8f329e..a2b6303 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -112,10 +112,10 @@ spec: steps { container ('gradle') { script { - /* propfile = readProperties(file: './project.properties') + propfile = readProperties(file: './project.properties') println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - echo propfile */ + /* if($propfile==true){ withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' From f64b5ddf6e7d947754e8916fce5beec271bc839c Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 16:46:13 +0530 Subject: [PATCH 059/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index a2b6303..9370188 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -131,15 +131,12 @@ spec: } -//println ("branch_name:"+ propfile['feature_deploy']) + } - - - - - } + } } + stage ("use env vars") { steps { From 664d9b8590e404aff082e9ff70793a2fb9be97e5 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 17:53:15 +0530 Subject: [PATCH 060/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 9370188..15ffd86 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -116,18 +116,15 @@ spec: println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - /* if($propfile==true){ + if(propfile['feature_deploy']==true){ withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' } - } */ + } + - when { - expression { return readFile('project.properties').contains('feature_deploy=true') } - echo "hi" -} } From 7f3dd7f4d52c07e5f3a6f5ed5755bb563a10af3b Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 18:02:44 +0530 Subject: [PATCH 061/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 15ffd86..5d2dc94 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -116,7 +116,8 @@ spec: println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - if(propfile['feature_deploy']==true){ + if( propfile['feature_deploy'] == true ){ + echo "hi" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' From 45e6a1a89ff585f3430bcfb8e157d8d36c1ed3d6 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 18:10:16 +0530 Subject: [PATCH 062/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 5d2dc94..5a99866 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -116,14 +116,20 @@ spec: println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - if( propfile['feature_deploy'] == true ){ + //Boolean.TRUE.equals(propfile['feature_deploy']) + + if( Boolean.TRUE.equals(propfile['feature_deploy']) ){ echo "hi" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' } + } + else { + echo "no need" + } } From aa0b7baf507b5b1f6b924538e4c4336df3b1100a Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 18:17:46 +0530 Subject: [PATCH 063/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 5a99866..904222a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -118,7 +118,7 @@ spec: //Boolean.TRUE.equals(propfile['feature_deploy']) - if( Boolean.TRUE.equals(propfile['feature_deploy']) ){ + if ( propfile['feature_deploy'] == "true" ) { echo "hi" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' From 7ca6a1c046a777e529219027442fc8977aecd4a0 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 18:21:53 +0530 Subject: [PATCH 064/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 904222a..d3462fe 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -122,7 +122,7 @@ spec: echo "hi" withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - + sh 'mvn -X deploy:deploy-file -Dfile=$APP_NAME/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' } From 24035b97081ea4e2d83a5c84bdf34b218200e739 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 18:25:22 +0530 Subject: [PATCH 065/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index d3d6d58..76c7318 100644 --- a/project.properties +++ b/project.properties @@ -1,2 +1,2 @@ -feature_deploy=true +feature_deploy=false servers=lxapp.2378 lxapp.656 lxapp.5376 From 2b2ffb801986df2ac90f940c481b21e7fca10dee Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 22:30:58 +0530 Subject: [PATCH 066/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 83 ++++--------------------------------------------- 1 file changed, 6 insertions(+), 77 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d3462fe..3146cb8 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -54,7 +54,7 @@ spec: } } - /* stage('Code Quality') { + stage('Code Quality') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { @@ -69,44 +69,8 @@ spec: } } } - } */ - /* stage ("Deploy") { - steps { - container ('gradle') { - sh ''' - - deploy=`cat project.properties | grep "feature_deploy" | cut -d'=' -f2 | awk '{print $1}' ` - - - if test "$deploy" = true - then - echo " im deploying" - ''' - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - - } - sh ''' - else - echo "no need" - fi - - server_list=`cat project.properties | grep "servers" | cut -d'=' -f2 ` - echo $server_list - - for server in $server_list - - do - - echo $server - done - - - - ''' - } - } - } */ + } + stage ("Deploy") { steps { @@ -116,28 +80,18 @@ spec: println ("deploy:"+ propfile['feature_deploy']) println ("reading properties ...") - //Boolean.TRUE.equals(propfile['feature_deploy']) - if ( propfile['feature_deploy'] == "true" ) { - echo "hi" - withMaven(maven: 'MAVEN-3.6.3') { + withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' sh 'mvn -X deploy:deploy-file -Dfile=$APP_NAME/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' } - } else { echo "no need" } - - - } - - - - } - + } + } } } @@ -149,31 +103,6 @@ spec: echo "BRANCH_NAME = ${env.BRANCH_NAME}" } } - /* stage('Publish Package') { - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' - } - } - } - } */ - - /* stage('Deploy Dev') { - when { branch 'dev'} - steps { - echo "I am executing Deploy the artifact from Archiva to target dev environment. My artifact has a unique name which is automatically generated and deployed to target dev environment" - echo "Work in progress" - } - } - stage('Smoke Test'){ - when { branch 'dev'} - steps { - echo "I am executing Smoke Test on target dev environment post deployment" - echo 'Work in progress' - } - } */ } } From cf5ffc5e544f56de6b9528f8d5f3c7b949c5c931 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 28 Jan 2021 22:35:41 +0530 Subject: [PATCH 067/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 3146cb8..7396997 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -90,7 +90,22 @@ spec: else { echo "no need" } + } + sh ''' + server_list=`cat project.properties | grep "servers" | cut -d'=' -f2 ` + echo $server_list + + for server in $server_list + + do + + echo $server + done + + + + ''' } } } @@ -101,6 +116,7 @@ spec: sh "printenv | sort" echo "BUILD_NUMBER = ${env.BUILD_NUMBER}" echo "BRANCH_NAME = ${env.BRANCH_NAME}" + } } From 003d4693c2bdf2ba26a154d309cb0b1a73bad1c7 Mon Sep 17 00:00:00 2001 From: sdgcpbs <76417184+sdgcpbs@users.noreply.github.com> Date: Mon, 1 Feb 2021 21:44:38 +0530 Subject: [PATCH 068/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7396997..37f64cf 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -117,6 +117,7 @@ spec: echo "BUILD_NUMBER = ${env.BUILD_NUMBER}" echo "BRANCH_NAME = ${env.BRANCH_NAME}" + } } From 554ea1ce1800e941b75cb8746eab06c34e2b18e4 Mon Sep 17 00:00:00 2001 From: sdgcpbs <76417184+sdgcpbs@users.noreply.github.com> Date: Mon, 1 Feb 2021 21:45:38 +0530 Subject: [PATCH 069/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 37f64cf..117c14d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -6,7 +6,7 @@ pipeline { CLUSTER_ZONE = "us-central1-a" CREDENTIALS_ID = "sd-devops" } - //agent any 2 + //agent any agent { kubernetes { label 'SpringBootRestApp' From b889ac2e1755cbaf213637e637b4eee3f5923cbc Mon Sep 17 00:00:00 2001 From: sdgcpss <77489029+sdgcpss@users.noreply.github.com> Date: Tue, 2 Feb 2021 18:51:15 +0530 Subject: [PATCH 070/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 117c14d..f01c853 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -40,7 +40,25 @@ spec: } } } - stage('Unit Test') { + stage('check_build_version'){ + steps { + /* $versionLine = (Get-Content build.gradle) -match "version\s*=\s*'\s*(\d+)\.(\d)+" + "$versionLine" -match "version\s*=\s*'\s*(\d+)\.(\d)+" + $major = $matches[1] + $minor = $matches[2] + $gitStatus = (git status) -match "On branch" + "$gitStatus" -match "On branch\s*(\w+)" + $branch = $matches[1] + + $tag = "$branch-${bamboo.planKey}-$major.$minor.${bamboo.buildNumber}${bamboo.repository.branch.name}" + + git tag "$tag" + git remote add origin http://${bamboo.git.user}:${bamboo.git.password}@${bamboo.git.url} + git push origin "$tag" */ + } + } + + stage('Unit Test') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { From 3ad2ef9ee9ffcdae62b1b7b839cdb08c210b4326 Mon Sep 17 00:00:00 2001 From: sdgcpss <77489029+sdgcpss@users.noreply.github.com> Date: Tue, 2 Feb 2021 18:55:02 +0530 Subject: [PATCH 071/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index f01c853..911b53a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -42,6 +42,7 @@ spec: } stage('check_build_version'){ steps { + container('gradle') { /* $versionLine = (Get-Content build.gradle) -match "version\s*=\s*'\s*(\d+)\.(\d)+" "$versionLine" -match "version\s*=\s*'\s*(\d+)\.(\d)+" $major = $matches[1] @@ -56,7 +57,8 @@ spec: git remote add origin http://${bamboo.git.user}:${bamboo.git.password}@${bamboo.git.url} git push origin "$tag" */ } - } + } + } stage('Unit Test') { steps { From 7a04a9f87a4226de7e1d38581d738a01efc9b4a8 Mon Sep 17 00:00:00 2001 From: sdgcpss <77489029+sdgcpss@users.noreply.github.com> Date: Wed, 3 Feb 2021 17:49:35 +0530 Subject: [PATCH 072/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 235 +++++++++++++++++++++++++++++------------------- 1 file changed, 144 insertions(+), 91 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 911b53a..81cdabd 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,12 +1,5 @@ pipeline { - environment { - PROJECT_ID = "sd-devops" - APP_NAME = "sample-java-app" - CLUSTER_NAME = "cluster-1" - CLUSTER_ZONE = "us-central1-a" - CREDENTIALS_ID = "sd-devops" - } - //agent any + agent { kubernetes { label 'SpringBootRestApp' @@ -26,21 +19,23 @@ spec: tty: true """ } - } + } - stages { - stage('check_gradle_version') { - steps { - container('gradle') { - sh 'gradle -v' - sh 'echo workspace is $WORKSPACE' - sh "ls -la ${pwd()}" - sh 'chmod 777 * ' - sh './gradlew compileJava' +stages { + stage('Build & Unit Test') { + steps { + container('gradle') { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing unit test' + // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' + sh 'mvn -f sample-java-app/pom.xml clean package' } } } - stage('check_build_version'){ + } + } + stage('check_build_version'){ steps { container('gradle') { /* $versionLine = (Get-Content build.gradle) -match "version\s*=\s*'\s*(\d+)\.(\d)+" @@ -59,87 +54,145 @@ spec: } } } - - stage('Unit Test') { - steps { - container('gradle') { + stage('Code Quality') { + steps { + container('gradle') { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing code quality using sonarqube' + sh 'mvn -f sample-java-app/pom.xml sonar:sonar' + } + /* sleep(60) + timeout(time: 1, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } */ + } + } + } + } + stage("Publish Package") { + steps { + container('gradle') { + script { + propfile = readProperties(file: './project.properties') + println("deploy:" + propfile['feature_deploy']) + println("reading properties ...") + if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName: 'Sonarqube') { - echo 'I am executing unit test' - sh "ls -la ${pwd()}" - sh 'mvn -f sample-java-app/pom.xml clean package' - } + echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' + /* echo 'copying the jar and war files from the individual target directorrys and copying it to artifacts directory ' + sh "mkdir -p $WORKSPACE/artifacts" + sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do cp -rp ${i}/dist/libs/* $WORKSPACE/artifacts/ ;done' */ + /* echo 'create a tar file on the Jenkins server' + sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */ + sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' + sh 'ls -lrt sample-java-app/target/' + sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + echo "noooooooooooooooooo" } } } } - - stage('Code Quality') { - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName: 'Sonarqube') { - echo 'I am executing code quality using sonarqube' - sh 'mvn -f sample-java-app/pom.xml sonar:sonar' - } - sleep(60) - timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true + } + } + stage("Deploy") { + steps { + container('gradle') { + script { + propfile = readProperties(file: './project.properties') + println("deploy:" + propfile['feature_deploy']) + println("reading properties ...") + if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am deploying the artifact into the target environment' + echo 'shutting down the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' + echo 'force stop any remaining mule process' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' */ + echo 'tomcat server stopped' + echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' + /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' */ + echo 'Deployment has been completed' + echo 'starting the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' */ + echo 'tomcat server started' } + } else { + echo "no need" } } } - } - - - stage ("Deploy") { - steps { - container ('gradle') { - script { - propfile = readProperties(file: './project.properties') - println ("deploy:"+ propfile['feature_deploy']) - println ("reading properties ...") - - if ( propfile['feature_deploy'] == "true" ) { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and push the artifact with unique name showing the branch from which it is generated, to Archiva' - sh 'mvn -X deploy:deploy-file -Dfile=$APP_NAME/target/sample-0.0.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' - } - - } - else { - echo "no need" + } + } + + stage('Post Deploy Tests') { + parallel { + stage('Smoke Test') { + steps { + echo "I am executing Smoke Test on target dev environment post deployment" } - + /*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` + echo "The response for current execution status is: $RESP" + if [ "$RESP" != "[]" ]; + then + echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." + exit 1 + else + echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" + fi + # To abort the request before attempting to re-run, uncomment and run below line. + # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/) + guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \") + echo "The GUID is: $guid" + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + while [[ $status != *"Completed"* ]] + do + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + sleep 15 + done + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/) + echo "The status is: $status" + execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) + echo "The exec status is: $execstatus" + if [[ $execstatus != *Passed* ]]; + then + echo "Failed" + exit 1 + else + echo "Passed" + exit + fi + exit */ + } + stage('Security Test') { + steps { + echo 'I am running Security Test here' } - sh ''' - server_list=`cat project.properties | grep "servers" | cut -d'=' -f2 ` - echo $server_list - - for server in $server_list - - do - - echo $server - done - - - - ''' - } - } - } - - - stage ("use env vars") { - steps { - sh "printenv | sort" - echo "BUILD_NUMBER = ${env.BUILD_NUMBER}" - echo "BRANCH_NAME = ${env.BRANCH_NAME}" - - - } - } - -} + } + } + } + } + post { + failure { + /*mail bcc: '', + body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", + cc: '', + charset: 'UTF-8', + from: '', + mimeType: 'text/html', + replyTo: '', + subject: "ERROR CI: Project name -> ${env.JOB_NAME}", + to: "foo@foomail.com";*/ + echo 'I am sending a notification with failure' + } + success { + echo 'I am sending a notification with success' + } + } } From 773efa4ef14de52f1a3f12c85f5a2950978a6ebb Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 21:37:55 +0530 Subject: [PATCH 073/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 81cdabd..1eccce0 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -30,6 +30,7 @@ stages { echo 'I am executing unit test' // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' sh 'mvn -f sample-java-app/pom.xml clean package' + sh 'mvn -f sample-java-app/pom.xml javadoc:javadoc' } } } From 34ec646f76546707218afa3b9f62fd255a4e7b16 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 21:46:04 +0530 Subject: [PATCH 074/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 1eccce0..d3826e5 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -180,6 +180,9 @@ stages { } } post { + always { + javadoc: Publish Javadoc + } failure { /*mail bcc: '', body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", From 2970874e76a528ff9630f8516a50406149b2b333 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 22:00:35 +0530 Subject: [PATCH 075/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d3826e5..d8603c8 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -30,7 +30,7 @@ stages { echo 'I am executing unit test' // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' sh 'mvn -f sample-java-app/pom.xml clean package' - sh 'mvn -f sample-java-app/pom.xml javadoc:javadoc' + sh 'mvn -X javadoc:javadoc' } } } @@ -181,7 +181,7 @@ stages { } post { always { - javadoc: Publish Javadoc + javadoc: 'Publish Javadoc' } failure { /*mail bcc: '', From 774e24945d8e5a09477e04a44fe84e15967fd840 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 22:01:19 +0530 Subject: [PATCH 076/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d8603c8..2da4934 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -180,9 +180,7 @@ stages { } } post { - always { - javadoc: 'Publish Javadoc' - } + failure { /*mail bcc: '', body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", From 938b03f21ceafcdf8ff820f126986dcce0ac21d7 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 22:07:33 +0530 Subject: [PATCH 077/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 2da4934..6179420 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -30,7 +30,7 @@ stages { echo 'I am executing unit test' // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' sh 'mvn -f sample-java-app/pom.xml clean package' - sh 'mvn -X javadoc:javadoc' + sh 'mvn javadoc:aggregate' } } } From a8a660a390cae2b35a403e1143a5da5017b74f41 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 23:16:32 +0530 Subject: [PATCH 078/148] Rename Jenkinsfile to Jenkinsfile_DNU --- Jenkinsfile => Jenkinsfile_DNU | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Jenkinsfile => Jenkinsfile_DNU (100%) diff --git a/Jenkinsfile b/Jenkinsfile_DNU similarity index 100% rename from Jenkinsfile rename to Jenkinsfile_DNU From 7ec91f54cb4571ef06fc0f926568b69d0f3e9c6c Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Wed, 3 Feb 2021 23:59:49 +0530 Subject: [PATCH 079/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 6179420..e59643d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -180,7 +180,9 @@ stages { } } post { - + always { + javadoc(javadocDir: '/home/jenkins/agent/workspace/Sandbox/EJB_test/target/site/apidocs', keepAll: true) + } failure { /*mail bcc: '', body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", From c2ab7949f60b7092009eb1aa89f85d4c039ca795 Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 4 Feb 2021 01:18:09 +0530 Subject: [PATCH 080/148] Update pom.xml Testing Jacoco --- pom.xml | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 045cb13..b7ad07b 100644 --- a/pom.xml +++ b/pom.xml @@ -73,7 +73,52 @@ httpclient 4.5.3 - + + org.jacoco + jacoco-maven-plugin + 0.8.3 + + + jacoco-initialize + + prepare-agent + + + + jacoco-report + test + + report + + + + + coverage-check + + check + + + target/jacoco-report + ${project.build.directory}/coverage-reports/jacoco.exec + + + CLASS + + com.asimio.demo.Application + + + + LINE + COVEREDRATIO + 80% + + + + + + + + From 5aac604f95917b021732396d87554371db17dfdf Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 4 Feb 2021 01:20:45 +0530 Subject: [PATCH 081/148] Update Jenkinsfile_AIP Testing Jacoco --- Jenkinsfile_AIP | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index e59643d..2237021 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -31,6 +31,13 @@ stages { // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' sh 'mvn -f sample-java-app/pom.xml clean package' sh 'mvn javadoc:aggregate' + sh 'mvn test' + jacoco( + execPattern: '**/*.exec', + classPattern: '**/*.class', + sourcePattern: '**/*.java', + exclusionPattern: '**/test*' + ) } } } From 09e3b91b21493e8c0b370ab20e634a62e539cada Mon Sep 17 00:00:00 2001 From: sdgcpsb <76002842+sdgcpsb@users.noreply.github.com> Date: Thu, 4 Feb 2021 01:31:41 +0530 Subject: [PATCH 082/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 2237021..24c7443 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -31,7 +31,6 @@ stages { // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' sh 'mvn -f sample-java-app/pom.xml clean package' sh 'mvn javadoc:aggregate' - sh 'mvn test' jacoco( execPattern: '**/*.exec', classPattern: '**/*.class', From 7702157b8844d1577f60a617799b0005af78081c Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 11:04:46 -0600 Subject: [PATCH 083/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 24c7443..25d962a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -187,7 +187,8 @@ stages { } post { always { - javadoc(javadocDir: '/home/jenkins/agent/workspace/Sandbox/EJB_test/target/site/apidocs', keepAll: true) + //javadoc(javadocDir: '/home/jenkins/agent/workspace/Sandbox/EJB_test/target/site/apidocs', keepAll: true) + javadoc(javadocDir: '/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs', keepAll: true) } failure { /*mail bcc: '', From b145ec5f8bd97a1922e8e2efbb75137575a513ef Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 11:09:37 -0600 Subject: [PATCH 084/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 25d962a..ed8bdf1 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -188,7 +188,8 @@ stages { post { always { //javadoc(javadocDir: '/home/jenkins/agent/workspace/Sandbox/EJB_test/target/site/apidocs', keepAll: true) - javadoc(javadocDir: '/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs', keepAll: true) + //javadoc(javadocDir: '/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs', keepAll: true) + echo '${env.JOB_NAME}' } failure { /*mail bcc: '', From a87ae73b6e8d4164b10a8046c3bfc7a57ad38297 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 11:15:23 -0600 Subject: [PATCH 085/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index ed8bdf1..cd9bc02 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -188,8 +188,8 @@ stages { post { always { //javadoc(javadocDir: '/home/jenkins/agent/workspace/Sandbox/EJB_test/target/site/apidocs', keepAll: true) - //javadoc(javadocDir: '/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs', keepAll: true) - echo '${env.JOB_NAME}' + echo "${env.JOB_NAME}" + javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) } failure { /*mail bcc: '', From 224c28a274e5bfefea62145559de53b8cf02a9f0 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 11:33:40 -0600 Subject: [PATCH 086/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 -- 1 file changed, 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index cd9bc02..058cae7 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -187,8 +187,6 @@ stages { } post { always { - //javadoc(javadocDir: '/home/jenkins/agent/workspace/Sandbox/EJB_test/target/site/apidocs', keepAll: true) - echo "${env.JOB_NAME}" javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) } failure { From 1f80d03b000145ce738c24612cc5b11719bc6ece Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 13:43:49 -0600 Subject: [PATCH 087/148] Update project.properties --- project.properties | 2 ++ 1 file changed, 2 insertions(+) diff --git a/project.properties b/project.properties index 76c7318..1c7df16 100644 --- a/project.properties +++ b/project.properties @@ -1,2 +1,4 @@ feature_deploy=false servers=lxapp.2378 lxapp.656 lxapp.5376 +javadoc=true +jacoco=true From 9933bba022da35be4ec0a4915ff3883b84a80eb7 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 13:48:28 -0600 Subject: [PATCH 088/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 058cae7..bfdfd8a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -25,19 +25,26 @@ stages { stage('Build & Unit Test') { steps { container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName: 'Sonarqube') { - echo 'I am executing unit test' - // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' - sh 'mvn -f sample-java-app/pom.xml clean package' - sh 'mvn javadoc:aggregate' - jacoco( - execPattern: '**/*.exec', - classPattern: '**/*.class', - sourcePattern: '**/*.java', - exclusionPattern: '**/test*' - ) - } + script { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing unit test' + // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' + sh 'mvn -f sample-java-app/pom.xml clean package' + propfile = readProperties(file: './project.properties') + if (propfile['javadoc'] == "true") { + sh 'mvn javadoc:aggregate' + } + if (propfile['jacoco'] == "true") { + jacoco( + execPattern: '**/*.exec', + classPattern: '**/*.class', + sourcePattern: '**/*.java', + exclusionPattern: '**/test*' + ) + } + } + } } } } @@ -187,7 +194,10 @@ stages { } post { always { - javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) + propfile = readProperties(file: './project.properties') + if (propfile['feature_deploy'] == "true") { + javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) + } } failure { /*mail bcc: '', From 8b2010a0a9804a89cc0d888a667346ff0e8cc09a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 13:51:34 -0600 Subject: [PATCH 089/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index bfdfd8a..16b0312 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -194,9 +194,11 @@ stages { } post { always { - propfile = readProperties(file: './project.properties') - if (propfile['feature_deploy'] == "true") { - javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) + script { + propfile = readProperties(file: './project.properties') + if (propfile['feature_deploy'] == "true") { + javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) + } } } failure { From 78c52aa3c443740ba9479fe7b306d8302e73c9ae Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 5 Feb 2021 15:00:00 -0600 Subject: [PATCH 090/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 16b0312..e1ff94a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -196,7 +196,7 @@ stages { always { script { propfile = readProperties(file: './project.properties') - if (propfile['feature_deploy'] == "true") { + if (propfile['javadoc'] == "true") { javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) } } From 90b908b63a31bf9e7e9706eb2555e2b7630927e5 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 10 Feb 2021 06:31:57 -0600 Subject: [PATCH 091/148] Update project.properties --- project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project.properties b/project.properties index 035a407..d4ee6f2 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ feature_deploy=false servers=lxapp.2378 lxapp.656 lxapp.5376 -javadoc=true -jacoco=true \ No newline at end of file +javadoc=false +jacoco=false From f9556672569d4bca7fc766eb52465bf89ac31839 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 10 Feb 2021 08:44:01 -0600 Subject: [PATCH 092/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7b20e48..54905ed 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -30,6 +30,7 @@ stages { withSonarQubeEnv(installationName: 'Sonarqube') { echo 'I am executing unit test' // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' + echo 'Add gradle clean and build for EJB and comment this step' sh 'mvn -f sample-java-app/pom.xml clean package' propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { @@ -49,31 +50,13 @@ stages { } } } - stage('check_build_version'){ - steps { - container('gradle') { - /* $versionLine = (Get-Content build.gradle) -match "version\s*=\s*'\s*(\d+)\.(\d)+" - "$versionLine" -match "version\s*=\s*'\s*(\d+)\.(\d)+" - $major = $matches[1] - $minor = $matches[2] - $gitStatus = (git status) -match "On branch" - "$gitStatus" -match "On branch\s*(\w+)" - $branch = $matches[1] - - $tag = "$branch-${bamboo.planKey}-$major.$minor.${bamboo.buildNumber}${bamboo.repository.branch.name}" - - git tag "$tag" - git remote add origin http://${bamboo.git.user}:${bamboo.git.password}@${bamboo.git.url} - git push origin "$tag" */ - } - } - } stage('Code Quality') { steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { withSonarQubeEnv(installationName: 'Sonarqube') { echo 'I am executing code quality using sonarqube' + echo 'Change the below command for sonar using the syntax from rakshitas jenkinsfile' sh 'mvn -f sample-java-app/pom.xml sonar:sonar' } /* sleep(60) @@ -94,6 +77,7 @@ stages { if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' + echo 'Replace the next 4 lines to reflect the EJB artifact and push it to archiva' /* echo 'copying the jar and war files from the individual target directorrys and copying it to artifacts directory ' sh "mkdir -p $WORKSPACE/artifacts" sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do cp -rp ${i}/dist/libs/* $WORKSPACE/artifacts/ ;done' */ @@ -119,6 +103,8 @@ stages { if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { echo 'I am deploying the artifact into the target environment' + echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' + echo 'Accom logic for multiple env and mult servers in each env based on the branch name' echo 'shutting down the tomcat ESB server' /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' echo 'force stop any remaining mule process' From e1e295eaf14ed84da6a4bf66440a23c461885db5 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 07:50:49 -0600 Subject: [PATCH 093/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 115 +++++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 56 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 54905ed..e906e01 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,3 +1,5 @@ +def CONF = readProperties file: './project.properties' + pipeline { agent { @@ -27,23 +29,22 @@ stages { container('gradle') { script { withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName: 'Sonarqube') { - echo 'I am executing unit test' - // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' - echo 'Add gradle clean and build for EJB and comment this step' - sh 'mvn -f sample-java-app/pom.xml clean package' - propfile = readProperties(file: './project.properties') - if (propfile['javadoc'] == "true") { - sh 'mvn javadoc:aggregate' - } - if (propfile['jacoco'] == "true") { - jacoco( - execPattern: '**/*.exec', - classPattern: '**/*.class', - sourcePattern: '**/*.java', - exclusionPattern: '**/test*' - ) - } + echo 'I am executing build and unit test' + echo 'use the command below when we switch to EJB source' + // sh 'gradle --no-daemon clean build' + echo 'Add gradle clean and build for EJB and comment this step' + sh 'mvn -f sample-java-app/pom.xml clean package' + //propfile = readProperties(file: './project.properties') + if (CONF['javadoc'] == "true") { + sh 'mvn javadoc:aggregate' + } + if (CONF['jacoco'] == "true") { + jacoco( + execPattern: '**/*.exec', + classPattern: '**/*.class', + sourcePattern: '**/*.java', + exclusionPattern: '**/test*' + ) } } } @@ -56,13 +57,15 @@ stages { withMaven(maven: 'MAVEN-3.6.3') { withSonarQubeEnv(installationName: 'Sonarqube') { echo 'I am executing code quality using sonarqube' - echo 'Change the below command for sonar using the syntax from rakshitas jenkinsfile' - sh 'mvn -f sample-java-app/pom.xml sonar:sonar' + echo "Change the line below when we switch to the actual EJB repo" + // sh 'gradle SonarQube' + echo 'Remove the line below when we switch to the actual EJB repo' + sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' } - /* sleep(60) + sleep(60) timeout(time: 1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - } */ + } } } } @@ -73,20 +76,21 @@ stages { script { propfile = readProperties(file: './project.properties') println("deploy:" + propfile['feature_deploy']) - println("reading properties ...") if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' echo 'Replace the next 4 lines to reflect the EJB artifact and push it to archiva' - /* echo 'copying the jar and war files from the individual target directorrys and copying it to artifacts directory ' + echo 'Use the 5 lines below when we switch to the actual EJB repo' + /* echo 'copying the jar and war files from the individual target directories and copying it to artifacts directory ' sh "mkdir -p $WORKSPACE/artifacts" - sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do cp -rp ${i}/dist/libs/* $WORKSPACE/artifacts/ ;done' */ - /* echo 'create a tar file on the Jenkins server' - sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */ + sh 'cp /dist/libs/* $WORKSPACE/artifacts/' + echo 'create a tar file on the Jenkins server' + sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true + */ + echo 'Remove the 3 lines below when we switch to the actual EJB repo' sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' sh 'ls -lrt sample-java-app/target/' sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' - echo "noooooooooooooooooo" } } } @@ -99,7 +103,6 @@ stages { script { propfile = readProperties(file: './project.properties') println("deploy:" + propfile['feature_deploy']) - println("reading properties ...") if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { echo 'I am deploying the artifact into the target environment' @@ -176,32 +179,32 @@ stages { echo 'I am running Security Test here' } } - } - } - } - post { - always { - script { - propfile = readProperties(file: './project.properties') - if (propfile['javadoc'] == "true") { - javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) - } - } - } - failure { - /*mail bcc: '', - body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", - cc: '', - charset: 'UTF-8', - from: '', - mimeType: 'text/html', - replyTo: '', - subject: "ERROR CI: Project name -> ${env.JOB_NAME}", - to: "foo@foomail.com";*/ - echo 'I am sending a notification with failure' - } - success { - echo 'I am sending a notification with success' - } - } + } + } + } + post { + always { + script { + propfile = readProperties(file: './project.properties') + if (propfile['javadoc'] == "true") { + javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) + } + } + } + failure { + /*mail bcc: '', + body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", + cc: '', + charset: 'UTF-8', + from: '', + mimeType: 'text/html', + replyTo: '', + subject: "ERROR CI: Project name -> ${env.JOB_NAME}", + to: "foo@foomail.com";*/ + echo 'I am sending a notification with failure' + } + success { + echo 'I am sending a notification with success' + } + } } From 50f9854dd79cc0472e3d5928550c8ba1a70815a3 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 07:56:31 -0600 Subject: [PATCH 094/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 226 ++++++++++++++++++++++++------------------------ 1 file changed, 111 insertions(+), 115 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index e906e01..a97a16d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,138 +1,135 @@ def CONF = readProperties file: './project.properties' pipeline { - - agent { - kubernetes { - label 'SpringBootRestApp' - defaultContainer 'jnlp' - yaml """ -apiVersion: v1 -kind: Pod -metadata: -labels: - component: ci -spec: - containers: - - name: gradle - image: gradle:3.5-jdk8-alpine - command: - - cat - tty: true -""" -} - } - -stages { - stage('Build & Unit Test') { - steps { - container('gradle') { - script { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and unit test' - echo 'use the command below when we switch to EJB source' - // sh 'gradle --no-daemon clean build' - echo 'Add gradle clean and build for EJB and comment this step' - sh 'mvn -f sample-java-app/pom.xml clean package' - //propfile = readProperties(file: './project.properties') - if (CONF['javadoc'] == "true") { - sh 'mvn javadoc:aggregate' - } - if (CONF['jacoco'] == "true") { - jacoco( - execPattern: '**/*.exec', - classPattern: '**/*.class', - sourcePattern: '**/*.java', - exclusionPattern: '**/test*' - ) - } - } + agent { + kubernetes { + label 'SpringBootRestApp' + defaultContainer 'jnlp' + yaml """ + apiVersion: v1 + kind: Pod + metadata: + labels: + component: ci + spec: + containers: + - name: gradle + image: gradle:3.5-jdk8-alpine + command: + - cat + tty: true + """ + } + } + stages { + stage('Build & Unit Test') { + steps { + container('gradle') { + script { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am executing build and unit test' + echo 'use the command below when we switch to EJB source' + // sh 'gradle --no-daemon clean build' + echo 'Add gradle clean and build for EJB and comment this step' + sh 'mvn -f sample-java-app/pom.xml clean package' + //propfile = readProperties(file: './project.properties') + if (CONF['javadoc'] == "true") { + sh 'mvn javadoc:aggregate' + } + if (CONF['jacoco'] == "true") { + jacoco( + execPattern: '**/*.exec', + classPattern: '**/*.class', + sourcePattern: '**/*.java', + exclusionPattern: '**/test*' + ) + } + } + } } } } - } - stage('Code Quality') { - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName: 'Sonarqube') { - echo 'I am executing code quality using sonarqube' - echo "Change the line below when we switch to the actual EJB repo" - // sh 'gradle SonarQube' - echo 'Remove the line below when we switch to the actual EJB repo' - sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' + stage('Code Quality') { + steps { + container('gradle') { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing code quality using sonarqube' + echo "Change the line below when we switch to the actual EJB repo" + // sh 'gradle SonarQube' + echo 'Remove the line below when we switch to the actual EJB repo' + sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' + } + sleep(60) + timeout(time: 1, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } } - sleep(60) - timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } } } } - } - stage("Publish Package") { - steps { - container('gradle') { - script { - propfile = readProperties(file: './project.properties') - println("deploy:" + propfile['feature_deploy']) - if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' - echo 'Replace the next 4 lines to reflect the EJB artifact and push it to archiva' - echo 'Use the 5 lines below when we switch to the actual EJB repo' - /* echo 'copying the jar and war files from the individual target directories and copying it to artifacts directory ' - sh "mkdir -p $WORKSPACE/artifacts" - sh 'cp /dist/libs/* $WORKSPACE/artifacts/' - echo 'create a tar file on the Jenkins server' - sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true - */ - echo 'Remove the 3 lines below when we switch to the actual EJB repo' - sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' - sh 'ls -lrt sample-java-app/target/' - sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + stage("Publish Package") { + steps { + container('gradle') { + script { + propfile = readProperties(file: './project.properties') + println("deploy:" + propfile['feature_deploy']) + if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' + echo 'Replace the next 4 lines to reflect the EJB artifact and push it to archiva' + echo 'Use the 5 lines below when we switch to the actual EJB repo' + /* echo 'copying the jar and war files from the individual target directories and copying it to artifacts directory ' + sh "mkdir -p $WORKSPACE/artifacts" + sh 'cp /dist/libs/* $WORKSPACE/artifacts/' + echo 'create a tar file on the Jenkins server' + sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true + */ + echo 'Remove the 3 lines below when we switch to the actual EJB repo' + sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' + sh 'ls -lrt sample-java-app/target/' + sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + } } } } } } - } - stage("Deploy") { - steps { - container('gradle') { - script { - propfile = readProperties(file: './project.properties') - println("deploy:" + propfile['feature_deploy']) - if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am deploying the artifact into the target environment' - echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' - echo 'Accom logic for multiple env and mult servers in each env based on the branch name' - echo 'shutting down the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' - echo 'force stop any remaining mule process' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' */ - echo 'tomcat server stopped' - echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' - /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' */ - echo 'Deployment has been completed' - echo 'starting the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' */ - echo 'tomcat server started' + stage("Deploy") { + steps { + container('gradle') { + script { + propfile = readProperties(file: './project.properties') + println("deploy:" + propfile['feature_deploy']) + if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am deploying the artifact into the target environment' + echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' + echo 'Accom logic for multiple env and mult servers in each env based on the branch name' + echo 'shutting down the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' + echo 'force stop any remaining mule process' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' */ + echo 'tomcat server stopped' + echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' + /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' */ + echo 'Deployment has been completed' + echo 'starting the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' */ + echo 'tomcat server started' + } + } else { + echo "no need" } - } else { - echo "no need" } } } } } -} - stage('Post Deploy Tests') { parallel { stage('Smoke Test') { @@ -207,4 +204,3 @@ stages { echo 'I am sending a notification with success' } } -} From c6bf3ea7820fde5bbbc342370bf0041eabd5a246 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 07:58:05 -0600 Subject: [PATCH 095/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index a97a16d..0f73029 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -129,7 +129,7 @@ pipeline { } } } - } + stage('Post Deploy Tests') { parallel { stage('Smoke Test') { @@ -204,3 +204,4 @@ pipeline { echo 'I am sending a notification with success' } } +} From 9455ce6113c314bc1bffb9426e6af5211e73691b Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 07:59:25 -0600 Subject: [PATCH 096/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 0f73029..52c6eb8 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -32,11 +32,11 @@ pipeline { // sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' sh 'mvn -f sample-java-app/pom.xml clean package' - //propfile = readProperties(file: './project.properties') - if (CONF['javadoc'] == "true") { + propfile = readProperties(file: './project.properties') + if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' } - if (CONF['jacoco'] == "true") { + if (propfile['jacoco'] == "true") { jacoco( execPattern: '**/*.exec', classPattern: '**/*.class', From e1ac1bd8d6b61122dbb9b369b29abc57256a971f Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:00:25 -0600 Subject: [PATCH 097/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 52c6eb8..b8b818a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,4 +1,4 @@ -def CONF = readProperties file: './project.properties' +//def CONF = readProperties file: './project.properties' pipeline { agent { From 748af5a9580c9e1da5b193e541cc9a55d5d952e4 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:03:09 -0600 Subject: [PATCH 098/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index b8b818a..e7370d5 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -6,19 +6,19 @@ pipeline { label 'SpringBootRestApp' defaultContainer 'jnlp' yaml """ - apiVersion: v1 - kind: Pod - metadata: - labels: - component: ci - spec: - containers: - - name: gradle - image: gradle:3.5-jdk8-alpine - command: - - cat - tty: true - """ +apiVersion: v1 +kind: Pod +metadata: +labels: + component: ci +spec: + containers: + - name: gradle + image: gradle:3.5-jdk8-alpine + command: + - cat + tty: true +""" } } stages { From bc7bad2fc2298cc1ad6e4a2c3ad2c32d17d7503c Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:03:59 -0600 Subject: [PATCH 099/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index e7370d5..39f253d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,4 +1,4 @@ -//def CONF = readProperties file: './project.properties' +def CONF = readProperties file: './project.properties' pipeline { agent { From 6345c3479ea809d3741f31c26862bf6b157f802b Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:10:29 -0600 Subject: [PATCH 100/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 39f253d..2b99192 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,4 +1,4 @@ -def CONF = readProperties file: './project.properties' +def propfile = readProperties file: './project.properties' pipeline { agent { @@ -32,7 +32,7 @@ spec: // sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' sh 'mvn -f sample-java-app/pom.xml clean package' - propfile = readProperties(file: './project.properties') + //propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' } From 343018c3580187c58c345b47e8caa3be1e019311 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:11:23 -0600 Subject: [PATCH 101/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 2b99192..708bac9 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,4 +1,4 @@ -def propfile = readProperties file: './project.properties' +//def propfile = readProperties file: './project.properties' pipeline { agent { @@ -32,7 +32,7 @@ spec: // sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' sh 'mvn -f sample-java-app/pom.xml clean package' - //propfile = readProperties(file: './project.properties') + propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' } From b249d2800256a4e0cf8b3756637cb601b91cce6a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:25:13 -0600 Subject: [PATCH 102/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 93 ++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 47 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 708bac9..8f0a6b1 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,4 +1,4 @@ -//def propfile = readProperties file: './project.properties' +def propfile pipeline { agent { @@ -99,7 +99,7 @@ spec: steps { container('gradle') { script { - propfile = readProperties(file: './project.properties') + //propfile = readProperties(file: './project.properties') println("deploy:" + propfile['feature_deploy']) if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { @@ -129,54 +129,53 @@ spec: } } } - - stage('Post Deploy Tests') { - parallel { - stage('Smoke Test') { - steps { - echo "I am executing Smoke Test on target dev environment post deployment" + stage('Post Deploy Tests') { + parallel { + stage('Smoke Test') { + steps { + echo "I am executing Smoke Test on target dev environment post deployment" + } + /*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` + echo "The response for current execution status is: $RESP" + if [ "$RESP" != "[]" ]; + then + echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." + exit 1 + else + echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" + fi + # To abort the request before attempting to re-run, uncomment and run below line. + # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/) + guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \") + echo "The GUID is: $guid" + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + while [[ $status != *"Completed"* ]] + do + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + sleep 15 + done + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/) + echo "The status is: $status" + execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) + echo "The exec status is: $execstatus" + if [[ $execstatus != *Passed* ]]; + then + echo "Failed" + exit 1 + else + echo "Passed" + exit + fi + exit */ } - /*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` - echo "The response for current execution status is: $RESP" - if [ "$RESP" != "[]" ]; - then - echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." - exit 1 - else - echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" - fi - # To abort the request before attempting to re-run, uncomment and run below line. - # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/) - guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \") - echo "The GUID is: $guid" - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) - echo "The status is: $status" - while [[ $status != *"Completed"* ]] - do - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) - echo "The status is: $status" - sleep 15 - done - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/) - echo "The status is: $status" - execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) - echo "The exec status is: $execstatus" - if [[ $execstatus != *Passed* ]]; - then - echo "Failed" - exit 1 - else - echo "Passed" - exit - fi - exit */ - } - stage('Security Test') { - steps { - echo 'I am running Security Test here' + stage('Security Test') { + steps { + echo 'I am running Security Test here' + } } } - } } } post { From 49c9efa0afa95bb391361370db5cc95a63e78158 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 08:30:54 -0600 Subject: [PATCH 103/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 8f0a6b1..1f6812b 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -72,7 +72,6 @@ spec: steps { container('gradle') { script { - propfile = readProperties(file: './project.properties') println("deploy:" + propfile['feature_deploy']) if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { @@ -99,7 +98,6 @@ spec: steps { container('gradle') { script { - //propfile = readProperties(file: './project.properties') println("deploy:" + propfile['feature_deploy']) if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { @@ -181,7 +179,7 @@ spec: post { always { script { - propfile = readProperties(file: './project.properties') + //propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) } From f1f3c47dd61a625414a7e35365d1dcc06ee84659 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 12:23:57 -0600 Subject: [PATCH 104/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 92 +++++++++++++++++++++++++++---------------------- 1 file changed, 50 insertions(+), 42 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 1f6812b..357ea57 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -21,6 +21,35 @@ spec: """ } } + environment { + GRADLE_PATH = '/opt/gradle/gradle-3.5.1/bin' + GRADLE_TASK = 'ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB' + DEPOYMENT_SERVER='10.6.74.90' + DEPLOYMENT_USER='muleadmin' + DEPLOYMENT_ARCHIVE_DIR='/home/muleadmin/stage/archive' + DEPLOYMENT_STAGE_DIR='/home/muleadmin/stage' + DEPLOYMENT_DIR='/opt/mule/latest/webapps' + WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' + ESB_BIN_PATH='/opt/mule/bin/esb_service' + ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' + RequestID=779 + stage_name=dev3 + uri=http://pwwsftapp01/executionmanager/api + username=devopsengineering@signetjewelers.com + } + propfile = readProperties(file: './project.properties') + if (propfile['feature_deploy'] == "true" ) { + USERNAME='muleadmin' + HOSTS='10.6.74.90' + } + if (env.BRANCH_NAME == 'dev' ) { + USERNAME='muleadmin' + HOSTS='10.6.74.91' + } + if (env.BRANCH_NAME == 'release') { + USERNAME='muleadmin' + HOSTS="'10.6.74.92' '10.6.74.93'" + } stages { stage('Build & Unit Test') { steps { @@ -29,10 +58,10 @@ spec: withMaven(maven: 'MAVEN-3.6.3') { echo 'I am executing build and unit test' echo 'use the command below when we switch to EJB source' - // sh 'gradle --no-daemon clean build' + //sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' sh 'mvn -f sample-java-app/pom.xml clean package' - propfile = readProperties(file: './project.properties') + //propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' } @@ -72,7 +101,6 @@ spec: steps { container('gradle') { script { - println("deploy:" + propfile['feature_deploy']) if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' @@ -98,7 +126,6 @@ spec: steps { container('gradle') { script { - println("deploy:" + propfile['feature_deploy']) if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { echo 'I am deploying the artifact into the target environment' @@ -121,7 +148,7 @@ spec: echo 'tomcat server started' } } else { - echo "no need" + echo "Deployment not required" } } } @@ -131,46 +158,28 @@ spec: parallel { stage('Smoke Test') { steps { - echo "I am executing Smoke Test on target dev environment post deployment" + container('gradle') { + script { + if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { + withMaven(maven: 'MAVEN-3.6.3') { + echo "I am executing Smoke Test on target dev environment post deployment" + } + } + } + } } - /*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` - echo "The response for current execution status is: $RESP" - if [ "$RESP" != "[]" ]; - then - echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." - exit 1 - else - echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" - fi - # To abort the request before attempting to re-run, uncomment and run below line. - # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/) - guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \") - echo "The GUID is: $guid" - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) - echo "The status is: $status" - while [[ $status != *"Completed"* ]] - do - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) - echo "The status is: $status" - sleep 15 - done - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/) - echo "The status is: $status" - execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) - echo "The exec status is: $execstatus" - if [[ $execstatus != *Passed* ]]; - then - echo "Failed" - exit 1 - else - echo "Passed" - exit - fi - exit */ } stage('Security Test') { steps { - echo 'I am running Security Test here' + container('gradle') { + script { + if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am running Security Test here' + } + } + } + } } } } @@ -179,7 +188,6 @@ spec: post { always { script { - //propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) } From 1d8c7c094252e842337ef14951c38b5c89179e3b Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 12:26:55 -0600 Subject: [PATCH 105/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 357ea57..966a5c1 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -32,10 +32,10 @@ spec: WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' ESB_BIN_PATH='/opt/mule/bin/esb_service' ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' - RequestID=779 - stage_name=dev3 - uri=http://pwwsftapp01/executionmanager/api - username=devopsengineering@signetjewelers.com + REQUESTID=779 + STAGE_NAME=dev3 + URI=http://pwwsftapp01/executionmanager/api + USERNAME=devopsengineering@signetjewelers.com } propfile = readProperties(file: './project.properties') if (propfile['feature_deploy'] == "true" ) { From 313c1fe44241759d83eeaceca1d24df84218d22a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 12:27:44 -0600 Subject: [PATCH 106/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 966a5c1..bd90028 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -32,10 +32,10 @@ spec: WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' ESB_BIN_PATH='/opt/mule/bin/esb_service' ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' - REQUESTID=779 - STAGE_NAME=dev3 - URI=http://pwwsftapp01/executionmanager/api - USERNAME=devopsengineering@signetjewelers.com + REQUESTID='779' + STAGE_NAME='dev3' + URI='http://pwwsftapp01/executionmanager/api' + USERNAME='devopsengineering@signetjewelers.com' } propfile = readProperties(file: './project.properties') if (propfile['feature_deploy'] == "true" ) { From 4b4fdf9b28d6ba2160afc318ad55f519bb68722d Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 12:29:04 -0600 Subject: [PATCH 107/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index bd90028..e2cfb7a 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -34,7 +34,7 @@ spec: ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' REQUESTID='779' STAGE_NAME='dev3' - URI='http://pwwsftapp01/executionmanager/api' + URI="http://pwwsftapp01/executionmanager/api" USERNAME='devopsengineering@signetjewelers.com' } propfile = readProperties(file: './project.properties') From f051585777e378dd7926e2ff2121601f379a7a25 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 12:29:50 -0600 Subject: [PATCH 108/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index e2cfb7a..5eb54cb 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -34,7 +34,7 @@ spec: ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' REQUESTID='779' STAGE_NAME='dev3' - URI="http://pwwsftapp01/executionmanager/api" + //URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' } propfile = readProperties(file: './project.properties') From 231e14f08f037c2367eab4728b9d3521033280fe Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 12:32:19 -0600 Subject: [PATCH 109/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 5eb54cb..b3d7ec4 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -37,7 +37,8 @@ spec: //URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' } - propfile = readProperties(file: './project.properties') + //All of these lines need to be within a script step (stages>stage>steps>script) in order to work + /*propfile = readProperties(file: './project.properties') if (propfile['feature_deploy'] == "true" ) { USERNAME='muleadmin' HOSTS='10.6.74.90' @@ -49,7 +50,7 @@ spec: if (env.BRANCH_NAME == 'release') { USERNAME='muleadmin' HOSTS="'10.6.74.92' '10.6.74.93'" - } + }*/ stages { stage('Build & Unit Test') { steps { @@ -61,7 +62,7 @@ spec: //sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' sh 'mvn -f sample-java-app/pom.xml clean package' - //propfile = readProperties(file: './project.properties') + propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' } From 23d292264450e38d2e900cac366c23b7af55d2ad Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 13:19:16 -0600 Subject: [PATCH 110/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index b3d7ec4..d0384de 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -34,10 +34,13 @@ spec: ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' REQUESTID='779' STAGE_NAME='dev3' + //These seems to be a problem when declaring URI in env, results in WorkflowScript: 37: you tried to assign a value to the class 'java.net.URI' //URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' } //All of these lines need to be within a script step (stages>stage>steps>script) in order to work + //If we include javadoc and jacoco flags in jenkinsfile it takes care of the propfile variable initialization + //We just need to work out were to insert the deploy info /*propfile = readProperties(file: './project.properties') if (propfile['feature_deploy'] == "true" ) { USERNAME='muleadmin' @@ -129,7 +132,11 @@ spec: script { if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am deploying the artifact into the target environment' + //Need to add info and initialize to be able to use these lines + /*for HOSTNAME in ${HOSTS} ; do + $DEPOYMENT_SERVER=$HOSTNAME + $DEPLOYMENT_USER=$USERNAME + echo "I am deploying the artifact into the target environment $HOSTNAME"*/ echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' echo 'Accom logic for multiple env and mult servers in each env based on the branch name' echo 'shutting down the tomcat ESB server' From c35678261ab5309bcfde38b64ce56e6213bb9f12 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:15:06 -0600 Subject: [PATCH 111/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 51 ++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d0384de..7fe9d4f 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -34,26 +34,15 @@ spec: ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' REQUESTID='779' STAGE_NAME='dev3' - //These seems to be a problem when declaring URI in env, results in WorkflowScript: 37: you tried to assign a value to the class 'java.net.URI' - //URI='http://pwwsftapp01/executionmanager/api' + WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' + USERNAME_FEATURE_DEPLOY='muleadmin' + HOSTS_FEATURE_DEPLOY='10.6.74.90' + USERNAME_DEV_DEPLOY='muleadmin' + HOSTS_DEV_DEPLOY='10.6.74.91' + USERNAME_RELEASE='muleadmin' + HOSTS_RELEASE_DEPLOY="'10.6.74.92' '10.6.74.93'" } - //All of these lines need to be within a script step (stages>stage>steps>script) in order to work - //If we include javadoc and jacoco flags in jenkinsfile it takes care of the propfile variable initialization - //We just need to work out were to insert the deploy info - /*propfile = readProperties(file: './project.properties') - if (propfile['feature_deploy'] == "true" ) { - USERNAME='muleadmin' - HOSTS='10.6.74.90' - } - if (env.BRANCH_NAME == 'dev' ) { - USERNAME='muleadmin' - HOSTS='10.6.74.91' - } - if (env.BRANCH_NAME == 'release') { - USERNAME='muleadmin' - HOSTS="'10.6.74.92' '10.6.74.93'" - }*/ stages { stage('Build & Unit Test') { steps { @@ -132,27 +121,41 @@ spec: script { if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { - //Need to add info and initialize to be able to use these lines - /*for HOSTNAME in ${HOSTS} ; do + if (propfile['feature_deploy'] == "true" ) { + USERNAME=$USERNAME_FEATURE_DEPLOY + HOSTS=$HOST_FEATURE_DEPLOY + } + if (env.BRANCH_NAME == 'dev' ) { + USERNAME=$USERNAME_DEV_DEPLOY + HOSTS=$HOST_DEV_DEPLOY + } + if (env.BRANCH_NAME == 'release') { + USERNAME=$USERNAME_RELEASE_DEPLOY + HOSTS=$HOST_RELEASE_DEPLOY + } + for HOSTNAME in ${HOSTS} ; do $DEPOYMENT_SERVER=$HOSTNAME $DEPLOYMENT_USER=$USERNAME - echo "I am deploying the artifact into the target environment $HOSTNAME"*/ + echo "I am deploying the artifact into the target environment $HOSTNAME" echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' echo 'Accom logic for multiple env and mult servers in each env based on the branch name' echo 'shutting down the tomcat ESB server' /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' echo 'force stop any remaining mule process' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' */ + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' + */ echo 'tomcat server stopped' echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' */ + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' + */ echo 'Deployment has been completed' echo 'starting the tomcat ESB server' /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' */ + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' + */ echo 'tomcat server started' } } else { From f522a3f7d28053e556965f199fe1034727c77ed6 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:16:02 -0600 Subject: [PATCH 112/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7fe9d4f..c9f84ae 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -137,6 +137,7 @@ spec: $DEPOYMENT_SERVER=$HOSTNAME $DEPLOYMENT_USER=$USERNAME echo "I am deploying the artifact into the target environment $HOSTNAME" + echo "Username = $USERNAME" echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' echo 'Accom logic for multiple env and mult servers in each env based on the branch name' echo 'shutting down the tomcat ESB server' From 9ec5f99d99821e4c1306b6aa98bba760ca36bb0a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:20:09 -0600 Subject: [PATCH 113/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index c9f84ae..2848958 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -121,6 +121,7 @@ spec: script { if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { withMaven(maven: 'MAVEN-3.6.3') { + HOSTNAME='' if (propfile['feature_deploy'] == "true" ) { USERNAME=$USERNAME_FEATURE_DEPLOY HOSTS=$HOST_FEATURE_DEPLOY From af809bde85d14876678f55b3d3da130f79a8f24b Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:25:11 -0600 Subject: [PATCH 114/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 51 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 25 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 2848958..7d09581 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -134,31 +134,32 @@ spec: USERNAME=$USERNAME_RELEASE_DEPLOY HOSTS=$HOST_RELEASE_DEPLOY } - for HOSTNAME in ${HOSTS} ; do - $DEPOYMENT_SERVER=$HOSTNAME - $DEPLOYMENT_USER=$USERNAME - echo "I am deploying the artifact into the target environment $HOSTNAME" - echo "Username = $USERNAME" - echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' - echo 'Accom logic for multiple env and mult servers in each env based on the branch name' - echo 'shutting down the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' - echo 'force stop any remaining mule process' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' - */ - echo 'tomcat server stopped' - echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' - /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' - */ - echo 'Deployment has been completed' - echo 'starting the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' - */ - echo 'tomcat server started' + for (HOSTNAME in ${HOSTS}) { + $DEPOYMENT_SERVER=$HOSTNAME + $DEPLOYMENT_USER=$USERNAME + echo "I am deploying the artifact into the target environment $HOSTNAME" + echo "Username = $USERNAME" + echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' + echo 'Accom logic for multiple env and mult servers in each env based on the branch name' + echo 'shutting down the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' + echo 'force stop any remaining mule process' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' + */ + echo 'tomcat server stopped' + echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' + /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' + */ + echo 'Deployment has been completed' + echo 'starting the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' + */ + echo 'tomcat server started' + } } } else { echo "Deployment not required" From fc5ee9a2761a4348703432703fc4357305a79210 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:26:03 -0600 Subject: [PATCH 115/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index d4ee6f2..286931b 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ -feature_deploy=false +feature_deploy=true servers=lxapp.2378 lxapp.656 lxapp.5376 javadoc=false jacoco=false From 3f689a4b8f49868fdcf9d69d2f448cba8a602dd5 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:35:30 -0600 Subject: [PATCH 116/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7d09581..ce41f46 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -123,7 +123,7 @@ spec: withMaven(maven: 'MAVEN-3.6.3') { HOSTNAME='' if (propfile['feature_deploy'] == "true" ) { - USERNAME=$USERNAME_FEATURE_DEPLOY + USERNAME=USERNAME_FEATURE_DEPLOY HOSTS=$HOST_FEATURE_DEPLOY } if (env.BRANCH_NAME == 'dev' ) { From c703c331f411f45825ebfb21ba36e43d6d127b8a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Thu, 11 Feb 2021 15:37:01 -0600 Subject: [PATCH 117/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index ce41f46..367512d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -82,10 +82,10 @@ spec: echo 'Remove the line below when we switch to the actual EJB repo' sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' } - sleep(60) + /*sleep(60) timeout(time: 1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - } + }*/ } } } @@ -123,16 +123,16 @@ spec: withMaven(maven: 'MAVEN-3.6.3') { HOSTNAME='' if (propfile['feature_deploy'] == "true" ) { - USERNAME=USERNAME_FEATURE_DEPLOY - HOSTS=$HOST_FEATURE_DEPLOY + USERNAME=${USERNAME_FEATURE_DEPLOY} + HOSTS=${HOST_FEATURE_DEPLOY} } if (env.BRANCH_NAME == 'dev' ) { - USERNAME=$USERNAME_DEV_DEPLOY - HOSTS=$HOST_DEV_DEPLOY + USERNAME=${USERNAME_DEV_DEPLOY} + HOSTS=${HOST_DEV_DEPLOY} } if (env.BRANCH_NAME == 'release') { - USERNAME=$USERNAME_RELEASE_DEPLOY - HOSTS=$HOST_RELEASE_DEPLOY + USERNAME=${USERNAME_RELEASE_DEPLOY} + HOSTS=${HOST_RELEASE_DEPLOY} } for (HOSTNAME in ${HOSTS}) { $DEPOYMENT_SERVER=$HOSTNAME From 470a7db1e566490aa1145af28ce7081b00cfb70e Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 12 Feb 2021 12:19:46 -0600 Subject: [PATCH 118/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 165 ++++++++++++++++++++++++------------------------ 1 file changed, 84 insertions(+), 81 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 367512d..0784ba4 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,11 +1,19 @@ def propfile - +def getFeatureDeployEnv(){ + return ['10.6.74.90', '10.6.74.89'] +} +def getDevDeployEnv(){ + return ['10.6.74.91'] +} +def getReleaseDeployEnv(){ + return ['10.6.74.92', '10.6.74.93'] +} pipeline { agent { - kubernetes { - label 'SpringBootRestApp' - defaultContainer 'jnlp' - yaml """ + kubernetes { + label 'SpringBootRestApp' + defaultContainer 'jnlp' + yaml """ apiVersion: v1 kind: Pod metadata: @@ -37,11 +45,12 @@ spec: WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' USERNAME_FEATURE_DEPLOY='muleadmin' - HOSTS_FEATURE_DEPLOY='10.6.74.90' + //HOSTS_FEATURE_DEPLOY=getFeatureDeployEnv() + HOSTS_FEATURE_DEPLOY="10.6.74.90, 10.6.74.89" USERNAME_DEV_DEPLOY='muleadmin' - HOSTS_DEV_DEPLOY='10.6.74.91' + HOSTS_DEV_DEPLOY=getDevDeployEnv() USERNAME_RELEASE='muleadmin' - HOSTS_RELEASE_DEPLOY="'10.6.74.92' '10.6.74.93'" + HOSTS_RELEASE_DEPLOY=getReleaseDeployEnv() } stages { stage('Build & Unit Test') { @@ -80,104 +89,100 @@ spec: echo "Change the line below when we switch to the actual EJB repo" // sh 'gradle SonarQube' echo 'Remove the line below when we switch to the actual EJB repo' - sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' + //sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' } /*sleep(60) timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true + waitForQualityGate abortPipeline: true }*/ } } } } stage("Publish Package") { + when { expression {env.GIT_BRANCH == 'origin/dev' || env.GIT_BRANCH == 'origin/release'|| propfile['feature_deploy'] == "true" }} steps { container('gradle') { script { - if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' - echo 'Replace the next 4 lines to reflect the EJB artifact and push it to archiva' - echo 'Use the 5 lines below when we switch to the actual EJB repo' - /* echo 'copying the jar and war files from the individual target directories and copying it to artifacts directory ' - sh "mkdir -p $WORKSPACE/artifacts" - sh 'cp /dist/libs/* $WORKSPACE/artifacts/' - echo 'create a tar file on the Jenkins server' - sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true - */ - echo 'Remove the 3 lines below when we switch to the actual EJB repo' - sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' - sh 'ls -lrt sample-java-app/target/' - sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' - } + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' + echo 'Replace the next 4 lines to reflect the EJB artifact and push it to archiva' + echo 'Use the 5 lines below when we switch to the actual EJB repo' + /* echo 'copying the jar and war files from the individual target directories and copying it to artifacts directory ' + sh "mkdir -p $WORKSPACE/artifacts" + sh 'cp /dist/libs/* $WORKSPACE/artifacts/' + echo 'create a tar file on the Jenkins server' + sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true + */ + echo 'Remove the 3 lines below when we switch to the actual EJB repo' + //sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' + //sh 'ls -lrt sample-java-app/target/' + //sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' } } } } } stage("Deploy") { + when { expression {env.GIT_BRANCH == 'origin/dev' || env.GIT_BRANCH == 'origin/release'|| propfile['feature_deploy'] == "true" }} steps { container('gradle') { script { - if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { - withMaven(maven: 'MAVEN-3.6.3') { - HOSTNAME='' - if (propfile['feature_deploy'] == "true" ) { - USERNAME=${USERNAME_FEATURE_DEPLOY} - HOSTS=${HOST_FEATURE_DEPLOY} - } - if (env.BRANCH_NAME == 'dev' ) { - USERNAME=${USERNAME_DEV_DEPLOY} - HOSTS=${HOST_DEV_DEPLOY} - } - if (env.BRANCH_NAME == 'release') { - USERNAME=${USERNAME_RELEASE_DEPLOY} - HOSTS=${HOST_RELEASE_DEPLOY} - } - for (HOSTNAME in ${HOSTS}) { - $DEPOYMENT_SERVER=$HOSTNAME - $DEPLOYMENT_USER=$USERNAME - echo "I am deploying the artifact into the target environment $HOSTNAME" - echo "Username = $USERNAME" - echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' - echo 'Accom logic for multiple env and mult servers in each env based on the branch name' - echo 'shutting down the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' - echo 'force stop any remaining mule process' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' - */ - echo 'tomcat server stopped' - echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' - /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' - */ - echo 'Deployment has been completed' - echo 'starting the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' - */ - echo 'tomcat server started' - } + withMaven(maven: 'MAVEN-3.6.3') { + if (propfile['feature_deploy'] == "true" ) { + USERNAME=env.USERNAME_FEATURE_DEPLOY + HOSTS=env.HOSTS_FEATURE_DEPLOY } - } else { - echo "Deployment not required" - } + if (env.BRANCH_NAME == 'dev' ) { + USERNAME=env.USERNAME_DEV_DEPLOY + HOSTS=env.HOSTS_DEV_DEPLOY + } + if (env.BRANCH_NAME == 'release') { + USERNAME=env.USERNAME_RELEASE_DEPLOY + HOSTS=env.HOSTS_RELEASE_DEPLOY + } + echo "ENV HOSTS: ${env.HOSTS_FEATURE_DEPLOY}" + echo "HOSTS: ${HOSTS}" + //for (HOSTNAME in ['10.6.74.90', '10.6.74.89']) { + HOSTS.tokenize(',').each { HOSTNAME -> + //env.DEPOYMENT_SERVER=$HOSTNAME + //env.DEPLOYMENT_USER=$USERNAME + echo "I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}" + echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' + echo 'Accom logic for multiple env and mult servers in each env based on the branch name' + echo 'shutting down the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' + echo 'force stop any remaining mule process' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' + */ + echo 'tomcat server stopped' + echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' + /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' + */ + echo 'Deployment has been completed' + echo 'starting the tomcat ESB server' + /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' + sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' + */ + echo 'tomcat server started' + } + } } } } } stage('Post Deploy Tests') { + when { expression {env.GIT_BRANCH == 'origin/dev' || env.GIT_BRANCH == 'origin/release'|| propfile['feature_deploy'] == "true" }} parallel { stage('Smoke Test') { steps { container('gradle') { script { - if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { - withMaven(maven: 'MAVEN-3.6.3') { - echo "I am executing Smoke Test on target dev environment post deployment" - } + withMaven(maven: 'MAVEN-3.6.3') { + echo "I am executing Smoke Test on target dev environment post deployment" } } } @@ -187,10 +192,8 @@ spec: steps { container('gradle') { script { - if (propfile['feature_deploy'] == "true" || env.BRANCH_NAME == 'dev' || env.BRANCH_NAME == 'release') { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am running Security Test here' - } + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am running Security Test here' } } } @@ -204,10 +207,10 @@ spec: script { if (propfile['javadoc'] == "true") { javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) - } + } } } - failure { + failure { /*mail bcc: '', body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', @@ -218,7 +221,7 @@ spec: subject: "ERROR CI: Project name -> ${env.JOB_NAME}", to: "foo@foomail.com";*/ echo 'I am sending a notification with failure' - } + } success { echo 'I am sending a notification with success' } From 0a96869bbc90cd5b866bf234ef0683fc6b84d9ca Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Fri, 12 Feb 2021 12:23:12 -0600 Subject: [PATCH 119/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 286931b..d4ee6f2 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ -feature_deploy=true +feature_deploy=false servers=lxapp.2378 lxapp.656 lxapp.5376 javadoc=false jacoco=false From 72591e57d917ea147d4e9a99d5b60cb6099fad72 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 08:20:35 -0600 Subject: [PATCH 120/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 65 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 22 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 0784ba4..9a13d18 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -1,13 +1,5 @@ def propfile -def getFeatureDeployEnv(){ - return ['10.6.74.90', '10.6.74.89'] -} -def getDevDeployEnv(){ - return ['10.6.74.91'] -} -def getReleaseDeployEnv(){ - return ['10.6.74.92', '10.6.74.93'] -} + pipeline { agent { kubernetes { @@ -45,12 +37,11 @@ spec: WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' USERNAME_FEATURE_DEPLOY='muleadmin' - //HOSTS_FEATURE_DEPLOY=getFeatureDeployEnv() - HOSTS_FEATURE_DEPLOY="10.6.74.90, 10.6.74.89" + HOSTS_FEATURE_DEPLOY="10.6.74.90" USERNAME_DEV_DEPLOY='muleadmin' - HOSTS_DEV_DEPLOY=getDevDeployEnv() + HOSTS_DEV_DEPLOY="10.6.74.91, 10.6.74.92" USERNAME_RELEASE='muleadmin' - HOSTS_RELEASE_DEPLOY=getReleaseDeployEnv() + HOSTS_RELEASE_DEPLOY="10.6.74.93, 10.6.74.94" } stages { stage('Build & Unit Test') { @@ -91,10 +82,10 @@ spec: echo 'Remove the line below when we switch to the actual EJB repo' //sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' } - /*sleep(60) + sleep(60) timeout(time: 1, unit: 'MINUTES') { waitForQualityGate abortPipeline: true - }*/ + } } } } @@ -115,9 +106,9 @@ spec: sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */ echo 'Remove the 3 lines below when we switch to the actual EJB repo' - //sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' - //sh 'ls -lrt sample-java-app/target/' - //sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' + sh 'ls -lrt sample-java-app/target/' + sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' } } } @@ -141,12 +132,8 @@ spec: USERNAME=env.USERNAME_RELEASE_DEPLOY HOSTS=env.HOSTS_RELEASE_DEPLOY } - echo "ENV HOSTS: ${env.HOSTS_FEATURE_DEPLOY}" - echo "HOSTS: ${HOSTS}" //for (HOSTNAME in ['10.6.74.90', '10.6.74.89']) { HOSTS.tokenize(',').each { HOSTNAME -> - //env.DEPOYMENT_SERVER=$HOSTNAME - //env.DEPLOYMENT_USER=$USERNAME echo "I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}" echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' echo 'Accom logic for multiple env and mult servers in each env based on the branch name' @@ -183,6 +170,40 @@ spec: script { withMaven(maven: 'MAVEN-3.6.3') { echo "I am executing Smoke Test on target dev environment post deployment" + /*RESP=`curl -X GET "${bamboo.uri}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` + echo "The response for current execution status is: $RESP" + if [ "$RESP" != "[]" ]; + then + echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." + exit 1 + else + echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" + fi + # To abort the request before attempting to re-run, uncomment and run below line. + # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/Request/${bamboo.RequestID}/abort/) + guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${bamboo.stage_name}}" -H "id: ${bamboo.RequestID}" ${bamboo.uri}/ExecuteRequest/ | tr -d \") + echo "The GUID is: $guid" + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + while [[ $status != *"Completed"* ]] + do + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + sleep 15 + done + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/) + echo "The status is: $status" + execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${bamboo.uri}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) + echo "The exec status is: $execstatus" + if [[ $execstatus != *Passed* ]]; + then + echo "Failed" + exit 1 + else + echo "Passed" + exit + fi + exit */ } } } From f2e1c68162bbb8d2bf808817ade8b98206fe6a2e Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 09:27:04 -0600 Subject: [PATCH 121/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 9a13d18..730ba14 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -78,9 +78,9 @@ spec: withSonarQubeEnv(installationName: 'Sonarqube') { echo 'I am executing code quality using sonarqube' echo "Change the line below when we switch to the actual EJB repo" - // sh 'gradle SonarQube' + sh 'gradle SonarQube' echo 'Remove the line below when we switch to the actual EJB repo' - //sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' + sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' } sleep(60) timeout(time: 1, unit: 'MINUTES') { From a1c0195d143f826d35016ca089525449ea819a3e Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 09:37:22 -0600 Subject: [PATCH 122/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 730ba14..899745d 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -78,7 +78,7 @@ spec: withSonarQubeEnv(installationName: 'Sonarqube') { echo 'I am executing code quality using sonarqube' echo "Change the line below when we switch to the actual EJB repo" - sh 'gradle SonarQube' + //sh 'gradle SonarQube' echo 'Remove the line below when we switch to the actual EJB repo' sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' } From 1126f18a9e625f9ea2d4d739c34f42d75208ab05 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 09:47:19 -0600 Subject: [PATCH 123/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index d4ee6f2..286931b 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ -feature_deploy=false +feature_deploy=true servers=lxapp.2378 lxapp.656 lxapp.5376 javadoc=false jacoco=false From 9a3622b97b8e181d9a6568f5b03a7c4db3fe30fb Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 10:41:53 -0600 Subject: [PATCH 124/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 899745d..decdd90 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -227,7 +227,7 @@ spec: always { script { if (propfile['javadoc'] == "true") { - javadoc(javadocDir: "/home/jenkins/agent/workspace/${env.JOB_NAME}/target/site/apidocs", keepAll: true) + javadoc(javadocDir: "/$WORKSPACE/target/site/apidocs", keepAll: true) } } } From bbd93840e9f470d0885b57403a74be6a56068093 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 15:25:43 -0600 Subject: [PATCH 125/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index decdd90..974a717 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -106,6 +106,10 @@ spec: sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */ echo 'Remove the 3 lines below when we switch to the actual EJB repo' + sh 'ls' + sh 'cd sample-java-app' + sh 'ls' + sh 'pwd' sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' sh 'ls -lrt sample-java-app/target/' sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' From 826190ef2b2b0c0363dd39c94cb5722aaf1d7388 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Mon, 15 Feb 2021 15:35:16 -0600 Subject: [PATCH 126/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 974a717..482db21 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -107,9 +107,10 @@ spec: */ echo 'Remove the 3 lines below when we switch to the actual EJB repo' sh 'ls' - sh 'cd sample-java-app' - sh 'ls' - sh 'pwd' + dir("$WORKSPACE/sample-java-app"){ + sh "pwd" + sh 'ls' + } sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' sh 'ls -lrt sample-java-app/target/' sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' From 4fc7f880a763946ebaa2cee0cdfa7d989ff67252 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 10:27:01 -0600 Subject: [PATCH 127/148] Update pom.xml --- sample-java-app/pom.xml | 59 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) diff --git a/sample-java-app/pom.xml b/sample-java-app/pom.xml index 4b589c0..6b6cdbd 100644 --- a/sample-java-app/pom.xml +++ b/sample-java-app/pom.xml @@ -10,12 +10,15 @@ io.buildpacks.example sample - 0.0.1-SNAPSHOT + + EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} sample Sample Java Application 1.8 + ${env.GIT_BRANCH} + ${BUILD_NUMBER} @@ -41,12 +44,12 @@ internal Archiva Managed Internal Repository - http://35.188.92.10/repository/internal/ + https://archiva.sgn.devops.accentureanalytics.com/repository/internal/ snapshots Archiva Managed Snapshot Repository - http://35.188.92.10/repository/snapshots/ + https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/ @@ -68,6 +71,54 @@ 4.5.3 + + + org.jacoco + jacoco-maven-plugin + 0.8.3 + + + jacoco-initialize + + prepare-agent + + + + jacoco-report + test + + report + + + + + coverage-check + + check + + + target/jacoco-report + ${project.build.directory}/coverage-reports/jacoco.exec + + + CLASS + + com.asimio.demo.Application + + + + LINE + COVEREDRATIO + 80% + + + + + + + + + @@ -83,7 +134,7 @@ snapshots Archiva Managed Snapshot Repository - http://35.188.92.10/repository/snapshots/ + https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/ false From 20c3dce78a5de53b1e150e540c73d42909c03c3f Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 10:27:56 -0600 Subject: [PATCH 128/148] Update project.properties --- project.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project.properties b/project.properties index 286931b..3c3af93 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ -feature_deploy=true -servers=lxapp.2378 lxapp.656 lxapp.5376 +feature_deploy=false javadoc=false jacoco=false +code_quality=false From a9e939e80fd39e55ef1d7b9652ec6828d7fa4727 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 10:28:19 -0600 Subject: [PATCH 129/148] Update project.properties --- project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.properties b/project.properties index 3c3af93..f98cbd2 100644 --- a/project.properties +++ b/project.properties @@ -1,4 +1,4 @@ -feature_deploy=false +feature_deploy=true javadoc=false jacoco=false code_quality=false From 45eb996a3740cd12d121b6d4734ebf83e70725f7 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 10:30:27 -0600 Subject: [PATCH 130/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 78 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 482db21..6aaf913 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -2,10 +2,10 @@ def propfile pipeline { agent { - kubernetes { - label 'SpringBootRestApp' - defaultContainer 'jnlp' - yaml """ + kubernetes { + label 'SpringBootRestApp' + defaultContainer 'jnlp' + yaml """ apiVersion: v1 kind: Pod metadata: @@ -23,25 +23,24 @@ spec: } environment { GRADLE_PATH = '/opt/gradle/gradle-3.5.1/bin' - GRADLE_TASK = 'ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB' - DEPOYMENT_SERVER='10.6.74.90' - DEPLOYMENT_USER='muleadmin' + GRADLE_TASK = 'EcomEJBProxy' DEPLOYMENT_ARCHIVE_DIR='/home/muleadmin/stage/archive' DEPLOYMENT_STAGE_DIR='/home/muleadmin/stage' - DEPLOYMENT_DIR='/opt/mule/latest/webapps' - WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' + DEPLOYMENT_DIR='/var/WebSphere/deploy' + WAR_FILES='EcomEJBProxy' ESB_BIN_PATH='/opt/mule/bin/esb_service' ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' REQUESTID='779' STAGE_NAME='dev3' WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' USERNAME='devopsengineering@signetjewelers.com' - USERNAME_FEATURE_DEPLOY='muleadmin' + USERNAME_FEATURE_DEPLOY='wasadmin' HOSTS_FEATURE_DEPLOY="10.6.74.90" - USERNAME_DEV_DEPLOY='muleadmin' + USERNAME_DEV_DEPLOY='wasadmin' HOSTS_DEV_DEPLOY="10.6.74.91, 10.6.74.92" - USERNAME_RELEASE='muleadmin' + USERNAME_RELEASE='wasadmin' HOSTS_RELEASE_DEPLOY="10.6.74.93, 10.6.74.94" + ARTIFACT="EJB-build-${env.BUILD_NUMBER}-branch-${env.GIT_BRANCH}" } stages { stage('Build & Unit Test') { @@ -72,26 +71,27 @@ spec: } } stage('Code Quality') { + when { expression {propfile['code_quality'] == "true" }} steps { container('gradle') { withMaven(maven: 'MAVEN-3.6.3') { withSonarQubeEnv(installationName: 'Sonarqube') { echo 'I am executing code quality using sonarqube' echo "Change the line below when we switch to the actual EJB repo" - //sh 'gradle SonarQube' + // sh 'gradle SonarQube' echo 'Remove the line below when we switch to the actual EJB repo' - sh 'mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${BRANCH_NAME} -Dsonar.projectKey=EJB_sample sonar:sonar' + sh "mvn -f sample-java-app/pom.xml -Dsonar.projectName=EJB_${env.GIT_BRANCH} -Dsonar.projectKey=EJB_sample sonar:sonar" } sleep(60) timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true + waitForQualityGate abortPipeline: true } } } } } stage("Publish Package") { - when { expression {env.GIT_BRANCH == 'origin/dev' || env.GIT_BRANCH == 'origin/release'|| propfile['feature_deploy'] == "true" }} + when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} steps { container('gradle') { script { @@ -101,26 +101,25 @@ spec: echo 'Use the 5 lines below when we switch to the actual EJB repo' /* echo 'copying the jar and war files from the individual target directories and copying it to artifacts directory ' sh "mkdir -p $WORKSPACE/artifacts" - sh 'cp /dist/libs/* $WORKSPACE/artifacts/' + sh "cp /dist/libs/* $WORKSPACE/artifacts/" echo 'create a tar file on the Jenkins server' sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */ echo 'Remove the 3 lines below when we switch to the actual EJB repo' - sh 'ls' - dir("$WORKSPACE/sample-java-app"){ - sh "pwd" - sh 'ls' - } - sh 'mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar' + // sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/EJB_build-${BUILD_NUMBER}_branch-${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - sh 'mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${BRANCH_NAME}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/' + + dir("sample-java-app/target") { + sh "mvn -X deploy:deploy-file -Dfile=${ARTIFACT}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + } + //sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-EJB-build-branch.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } } } stage("Deploy") { - when { expression {env.GIT_BRANCH == 'origin/dev' || env.GIT_BRANCH == 'origin/release'|| propfile['feature_deploy'] == "true" }} + when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} steps { container('gradle') { script { @@ -129,35 +128,34 @@ spec: USERNAME=env.USERNAME_FEATURE_DEPLOY HOSTS=env.HOSTS_FEATURE_DEPLOY } - if (env.BRANCH_NAME == 'dev' ) { + if (env.GIT_BRANCH == 'dev' ) { USERNAME=env.USERNAME_DEV_DEPLOY HOSTS=env.HOSTS_DEV_DEPLOY } - if (env.BRANCH_NAME == 'release') { + if (env.GIT_BRANCH == 'release') { USERNAME=env.USERNAME_RELEASE_DEPLOY HOSTS=env.HOSTS_RELEASE_DEPLOY } - //for (HOSTNAME in ['10.6.74.90', '10.6.74.89']) { HOSTS.tokenize(',').each { HOSTNAME -> - echo "I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}" + echo 'I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}' echo 'Replace all the lines below for EJB and add the parameters to propfile and make refrences below' echo 'Accom logic for multiple env and mult servers in each env based on the branch name' echo 'shutting down the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH stop || sleep 20"' + /* sh 'ssh ${USERNAME}@${HOSTNAME} "$ESB_BIN_PATH stop || sleep 20"' echo 'force stop any remaining mule process' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' + sh 'ssh ${USERNAME}@${HOSTNAME} "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' */ echo 'tomcat server stopped' echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "cd $DEPLOYMENT_DIR && rm -rf $ESB_WAR_FOLDERS && cp -rp $DEPLOYMENT_STAGE_DIR/*.war $DEPLOYMENT_DIR"' + sh 'ssh ${USERNAME}@${HOSTNAME} "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' + sh 'ssh ${USERNAME}@${HOSTNAME} "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' + sh 'ssh ${USERNAME}@${HOSTNAME} "cd $}DEPLOYMENT_DIR} && rm -rf ${ESB_WAR_FOLDERS} && cp -rp ${DEPLOYMENT_STAGE_DIR}/*.war $DEPLOYMENT_DIR"' */ echo 'Deployment has been completed' echo 'starting the tomcat ESB server' - /* sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "$ESB_BIN_PATH start"' - sh 'ssh $DEPLOYMENT_USER@$DEPOYMENT_SERVER "sleep 20"' + /* sh 'ssh ${USERNAME}@${HOSTNAME} "${ESB_BIN_PATH start}"' + sh 'ssh ${USERNAME}@${HOSTNAME} "sleep 20"' */ echo 'tomcat server started' } @@ -167,7 +165,7 @@ spec: } } stage('Post Deploy Tests') { - when { expression {env.GIT_BRANCH == 'origin/dev' || env.GIT_BRANCH == 'origin/release'|| propfile['feature_deploy'] == "true" }} + when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} parallel { stage('Smoke Test') { steps { @@ -233,10 +231,10 @@ spec: script { if (propfile['javadoc'] == "true") { javadoc(javadocDir: "/$WORKSPACE/target/site/apidocs", keepAll: true) - } + } } } - failure { + failure { /*mail bcc: '', body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", cc: '', @@ -247,7 +245,7 @@ spec: subject: "ERROR CI: Project name -> ${env.JOB_NAME}", to: "foo@foomail.com";*/ echo 'I am sending a notification with failure' - } + } success { echo 'I am sending a notification with success' } From 4c16a747792cc802c8a56613bcf012e6e17278fd Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:17:23 -0600 Subject: [PATCH 131/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 6aaf913..d99ec04 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -108,11 +108,7 @@ spec: echo 'Remove the 3 lines below when we switch to the actual EJB repo' // sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/EJB_build-${BUILD_NUMBER}_branch-${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - - dir("sample-java-app/target") { - sh "mvn -X deploy:deploy-file -Dfile=${ARTIFACT}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" - } - //sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-EJB-build-branch.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH}-0.1.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } From 7efc46276222221dcb02ff795425f9d1b553c862 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:17:27 -0600 Subject: [PATCH 132/148] Update pom.xml --- sample-java-app/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sample-java-app/pom.xml b/sample-java-app/pom.xml index 6b6cdbd..839e664 100644 --- a/sample-java-app/pom.xml +++ b/sample-java-app/pom.xml @@ -10,9 +10,9 @@ io.buildpacks.example sample - - EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} - sample + 0.1.1-SNAPSHOT + + EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} Sample Java Application From cc5faba15c64501575ee13f2c11eb541e1c5a72e Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:21:37 -0600 Subject: [PATCH 133/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index d99ec04..7fab509 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -108,7 +108,7 @@ spec: echo 'Remove the 3 lines below when we switch to the actual EJB repo' // sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/EJB_build-${BUILD_NUMBER}_branch-${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH}-0.1.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.1.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } From d37e0eb06eb451d392138f26da7a28f9ea045069 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:25:29 -0600 Subject: [PATCH 134/148] Update pom.xml --- sample-java-app/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample-java-app/pom.xml b/sample-java-app/pom.xml index 839e664..a80d19a 100644 --- a/sample-java-app/pom.xml +++ b/sample-java-app/pom.xml @@ -9,7 +9,7 @@ io.buildpacks.example - sample + EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} 0.1.1-SNAPSHOT EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} From 409c6d69c5b2781163faf767bf0322c2f4ab6c3a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:38:32 -0600 Subject: [PATCH 135/148] Update pom.xml --- sample-java-app/pom.xml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sample-java-app/pom.xml b/sample-java-app/pom.xml index a80d19a..ae59812 100644 --- a/sample-java-app/pom.xml +++ b/sample-java-app/pom.xml @@ -9,16 +9,15 @@ io.buildpacks.example - EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} - 0.1.1-SNAPSHOT + sample + ${revision} - EJB-build-${BUILD_NUMBER}-branch-${env.GIT_BRANCH} + CI-Test Sample Java Application 1.8 - ${env.GIT_BRANCH} - ${BUILD_NUMBER} + 1.0.0-SNAPSHOT From 4d3a0b41f83e49ee795e03b2920f94652b951890 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:39:49 -0600 Subject: [PATCH 136/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7fab509..8cc5df0 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -52,7 +52,7 @@ spec: echo 'use the command below when we switch to EJB source' //sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' - sh 'mvn -f sample-java-app/pom.xml clean package' + sh 'mvn -f sample-java-app/pom.xml -Drevision=EJB-branch-${env.GIT_BRANCH}-build-${env.BUILD_NUMBER} clean package' propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' @@ -108,7 +108,7 @@ spec: echo 'Remove the 3 lines below when we switch to the actual EJB repo' // sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/EJB_build-${BUILD_NUMBER}_branch-${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-0.1.1-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-EJB-branch-${env.GIT_BRANCH}-build-${env.BUILD_NUMBER}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } From e0cb96481df64405e719c98758273dc06a653733 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:44:46 -0600 Subject: [PATCH 137/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 8cc5df0..ecfa825 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -52,7 +52,7 @@ spec: echo 'use the command below when we switch to EJB source' //sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' - sh 'mvn -f sample-java-app/pom.xml -Drevision=EJB-branch-${env.GIT_BRANCH}-build-${env.BUILD_NUMBER} clean package' + sh 'mvn -f sample-java-app/pom.xml -Drevision=1.0.0-SNAPSHOT clean package' propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' @@ -108,7 +108,7 @@ spec: echo 'Remove the 3 lines below when we switch to the actual EJB repo' // sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/EJB_build-${BUILD_NUMBER}_branch-${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-EJB-branch-${env.GIT_BRANCH}-build-${env.BUILD_NUMBER}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-1.0.0-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } From 478ae21518c43a8df770e118ef11e93eed1e4519 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:57:47 -0600 Subject: [PATCH 138/148] Update pom.xml --- sample-java-app/pom.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sample-java-app/pom.xml b/sample-java-app/pom.xml index ae59812..afaf1dd 100644 --- a/sample-java-app/pom.xml +++ b/sample-java-app/pom.xml @@ -35,7 +35,11 @@ spring-boot-starter-test test - + + io.buildpacks.example + sample + ${project.version} + From ee89676930f7f755f71bf5814d57c44d365b82e8 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 11:58:26 -0600 Subject: [PATCH 139/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index ecfa825..7084116 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -52,7 +52,7 @@ spec: echo 'use the command below when we switch to EJB source' //sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' - sh 'mvn -f sample-java-app/pom.xml -Drevision=1.0.0-SNAPSHOT clean package' + sh 'mvn -Drevision=1.1.1-SNAPSHOT -f sample-java-app/pom.xml clean package' propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' From 1c5fe36e62b2868d4e9c03da217a96dcd9eca396 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 12:00:56 -0600 Subject: [PATCH 140/148] Update pom.xml --- sample-java-app/pom.xml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/sample-java-app/pom.xml b/sample-java-app/pom.xml index afaf1dd..07d57e1 100644 --- a/sample-java-app/pom.xml +++ b/sample-java-app/pom.xml @@ -35,11 +35,6 @@ spring-boot-starter-test test - - io.buildpacks.example - sample - ${project.version} -
From 83ab59ec882e25f0d6d8b7f55536de658fbd5c02 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Wed, 17 Feb 2021 12:04:19 -0600 Subject: [PATCH 141/148] Update Jenkinsfile_AIP --- Jenkinsfile_AIP | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile_AIP b/Jenkinsfile_AIP index 7084116..c00ca43 100644 --- a/Jenkinsfile_AIP +++ b/Jenkinsfile_AIP @@ -40,7 +40,7 @@ spec: HOSTS_DEV_DEPLOY="10.6.74.91, 10.6.74.92" USERNAME_RELEASE='wasadmin' HOSTS_RELEASE_DEPLOY="10.6.74.93, 10.6.74.94" - ARTIFACT="EJB-build-${env.BUILD_NUMBER}-branch-${env.GIT_BRANCH}" + ARTIFACT="EJB-branch-${env.GIT_BRANCH}-build-${env.BUILD_NUMBER}" } stages { stage('Build & Unit Test') { @@ -52,7 +52,7 @@ spec: echo 'use the command below when we switch to EJB source' //sh 'gradle --no-daemon clean build' echo 'Add gradle clean and build for EJB and comment this step' - sh 'mvn -Drevision=1.1.1-SNAPSHOT -f sample-java-app/pom.xml clean package' + sh "mvn -Drevision=${ARTIFACT} -f sample-java-app/pom.xml clean package" propfile = readProperties(file: './project.properties') if (propfile['javadoc'] == "true") { sh 'mvn javadoc:aggregate' @@ -108,7 +108,7 @@ spec: echo 'Remove the 3 lines below when we switch to the actual EJB repo' // sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/EJB_build-${BUILD_NUMBER}_branch-${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-1.0.0-SNAPSHOT.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-${ARTIFACT}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } From de5d82125835b6e46a2d96f80a3521fcc6619030 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:36:12 -0600 Subject: [PATCH 142/148] Create Jenkinsfile_PROD --- Jenkinsfile_PROD | 245 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 245 insertions(+) create mode 100644 Jenkinsfile_PROD diff --git a/Jenkinsfile_PROD b/Jenkinsfile_PROD new file mode 100644 index 0000000..621e2aa --- /dev/null +++ b/Jenkinsfile_PROD @@ -0,0 +1,245 @@ +def propfile +pipeline { + agent { + kubernetes { + label 'SpringBootRestApp' + defaultContainer 'jnlp' + yaml """ +apiVersion: v1 +kind: Pod +metadata: +labels: + component: ci +spec: + containers: + - name: gradle + image: gradle:3.5-jdk8-alpine + command: + - cat + tty: true +""" + } + } + environment { + GRADLE_PATH = '/opt/gradle/gradle-3.5.1/bin' + GRADLE_TASK = 'ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB' + DEPLOYMENT_ARCHIVE_DIR='/home/muleadmin/stage/archive' + DEPLOYMENT_STAGE_DIR='/home/muleadmin/stage' + DEPLOYMENT_DIR='/opt/mule/latest/webapps' + WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' + ESB_BIN_PATH='/opt/mule/bin/esb_service' + ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' + REQUESTID='779' + STAGE_NAME='dev3' + WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' + USERNAME='devopsengineering@signetjewelers.com' + USERNAME_FEATURE_DEPLOY='muleadmin' + HOSTS_FEATURE_DEPLOY="10.6.74.90" + USERNAME_DEV_DEPLOY='muleadmin' + HOSTS_DEV_DEPLOY="10.6.74.91, 10.6.74.92" + USERNAME_RELEASE='muleadmin' + HOSTS_RELEASE_DEPLOY="10.6.74.93, 10.6.74.94" + } + stages { + stage('Build & Unit Test') { + steps { + container('gradle') { + script { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am executing build and unit test' + echo "Use the line below when we switch to the actual repo" + // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' + echo "Remove the line below when we switch to the actual repo" + sh 'mvn -f sample-java-app/pom.xml clean package' + propfile = readProperties(file: './project.properties') + if (propfile['javadoc'] == "true") { + sh 'mvn javadoc:aggregate' + } + if (propfile['jacoco'] == "true") { + jacoco( + execPattern: '**/*.exec', + classPattern: '**/*.class', + sourcePattern: '**/*.java', + exclusionPattern: '**/test*' + ) + } + } + } + } + } + } + stage('Code Quality') { + when { expression {propfile['code_quality'] == "true" }} + steps { + container('gradle') { + withMaven(maven: 'MAVEN-3.6.3') { + withSonarQubeEnv(installationName: 'Sonarqube') { + echo 'I am executing code quality using sonarqube' + echo ' Update the line below when we switch to actual ESB repo' + // sh './gradle Sonarqube' + echo ' Remove the line below after we switch to ESB repo' + sh "mvn -f sample-java-app/pom.xml -Dsonar.projectName=ESB_${env.GIT_BRANCH} -Dsonar.projectKey=ESB_sample sonar:sonar" + } + sleep(60) + timeout(time: 1, unit: 'MINUTES') { + waitForQualityGate abortPipeline: true + } + } + } + } + } + stage("Publish Package") { + when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} + steps { + container('gradle') { + script { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' + echo 'Replace the next 4 lines to reflect the ESB artifact and push it to archiva' + echo 'Use the 5 lines below when we switch to the actual ESB repo' + /* echo 'copying the jar and war files from the individual target directorrys and copying it to artifacts directory ' + sh "mkdir -p $WORKSPACE/artifacts" + sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do cp -rp ${i}/dist/libs/* $WORKSPACE/artifacts/ ;done' + echo 'create a tar file on the Jenkins server' + sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true + */ + echo 'Remove the below 3 lines after switching to the actual ESB repo' + sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar" + sh 'ls -lrt sample-java-app/target/' + sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + } + } + } + } + } + stage("Deploy") { + when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} + steps { + container('gradle') { + script { + withMaven(maven: 'MAVEN-3.6.3') { + if (propfile['feature_deploy'] == "true" ) { + USERNAME=env.USERNAME_FEATURE_DEPLOY + HOSTS=env.HOSTS_FEATURE_DEPLOY + } + if (env.GIT_BRANCH == 'dev' ) { + USERNAME=env.USERNAME_DEV_DEPLOY + HOSTS=env.HOSTS_DEV_DEPLOY + } + if (env.GIT_BRANCH == 'release') { + USERNAME=env.USERNAME_RELEASE_DEPLOY + HOSTS=env.HOSTS_RELEASE_DEPLOY + } + HOSTS.tokenize(',').each { HOSTNAME -> + echo "I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}" + echo 'Replace all the lines below for ESB and add the parameters to propfile and make refrences below' + echo 'Accom logic for multiple env and mult servers in each env based on the branch name' + echo 'shutting down the tomcat ESB server' + /* sh 'ssh ${USERNAME}@${HOSTNAME} "$ESB_BIN_PATH stop || sleep 20"' + echo 'force stop any remaining mule process' + sh 'ssh ${USERNAME}@${HOSTNAME} "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' + */ + echo 'tomcat server stopped' + echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' + /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' + sh 'ssh ${USERNAME}@${HOSTNAME} "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' + sh 'ssh ${USERNAME}@${HOSTNAME} "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' + sh 'ssh ${USERNAME}@${HOSTNAME} "cd $}DEPLOYMENT_DIR} && rm -rf ${ESB_WAR_FOLDERS} && cp -rp ${DEPLOYMENT_STAGE_DIR}/*.war $DEPLOYMENT_DIR"' + */ + echo 'Deployment has been completed' + echo 'starting the tomcat ESB server' + /* sh 'ssh ${USERNAME}@${HOSTNAME} "${ESB_BIN_PATH start}"' + sh 'ssh ${USERNAME}@${HOSTNAME} "sleep 20"' + */ + echo 'tomcat server started' + } + } + } + } + } + } + + + stage('Post Deploy Tests') { + when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} + parallel { + stage('Smoke Test') { + steps { + echo "I am executing Smoke Test on target dev environment post deployment" + } + /*RESP=`curl -X GET "${WORKSOFT_URI}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` + echo "The response for current execution status is: $RESP" + if [ "$RESP" != "[]" ]; + then + echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." + exit 1 + else + echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" + fi + # To abort the request before attempting to re-run, uncomment and run below line. + # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${REQUESTID}" ${WORKSOFT_URI}/Request/${REQUESTID}/abort/) + guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${STAGE_NAME}}" -H "id: ${REQUESTID}" ${WORKSOFT_URI}/ExecuteRequest/ | tr -d \") + echo "The GUID is: $guid" + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + while [[ $status != *"Completed"* ]] + do + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) + echo "The status is: $status" + sleep 15 + done + status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/) + echo "The status is: $status" + execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) + echo "The exec status is: $execstatus" + if [[ $execstatus != *Passed* ]]; + then + echo "Failed" + exit 1 + else + echo "Passed" + exit + fi + exit */ + } + stage('Security Test') { + steps { + container('gradle') { + script { + withMaven(maven: 'MAVEN-3.6.3') { + echo 'I am running Security Test here' + } + } + } + } + } + } + } + + } + + post { + always { + script { + if (propfile['javadoc'] == "true") { + javadoc(javadocDir: "/$WORKSPACE/target/site/apidocs", keepAll: true) + } + } + } + failure { + /*mail bcc: '', + body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", + cc: '', + charset: 'UTF-8', + from: '', + mimeType: 'text/html', + replyTo: '', + subject: "ERROR CI: Project name -> ${env.JOB_NAME}", + to: "foo@foomail.com";*/ + echo 'I am sending a notification with failure' + } + success { + echo 'I am sending a notification with success' + } + } +} From f955fb91d288b24e23cc93aeca580d33b6db6fa4 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:43:54 -0600 Subject: [PATCH 143/148] Update Jenkinsfile_PROD --- Jenkinsfile_PROD | 33 +++++++-------------------------- 1 file changed, 7 insertions(+), 26 deletions(-) diff --git a/Jenkinsfile_PROD b/Jenkinsfile_PROD index 621e2aa..14cf09a 100644 --- a/Jenkinsfile_PROD +++ b/Jenkinsfile_PROD @@ -20,26 +20,6 @@ spec: """ } } - environment { - GRADLE_PATH = '/opt/gradle/gradle-3.5.1/bin' - GRADLE_TASK = 'ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB' - DEPLOYMENT_ARCHIVE_DIR='/home/muleadmin/stage/archive' - DEPLOYMENT_STAGE_DIR='/home/muleadmin/stage' - DEPLOYMENT_DIR='/opt/mule/latest/webapps' - WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' - ESB_BIN_PATH='/opt/mule/bin/esb_service' - ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' - REQUESTID='779' - STAGE_NAME='dev3' - WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' - USERNAME='devopsengineering@signetjewelers.com' - USERNAME_FEATURE_DEPLOY='muleadmin' - HOSTS_FEATURE_DEPLOY="10.6.74.90" - USERNAME_DEV_DEPLOY='muleadmin' - HOSTS_DEV_DEPLOY="10.6.74.91, 10.6.74.92" - USERNAME_RELEASE='muleadmin' - HOSTS_RELEASE_DEPLOY="10.6.74.93, 10.6.74.94" - } stages { stage('Build & Unit Test') { steps { @@ -119,16 +99,16 @@ spec: script { withMaven(maven: 'MAVEN-3.6.3') { if (propfile['feature_deploy'] == "true" ) { - USERNAME=env.USERNAME_FEATURE_DEPLOY - HOSTS=env.HOSTS_FEATURE_DEPLOY + propfile['USERNAME']=propfile['USERNAME_FEATURE_DEPLOY'] + propfile['HOSTS']=propfile['HOSTS_FEATURE_DEPLOY'] } if (env.GIT_BRANCH == 'dev' ) { - USERNAME=env.USERNAME_DEV_DEPLOY - HOSTS=env.HOSTS_DEV_DEPLOY + propfile['USERNAME']=propfile['USERNAME_DEV_DEPLOY'] + propfile['HOSTS']=propfile['HOSTS_DEV_DEPLOY'] } if (env.GIT_BRANCH == 'release') { - USERNAME=env.USERNAME_RELEASE_DEPLOY - HOSTS=env.HOSTS_RELEASE_DEPLOY + propfile['USERNAME']=propfile['USERNAME_RELEASE_DEPLOY'] + propfile['HOSTS']=propfile['HOSTS_RELEASE_DEPLOY'] } HOSTS.tokenize(',').each { HOSTNAME -> echo "I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}" @@ -152,6 +132,7 @@ spec: sh 'ssh ${USERNAME}@${HOSTNAME} "sleep 20"' */ echo 'tomcat server started' + echo "propfile['USERNAME']" } } } From 9e5e6bb30522db27868719ff509ff94a1692e29a Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:43:55 -0600 Subject: [PATCH 144/148] Update project.properties --- project.properties | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/project.properties b/project.properties index f98cbd2..94f6d3c 100644 --- a/project.properties +++ b/project.properties @@ -2,3 +2,24 @@ feature_deploy=true javadoc=false jacoco=false code_quality=false + +// New variables + +GRADLE_PATH = '/opt/gradle/gradle-3.5.1/bin' +GRADLE_TASK = 'ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB' +DEPLOYMENT_ARCHIVE_DIR='/home/muleadmin/stage/archive' +DEPLOYMENT_STAGE_DIR='/home/muleadmin/stage' +DEPLOYMENT_DIR='/opt/mule/latest/webapps' +WAR_FILES='AlertESB.war FraudESB.war TaxESB.war PaymentESB.war FulfillmentESB.war ESBAuditLog.war ESBAutomatedQueueRetry.war OrderReconESB.war' +ESB_BIN_PATH='/opt/mule/bin/esb_service' +ESB_WAR_FOLDERS='PaymentESB ESBAuditLog OrderReconESB FraudESB TaxESB FulfillmentESB AlertESB ESBAutomatedQueueRetry' +REQUESTID='779' +STAGE_NAME='dev3' +WORKSOFT_URI='http://pwwsftapp01/executionmanager/api' +USERNAME='devopsengineering@signetjewelers.com' +USERNAME_FEATURE_DEPLOY='muleadmin' +HOSTS_FEATURE_DEPLOY="10.6.74.90" +USERNAME_DEV_DEPLOY='muleadmin' +HOSTS_DEV_DEPLOY="10.6.74.91, 10.6.74.92" +USERNAME_RELEASE='muleadmin' +HOSTS_RELEASE_DEPLOY="10.6.74.93, 10.6.74.94" From e83d9bd7171463a9ff53a1045e27eee08459f7ea Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:49:57 -0600 Subject: [PATCH 145/148] Update Jenkinsfile_PROD --- Jenkinsfile_PROD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile_PROD b/Jenkinsfile_PROD index 14cf09a..316bc3f 100644 --- a/Jenkinsfile_PROD +++ b/Jenkinsfile_PROD @@ -86,7 +86,7 @@ spec: echo 'Remove the below 3 lines after switching to the actual ESB repo' sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar" sh 'ls -lrt sample-java-app/target/' - sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" + //sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } } From 41bf423429a3c52ff75e49c20a23ba1bfd5fdf27 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:52:06 -0600 Subject: [PATCH 146/148] Update Jenkinsfile_PROD --- Jenkinsfile_PROD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_PROD b/Jenkinsfile_PROD index 316bc3f..4178d3b 100644 --- a/Jenkinsfile_PROD +++ b/Jenkinsfile_PROD @@ -84,8 +84,8 @@ spec: sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true */ echo 'Remove the below 3 lines after switching to the actual ESB repo' - sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar" - sh 'ls -lrt sample-java-app/target/' + //sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar" + //sh 'ls -lrt sample-java-app/target/' //sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" } } From 8b3e28c10036233ca19955d44c75c9fe3cf26e74 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:58:06 -0600 Subject: [PATCH 147/148] Update Jenkinsfile_PROD --- Jenkinsfile_PROD | 199 +---------------------------------------------- 1 file changed, 2 insertions(+), 197 deletions(-) diff --git a/Jenkinsfile_PROD b/Jenkinsfile_PROD index 4178d3b..f74d5bf 100644 --- a/Jenkinsfile_PROD +++ b/Jenkinsfile_PROD @@ -23,204 +23,9 @@ spec: stages { stage('Build & Unit Test') { steps { - container('gradle') { - script { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am executing build and unit test' - echo "Use the line below when we switch to the actual repo" - // sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do gradle --no-daemon -p ${i} clean build;done' - echo "Remove the line below when we switch to the actual repo" - sh 'mvn -f sample-java-app/pom.xml clean package' - propfile = readProperties(file: './project.properties') - if (propfile['javadoc'] == "true") { - sh 'mvn javadoc:aggregate' - } - if (propfile['jacoco'] == "true") { - jacoco( - execPattern: '**/*.exec', - classPattern: '**/*.class', - sourcePattern: '**/*.java', - exclusionPattern: '**/test*' - ) - } - } - } - } + propfile = readProperties(file: './project.properties') + echo propfile['USERNAME'] } } - stage('Code Quality') { - when { expression {propfile['code_quality'] == "true" }} - steps { - container('gradle') { - withMaven(maven: 'MAVEN-3.6.3') { - withSonarQubeEnv(installationName: 'Sonarqube') { - echo 'I am executing code quality using sonarqube' - echo ' Update the line below when we switch to actual ESB repo' - // sh './gradle Sonarqube' - echo ' Remove the line below after we switch to ESB repo' - sh "mvn -f sample-java-app/pom.xml -Dsonar.projectName=ESB_${env.GIT_BRANCH} -Dsonar.projectKey=ESB_sample sonar:sonar" - } - sleep(60) - timeout(time: 1, unit: 'MINUTES') { - waitForQualityGate abortPipeline: true - } - } - } - } - } - stage("Publish Package") { - when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} - steps { - container('gradle') { - script { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am pushing the artifact with unique name showing the branch from which it is generated, to Archiva' - echo 'Replace the next 4 lines to reflect the ESB artifact and push it to archiva' - echo 'Use the 5 lines below when we switch to the actual ESB repo' - /* echo 'copying the jar and war files from the individual target directorrys and copying it to artifacts directory ' - sh "mkdir -p $WORKSPACE/artifacts" - sh 'for i in ESBAuditClient ESBAuditLog ESBErrorTranslator TaxESB FraudESB FulfillmentESB PaymentESB ESBRadial ESBAutomatedQueueRetry AlertESB OrderReconESB;do cp -rp ${i}/dist/libs/* $WORKSPACE/artifacts/ ;done' - echo 'create a tar file on the Jenkins server' - sh "cd $WORKSPACE/artifacts/ && tar -cvzf artifact.tar * && md5sum artifact.tar archiveArtifacts artifacts: 'artifacts/*.tar', fingerprint: true - */ - echo 'Remove the below 3 lines after switching to the actual ESB repo' - //sh "mv sample-java-app/target/sample-0.0.1-SNAPSHOT.jar sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar" - //sh 'ls -lrt sample-java-app/target/' - //sh "mvn -X deploy:deploy-file -Dfile=sample-java-app/target/sample-build_${BUILD_NUMBER}-branch_${env.GIT_BRANCH}.jar -DpomFile=sample-java-app/pom.xml -DrepositoryId=snapshots -Durl=https://archiva.sgn.devops.accentureanalytics.com/repository/snapshots/" - } - } - } - } - } - stage("Deploy") { - when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} - steps { - container('gradle') { - script { - withMaven(maven: 'MAVEN-3.6.3') { - if (propfile['feature_deploy'] == "true" ) { - propfile['USERNAME']=propfile['USERNAME_FEATURE_DEPLOY'] - propfile['HOSTS']=propfile['HOSTS_FEATURE_DEPLOY'] - } - if (env.GIT_BRANCH == 'dev' ) { - propfile['USERNAME']=propfile['USERNAME_DEV_DEPLOY'] - propfile['HOSTS']=propfile['HOSTS_DEV_DEPLOY'] - } - if (env.GIT_BRANCH == 'release') { - propfile['USERNAME']=propfile['USERNAME_RELEASE_DEPLOY'] - propfile['HOSTS']=propfile['HOSTS_RELEASE_DEPLOY'] - } - HOSTS.tokenize(',').each { HOSTNAME -> - echo "I am deploying the artifact into the target environment ${HOSTNAME} as user ${USERNAME}" - echo 'Replace all the lines below for ESB and add the parameters to propfile and make refrences below' - echo 'Accom logic for multiple env and mult servers in each env based on the branch name' - echo 'shutting down the tomcat ESB server' - /* sh 'ssh ${USERNAME}@${HOSTNAME} "$ESB_BIN_PATH stop || sleep 20"' - echo 'force stop any remaining mule process' - sh 'ssh ${USERNAME}@${HOSTNAME} "if [[ $(ps aux | grep /opt/mule/latest/ | grep -vc grep) > 0 ]]; then "kill -9 $(ps -ef|pgrep -f "/opt/mule/latest/bin")"; else echo "do nothing"; fi"' - */ - echo 'tomcat server stopped' - echo 'copying the tar file from jenkins to deployment directory on app and remove the old folders and untarring the new jar and war files' - /* sh 'scp -rp $WORKSPACE/artifacts/artifact.tar $DEPLOYMENT_USER@$DEPOYMENT_SERVER:$DEPLOYMENT_STAGE_DIR/' - sh 'ssh ${USERNAME}@${HOSTNAME} "cd $DEPLOYMENT_STAGE_DIR && rm -rf *.war *.jar"' - sh 'ssh ${USERNAME}@${HOSTNAME} "cd $DEPLOYMENT_STAGE_DIR && tar -xvzf artifact.tar && rm -rf *.jar"' - sh 'ssh ${USERNAME}@${HOSTNAME} "cd $}DEPLOYMENT_DIR} && rm -rf ${ESB_WAR_FOLDERS} && cp -rp ${DEPLOYMENT_STAGE_DIR}/*.war $DEPLOYMENT_DIR"' - */ - echo 'Deployment has been completed' - echo 'starting the tomcat ESB server' - /* sh 'ssh ${USERNAME}@${HOSTNAME} "${ESB_BIN_PATH start}"' - sh 'ssh ${USERNAME}@${HOSTNAME} "sleep 20"' - */ - echo 'tomcat server started' - echo "propfile['USERNAME']" - } - } - } - } - } - } - - - stage('Post Deploy Tests') { - when { expression {env.GIT_BRANCH == 'dev' || env.GIT_BRANCH == 'release'|| propfile['feature_deploy'] == "true" }} - parallel { - stage('Smoke Test') { - steps { - echo "I am executing Smoke Test on target dev environment post deployment" - } - /*RESP=`curl -X GET "${WORKSOFT_URI}/RequestsRunning" -H "accept: application/xml" -H "authorization: bearer lR0AA2qfq7v9Ry96vDAgqcer1GPVd5yStmv1_aJVFS43rk06EytB7WsS0_owoiXIgpOXmZVEfkY4ST0JwHtRBk7RH0QRaldWtQT8udC0VdimdGx38RddY2sGaeeF0t9Aflr5rh1Jc_EUfkNK8YrKVxQ6kxB05aCe46CD2fkognv7TiJATmht-ycUjEsd_oy8jH5EK9fmn9eL-wXavNTQcEdsUmFm3-2r3IJDzMK7XCa74qu353yOKLvVyZ1yYQBnc1_fY5GS1BDrFLUZprxpAS30lGEu-d_JTTOQ989UJtIEB3cZzDkIQzeqdYBGCsiDdjdHo2DC1FK2kVPyBITTbQ"` - echo "The response for current execution status is: $RESP" - if [ "$RESP" != "[]" ]; - then - echo "There is a test executing currently in Worksoft. Hence, not proceeding with the execution of Worksoft test cases." - exit 1 - else - echo "There are no tests executing right now. Hence, proceeding with Worksoft test execution" - fi - # To abort the request before attempting to re-run, uncomment and run below line. - # abort=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "id: ${REQUESTID}" ${WORKSOFT_URI}/Request/${REQUESTID}/abort/) - guid=$(curl -X PUT -H "Authorization: Bearer $token" -d "" -H "parameters: {TestEnv}{${STAGE_NAME}}" -H "id: ${REQUESTID}" ${WORKSOFT_URI}/ExecuteRequest/ | tr -d \") - echo "The GUID is: $guid" - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) - echo "The status is: $status" - while [[ $status != *"Completed"* ]] - do - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/ | awk -F':' '{print $2}' | tr -d \" | tr -d \}) - echo "The status is: $status" - sleep 15 - done - status=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/) - echo "The status is: $status" - execstatus=$(curl -X GET -H "Authorization: Bearer $token" -d "" -H "APIRequestID: $guid" ${WORKSOFT_URI}/ExecutionStatus/ | awk -F':' '{print $3}' | tr -d \" | tr -d \}) - echo "The exec status is: $execstatus" - if [[ $execstatus != *Passed* ]]; - then - echo "Failed" - exit 1 - else - echo "Passed" - exit - fi - exit */ - } - stage('Security Test') { - steps { - container('gradle') { - script { - withMaven(maven: 'MAVEN-3.6.3') { - echo 'I am running Security Test here' - } - } - } - } - } - } } - - } - - post { - always { - script { - if (propfile['javadoc'] == "true") { - javadoc(javadocDir: "/$WORKSPACE/target/site/apidocs", keepAll: true) - } - } - } - failure { - /*mail bcc: '', - body: "Example
\n
Project: ${env.JOB_NAME}
Build Number: ${env.BUILD_NUMBER}
URL de build: ${env.BUILD_URL}", - cc: '', - charset: 'UTF-8', - from: '', - mimeType: 'text/html', - replyTo: '', - subject: "ERROR CI: Project name -> ${env.JOB_NAME}", - to: "foo@foomail.com";*/ - echo 'I am sending a notification with failure' - } - success { - echo 'I am sending a notification with success' - } - } } From 8e73721d12cfcb0efef539f11e53d4418165b025 Mon Sep 17 00:00:00 2001 From: sdgcpae Date: Tue, 2 Mar 2021 13:59:17 -0600 Subject: [PATCH 148/148] Update Jenkinsfile_PROD --- Jenkinsfile_PROD | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile_PROD b/Jenkinsfile_PROD index f74d5bf..680faeb 100644 --- a/Jenkinsfile_PROD +++ b/Jenkinsfile_PROD @@ -23,8 +23,10 @@ spec: stages { stage('Build & Unit Test') { steps { - propfile = readProperties(file: './project.properties') - echo propfile['USERNAME'] + script { + propfile = readProperties(file: './project.properties') + echo propfile['USERNAME'] + } } } }