-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
45 lines (40 loc) · 1.34 KB
/
Jenkinsfile
File metadata and controls
45 lines (40 loc) · 1.34 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
36
37
38
39
40
41
42
43
44
45
node {
// Mark the code checkout 'stage'....
stage('Checkout') {
// Checkout code from repository
checkout scm
}
stage('Environment') {
sh 'printenv'
}
// Mark the code build 'stage'....
stage('Build')
def dockerImage = docker.build("trnubot/captainhook:${env.BUILD_TAG}")
stage('Test') {
try {
withEnv(["GOSS_VER=v0.3.4","GOSS_PATH=${env.WORKSPACE}/goss","GOSS_OPTS=--format junit"]) {
sh "wget -O goss https://github.com/aelsabbahy/goss/releases/download/$GOSS_VER/goss-linux-amd64 && chmod +x goss"
sh "./dgoss run trnubot/captainhook:${env.BUILD_TAG} | tee junit-out.xml"
dockerImage.inside {
sh 'echo "OK"'
sh 'ls -l /entry.sh'
}
}
}
finally {
junit 'junit-out.xml'
}
}
stage('Push') {
docker.withRegistry('https://registry.hub.docker.com', '22ec7b27-f486-4683-a51d-606b88dac043') {
if (env.BRANCH_NAME == 'master') {
echo 'Pushing docker tag latest'
dockerImage.push('latest')
dockerImage.push('master')
} else {
echo "Pushing docker tag ${env.BUILD_TAG}"
dockerImage.push()
}
}
}
}