forked from fabric8-analytics/fabric8-analytics-worker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
76 lines (66 loc) · 2.62 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
65
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env groovy
@Library('github.com/msrb/cicd-pipeline-helpers')
def commitId
node('docker') {
def image = docker.image('bayesian/cucos-worker')
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, '--pull --no-cache .')
sh "docker tag ${image.id} docker-registry.usersys.redhat.com/${image.id}"
docker.build('cucos-lib-tests', '-f Dockerfile.tests .')
}
stage('Tests') {
timeout(30) {
sh './runtest.sh'
}
}
stage('Integration Tests') {
ws {
docker.withRegistry('https://docker-registry.usersys.redhat.com/') {
docker.image('bayesian/bayesian-api').pull()
docker.image('bayesian/coreapi-jobs').pull()
docker.image('bayesian/coreapi-pgbouncer').pull()
docker.image('bayesian/coreapi-downstream-data-import').pull()
}
git url: 'https://github.com/baytemp/common.git', branch: 'master', credentialsId: 'baytemp-ci-gh'
dir('integration-tests') {
timeout(30) {
sh './runtest.sh'
}
}
}
}
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 process -v IMAGE_TAG=${commitId} -v WORKER_ADMINISTRATION_REGION=ingestion -f template.yaml | oc --context=dev apply -f -"
sh "oc --context=dev process -v IMAGE_TAG=${commitId} -v WORKER_ADMINISTRATION_REGION=api -f template.yaml | oc --context=dev apply -f -"
}
//stage('Deploy - rh-idev') {
// unstash 'template'
// sh "oc --context=rh-idev process -v IMAGE_TAG=${commitId} -v WORKER_ADMINISTRATION_REGION=ingestion -f template.yaml | oc --context=rh-idev apply -f -"
// sh "oc --context=rh-idev process -v IMAGE_TAG=${commitId} -v WORKER_ADMINISTRATION_REGION=api -f template.yaml | oc --context=rh-idev apply -f -"
//}
}
}