Skip to content

{kola,kolaTestIso}: workaround issue with accessDenied from dir() #124

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

Merged
merged 1 commit into from
Oct 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions vars/kola.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def call(params = [:]) {
def token = shwrapCapture("uuidgen | cut -f1 -d-")

// Create a unique output directory for this run of kola
def outputDir = shwrapCapture("cosa shell -- mktemp -d ${cosaDir}/tmp/kola-XXXXX")
def outputDir = shwrapCapture("cd ${cosaDir} && cosa shell -- mktemp -d ${cosaDir}/tmp/kola-XXXXX")

// list of identifiers for each run for log collection
def ids = []
Expand Down Expand Up @@ -61,8 +61,8 @@ def call(params = [:]) {
shwrap("mkdir -p /var/tmp/kola && ln -s ${env.WORKSPACE} /var/tmp/kola/${name}")
} else {
shwrap("""
cosa shell -- mkdir -p /var/tmp/kola
cosa remote-session sync ${env.WORKSPACE}/ :/var/tmp/kola/${name}/
cd ${cosaDir} && cosa shell -- mkdir -p /var/tmp/kola
cd ${cosaDir} && cosa remote-session sync ${env.WORKSPACE}/ :/var/tmp/kola/${name}/
""")
}
args += "--exttest /var/tmp/kola/${name}"
Expand All @@ -87,23 +87,23 @@ def call(params = [:]) {
// do a single run in that case.
id = marker == "" ? "kola" : "kola-${marker}"
ids += id
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --parallel ${parallel} ${args} ${extraArgs}")
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --parallel ${parallel} ${args} ${extraArgs}")
} else {
// basic run
if (!params['skipBasicScenarios']) {
id = marker == "" ? "kola-basic" : "kola-basic-${marker}"
ids += id
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --basic-qemu-scenarios")
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --basic-qemu-scenarios")
}
// normal run (without reprovision tests because those require a lot of memory)
id = marker == "" ? "kola" : "kola-${marker}"
ids += id
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag '!reprovision' --parallel ${parallel} ${args}")
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag '!reprovision' --parallel ${parallel} ${args}")

// re-provision tests (not run with --parallel argument to kola)
id = marker == "" ? "kola-reprovision" : "kola-reprovision-${marker}"
ids += id
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag reprovision ${args}")
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag reprovision ${args}")
}
}

