forked from fabric8-analytics/fabric8-analytics-recommender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
50 lines (43 loc) · 1.54 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
#!/usr/bin/env groovy
@Library('github.com/msrb/cicd-pipeline-helpers')
def commitId
node('docker') {
def image = docker.image('bayesian/analytics-training')
stage('Checkout') {
checkout scm
commitId = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
dir('openshift') {
stash name: 'template', includes: 'template.yaml'
}
}
stage('Build') {
dockerCleanup()
docker.build(image.id, '-f Dockerfile.analytics-training --pull --no-cache .')
}
if (env.BRANCH_NAME == 'master') {
stage('Push Images') {
docker.withRegistry('https://docker-registry.usersys.redhat.com/') {
image.push('latest')
image.push(commitId)
}
docker.withRegistry('https://registry.devshift.net/') {
image.push('latest')
image.push(commitId)
}
}
}
}
if (env.BRANCH_NAME == 'master') {
node('oc') {
stage('Deploy - dev') {
unstash 'template'
sh 'oc --context=dev delete job bayesian-analytics-training || :'
sh "oc --context=dev process -v IMAGE_TAG=${commitId} -f template.yaml | oc --context=dev apply -f -"
}
//stage('Deploy - rh-idev') {
// unstash 'template'
// sh 'oc --context=rh-idev delete job bayesian-analytics-training || :'
// sh "oc --context=rh-idev process -v IMAGE_TAG=${commitId} -f template.yaml | oc --context=rh-idev apply -f -"
//}
}
}