Skip to content

Commit

Permalink
Choose a full test run when a PR has the test:full label
Browse files Browse the repository at this point in the history
Fixes saltstack#64539

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
  • Loading branch information
s0undt3ch committed Jun 27, 2023
1 parent 0c7791b commit d27ce77
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog/64539.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a `test:full` label in the salt repository, which, when selected, will force a full test run.
21 changes: 20 additions & 1 deletion tools/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,23 @@ def define_testrun(ctx: Context, event_name: str, changed_files: pathlib.Path):
ctx.error(f"Could not load the changed files from '{changed_files}': {exc}")
ctx.exit(1)

labels: list[str] = []
gh_event_path = os.environ.get("GITHUB_EVENT_PATH") or None
if gh_event_path is not None:
try:
gh_event = json.loads(open(gh_event_path).read())
except Exception as exc:
ctx.error(
f"Could not load the GH Event payload from {gh_event_path!r}:\n", exc
)
ctx.exit(1)

labels.extend(
label[0] for label in _get_pr_test_labels_from_event_payload(gh_event)
)

# So, it's a pull request...
# Based on which files changed, or other things like PR comments we can
# Based on which files changed, or other things like PR labels we can
# decide what to run, or even if the full test run should be running on the
# pull request, etc...
changed_pkg_requirements_files = json.loads(
Expand Down Expand Up @@ -472,6 +487,10 @@ def define_testrun(ctx: Context, event_name: str, changed_files: pathlib.Path):
wfh.write(f"{path}\n")
wfh.write("</pre>\n</details>\n")
testrun = {"type": "full"}
elif "test:full" in labels:
with open(github_step_summary, "a", encoding="utf-8") as wfh:
wfh.write("Full test run chosen because the label `test:full` is set.\n")
testrun = {"type": "full"}
else:
testrun_changed_files_path = tools.utils.REPO_ROOT / "testrun-changed-files.txt"
testrun = {
Expand Down

0 comments on commit d27ce77

Please sign in to comment.