Skip to content

Commit

Permalink
cmd-kola: add support for kola-blacklist.yaml
Browse files Browse the repository at this point in the history
Rather than encoding the blacklist in three different places (the
fedora-coreos-config CI, the coreos-assembler CI, and the pipeline),
let's just teach `cosa kola` to auto-detect a `kola-blacklist.yaml` from
the src config and automatically blacklisting them when executing kola.

I proposed making this baked in kola itself with slightly different
semantics in: https://github.com/coreos/mantle/issues/1103

Though teaching this to cosa should still make things easier to maintain
for now at least.
  • Loading branch information
jlebon committed Oct 22, 2019
1 parent 8e4c370 commit 2ed535a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/cmd-kola
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import json
import os
import sys
import shutil
import yaml

cosa_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, cosa_dir)
Expand All @@ -29,6 +30,17 @@ builddir = builds.get_build_dir(args.build)
with open(os.path.join(builddir, "meta.json")) as f:
buildmeta = json.load(f)

# automatically add blacklisted tests specified in the src config
blacklist_args = []
blacklist_path = "src/config/kola-blacklist.yaml"
if os.path.isfile(blacklist_path):
with open(blacklist_path) as f:
blacklist = yaml.safe_load(f)
for obj in blacklist:
print(f"⚠️ Skipping kola test pattern \"{obj['pattern']}\":")
print(f"⚠️ {obj['tracker']}")
blacklist_args += ['--blacklist-test', obj['pattern']]

qemuimg = buildmeta['images'].get('qemu')
if qemuimg is None:
raise SystemExit(f"No qemu image in build: {args.build}")
Expand Down Expand Up @@ -60,6 +72,8 @@ outputdir = args.output_dir or "tmp/kola"
kolaargs.extend(['--output-dir', outputdir])
kolaargs.extend(args.subargs)

kolaargs.extend(blacklist_args)

# flush before exec; see https://docs.python.org/3.7/library/os.html#os.execvpe
print(subprocess.list2cmdline(kolaargs), flush=True)
env = dict(os.environ)
Expand Down

0 comments on commit 2ed535a

Please sign in to comment.