Skip to content

Upload Workflow Metadata #105954

Upload Workflow Metadata

Upload Workflow Metadata #105954

# This workflow runs automatically when targeted test workflows complete.
# It collects workflow metadata and uploads it to GCS.
name: Upload Workflow Metadata
on:
# zizmor: ignore[dangerous-triggers]
workflow_run:
workflows:
- "CI - Wheel Tests (Continuous)"
- "CI - Pytest CPU"
- "CI - Bazel CPU tests with wheel dependencies (RBE)"
- "Bazel CUDA"
- "CI - Pytest TPU"
- "CI - Bazel test TPU"
- "CI - Pytest CUDA"
- "CI - Bazel H100 and B200 CUDA tests"
- "Bazel ROCm"
- "CI - Pytest ROCm"
- "CI - jaxlib head with NumPy nightly"
- "Pytest CPU"
- "Mosaic GPU B200 Presubmit"
- "JAX Array API"
- "CI - with Numpy/Scipy nightly wheels (nightly)"
- "CI - Address Sanitizer (nightly)"
- "Bazel CPU"
- "Bazel TPU"
- "CI - Wheel Tests (Nightly/Release)"
types:
- completed
permissions:
actions: read
contents: read
jobs:
upload:
if: github.repository_owner == 'jax-ml'
name: "Upload Workflow Metadata"
runs-on: linux-x86-n4-4
container: us-docker.pkg.dev/ml-oss-artifacts-published/ml-public-container/ml-build:latest # zizmor: ignore[unpinned-images]
defaults:
run:
shell: bash
steps:
- name: Checkout repo
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Fetch and Upload Metadata
env:
GITHUB_TOKEN: ${{ github.token }}
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
WORKFLOW_RUN_NAME: ${{ github.event.workflow_run.name }}
WORKFLOW_RUN_NUMBER: ${{ github.event.workflow_run.run_number }}
WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
REPO: ${{ github.repository }}
run: |
curl -f -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/actions/runs/$WORKFLOW_RUN_ID" > workflow_run.json
curl -f -s -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/actions/runs/$WORKFLOW_RUN_ID/jobs?per_page=200" > jobs.json
# Download logs
curl -f -s -L -H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/$REPO/actions/runs/$WORKFLOW_RUN_ID/logs" > logs.zip
# Check if zip file is empty before unzipping
if [ -s logs.zip ]; then
unzip logs.zip -d logs
else
echo "Warning: logs.zip is empty or not found. Creating empty logs directory."
mkdir logs
fi
# Path sanitization
SAFE_NAME="${WORKFLOW_RUN_NAME//\//-}"
gcs_upload_uri="gs://general-ml-ci-transient/jax-github-actions/jax/$SAFE_NAME/$WORKFLOW_RUN_NUMBER/$WORKFLOW_RUN_ATTEMPT"
# Upload everything
gcloud storage cp -r workflow_run.json jobs.json logs "$gcs_upload_uri/"
# Process test results using the script
# TODO(dsuo): Enable processing test results once GHA runner GCP permissions are resolved.
# bash third_party/py/jax/oss/ci/postprocess/process_test_results.sh "$gcs_upload_uri"