-
Notifications
You must be signed in to change notification settings - Fork 227
Expand file tree
/
Copy pathJenkinsfile-parameterized-tomcat-deploy
More file actions
64 lines (49 loc) · 1.71 KB
/
Jenkinsfile-parameterized-tomcat-deploy
File metadata and controls
64 lines (49 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
pipeline {
agent any
parameters {
choice choices: ['develop', 'release', 'master'], description: 'Please provide the branch name so that we can deploy', name: 'branch'
}
// not required in case of parameterized
triggers {
pollSCM 'H/2 * * * * '
}
tools {
maven 'maven'
}
environment {
project_type = 'java'
DEPLOY_TO = 'production'
}
stages {
stage('git fetch') {
steps {
git branch: "${params.branch}", credentialsId: '4991f864-6845-456a-90df-f0f62edcdc79', url: 'https://github.com/mailrahulsre/java-db-Login.git'
}
}
stage('Build the code') {
when{
environment name: 'project_type', value: 'java'
}
steps {
sh 'mvn -Dmaven.test.failure.ignore=true clean package'
echo "deploying to ${DEPLOY_TO} Env "
deploy adapters: [tomcat8(credentialsId: 'tomcat-cred', path: '', url: 'http://172.31.32.223:8080')], contextPath: 'login-release-branch', onFailure: false, war: '**/*.war'
}
}
}
post {
always {
echo "You can always see me"
}
success {
echo "I am running because the job ran successfully"
//sh '/usr/local/bin/aws s3 cp /jenkins-home/workspace/stage-tavisca/target/LoginRegisterApp.war s3://9am-weekend-jul/$JOB_NAME/${BUILD_NUMBER}/'
}
unstable {
echo "Gear up ! The build is unstable. Try fix it"
}
failure {
echo "OMG ! The build failed"
}
}
}