Skip to content

Commit

Permalink
[orion-decision-ci] Fix CI check pre-commit hook.
Browse files Browse the repository at this point in the history
It was ignoring `.taskcluster.yml` files using generic-worker & podman
directly.
  • Loading branch information
jschwartzentruber committed Jun 13, 2024
1 parent 560aa20 commit 660092f
Showing 1 changed file with 39 additions and 11 deletions.
50 changes: 39 additions & 11 deletions services/orion-decision/src/orion_decision/ci_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"""Checker for CI build matrix"""

import argparse
from itertools import chain
from logging import getLogger
from pathlib import Path

Expand Down Expand Up @@ -50,19 +51,46 @@ def check_matrix(args: argparse.Namespace) -> None:
for task in rendered_taskcluster_yml.get("tasks", []):
# skip malformed tasks ...
# taskcluster_yml_validator will catch it
if (
"payload" not in task
or "image" not in task["payload"]
or "command" not in task["payload"]
):
if "payload" not in task:
LOG.warning("no payload")
continue

# does it use orion-decision image and call ci-decision?
cmd = yaml_dump(task["payload"]["command"])
if (
"orion-decision" not in yaml_dump(task["payload"]["image"])
or "ci-decision" not in cmd
):
if set(task["payload"]) >= {"command", "image"}:
# docker-worker payload
# does it use orion-decision image and call ci-decision?
cmd = yaml_dump(task["payload"]["command"])
if (
"orion-decision" not in yaml_dump(task["payload"]["image"])
or "ci-decision" not in cmd
):
LOG.warning(
"no orion-decision in payload image or "
"ci-decision not in command"
)
continue

elif "command" in task["payload"]:
cmd = yaml_dump(task["payload"]["command"])
if not (
any(
"podman" in cmd
for cmd in chain.from_iterable(task["payload"]["command"])
)
and any(
"orion-decision" in cmd
for cmd in chain.from_iterable(task["payload"]["command"])
)
and any(
"ci-decision" in cmd
for cmd in chain.from_iterable(task["payload"]["command"])
)
):
LOG.warning(
"generic-worker payload not using podman & orion-decision?"
)
continue
else:
LOG.warning("unrecognized worker payload")
continue

# does that job have a CI_MATRIX env var or pass --matrix? (fail if not)
Expand Down

0 comments on commit 660092f

Please sign in to comment.