-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathJenkinsfile
65 lines (49 loc) · 1.56 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
#!/usr/bin/env groovy
@Library("github.com/RedHatInsights/insights-pipeline-lib@v3")
NS='remediations-pr'
def notify(subject, body, color) {
message = subject
if (body != null) {
message += " | ${body}"
}
slackSend message: message, color: color, channel: '#remediations'
}
def notifyOnFailure(Closure step) {
try {
step()
} catch (e) {
notify("@jharting [${env.JOB_NAME.split('/')[-1]}] Build failed", "See ${env.BUILD_URL}console", "danger")
throw e
}
}
node('nodejs') {
notifyOnFailure {
notify("[${env.JOB_NAME.split('/')[-1]}] Build started", null, "#439FE0")
env.NODEJS_HOME = "${tool 'node-10'}"
env.PATH="${env.NODEJS_HOME}/bin:${env.PATH}"
checkout scm
def utils = load "./build/utils.groovy"
sh 'git rev-parse HEAD'
stage('build') {
sh 'npm ci'
sh 'npm run compile'
}
openshift.withCluster() {
utils.withScaledEnv(NS) {
env.DB_HOST="postgres.${NS}.svc"
stage('verify') {
sh 'npm run verify'
}
}
stage('build image') {
timeout (10) {
openshift.withProject('buildfactory') {
def build = openshift.selector('bc', 'remediations-consumer').startBuild()
build.logs('-f')
}
}
}
notify("[${env.JOB_NAME.split('/')[-1]}] Build finished", null, "good")
}
}
}