-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
48 lines (43 loc) · 1.44 KB
/
Jenkinsfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
pipeline {
agent any
tools {
// Install the Maven version configured as "M3" and add it to the path.
maven "mvn"
jdk "java8"
'org.jenkinsci.plugins.docker.commons.tools.DockerTool' 'docker'
}
stages {
stage ('Initialize') {
steps {
sh '''
echo "PATH = ${PATH}"
echo "M2_HOME = ${M2_HOME}"
'''
}
}
stage('Build') {
steps {
// Get some code from a GitHub repository
git url: 'https://gitlab.com/vanchung1995/hellospring', branch: 'master', credentialsId: 'gitlab_chungvv'
sh "ls -la"
// Run Maven on a Unix agent.
sh "mvn -Dmaven.test.failure.ignore=true clean install"
// To run Maven on a Windows agent, use
// bat "mvn -Dmaven.test.failure.ignore=true clean package"
}
post {
// If Maven was able to run the tests, even if some of the test
// failed, record the test results and archive the jar file.
success {
junit '**/target/surefire-reports/TEST-*.xml'
archiveArtifacts 'target/*.jar'
}
}
}
stage('Build docker') {
steps {
sh 'docker build -t hellospring .'
}
}
}
}