-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
21 lines (21 loc) · 838 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
node {
stage('clone git project') {
git 'https://github.com/irfanahmed786/hello-world-master.git'
}
stage('build maven project'){
def mvnHOME = tool name: 'Maven', type: 'maven'
def mvnCMD = "$mvnHOME/bin/mvn"
sh "$mvnCMD clean install"
}
stage('copy artifacts'){
sshagent(['dockeradmin']) {
sh "scp -p /var/lib/jenkins/workspace/hello-world-project_master/webapp/target/webapp.war [email protected]:/opt/docker_project/docker-images/hello-world/prod/"
}
}
stage('deploy hello world through ansible'){
sshagent(['ansiadmin']) {
def runHelloWorld = 'ansible-playbook /opt/ansiadm/projects/k8s/hello-world.yml'
sh "ssh -o StrictHostKeyChecking=no -l ansiadmin 192.168.56.125 ${runHelloWorld}"
}
}
}