-
Notifications
You must be signed in to change notification settings - Fork 7
/
Jenkinsfile
54 lines (49 loc) · 1.8 KB
/
Jenkinsfile
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
pipeline {
agent any
tools {
maven 'Maven_Home'
jdk 'JDK_11'
}
stages {
stage('Initialize Git POLL SCM Feature') {
steps {
//Enable remote triggers
script {
properties([[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/bipin115/CICD-deployment-using-Ansible-CM-tool.git'], pipelineTriggers([pollSCM('* * * * *')])])
}
}
}
stage(' Clean existing workspace') {
steps {
cleanWs()
}
}
stage('Git project checkout') {
steps {
git branch: 'master', url: 'https://github.com/bipin115/CICD-deployment-using-Ansible-CM-tool.git'
}
}
stage(' Applying Playbook to Configurig tomcat server on remote server'){
steps {
sh "ansible-playbook tomcat-setup.yaml"
}
}
stage(' Building WAR package from Java project and deployig to remote Tomcat server'){
steps {
build 'deploy-war-package-remote-host'
}
// post {
// success {
// echo "Now Archiving the Artifacts...."
// archiveArtifacts artifacts: '**/*.war'
// }
// }
}
// stage(' Deployig WAR package on remote tomcat server'){
// steps {
// deploy adapters: [tomcat9(credentialsId: 'tomcat-admin-remote-deployment', path: '', url: 'http://3.109.200.185:8080/')], contextPath: '/', war: '**/*.war'
// sh "scp /var/lib/jenkins/workspace/deploy-war-package-remote-host/target/spring-maven-app-0.0.1-SNAPSHOT.war devops@15.207.98.117:/opt/tomcat/webapps/"
// }
// }
}
}