forked from coreos/coreos-ci-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkolaTestIso.groovy
44 lines (38 loc) · 2.21 KB
/
kolaTestIso.groovy
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
// Run kola testiso
// Available parameters:
// cosaDir: string -- cosa working directory
// extraArgs: string -- extra arguments to pass to `kola testiso`
// marker: string -- some identifying text to add to uploaded artifact filenames
// skipUEFI: boolean -- skip UEFI tests
// skipSecureBoot boolean -- skip secureboot tests
// skipPxeAppendRootfs boolean -- skip PXE with appended roofs tests
def call(params = [:]) {
def cosaDir = utils.getCosaDir(params);
def extraArgs = params.get('extraArgs', "");
def marker = params.get('marker', "");
if (params['skipUEFI']) {
extraArgs += " --denylist-test *.uefi*"
}
if (params['skipSecureBoot']) {
extraArgs += " --denylist-test *.uefi-secure"
}
// Define a unique token to be added to the file name uploads
// Prevents multiple runs overwriting same filename in archiveArtifacts
def token = shwrapCapture("uuidgen | cut -f1 -d-")
// Create a unique output directory for this run of kola
def outputDir = shwrapCapture("cd ${cosaDir} && cosa shell -- mktemp -d ${cosaDir}/tmp/kola-XXXXX")
def id = marker == "" ? "kola-testiso" : "kola-testiso-${marker}"
// We add --inst-insecure here since in CI and in our build pipeline
// the signatures for the metal images won't have been created yet.
try {
shwrap("cd ${cosaDir} && cosa kola testiso --inst-insecure ${extraArgs} --output-dir ${outputDir}/${id}")
if (!params['skipPxeAppendRootfs']) {
shwrap("cd ${cosaDir} && cosa kola testiso pxe* --pxe-append-rootfs ${extraArgs} --output-dir ${outputDir}/${id}")
}
} finally {
shwrap("cd ${cosaDir} && cosa shell -- tar -C ${outputDir} -c --xz ${id} > ${env.WORKSPACE}/${id}-${token}.tar.xz || :")
archiveArtifacts allowEmptyArchive: true, artifacts: "${id}-${token}.tar.xz"
shwrap("cd ${cosaDir} && cosa shell -- /usr/lib/coreos-assembler/kola-junit --classname ${id} --koladir ${outputDir}/${id} --output - > ${env.WORKSPACE}/${id}-${token}.xml || :")
junit allowEmptyResults: true, skipMarkingBuildUnstable: true, skipPublishingChecks: true, testResults: "${id}-${token}.xml"
}
}