(
ctx: Context,
salt_version: str,
event_name: str,
changed_files: pathlib.Path,
skip_tests: bool = False,
skip_pkg_tests: bool = False,
skip_pkg_download_tests: bool = False,
)
| 765 | }, |
| 766 | ) |
| 767 | def workflow_config( |
| 768 | ctx: Context, |
| 769 | salt_version: str, |
| 770 | event_name: str, |
| 771 | changed_files: pathlib.Path, |
| 772 | skip_tests: bool = False, |
| 773 | skip_pkg_tests: bool = False, |
| 774 | skip_pkg_download_tests: bool = False, |
| 775 | ): |
| 776 | full = False |
| 777 | gh_event_path = os.environ.get("GITHUB_EVENT_PATH") or None |
| 778 | gh_event: dict[str, Any] = {} |
| 779 | config: dict[str, Any] = {} |
| 780 | labels: list[tuple[str, str]] = [] |
| 781 | slugs: str | list[str] = [] |
| 782 | |
| 783 | ctx.info(f"{'==== environment ====':^80s}") |
| 784 | ctx.info(escape(pprint.pformat(dict(os.environ)))) |
| 785 | ctx.info(f"{'==== end environment ====':^80s}") |
| 786 | ctx.info(f"Github event path is {gh_event_path}") |
| 787 | |
| 788 | if gh_event_path is None: |
| 789 | config["linux_arm_runner"] = "" |
| 790 | else: |
| 791 | try: |
| 792 | gh_event = json.loads(open(gh_event_path, encoding="utf-8").read()) |
| 793 | except Exception as exc: |
| 794 | ctx.error( |
| 795 | f"Could not load the GH Event payload from {gh_event_path!r}:\n", exc |
| 796 | ) |
| 797 | ctx.exit(1) |
| 798 | |
| 799 | if "pull_request" in gh_event: |
| 800 | pr = gh_event["pull_request"]["number"] |
| 801 | labels = _get_pr_test_labels_from_event_payload(gh_event) |
| 802 | ctx.info(f"labels are {labels!r}") |
| 803 | else: |
| 804 | ctx.warn("The 'pull_request' key was not found on the event payload.") |
| 805 | |
| 806 | if gh_event["repository"]["private"]: |
| 807 | # Private repositories need arm runner configuration environment |
| 808 | # variable. |
| 809 | if os.environ.get("LINUX_ARM_RUNNER", "0") in ("0", ""): |
| 810 | config["linux_arm_runner"] = "" |
| 811 | else: |
| 812 | config["linux_arm_runner"] = os.environ["LINUX_ARM_RUNNER"] |
| 813 | else: |
| 814 | # Public repositories can use github's arm64 runners. |
| 815 | config["linux_arm_runner"] = "ubuntu-24.04-arm" |
| 816 | |
| 817 | if event_name != "pull_request" or "test:full" in labels: |
| 818 | full = True |
| 819 | slugs = os.environ.get("FULL_TESTRUN_SLUGS", "") |
| 820 | if not slugs: |
| 821 | slugs = tools.utils.get_cicd_shared_context()["full-testrun-slugs"] |
| 822 | else: |
| 823 | slugs = os.environ.get("PR_TESTRUN_SLUGS", "") |
| 824 | if not slugs: |
nothing calls this directly
no test coverage detected