From 9175a455e5fef2c0e8e40c5603c7d7927ebae6c9 Mon Sep 17 00:00:00 2001 From: tnazarew Date: Thu, 5 Nov 2026 18:02:52 +0100 Subject: [PATCH 1/2] ci: publish what passed and retry failed parts in the release check Every job after the components used if: !failure(), so one failed component (e.g. a Dataproc cluster that didn't start) blocked the report, releases.json and the site for everything else, and the next run re-ran everything that had changed. - A part is a (component, component version, OpenLineage version) triple. The release check writes the parts it plans (planned-parts artifact, pairs without a valid scenario left out); collect marks planned parts without a report as pending in generated-files/pending_runs.json, with the number of failed runs in a row and the first/last failed run, and lists them in the job summary. - get_release_matrices.sh adds pending parts to the next run's matrices, so a failed part is retried on every scheduled run until it passes, even when no new release appeared. - collect, notify, update-repo-files, tables and site run when their inputs succeeded (!cancelled() + result checks) instead of only when nothing failed; a failed notification doesn't block publishing. - New workflow_dispatch input publish ('false' skips issues, report and site) to test pipeline changes from a branch. - Drops the update_repo_files move of updated-new-report.json, which collect never uploads. Co-Authored-By: Claude Opus 5.5 Signed-off-by: tnazarew --- .../workflows/collect_and_compare_reports.yml | 25 +++ .github/workflows/main_new_release.yml | 46 +++++- .github/workflows/update_repo_files.yml | 3 +- generated-files/pending_runs.json | 1 + scripts/check_structure.sh | 1 + scripts/get_release_matrices.sh | 35 +++- scripts/pending_runs.py | 151 ++++++++++++++++++ scripts/tests/test_get_release_matrices.py | 67 ++++++++ scripts/tests/test_pending_runs.py | 124 ++++++++++++++ 9 files changed, 441 insertions(+), 12 deletions(-) create mode 100644 generated-files/pending_runs.json create mode 100644 scripts/pending_runs.py create mode 100644 scripts/tests/test_get_release_matrices.py create mode 100644 scripts/tests/test_pending_runs.py diff --git a/.github/workflows/collect_and_compare_reports.yml b/.github/workflows/collect_and_compare_reports.yml index 8c819d44..4be68136 100644 --- a/.github/workflows/collect_and_compare_reports.yml +++ b/.github/workflows/collect_and_compare_reports.yml @@ -7,6 +7,11 @@ on: required: false default: false description: "fail the job if new failure report is found" + track-pending: + type: boolean + required: false + default: false + description: "update pending_runs.json from the planned-parts artifact: planned parts without a report stay pending (release check)" jobs: collect-and-compare-reports: @@ -32,6 +37,26 @@ jobs: path: reports/ merge-multiple: true + # before the comparison writes its own *-report.json files into reports/ + - name: Update pending parts + if: ${{ inputs.track-pending }} + run: | + python scripts/pending_runs.py update \ + --planned reports/planned.json \ + --reports-dir reports/ \ + --pending generated-files/pending_runs.json \ + --run-url "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \ + --out reports/updated-pending-runs.json \ + --summary "$GITHUB_STEP_SUMMARY" + + - uses: actions/upload-artifact@v4 + if: ${{ inputs.track-pending }} + with: + name: updated-pending-runs + path: reports/updated-pending-runs.json + retention-days: 1 + if-no-files-found: error + - name: Run task for Collect Reports id: collect-and-merge-reports run: python scripts/compare_and_merge_reports.py --report_base_dir=./reports/ diff --git a/.github/workflows/main_new_release.yml b/.github/workflows/main_new_release.yml index 9b9ccfda..1cb2d33e 100644 --- a/.github/workflows/main_new_release.yml +++ b/.github/workflows/main_new_release.yml @@ -33,6 +33,10 @@ on: dbt_matrix: description: 'Overwrite matrix for hive tests' required: false + publish: + description: "Publish the results (issues, report, site). 'false' to test pipeline changes from a branch" + required: false + default: 'true' permissions: id-token: write @@ -109,6 +113,33 @@ jobs: FORCE_ALL: ${{ github.event_name == 'workflow_dispatch' }} run: ./scripts/get_release_matrices.sh | tee -a $GITHUB_OUTPUT + # what this run tests, so the collect step can tell which parts produced no result (pending_runs.json) + - name: Plan the parts of this run + env: + SPARK_MATRIX: ${{ github.event.inputs.spark_matrix || steps.set-matrix-values.outputs.spark_dataproc_matrix }} + HIVE_MATRIX: ${{ github.event.inputs.hive_matrix || steps.set-matrix-values.outputs.hive_dataproc_matrix }} + DBT_MATRIX: ${{ github.event.inputs.dbt_matrix || steps.set-matrix-values.outputs.dbt_matrix }} + RUN_SPARK: ${{ github.event.inputs.run_spark_dataproc || steps.set-matrix-values.outputs.run_spark_dataproc }} + RUN_HIVE: ${{ github.event.inputs.run_hive_dataproc || steps.set-matrix-values.outputs.run_hive_dataproc }} + RUN_DBT: ${{ github.event.inputs.run_dbt || steps.set-matrix-values.outputs.run_dbt }} + RUN_SCENARIOS: ${{ steps.set-matrix-values.outputs.run_scenarios }} + RUN_DATAPLEX: ${{ github.event.inputs.run_dataplex || steps.set-matrix-values.outputs.run_dataplex }} + run: | + mkdir -p generated-files/planned + python3 scripts/pending_runs.py plan \ + --spark-dataproc-matrix "$([[ "$RUN_SPARK" == "true" ]] && echo "$SPARK_MATRIX")" \ + --hive-dataproc-matrix "$([[ "$RUN_HIVE" == "true" ]] && echo "$HIVE_MATRIX")" \ + --dbt-matrix "$([[ "$RUN_DBT" == "true" ]] && echo "$DBT_MATRIX")" \ + --run-scenarios "$RUN_SCENARIOS" \ + --run-dataplex "$RUN_DATAPLEX" \ + --out generated-files/planned/planned.json + + - uses: actions/upload-artifact@v4 + with: + name: planned-parts + path: generated-files/planned/planned.json + retention-days: 1 + ######## COMPONENT VALIDATION ######## scenarios: @@ -177,14 +208,17 @@ jobs: - spark-dataproc - hive-dataproc - dbt - if: ${{ !failure() && needs.initialize_workflow.outputs.any_run == 'true' }} + # a failed component doesn't stop the others from being published; it stays pending and is retried + if: ${{ !cancelled() && needs.initialize_workflow.result == 'success' && needs.initialize_workflow.outputs.any_run == 'true' }} uses: ./.github/workflows/collect_and_compare_reports.yml + with: + track-pending: true notify-maintainers: needs: - initialize_workflow - collect-and-compare-reports - if: ${{ !failure() && needs.initialize_workflow.outputs.any_run == 'true' }} + if: ${{ !cancelled() && needs.collect-and-compare-reports.result == 'success' && github.event.inputs.publish != 'false' }} uses: ./.github/workflows/notify_maintainers.yml with: workflow-type: 'release' @@ -194,8 +228,10 @@ jobs: update-repo-files: needs: - initialize_workflow + - collect-and-compare-reports - notify-maintainers - if: ${{ !failure() && needs.initialize_workflow.outputs.any_run == 'true' }} + # a failed notification doesn't block publishing + if: ${{ !cancelled() && needs.collect-and-compare-reports.result == 'success' && github.event.inputs.publish != 'false' }} uses: ./.github/workflows/update_repo_files.yml secrets: CI_PUSH_TOKEN: ${{ secrets.CI_PUSH_TOKEN }} @@ -206,14 +242,14 @@ jobs: generate-compatibility-tables: needs: update-repo-files - if: ${{ !failure() && needs.update-repo-files.outputs.changes_made == 'true' }} + if: ${{ !cancelled() && needs.update-repo-files.result == 'success' && needs.update-repo-files.outputs.changes_made == 'true' }} uses: ./.github/workflows/generate_compatibility_tables.yml update-site: needs: - update-repo-files - generate-compatibility-tables - if: ${{ !failure() && needs.update-repo-files.outputs.changes_made == 'true' }} + if: ${{ !cancelled() && needs.update-repo-files.result == 'success' && needs.generate-compatibility-tables.result == 'success' && needs.update-repo-files.outputs.changes_made == 'true' }} uses: ./.github/workflows/update_site.yml secrets: CI_PUSH_TOKEN: ${{ secrets.OL_SITE_PUSH_TOKEN }} diff --git a/.github/workflows/update_repo_files.yml b/.github/workflows/update_repo_files.yml index f880b6d5..6ef611b2 100644 --- a/.github/workflows/update_repo_files.yml +++ b/.github/workflows/update_repo_files.yml @@ -53,10 +53,9 @@ jobs: workflow_type: ${{ inputs.workflow-type }} run: | if [[ ${workflow_type} == "release" ]]; then - historical_report_name="${{inputs.trigger-type}}_${{ inputs.execution-time }}.json" - mv ./generated-files/updated-new-report.json ./generated-files/historical_reports/${historical_report_name} || echo "updated-new-report.json not found" mv ./generated-files/updated-report.json ./generated-files/report.json || echo "updated-report.json not found" mv ./generated-files/updated-releases.json ./generated-files/releases.json || echo "updated-releases.json not found" + mv ./generated-files/updated-pending-runs.json ./generated-files/pending_runs.json || echo "updated-pending-runs.json not found" elif [[ $type == "spec_change" ]]; then mv ./generated-files/updated-spec-versions.json ./generated-files/spec_versions.json || echo "updated-spec-versions.json not found" fi diff --git a/generated-files/pending_runs.json b/generated-files/pending_runs.json new file mode 100644 index 00000000..fe51488c --- /dev/null +++ b/generated-files/pending_runs.json @@ -0,0 +1 @@ +[] diff --git a/scripts/check_structure.sh b/scripts/check_structure.sh index 8b69d26e..1e6d6af4 100755 --- a/scripts/check_structure.sh +++ b/scripts/check_structure.sh @@ -24,6 +24,7 @@ remove_trailing_slash() { check_path "$BASE_PATH/consumer/README.md" check_path "$BASE_PATH/generated-files/compatibility-table.md" check_path "$BASE_PATH/generated-files/releases.json" +check_path "$BASE_PATH/generated-files/pending_runs.json" check_path "$BASE_PATH/generated-files/report.json" check_path "$BASE_PATH/generated-files/spec_versions.json" diff --git a/scripts/get_release_matrices.sh b/scripts/get_release_matrices.sh index cb90859b..07242be1 100755 --- a/scripts/get_release_matrices.sh +++ b/scripts/get_release_matrices.sh @@ -6,12 +6,24 @@ # versions of the matrix (versions.json plus the latest release) # - consumers run only when something else runs # With FORCE_ALL=true (manual runs) every producer runs its full matrix. +# Parts that produced no result in an earlier run (PENDING_FILE, see pending_runs.py) are added to the matrices, so they're +# retried until they pass. Matrices are cross products, so adding a pending pair can re-run a few extra pairs. # -# Environment: LATEST_OL, OL_CHANGED, LATEST_DBT, DBT_CHANGED, DATAPROC_CHANGED_FAMILIES (JSON list), FORCE_ALL +# Environment: LATEST_OL, OL_CHANGED, LATEST_DBT, DBT_CHANGED, DATAPROC_CHANGED_FAMILIES (JSON list), FORCE_ALL, +# PENDING_FILE (default generated-files/pending_runs.json) set -euo pipefail : "${OL_CHANGED:=false}" "${DBT_CHANGED:=false}" "${DATAPROC_CHANGED_FAMILIES:=[]}" "${FORCE_ALL:=false}" +: "${PENDING_FILE:=generated-files/pending_runs.json}" + +pending='[]' +[[ -f "$PENDING_FILE" ]] && pending=$(jq -c . "$PENDING_FILE") + +# true when a part of the given component is pending +is_pending() { + jq -e --arg c "$1" 'any(.[]; .component == $c)' <<< "$pending" > /dev/null +} # Prints the matrix of a producer, or nothing if it shouldn't run. # $1 - producer directory name, $2 - JSON list of its new component versions, $3 - latest component release if tracked @@ -24,18 +36,31 @@ get_matrix() { --arg latest_component "$latest_component" \ --argjson ol_changed "$OL_CHANGED" \ --argjson force_all "$FORCE_ALL" \ - --argjson changed "$changed_versions" ' + --argjson changed "$changed_versions" \ + --argjson pending "$pending" \ + --arg component "$component" ' def with_latest($v): if $v != "" and index($v) == null then . + [$v] else . end; + def with_all($vs): reduce $vs[] as $v (.; with_latest($v)); (.openlineage_versions | with_latest($latest_ol)) as $all_ol | (.component_version | with_latest($latest_component)) as $all_components - | if $force_all or ($ol_changed and ($changed | length) > 0) then + | (if $force_all or ($ol_changed and ($changed | length) > 0) then {openlineage_versions: $all_ol, component_version: $all_components} elif $ol_changed then {openlineage_versions: [$latest_ol], component_version: $all_components} elif ($changed | length) > 0 then {openlineage_versions: $all_ol, component_version: $changed} else + null + end) as $matrix + | [$pending[] | select(.component == $component)] as $retry + | if ($retry | length) > 0 then + ($matrix // {openlineage_versions: [], component_version: []}) + | .openlineage_versions |= with_all([$retry[].openlineage_version]) + | .component_version |= with_all([$retry[].component_version]) + elif $matrix == null then empty + else + $matrix end' "$versions_file" } @@ -56,8 +81,8 @@ any_producer=false for matrix in "$spark_matrix" "$hive_matrix" "$dbt_matrix"; do [[ -n "$matrix" ]] && any_producer=true done -run_scenarios=$([[ "$OL_CHANGED" == "true" || "$FORCE_ALL" == "true" ]] && echo true || echo false) -any_run=$([[ "$any_producer" == "true" || "$run_scenarios" == "true" ]] && echo true || echo false) +run_scenarios=$([[ "$OL_CHANGED" == "true" || "$FORCE_ALL" == "true" ]] || is_pending scenarios && echo true || echo false) +any_run=$([[ "$any_producer" == "true" || "$run_scenarios" == "true" ]] || is_pending dataplex && echo true || echo false) echo "spark_dataproc_matrix=$spark_matrix" echo "hive_dataproc_matrix=$hive_matrix" diff --git a/scripts/pending_runs.py b/scripts/pending_runs.py new file mode 100644 index 00000000..fe87676d --- /dev/null +++ b/scripts/pending_runs.py @@ -0,0 +1,151 @@ +"""Tracks the parts of the release check that produced no result, so later scheduled runs retry them. + +A part is a (component, component_version, openlineage_version) triple; consumers (dataplex, scenarios) have empty +versions. A planned part is done when a collected report has its entry; otherwise it stays pending in +generated-files/pending_runs.json, which get_release_matrices.sh adds to the next run's matrices. + + plan the parts a run is going to test, from the effective matrices (pairs without a valid scenario are left out, + they can never produce a report) + update the new pending list, from the planned parts, the collected reports and the old pending list + +Only the standard library is used, so it runs before any dependencies are installed. +""" +import argparse +import json +import os +from pathlib import Path + +from compare_releases import release_between + +# written by compare_and_merge_reports.py or downloaded next to the component reports, not component results +NOT_COMPONENT_REPORTS = {"report.json", "updated-report.json", "new-report.json", "retention-failures-report.json"} + + +def _key(component, component_version, openlineage_version): + return component, component_version or "", openlineage_version or "" + + +def _part_key(part): + return _key(part["component"], part["component_version"], part["openlineage_version"]) + + +def _has_valid_scenario(producer_dir, component, component_version, openlineage_version): + scenarios_dir = Path(producer_dir) / component / "scenarios" + for config_path in sorted(scenarios_dir.glob("*/config.json")): + config = json.loads(config_path.read_text()) + cvs = config.get("component_versions", {}) + ols = config.get("openlineage_versions", {}) + if (release_between(component_version, cvs.get("min"), cvs.get("max")) and + release_between(openlineage_version, ols.get("min"), ols.get("max"))): + return True + return False + + +def plan(matrices, run_scenarios, run_dataplex, producer_dir): + """matrices: {component: {"component_version": [...], "openlineage_versions": [...]} or None/"" when not running}""" + parts = [] + for component, matrix in matrices.items(): + if not matrix: + continue + for cv in matrix["component_version"]: + for ol in matrix["openlineage_versions"]: + if _has_valid_scenario(producer_dir, component, cv, ol): + parts.append({"component": component, "component_version": cv, "openlineage_version": ol}) + if run_dataplex: + parts.append({"component": "dataplex", "component_version": "", "openlineage_version": ""}) + if run_scenarios: + parts.append({"component": "scenarios", "component_version": "", "openlineage_version": ""}) + return sorted(parts, key=_part_key) + + +def read_reports(reports_dir): + entries = [] + for path in sorted(Path(reports_dir).iterdir()): + if path.is_file() and path.name.endswith("-report.json") and path.name not in NOT_COMPONENT_REPORTS: + entries.extend(json.loads(path.read_text())) + return entries + + +def update(planned, report_entries, old_pending, run_url): + done = {_key(e["name"], e.get("component_version"), e.get("openlineage_version")) for e in report_entries} + planned_keys = {_part_key(p) for p in planned} + old_by_key = {_part_key(p): p for p in old_pending} + + pending = [] + for key, entry in old_by_key.items(): + if key not in planned_keys: + pending.append(entry) # not attempted this run, unchanged + for part in planned: + key = _part_key(part) + if key in done: + continue + previous = old_by_key.get(key) + pending.append({ + **part, + "failures": (previous["failures"] if previous else 0) + 1, + "first_failed_run": previous["first_failed_run"] if previous else run_url, + "last_failed_run": run_url, + }) + return sorted(pending, key=_part_key) + + +def summary(pending): + if not pending: + return "No parts without a result.\n" + lines = ["### Parts without a result (retried by the next scheduled run)", "", + "| Component | Component version | OpenLineage | Failed runs in a row | Since |", "|---|---|---|---|---|"] + for p in pending: + lines.append(f"| {p['component']} | {p['component_version'] or '-'} | {p['openlineage_version'] or '-'} | " + f"{p['failures']} | [run]({p['first_failed_run']}) |") + return "\n".join(lines) + "\n" + + +def _load_matrix(value): + value = (value or "").strip() + return json.loads(value) if value else None + + +def main(): + parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) + sub = parser.add_subparsers(dest="command", required=True) + + p = sub.add_parser("plan", help="write the planned parts of this run") + for component in ["spark_dataproc", "hive_dataproc", "dbt"]: + p.add_argument(f"--{component.replace('_', '-')}-matrix", default="", help=f"{component} matrix JSON, empty when not running") + p.add_argument("--run-scenarios", default="false") + p.add_argument("--run-dataplex", default="false") + p.add_argument("--producer-dir", default="producer") + p.add_argument("--out", required=True) + + u = sub.add_parser("update", help="write the new pending list") + u.add_argument("--planned", required=True) + u.add_argument("--reports-dir", required=True) + u.add_argument("--pending", required=True, help="the current pending_runs.json") + u.add_argument("--run-url", required=True) + u.add_argument("--out", required=True) + u.add_argument("--summary", default=None, help="file to append a Markdown summary to (e.g. $GITHUB_STEP_SUMMARY)") + + args = parser.parse_args() + if args.command == "plan": + matrices = { + "spark_dataproc": _load_matrix(args.spark_dataproc_matrix), + "hive_dataproc": _load_matrix(args.hive_dataproc_matrix), + "dbt": _load_matrix(args.dbt_matrix), + } + planned = plan(matrices, args.run_scenarios == "true", args.run_dataplex == "true", args.producer_dir) + Path(args.out).write_text(json.dumps(planned, indent=2) + "\n") + print(json.dumps(planned, indent=2)) + else: + planned = json.loads(Path(args.planned).read_text()) + old_pending = json.loads(Path(args.pending).read_text()) if os.path.exists(args.pending) else [] + pending = update(planned, read_reports(args.reports_dir), old_pending, args.run_url) + Path(args.out).write_text(json.dumps(pending, indent=2) + "\n") + text = summary(pending) + print(text) + if args.summary: + with open(args.summary, "a") as f: + f.write(text) + + +if __name__ == "__main__": + main() diff --git a/scripts/tests/test_get_release_matrices.py b/scripts/tests/test_get_release_matrices.py new file mode 100644 index 00000000..cf4bbfe6 --- /dev/null +++ b/scripts/tests/test_get_release_matrices.py @@ -0,0 +1,67 @@ +"""Runs scripts/get_release_matrices.sh against the repo's versions.json files with a temporary pending list.""" +import json +import os +import subprocess + +from conftest import REPO_ROOT + +LATEST_OL = "9.9.0" + + +def run(tmp_path, pending=None, **env): + pending_file = tmp_path / "pending_runs.json" + pending_file.write_text(json.dumps(pending or [])) + full_env = {**os.environ, "LATEST_OL": LATEST_OL, "PENDING_FILE": str(pending_file), **env} + out = subprocess.run(["bash", "scripts/get_release_matrices.sh"], cwd=REPO_ROOT, env=full_env, + capture_output=True, text=True, check=True).stdout + values = dict(line.split("=", 1) for line in out.splitlines() if "=" in line) + return {k: (json.loads(v) if v.startswith("{") else v) for k, v in values.items()} + + +def pending_part(component, cv="", ol="", failures=1): + return {"component": component, "component_version": cv, "openlineage_version": ol, "failures": failures, + "first_failed_run": "r", "last_failed_run": "r"} + + +def test_nothing_changed_nothing_pending_runs_nothing(tmp_path): + out = run(tmp_path) + assert out["any_run"] == "false" + assert out["spark_dataproc_matrix"] == "" + assert out["run_spark_dataproc"] == "false" + + +def test_pending_part_runs_alone(tmp_path): + out = run(tmp_path, [pending_part("spark_dataproc", "3.5.1", "1.55.0")]) + assert out["spark_dataproc_matrix"] == {"openlineage_versions": ["1.55.0"], "component_version": ["3.5.1"]} + assert out["run_spark_dataproc"] == "true" + assert out["run_hive_dataproc"] == "false" + assert out["any_run"] == "true" + # consumers run when anything runs + assert out["run_dataplex"] == "true" + + +def test_pending_part_is_added_to_a_changed_matrix(tmp_path): + # a new OL release runs every spark version with it; the pending pair with an older OL is added + out = run(tmp_path, [pending_part("spark_dataproc", "3.5.1", "1.55.0")], OL_CHANGED="true") + matrix = out["spark_dataproc_matrix"] + assert "1.55.0" in matrix["openlineage_versions"] and LATEST_OL in matrix["openlineage_versions"] + assert "3.5.1" in matrix["component_version"] + assert len(matrix["openlineage_versions"]) == len(set(matrix["openlineage_versions"])) + + +def test_pending_scenarios_runs_the_scenarios_check(tmp_path): + out = run(tmp_path, [pending_part("scenarios")]) + assert out["run_scenarios"] == "true" + assert out["any_run"] == "true" + + +def test_pending_dataplex_runs_dataplex(tmp_path): + out = run(tmp_path, [pending_part("dataplex")]) + assert out["run_dataplex"] == "true" + assert out["any_run"] == "true" + assert out["run_spark_dataproc"] == "false" + + +def test_missing_pending_file_is_like_an_empty_one(tmp_path): + out = run(tmp_path, PENDING_FILE=str(tmp_path / "missing.json")) + assert out["any_run"] == "false" diff --git a/scripts/tests/test_pending_runs.py b/scripts/tests/test_pending_runs.py new file mode 100644 index 00000000..337b0515 --- /dev/null +++ b/scripts/tests/test_pending_runs.py @@ -0,0 +1,124 @@ +import json + +import pytest + +from pending_runs import plan, update + +RUN_1 = "https://github.com/o/r/actions/runs/1" +RUN_2 = "https://github.com/o/r/actions/runs/2" + + +@pytest.fixture +def producer_dir(tmp_path): + def scenario(component, name, component_versions=None, openlineage_versions=None): + config = {"tests": []} + if component_versions: + config["component_versions"] = component_versions + if openlineage_versions: + config["openlineage_versions"] = openlineage_versions + path = tmp_path / "producer" / component / "scenarios" / name / "config.json" + path.parent.mkdir(parents=True) + path.write_text(json.dumps(config)) + + scenario("spark_dataproc", "bigquery") + # like bigtable: never valid for the tested versions + scenario("spark_dataproc", "bigtable", openlineage_versions={"min": "1.0.0", "max": "1.0.0"}) + scenario("dbt", "csv_to_postgres", component_versions={"min": "1.8.0", "max": "1.8.0"}) + return tmp_path / "producer" + + +def part(component, cv="", ol=""): + return {"component": component, "component_version": cv, "openlineage_version": ol} + + +def test_plan_is_the_cross_product_of_each_matrix(producer_dir): + planned = plan({"spark_dataproc": {"component_version": ["3.5.1", "3.3.2"], "openlineage_versions": ["1.55.0"]}}, + run_scenarios=False, run_dataplex=False, producer_dir=producer_dir) + assert planned == [part("spark_dataproc", "3.3.2", "1.55.0"), part("spark_dataproc", "3.5.1", "1.55.0")] + + +def test_plan_drops_pairs_without_a_valid_scenario(producer_dir): + # dbt 1.12.6 has no scenario (csv_to_postgres is gated to 1.8.0), so it can never produce a report + planned = plan({"dbt": {"component_version": ["1.8.0", "1.12.6"], "openlineage_versions": ["1.55.0"]}}, + run_scenarios=False, run_dataplex=False, producer_dir=producer_dir) + assert planned == [part("dbt", "1.8.0", "1.55.0")] + + +def test_plan_includes_consumers_without_versions(producer_dir): + planned = plan({}, run_scenarios=True, run_dataplex=True, producer_dir=producer_dir) + assert planned == [part("dataplex"), part("scenarios")] + + +def test_plan_skips_producers_that_dont_run(producer_dir): + assert plan({"spark_dataproc": None, "dbt": ""}, run_scenarios=False, run_dataplex=False, + producer_dir=producer_dir) == [] + + +def report_entry(name, cv="", ol=""): + return {"name": name, "component_type": "producer", "component_version": cv, "openlineage_version": ol, + "scenarios": []} + + +def test_update_drops_done_parts_and_records_new_failures(): + planned = [part("spark_dataproc", "3.5.1", "1.55.0"), part("dbt", "1.8.0", "1.55.0")] + reports = [report_entry("dbt", "1.8.0", "1.55.0")] + + pending = update(planned, reports, [], RUN_1) + + assert pending == [dict(part("spark_dataproc", "3.5.1", "1.55.0"), failures=1, + first_failed_run=RUN_1, last_failed_run=RUN_1)] + + +def test_update_counts_consecutive_failures_and_keeps_the_first_run(): + planned = [part("spark_dataproc", "3.5.1", "1.55.0")] + old = [dict(part("spark_dataproc", "3.5.1", "1.55.0"), failures=2, first_failed_run=RUN_1, last_failed_run=RUN_1)] + + [entry] = update(planned, [], old, RUN_2) + + assert entry["failures"] == 3 + assert entry["first_failed_run"] == RUN_1 + assert entry["last_failed_run"] == RUN_2 + + +def test_update_drops_a_recovered_part(): + planned = [part("spark_dataproc", "3.5.1", "1.55.0")] + old = [dict(part("spark_dataproc", "3.5.1", "1.55.0"), failures=4, first_failed_run=RUN_1, last_failed_run=RUN_1)] + + assert update(planned, [report_entry("spark_dataproc", "3.5.1", "1.55.0")], old, RUN_2) == [] + + +def test_update_keeps_pending_parts_that_werent_planned(): + # e.g. a manual run with only dbt enabled + old = [dict(part("hive_dataproc", "3.1.3", "1.55.0"), failures=1, first_failed_run=RUN_1, last_failed_run=RUN_1)] + + assert update([part("dbt", "1.8.0", "1.55.0")], [report_entry("dbt", "1.8.0", "1.55.0")], old, RUN_2) == old + + +def test_update_without_any_report_makes_everything_pending(): + planned = [part("dataplex"), part("scenarios")] + + pending = update(planned, [], [], RUN_1) + + assert [(p["component"], p["failures"]) for p in pending] == [("dataplex", 1), ("scenarios", 1)] + + +def test_update_matches_consumers_by_name(): + planned = [part("dataplex")] + assert update(planned, [report_entry("dataplex")], [], RUN_1) == [] + + +def test_read_reports_ignores_files_produced_by_the_comparison(tmp_path): + from pending_runs import read_reports + (tmp_path / "spark-dataproc-3.5.1-1.55.0-report.json").write_text(json.dumps([report_entry("spark_dataproc", "3.5.1", "1.55.0")])) + for name in ["report.json", "updated-report.json", "new-report.json", "retention-failures-report.json"]: + (tmp_path / name).write_text(json.dumps([report_entry("dbt", "1.8.0", "1.55.0")])) + (tmp_path / "planned.json").write_text("[]") + + assert [(e["name"], e["component_version"]) for e in read_reports(tmp_path)] == [("spark_dataproc", "3.5.1")] + + +def test_summary_lists_pending_parts(): + from pending_runs import summary + text = summary([dict(part("spark_dataproc", "3.5.1", "1.55.0"), failures=3, first_failed_run=RUN_1, last_failed_run=RUN_2)]) + assert "spark_dataproc" in text and "3.5.1" in text and "1.55.0" in text and "| 3 |" in text + assert summary([]) == "No parts without a result.\n" From 637a2b61e7e6b832798cc3e7c487b94b5a9c3da9 Mon Sep 17 00:00:00 2001 From: tnazarew Date: Fri, 6 Nov 2026 13:26:33 +0100 Subject: [PATCH 2/2] ci: don't let one failed pair cancel the others in the hive and dbt matrices GitHub's default fail-fast cancels the remaining matrix jobs when one fails, so a broken pair (e.g. an OpenLineage version that isn't published yet) also left its siblings without a result. Spark already sets fail-fast: false in its own workflow. Co-Authored-By: Claude Opus 5.5 Signed-off-by: tnazarew --- .github/workflows/main_new_release.yml | 2 ++ .github/workflows/main_ol_spec_changes.yml | 2 ++ .github/workflows/main_pr.yml | 2 ++ 3 files changed, 6 insertions(+) diff --git a/.github/workflows/main_new_release.yml b/.github/workflows/main_new_release.yml index 1cb2d33e..316787ff 100644 --- a/.github/workflows/main_new_release.yml +++ b/.github/workflows/main_new_release.yml @@ -178,6 +178,7 @@ jobs: if: ${{ needs.initialize_workflow.outputs.run_hive_dataproc == 'true' }} uses: ./.github/workflows/producer_hive_dataproc.yml strategy: + fail-fast: false matrix: ${{ fromJson(needs.initialize_workflow.outputs.hive_matrix) }} secrets: gcpKey: ${{ secrets.GCP_SA_KEY }} @@ -192,6 +193,7 @@ jobs: if: ${{ needs.initialize_workflow.outputs.run_dbt == 'true' }} uses: ./.github/workflows/producer_dbt.yml strategy: + fail-fast: false matrix: ${{ fromJson(needs.initialize_workflow.outputs.dbt_matrix) }} with: ol_release: ${{ matrix.openlineage_versions }} diff --git a/.github/workflows/main_ol_spec_changes.yml b/.github/workflows/main_ol_spec_changes.yml index 00eccfd8..bc386e39 100644 --- a/.github/workflows/main_ol_spec_changes.yml +++ b/.github/workflows/main_ol_spec_changes.yml @@ -148,6 +148,7 @@ jobs: if: ${{ success() && needs.initialize_workflow.outputs.changes_in_spec == 'true' }} uses: ./.github/workflows/producer_hive_dataproc.yml strategy: + fail-fast: false matrix: ${{ fromJson(needs.initialize_workflow.outputs.hive_matrix) }} secrets: gcpKey: ${{ secrets.GCP_SA_KEY }} @@ -162,6 +163,7 @@ jobs: if: ${{ success() && needs.initialize_workflow.outputs.changes_in_spec == 'true' }} uses: ./.github/workflows/producer_dbt.yml strategy: + fail-fast: false matrix: ${{ fromJson(needs.initialize_workflow.outputs.dbt_matrix) }} with: ol_release: ${{ matrix.openlineage_versions }} diff --git a/.github/workflows/main_pr.yml b/.github/workflows/main_pr.yml index b646c56f..4e0a8225 100644 --- a/.github/workflows/main_pr.yml +++ b/.github/workflows/main_pr.yml @@ -141,6 +141,7 @@ jobs: if: ${{ needs.initialize_workflow.outputs.run_hive_dataproc == 'true' }} uses: ./.github/workflows/producer_hive_dataproc.yml strategy: + fail-fast: false matrix: ${{ fromJson(needs.initialize_workflow.outputs.hive_matrix) }} secrets: gcpKey: ${{ secrets.GCP_SA_KEY }} @@ -154,6 +155,7 @@ jobs: if: ${{ needs.initialize_workflow.outputs.run_dbt == 'true' }} uses: ./.github/workflows/producer_dbt.yml strategy: + fail-fast: false matrix: ${{ fromJson(needs.initialize_workflow.outputs.dbt_matrix) }} with: dbt_release: ${{ matrix.component_version }}