Expand All @@ -115,7 +115,7 @@ def call(params = [:]) {
try {
def id = marker == "" ? "kola-upgrade" : "kola-upgrade-${marker}"
ids += id
shwrap("cosa kola ${rerun} --output-dir=${outputDir}/${id} --upgrades --build=${buildID} ${archArg} ${platformArgs}")
shwrap("cd ${cosaDir} && cosa kola ${rerun} --output-dir=${outputDir}/${id} --upgrades --build=${buildID} ${archArg} ${platformArgs}")
} catch(e) {
if (params["allowUpgradeFail"]) {
warnError(message: 'Upgrade Failed') {
Expand All @@ -128,22 +128,19 @@ def call(params = [:]) {
}
}

// Run the Kola tests from the cosaDir
dir(cosaDir) {
try {
if (kolaRuns.size() == 1) {
kolaRuns.each { k, v -> v() }
} else {
parallel(kolaRuns)
}
} finally {
for (id in ids) {
// sanity check kola actually ran and dumped its output
shwrap("cosa shell -- test -d ${outputDir}/${id}")
// collect the output
shwrap("cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
}
try {
if (kolaRuns.size() == 1) {
kolaRuns.each { k, v -> v() }
} else {
parallel(kolaRuns)
}
} finally {
for (id in ids) {
// sanity check kola actually ran and dumped its output
shwrap("cd ${cosaDir} && cosa shell -- test -d ${outputDir}/${id}")
// collect the output
shwrap("cd ${cosaDir} && cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
}
}
}
47 changes: 22 additions & 25 deletions vars/kolaTestIso.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def call(params = [:]) {
def token = shwrapCapture("uuidgen | cut -f1 -d-")

// Create a unique output directory for this run of fcosKola
def outputDir = shwrapCapture("cosa shell -- mktemp -d ${cosaDir}/tmp/kolaTestIso-XXXXX")
def outputDir = shwrapCapture("cd ${cosaDir} && cosa shell -- mktemp -d ${cosaDir}/tmp/kolaTestIso-XXXXX")

// list of identifiers for each run for log collection
def ids = []
Expand All @@ -44,7 +44,7 @@ def call(params = [:]) {
def id = marker == "" ? "kola-testiso-metal" : "kola-testiso-metal-${marker}"
ids += id
def scenariosArg = scenarios == "" ? "" : "--scenarios ${scenarios}"
shwrap("cosa kola testiso -S ${extraArgs} ${scenariosArg} --output-dir ${outputDir}/${id}")
shwrap("cd ${cosaDir} && cosa kola testiso -S ${extraArgs} ${scenariosArg} --output-dir ${outputDir}/${id}")
}
if (!params['skipMetal4k']) {
// metal4k test doesn't work on s390x for now
Expand All @@ -55,15 +55,15 @@ def call(params = [:]) {
def id = marker == "" ? "kola-testiso-metal4k" : "kola-testiso-metal4k-${marker}"
ids += id
def scenariosArg = scenarios4k == "" ? "" : "--scenarios ${scenarios4k}"
shwrap("cosa kola testiso -S --qemu-native-4k ${extraArgs4k} ${scenariosArg} --output-dir ${outputDir}/${id}")
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-native-4k ${extraArgs4k} ${scenariosArg} --output-dir ${outputDir}/${id}")
}
}
}
if (!params['skipMultipath']) {
testIsoRuns["${arch}:kola:multipath"] = {
def id = marker == "" ? "kola-testiso-multipath" : "kola-testiso-multipath-${marker}"
ids += id
shwrap("cosa kola testiso -S --qemu-multipath ${extraArgsMultipath} --scenarios ${scenariosMultipath} --output-dir ${outputDir}/${id}")
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-multipath ${extraArgsMultipath} --scenarios ${scenariosMultipath} --output-dir ${outputDir}/${id}")
}
}
if (!params['skipUEFI']) {
Expand All @@ -76,32 +76,29 @@ def call(params = [:]) {
testIsoRuns["${arch}:kola:uefi"] = {
def id = marker == "" ? "kola-testiso-uefi" : "kola-testiso-uefi-${marker}"
ids += id
shwrap("cosa shell -- mkdir -p ${outputDir}/${id}")
shwrap("cosa kola testiso -S --qemu-firmware=uefi ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/insecure")
shwrap("cosa kola testiso -S --qemu-firmware=uefi-secure ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/secure")
shwrap("cd ${cosaDir} && cosa shell -- mkdir -p ${outputDir}/${id}")
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-firmware=uefi ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/insecure")
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-firmware=uefi-secure ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/secure")
}
}
}

// Run the Kola tests from the cosaDir
dir(cosaDir) {
try {
// Run at most two testiso runs at a time to try not to
// exceed 8G of memory usage.
def runs = [:]
testIsoRuns.eachWithIndex { key, value, index ->
def i = index + 1 // index starts at 0, adjust
runs[key] = value
if (i % 2 == 0 || i == testIsoRuns.size()) {
parallel runs
runs = [:] // empty out map for next iteration
}
}
} finally {
for (id in ids) {
shwrap("cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
try {
// Run at most two testiso runs at a time to try not to
// exceed 8G of memory usage.
def runs = [:]
testIsoRuns.eachWithIndex { key, value, index ->
def i = index + 1 // index starts at 0, adjust
runs[key] = value
if (i % 2 == 0 || i == testIsoRuns.size()) {
parallel runs
runs = [:] // empty out map for next iteration
}
}
} finally {
for (id in ids) {
shwrap("cd ${cosaDir} && cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
}
}
}