forked from evidolob/codeready-workspaces-theia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontainers.Jenkinsfile
141 lines (130 loc) · 4.83 KB
/
containers.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/env groovy
// PARAMETERS for this pipeline:
// DWNSTM_BRANCH = crw-2.4-rhel-8
// SCRATCH = true (don't push to Quay) or false (do push to Quay)
def buildNode = "rhel7-releng" // node label
// def JOB_BRANCH = CRW_VERSION // computed below; used to differentiate job URLs
timeout(360) {
node("${buildNode}"){
stage "rhpkg container-builds"
wrap([$class: 'TimestamperBuildWrapper']) {
def CRW_VERSION = sh(script: '''#!/bin/bash -xe
wget -qO- https://raw.githubusercontent.com/redhat-developer/codeready-workspaces/''' + DWNSTM_BRANCH + '''/dependencies/VERSION
''', returnStdout: true)
println "Got CRW_VERSION = '" + CRW_VERSION.trim() + "'"
echo "currentBuild.result = " + currentBuild.result
if (!currentBuild.result.equals("ABORTED") && !currentBuild.result.equals("FAILED")) {
def QUAY_REPO_PATHs=(env.ghprbPullId && env.ghprbPullId?.trim()?"":("${SCRATCH}"=="true"?"":"theia-dev-rhel8"))
echo "[INFO] Trigger get-sources-rhpkg-container-build " + (env.ghprbPullId && env.ghprbPullId?.trim()?"for PR-${ghprbPullId} ":"") + \
"with SCRATCH = ${SCRATCH}, QUAY_REPO_PATHs = ${QUAY_REPO_PATHs}, JOB_BRANCH = ${CRW_VERSION}"
// trigger OSBS build
build(
job: 'get-sources-rhpkg-container-build',
wait: true,
propagate: true,
parameters: [
[
$class: 'StringParameterValue',
name: 'GIT_PATHs',
value: "containers/codeready-workspaces-theia-dev",
],
[
$class: 'StringParameterValue',
name: 'DWNSTM_BRANCH',
value: "${DWNSTM_BRANCH}",
],
[
$class: 'StringParameterValue',
name: 'QUAY_REPO_PATHs',
value: "${QUAY_REPO_PATHs}",
],
[
$class: 'StringParameterValue',
name: 'SCRATCH',
value: "${SCRATCH}",
],
[
$class: 'StringParameterValue',
name: 'JOB_BRANCH',
value: "${CRW_VERSION}",
]
]
)
QUAY_REPO_PATHs=(env.ghprbPullId && env.ghprbPullId?.trim()?"":("${SCRATCH}"=="true"?"":"theia-rhel8"))
echo "[INFO] Trigger get-sources-rhpkg-container-build " + (env.ghprbPullId && env.ghprbPullId?.trim()?"for PR-${ghprbPullId} ":"") + \
"with SCRATCH = ${SCRATCH}, QUAY_REPO_PATHs = ${QUAY_REPO_PATHs}, JOB_BRANCH = ${CRW_VERSION}"
// trigger OSBS build
build(
job: 'get-sources-rhpkg-container-build',
wait: true,
propagate: true,
parameters: [
[
$class: 'StringParameterValue',
name: 'GIT_PATHs',
value: "containers/codeready-workspaces-theia",
],
[
$class: 'StringParameterValue',
name: 'DWNSTM_BRANCH',
value: "${DWNSTM_BRANCH}",
],
[
$class: 'StringParameterValue',
name: 'QUAY_REPO_PATHs',
value: "${QUAY_REPO_PATHs}",
],
[
$class: 'StringParameterValue',
name: 'SCRATCH',
value: "${SCRATCH}",
],
[
$class: 'StringParameterValue',
name: 'JOB_BRANCH',
value: "${CRW_VERSION}",
]
]
)
QUAY_REPO_PATHs=(env.ghprbPullId && env.ghprbPullId?.trim()?"":("${SCRATCH}"=="true"?"":"theia-endpoint-rhel8"))
echo "[INFO] Trigger get-sources-rhpkg-container-build " + (env.ghprbPullId && env.ghprbPullId?.trim()?"for PR-${ghprbPullId} ":"") + \
"with SCRATCH = ${SCRATCH}, QUAY_REPO_PATHs = ${QUAY_REPO_PATHs}, JOB_BRANCH = ${CRW_VERSION}"
// trigger OSBS build
build(
job: 'get-sources-rhpkg-container-build',
wait: true,
propagate: true,
parameters: [
[
$class: 'StringParameterValue',
name: 'GIT_PATHs',
value: "containers/codeready-workspaces-theia-endpoint",
],
[
$class: 'StringParameterValue',
name: 'DWNSTM_BRANCH',
value: "${DWNSTM_BRANCH}",
],
[
$class: 'StringParameterValue',
name: 'QUAY_REPO_PATHs',
value: "${QUAY_REPO_PATHs}",
],
[
$class: 'StringParameterValue',
name: 'SCRATCH',
value: "${SCRATCH}",
],
[
$class: 'StringParameterValue',
name: 'JOB_BRANCH',
value: "${CRW_VERSION}",
]
]
)
} else {
echo "[ERROR] Build status is " + currentBuild.result + " from previous stage. Skip!"
}
}
}
}