forked from jenkins-docs/simple-java-maven-app
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathJenkinsfile
More file actions
36 lines (32 loc) · 837 Bytes
/
Jenkinsfile
File metadata and controls
36 lines (32 loc) · 837 Bytes
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
pipeline {
agent any
environment {
GIT_VER = getSCMVer()
IMAGE = readMavenPom().getArtifactId()
VERSION = readMavenPom().getVersion()
}
stages {
stage('Github Pull') {
steps {
echo 'Pulling from git'
echo "Git version is $GIT_VER"
git 'https://github.com/devops-max/simple-java-maven-app'
}
}
stage('Maven Build') {
steps {
echo 'Building Project'
sh 'mvn clean package'
}
}
stage('Create Docker Image') {
steps {
sh 'docker build . -t sampleapp:${VERSION}'
}
}
}
}
def getSCMVer() {
def gitVer = sh returnStdout: true, script: 'git --version'
return gitVer
}