Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to use ram disk for jenkins workspace #47746

Merged
merged 9 commits into from
Oct 18, 2019
23 changes: 16 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
'oss-ciGroup4': getOssCiGroupWorker(4),
'oss-ciGroup5': getOssCiGroupWorker(5),
'oss-ciGroup6': getOssCiGroupWorker(6),
]),
'kibana-oss-agent2': withWorkers('kibana-oss-tests2', { buildOss() }, [
'oss-ciGroup7': getOssCiGroupWorker(7),
'oss-ciGroup8': getOssCiGroupWorker(8),
'oss-ciGroup9': getOssCiGroupWorker(9),
Expand All @@ -34,8 +32,6 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a
'xpack-ciGroup3': getXpackCiGroupWorker(3),
'xpack-ciGroup4': getXpackCiGroupWorker(4),
'xpack-ciGroup5': getXpackCiGroupWorker(5),
]),
'kibana-xpack-agent2': withWorkers('kibana-xpack-tests2', { buildXpack() }, [
'xpack-ciGroup6': getXpackCiGroupWorker(6),
'xpack-ciGroup7': getXpackCiGroupWorker(7),
'xpack-ciGroup8': getXpackCiGroupWorker(8),
Expand All @@ -60,7 +56,7 @@ stage("Kibana Pipeline") { // This stage is just here to help the BlueOcean UI a

def withWorkers(name, preWorkerClosure = {}, workerClosures = [:]) {
return {
jobRunner('tests-xl') {
jobRunner('tests-xl', true) {
try {
doSetup()
preWorkerClosure()
Expand Down Expand Up @@ -151,7 +147,7 @@ def legacyJobRunner(name) {
withEnv([
"JOB=${name}",
]) {
jobRunner('linux && immutable') {
jobRunner('linux && immutable', false) {
try {
runbld('.ci/run.sh', true)
} finally {
Expand All @@ -172,8 +168,21 @@ def legacyJobRunner(name) {
}
}

def jobRunner(label, closure) {
def jobRunner(label, useRamDisk, closure) {
node(label) {
if (useRamDisk) {
// Move to a temporary workspace, so that we can symlink the real workspace into /dev/shm
def originalWorkspace = env.WORKSPACE
ws('/tmp/workspace') {
sh """
mkdir -p /dev/shm/workspace
mkdir -p '${originalWorkspace}'
jbudz marked this conversation as resolved.
Show resolved Hide resolved
rm -rf '${originalWorkspace}'
jbudz marked this conversation as resolved.
Show resolved Hide resolved
ln -s /dev/shm/workspace '${originalWorkspace}'
"""
}
}

def scmVars = checkout scm

withEnv([
Expand Down