-
Notifications
You must be signed in to change notification settings - Fork 1
/
.Jenkinsfile
64 lines (60 loc) · 1.85 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
64
pipeline {
agent { label 'docker' }
environment {
ROLES_VERSION = "${env.GIT_COMMIT}"
}
stages {
stage('Anible Lint') {
agent {
docker {
image 'evolix/ansible-lint:latest'
}
}
steps {
script {
sh 'for role_dir in ./*/; do HOME=$WORKSPACE_TMP ansible-lint -p $role_dir || : ; done'
recordIssues(tools: [ansibleLint()])
}
}
}
stage('Build tagged docker image') {
when {
buildingTag()
}
steps {
script {
def im = docker.build("evolix/ansible-roles:build${env.BUILD_ID}")
im.inside {
sh 'echo Test needed'
}
def version = TAG_NAME
def versions = version.split('\\.')
def major = versions[0]
def minor = versions[0] + '.' + versions[1]
def patch = version.trim()
docker.withRegistry('', 'hub.docker') {
im.push(major)
im.push(minor)
im.push(patch)
}
}
}
}
stage('Build latest docker image') {
when {
branch 'unstable'
}
steps {
script {
def im = docker.build("evolix/ansible-roles:build${env.BUILD_ID}")
im.inside {
sh 'echo Test needed'
}
docker.withRegistry('', 'hub.docker') {
im.push('latest')
}
}
}
}
}
}