From 73611433afae9c0f6e8e7a86ae61f552cb0ca144 Mon Sep 17 00:00:00 2001 From: honeysri16 <99634487+honeysri16@users.noreply.github.com> Date: Tue, 29 Mar 2022 16:33:55 +0530 Subject: [PATCH 1/3] Update Jenkinsfile --- Jenkinsfile | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index d736734..57a2d2a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,44 +1,18 @@ pipeline { agent any - tools{ - maven 'Maven3.8.2' - } + tools { + maven 'Maven3.8.4' + } stages { - stage("checkout") { + stage('Checkout') { steps { - checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/keyspaceits/javawebapp.git']]]) + checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [], userRemoteConfigs: [[url: 'https://github.com/keyspaceits/javawebapp.git']]]) } } - stage("build") { + stage('Build') { steps { sh 'mvn clean install -f pom.xml' - } - } - stage("CodeQuality") { - steps { - withSonarQubeEnv('SonarQube') { - sh 'mvn sonar:sonar -f pom.xml' - } - } - } - stage("dev deploy") { - steps { - deploy adapters: [tomcat9(credentialsId: 'deployer', path: '', url: 'http://54.164.159.39:8080')], contextPath: null, war: '**/*.war' - } - } - stage('Dev apprl for QA') { - steps { - echo "taking approval from Dev Manager" - timeout(time: 7, unit: 'DAYS') { - input message: 'Do you want to proceed to QA?', submitter:'admin' - } - } - } - stage('QA Deploy'){ - steps{ - deploy adapters: [tomcat9(credentialsId: 'deployer', path: '', url: 'http://54.164.159.39:8080')], contextPath: null, war: '**/*.war' - } - } - + } + } } } From 012003f43d302c029e89304c7f5bcc71b1a39e4b Mon Sep 17 00:00:00 2001 From: honeysri16 <99634487+honeysri16@users.noreply.github.com> Date: Tue, 29 Mar 2022 16:36:12 +0530 Subject: [PATCH 2/3] Update Jenkinsfile --- Jenkinsfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 57a2d2a..8196a59 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,8 +1,13 @@ pipeline { + parameters { + choice(choices: ['Dev', 'QA'], description: 'Target for build env', name: 'env') + choice(choices: ['Y','N'], description: 'is the deployment for release' , name: 'isRelease') + } + agent any tools { - maven 'Maven3.8.4' - } + maven 'Maven3.8.4' + } stages { stage('Checkout') { steps { @@ -12,7 +17,7 @@ pipeline { stage('Build') { steps { sh 'mvn clean install -f pom.xml' - } + } } } } From 932c3149e15aa7ee7c5248126bb7c95d3ffdd118 Mon Sep 17 00:00:00 2001 From: honeysri16 <99634487+honeysri16@users.noreply.github.com> Date: Fri, 8 Apr 2022 12:08:49 +0530 Subject: [PATCH 3/3] Update Jenkinsfile --- Jenkinsfile | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8196a59..93a2f89 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -19,5 +19,22 @@ pipeline { sh 'mvn clean install -f pom.xml' } } - } + stage('S3Bucket Deploy to Dev') { + when { + branch 'master' + } + steps { + s3Upload consoleLogLevel: 'INFO', dontSetBuildResultOnFailure: false, dontWaitForConcurrentBuildCompletion: false, entries: [[bucket: 'jenkins-dev2', excludedFile: '', flatten: false, gzipFiles: false, keepForever: false, managedArtifacts: false, noUploadOnFailure: false, selectedRegion: 'us-east-1', showDirectlyInBrowser: false, sourceFile: '**/*.war', storageClass: 'STANDARD', uploadFromSlave: false, useServerSideEncryption: false]], pluginFailureResultConstraint: 'FAILURE', profileName: 's3', userMetadata: [] + } + } + stage('S3 Bucket Deploy to Qa') { + when { + branch 'test' + } + steps { + s3Upload consoleLogLevel: 'INFO', dontSetBuildResultOnFailure: false, dontWaitForConcurrentBuildCompletion: false, entries: [[bucket: 'jenkins-qa2', excludedFile: '', flatten: false, gzipFiles: false, keepForever: false, managedArtifacts: false, noUploadOnFailure: false, selectedRegion: 'us-east-1', showDirectlyInBrowser: false, sourceFile: '**/*.war', storageClass: 'STANDARD', uploadFromSlave: false, useServerSideEncryption: false]], pluginFailureResultConstraint: 'FAILURE', profileName: 's3', userMetadata: [] + } + } +} + }