added filter to decide what challenges to include

This commit is contained in:
2026-11-05 15:42:52 +01:00
parent 4fac6ed86d
commit 09849d0ef6
11 changed files with 214 additions and 28 deletions
+11 -3
View File
@@ -11,6 +11,9 @@ up: description.yml is filled in (not the template), its flag and containers mak
sense, and the deploy dirs and solve.py exist. Otherwise the challenge is shown
as blocked and kept out of challs.txt. The rules are in tracker/checks.py.
challenges.yml says which repos are part of this CTF; only those are counted, put
in the note and deployed. The terminal summary also lists the others.
Config: see .env.example -> .env (chmod 600)
"""
from __future__ import annotations
@@ -29,6 +32,7 @@ from tracker.gitlab import GitLab
from tracker.hedgedoc import HedgeDocNote, push_hedgedoc, update_hedgedoc
from tracker.markdown import render_hedgedoc
from tracker.overview import collect
from tracker.selection import load_selection
from tracker.terminal import print_terminal
@@ -59,7 +63,7 @@ def main() -> None:
help="overwrite an existing HedgeDoc note in place; defaults to "
"HEDGEDOC_NOTE from the config. This is the one to cron.")
ap.add_argument("--challs", action="store_true",
help="commit the clone URLs of every unblocked Testing Ready+ challenge to "
help="commit the clone URLs of every included, unblocked Testing Ready+ challenge to "
f"CHALLS_PATH (default {DEFAULT_CHALLS_PATH!r}) in the "
"deployment repo CHALLS_REPO_URL, if they changed")
ap.add_argument("--challs-out", metavar="FILE",
@@ -89,6 +93,10 @@ def main() -> None:
sys.exit(str(e))
if args.challs and not cfg.get("CHALLS_REPO_URL"):
sys.exit("--challs needs CHALLS_REPO_URL in the config")
try:
selection = load_selection()
except ValueError as e:
sys.exit(str(e))
if note_url:
single_run_lock("hedgedoc")
if args.challs:
@@ -96,10 +104,10 @@ def main() -> None:
gl = GitLab(cfg["GITLAB_GROUP_URL"], cfg["GITLAB_TOKEN"])
try:
ov = collect(gl)
ov = collect(gl, selection)
except (requests.RequestException, RuntimeError) as e:
sys.exit(f"reading {cfg['GITLAB_GROUP_URL']} failed: {e}")
if not ov.challenges and not ov.blank:
if not ov.challenges and not ov.blank and not ov.excluded and not ov.undecided:
sys.exit(f"no repos found in {cfg['GITLAB_GROUP_URL']!r}")
md = render_hedgedoc(ov, title, tags)