Skip to content

Commit

Permalink
Create Jenkinsfile
Browse files Browse the repository at this point in the history
  • Loading branch information
javahometech authored Jul 27, 2022
1 parent 3001761 commit c46b84c
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions ansible/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
pipeline{
agent any
tools {
maven 'maven2'
}
stages{
stage("Git Checkout"){
steps{
git url: "https://github.com/javahometech/my-app"
}
}
stage("Maven Build"){
steps{
sh "mvn clean package"
}
}

stage("Ansible Deploy"){
steps{
script{
def pom = readMavenPom file: 'pom.xml'
def name = pom.artifactId
def ext = pom.packaging
def version = pom.version
def war_file = "${name}-${version}.${ext}"
withEnv(["WAR_FILE=${war_file}"]) {
ansiblePlaybook credentialsId: 'tomcat-dev',
inventory: './ansible/dev',
playbook: './ansible/tomcat-deploy.yml'
}

}
}
}
}
}

0 comments on commit c46b84c

Please sign in to comment.