-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
35 lines (34 loc) · 1.2 KB
/
Jenkinsfile
File metadata and controls
35 lines (34 loc) · 1.2 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
node {
def mvnHome
def appimage
stage('Preparation') { // for display purposes
// Get some code from a GitHub repository
git branch: 'master',
url: 'https://github.com/amitmohleji/APP-X.git'
// Get the Maven tool.
// ** NOTE: This 'M3' Maven tool must be configured
// ** in the global configuration.
mvnHome = tool 'maven3'
}
stage('Build') {
sh "${mvnHome}/bin/mvn clean package -DskipTests=true"
}
stage('Update Manifest'){
sh "sed -i 's/{{BUILD_NUMBER}}/$BUILD_NUMBER/g' deployit-manifest.xml"
}
stage('Update K8s.yaml'){
sh "sed -i 's/{{BUILD_NUMBER}}/$BUILD_NUMBER/g' petclinic.yaml/k8s.yaml"
}
stage('Build Docker Image') {
appimage = docker.build("amitmohleji/appx:$BUILD_NUMBER")
}
stage('Push Image to Registry(dockerhub)') {
docker.withRegistry("", "cred") {
appimage.push("$BUILD_NUMBER")
}
}
stage('Publish'){
xldCreatePackage artifactsPath: '.', manifestPath: 'deployit-manifest.xml', darPath: '$JOB_NAME-$BUILD_NUMBER.0.dar'
xldPublishPackage serverCredentials: 'admin', darPath: '$JOB_NAME-$BUILD_NUMBER.0.dar'
}
}