Skip to content

Commit 620ad37

Browse files
authored
Add ability to use ram disk for jenkins workspace (#47746) (#48666)
* Add ability to use ram disk for jenkins workspace * Re-combine ciGroup agents * Address some PR feedback / questions * Add --preserve-root
1 parent 063c2c6 commit 620ad37

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Jenkinsfile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
1717
'oss-ciGroup4': getOssCiGroupWorker(4),
1818
'oss-ciGroup5': getOssCiGroupWorker(5),
1919
'oss-ciGroup6': getOssCiGroupWorker(6),
20-
]),
21-
'kibana-oss-agent2': withWorkers('kibana-oss-tests2', { buildOss() }, [
2220
'oss-ciGroup7': getOssCiGroupWorker(7),
2321
'oss-ciGroup8': getOssCiGroupWorker(8),
2422
'oss-ciGroup9': getOssCiGroupWorker(9),
@@ -34,8 +32,6 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
3432
'xpack-ciGroup3': getXpackCiGroupWorker(3),
3533
'xpack-ciGroup4': getXpackCiGroupWorker(4),
3634
'xpack-ciGroup5': getXpackCiGroupWorker(5),
37-
]),
38-
'kibana-xpack-agent2': withWorkers('kibana-xpack-tests2', { buildXpack() }, [
3935
'xpack-ciGroup6': getXpackCiGroupWorker(6),
4036
'xpack-ciGroup7': getXpackCiGroupWorker(7),
4137
'xpack-ciGroup8': getXpackCiGroupWorker(8),
@@ -60,7 +56,7 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
6056

6157
def withWorkers(name, preWorkerClosure = {}, workerClosures = [:]) {
6258
return {
63-
jobRunner('tests-xl') {
59+
jobRunner('tests-xl', true) {
6460
try {
6561
doSetup()
6662
preWorkerClosure()
@@ -151,7 +147,7 @@ def legacyJobRunner(name) {
151147
withEnv([
152148
"JOB=${name}",
153149
]) {
154-
jobRunner('linux && immutable') {
150+
jobRunner('linux && immutable', false) {
155151
try {
156152
runbld('.ci/run.sh', true)
157153
} finally {
@@ -172,8 +168,21 @@ def legacyJobRunner(name) {
172168
}
173169
}
174170

175-
def jobRunner(label, closure) {
171+
def jobRunner(label, useRamDisk, closure) {
176172
node(label) {
173+
if (useRamDisk) {
174+
// Move to a temporary workspace, so that we can symlink the real workspace into /dev/shm
175+
def originalWorkspace = env.WORKSPACE
176+
ws('/tmp/workspace') {
177+
sh """
178+
mkdir -p /dev/shm/workspace
179+
mkdir -p '${originalWorkspace}' # create all of the directories leading up to the workspace, if they don't exist
180+
rm --preserve-root -rf '${originalWorkspace}' # then remove just the workspace, just in case there's stuff in it
181+
ln -s /dev/shm/workspace '${originalWorkspace}'
182+
"""
183+
}
184+
}
185+
177186
def scmVars = checkout scm
178187

179188
withEnv([

0 commit comments

Comments
 (0)