-
Notifications
You must be signed in to change notification settings - Fork 1
/
Jenkinsfile
63 lines (58 loc) · 1.53 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
node('docker') {
def app
environment {
DOCKER_CREDS = credentials('docker-hub')
}
stage('Clone repository on slave') {
/* Let's make sure we have the repository cloned to our workspace */
checkout scm
}
stage('Gradle Build') {
sh './gradlew build -x test'
}
stage('Gradle Tests') {
try{
sh './gradlew test'
}catch (Exception e){
//Ignore failed tests
}
/* Publish test results
publishHTML([
allowMissing: false,
alwaysLinkToLastBuild: false,
keepAll: false,
reportDir: './build/reports/tests/test/',
reportFiles: 'index.html',
reportName: 'HTML Test Report',
reportTitles: ''
])*/
//Post Jacoco test coverage report
//jacoco classPattern: '**/build/classes',exclusionPattern: '**/BeanstalkClient.class', execPattern: '**/build/jacoco/**.exec', inclusionPattern: '**/*.class', sourceInclusionPattern: '**/*.groovy', sourcePattern: '**/src/main/groovy'
}
stage('Build image') {
/* This builds the actual image; synonymous to
* docker build on the command line */
//Check if file exists
sh './gradlew build -x test'
def exists = fileExists './build/libs/workerB-all.jar'
if (exists) {
echo 'The Jar Exists'
} else {
echo 'Can not find the jar'
output=sh (
script: 'ls -LR',
returnStdout: true
).trim()
echo output
}
app = docker.build("iceberg00/hp-docker-capstone-workerb")
}
stage('Test image') {
}
stage('Push image'){
docker.withRegistry('https://registry.hub.docker.com', 'docker-hub') {
app.push("${env.BUILD_NUMBER}")
app.push("latest")
}
}
}