Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/collect_and_compare_reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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/
Expand Down
48 changes: 43 additions & 5 deletions .github/workflows/main_new_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -147,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 }}
Expand All @@ -161,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 }}
Expand All @@ -177,14 +210,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'
Expand All @@ -194,8 +230,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 }}
Expand All @@ -206,14 +244,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 }}
2 changes: 2 additions & 0 deletions .github/workflows/main_ol_spec_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/update_repo_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions generated-files/pending_runs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
1 change: 1 addition & 0 deletions scripts/check_structure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
35 changes: 30 additions & 5 deletions scripts/get_release_matrices.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
}

Expand All @@ -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"
Expand Down
Loading
Loading