forked from openshift/assisted-installer-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (48 loc) · 1.5 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
pipeline {
environment {
AGENT_IMAGE = 'quay.io/ocpmetal/assisted-installer-agent'
}
agent {
node {
label 'centos_worker'
}
}
stages {
stage('build') {
steps {
sh 'skipper make build'
}
}
stage('test') {
steps {
sh 'skipper make subsystem'
}
}
stage('publish images on push to master') {
when {
branch 'master'
}
steps {
withCredentials([usernamePassword(credentialsId: 'ocpmetal_cred', passwordVariable: 'PASS', usernameVariable: 'USER')]) {
sh '''docker login quay.io -u $USER -p $PASS'''
}
sh '''docker tag ${AGENT_IMAGE} ${AGENT_IMAGE}:latest'''
sh '''docker tag ${AGENT_IMAGE} ${AGENT_IMAGE}:${GIT_COMMIT}'''
sh '''docker push ${AGENT_IMAGE}:latest'''
sh '''docker push ${AGENT_IMAGE}:${GIT_COMMIT}'''
}
post {
failure {
script {
if (env.BRANCH_NAME == 'master')
stage('notify master branch fail') {
withCredentials([string(credentialsId: 'slack-token', variable: 'TOKEN')]) {
sh '''curl -X POST -H 'Content-type: application/json' --data '{"text":"Attention! master branch push integration failed, Check assisted-installer-agent"}' https://hooks.slack.com/services/${TOKEN}'''
}
}
}
}
}
}
}
}