diff --git a/Jenkinsfile b/Jenkinsfile index d736734..93a2f89 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,44 +1,40 @@ 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.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' - } - } - - } + } + 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: [] + } + } +} + }