forked from javahometech/my-app
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
javahometech
authored
Jul 27, 2022
1 parent
3001761
commit c46b84c
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
} |