-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (49 loc) · 1.08 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
pipeline {
agent {
node {
label 'docker-build'
}
}
stages {
stage('Build') {
steps {
script {
if (! env.version) {
gitCommitHash = sh(returnStdout: true, script: 'git rev-parse --short HEAD')
version = gitCommitHash
c = docker.build("${registry}/${image}", "--build-arg buildTime=`date -Iseconds` .")
}
}
}
}
stage('Verify') {
steps {
script {
c.run("", "version --client")
}
}
}
stage('Push') {
steps {
script {
docker.withRegistry('', env.credentialsId) {
if (env.BRANCH_NAME == 'devel') {
println 'Development branch...skipping push...'
} else {
c.push("${env.BRANCH_NAME}")
}
if (env.BRANCH_NAME == 'master') {
c.push('latest')
}
}
}
}
}
}
environment {
version = ''
credentialsId = 'hub-jamesbowling'
registry = 'jamesbowling'
image = 'k8s-cli'
}
}