Skip to content

Commit b2bbc1b

Browse files
committed
{kola,kolaTestIso}: workaround issue with accessDenied from dir()
When using `dir()` in the kola and kolaTestIso jobs we are getting a permission denied error if the directory is isn't under the env.WORKSPACE directory. Let's go back to using a `cd ${cosaDir}` for now to workaround this while we find better solutions. This `cd ${cosaDir}` will have no effect on multi-arch where we'll be operating in a remote session anyway.
1 parent 6a7df2d commit b2bbc1b

2 files changed

Lines changed: 43 additions & 49 deletions

File tree

vars/kola.groovy

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def call(params = [:]) {
3131
def token = shwrapCapture("uuidgen | cut -f1 -d-")
3232

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

3636
// list of identifiers for each run for log collection
3737
def ids = []
@@ -61,8 +61,8 @@ def call(params = [:]) {
6161
shwrap("mkdir -p /var/tmp/kola && ln -s ${env.WORKSPACE} /var/tmp/kola/${name}")
6262
} else {
6363
shwrap("""
64-
cosa shell -- mkdir -p /var/tmp/kola
65-
cosa remote-session sync ${env.WORKSPACE}/ :/var/tmp/kola/${name}/
64+
cd ${cosaDir} && cosa shell -- mkdir -p /var/tmp/kola
65+
cd ${cosaDir} && cosa remote-session sync ${env.WORKSPACE}/ :/var/tmp/kola/${name}/
6666
""")
6767
}
6868
args += "--exttest /var/tmp/kola/${name}"
@@ -87,23 +87,23 @@ def call(params = [:]) {
8787
// do a single run in that case.
8888
id = marker == "" ? "kola" : "kola-${marker}"
8989
ids += id
90-
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --parallel ${parallel} ${args} ${extraArgs}")
90+
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --parallel ${parallel} ${args} ${extraArgs}")
9191
} else {
9292
// basic run
9393
if (!params['skipBasicScenarios']) {
9494
id = marker == "" ? "kola-basic" : "kola-basic-${marker}"
9595
ids += id
96-
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --basic-qemu-scenarios")
96+
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --basic-qemu-scenarios")
9797
}
9898
// normal run (without reprovision tests because those require a lot of memory)
9999
id = marker == "" ? "kola" : "kola-${marker}"
100100
ids += id
101-
shwrap("cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag '!reprovision' --parallel ${parallel} ${args}")
101+
shwrap("cd ${cosaDir} && cosa kola run ${rerun} --output-dir=${outputDir}/${id} --build=${buildID} ${archArg} ${platformArgs} --tag '!reprovision' --parallel ${parallel} ${args}")
102102

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

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

131-
// Run the Kola tests from the cosaDir
132-
dir(cosaDir) {
133-
try {
134-
if (kolaRuns.size() == 1) {
135-
kolaRuns.each { k, v -> v() }
136-
} else {
137-
parallel(kolaRuns)
138-
}
139-
} finally {
140-
for (id in ids) {
141-
// sanity check kola actually ran and dumped its output
142-
shwrap("cosa shell -- test -d ${outputDir}/${id}")
143-
// collect the output
144-
shwrap("cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
145-
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
146-
}
131+
try {
132+
if (kolaRuns.size() == 1) {
133+
kolaRuns.each { k, v -> v() }
134+
} else {
135+
parallel(kolaRuns)
136+
}
137+
} finally {
138+
for (id in ids) {
139+
// sanity check kola actually ran and dumped its output
140+
shwrap("cd ${cosaDir} && cosa shell -- test -d ${outputDir}/${id}")
141+
// collect the output
142+
shwrap("cd ${cosaDir} && cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
143+
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
147144
}
148145
}
149146
}

vars/kolaTestIso.groovy

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def call(params = [:]) {
3434
def token = shwrapCapture("uuidgen | cut -f1 -d-")
3535

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

3939
// list of identifiers for each run for log collection
4040
def ids = []
@@ -44,7 +44,7 @@ def call(params = [:]) {
4444
def id = marker == "" ? "kola-testiso-metal" : "kola-testiso-metal-${marker}"
4545
ids += id
4646
def scenariosArg = scenarios == "" ? "" : "--scenarios ${scenarios}"
47-
shwrap("cosa kola testiso -S ${extraArgs} ${scenariosArg} --output-dir ${outputDir}/${id}")
47+
shwrap("cd ${cosaDir} && cosa kola testiso -S ${extraArgs} ${scenariosArg} --output-dir ${outputDir}/${id}")
4848
}
4949
if (!params['skipMetal4k']) {
5050
// metal4k test doesn't work on s390x for now
@@ -55,15 +55,15 @@ def call(params = [:]) {
5555
def id = marker == "" ? "kola-testiso-metal4k" : "kola-testiso-metal4k-${marker}"
5656
ids += id
5757
def scenariosArg = scenarios4k == "" ? "" : "--scenarios ${scenarios4k}"
58-
shwrap("cosa kola testiso -S --qemu-native-4k ${extraArgs4k} ${scenariosArg} --output-dir ${outputDir}/${id}")
58+
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-native-4k ${extraArgs4k} ${scenariosArg} --output-dir ${outputDir}/${id}")
5959
}
6060
}
6161
}
6262
if (!params['skipMultipath']) {
6363
testIsoRuns["${arch}:kola:multipath"] = {
6464
def id = marker == "" ? "kola-testiso-multipath" : "kola-testiso-multipath-${marker}"
6565
ids += id
66-
shwrap("cosa kola testiso -S --qemu-multipath ${extraArgsMultipath} --scenarios ${scenariosMultipath} --output-dir ${outputDir}/${id}")
66+
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-multipath ${extraArgsMultipath} --scenarios ${scenariosMultipath} --output-dir ${outputDir}/${id}")
6767
}
6868
}
6969
if (!params['skipUEFI']) {
@@ -76,32 +76,29 @@ def call(params = [:]) {
7676
testIsoRuns["${arch}:kola:uefi"] = {
7777
def id = marker == "" ? "kola-testiso-uefi" : "kola-testiso-uefi-${marker}"
7878
ids += id
79-
shwrap("cosa shell -- mkdir -p ${outputDir}/${id}")
80-
shwrap("cosa kola testiso -S --qemu-firmware=uefi ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/insecure")
81-
shwrap("cosa kola testiso -S --qemu-firmware=uefi-secure ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/secure")
79+
shwrap("cd ${cosaDir} && cosa shell -- mkdir -p ${outputDir}/${id}")
80+
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-firmware=uefi ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/insecure")
81+
shwrap("cd ${cosaDir} && cosa kola testiso -S --qemu-firmware=uefi-secure ${extraArgsUEFI} --scenarios ${scenariosUEFI} --output-dir ${outputDir}/${id}/secure")
8282
}
8383
}
8484
}
8585

86-
// Run the Kola tests from the cosaDir
87-
dir(cosaDir) {
88-
try {
89-
// Run at most two testiso runs at a time to try not to
90-
// exceed 8G of memory usage.
91-
def runs = [:]
92-
testIsoRuns.eachWithIndex { key, value, index ->
93-
def i = index + 1 // index starts at 0, adjust
94-
runs[key] = value
95-
if (i % 2 == 0 || i == testIsoRuns.size()) {
96-
parallel runs
97-
runs = [:] // empty out map for next iteration
98-
}
99-
}
100-
} finally {
101-
for (id in ids) {
102-
shwrap("cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
103-
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
86+
try {
87+
// Run at most two testiso runs at a time to try not to
88+
// exceed 8G of memory usage.
89+
def runs = [:]
90+
testIsoRuns.eachWithIndex { key, value, index ->
91+
def i = index + 1 // index starts at 0, adjust
92+
runs[key] = value
93+
if (i % 2 == 0 || i == testIsoRuns.size()) {
94+
parallel runs
95+
runs = [:] // empty out map for next iteration
10496
}
10597
}
98+
} finally {
99+
for (id in ids) {
100+
shwrap("cd ${cosaDir} && cosa shell -- tar -c --xz ${outputDir}/${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
101+
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
102+
}
106103
}
107104
}

0 commit comments

Comments
 (0)