Skip to content

feat: carry enacted_by identity on Abort/Signal and add SignalInfo result #2212

feat: carry enacted_by identity on Abort/Signal and add SignalInfo result

feat: carry enacted_by identity on Abort/Signal and add SignalInfo result #2212

Workflow file for this run

name: Check Generated Files
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- main
jobs:
setup:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
packages: read
issues: read
outputs:
image: ${{ steps.docker-image.outputs.image }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Determine Docker image
id: docker-image
run: |
# Check if gen.Dockerfile or build workflow was modified
git fetch --depth=1 origin ${{ github.base_ref }}
if git diff --name-only FETCH_HEAD..HEAD | grep -E '^(gen\.Dockerfile|Dockerfile\.ci|\.github/workflows/build-ci-image\.yml)$'; then
echo "modified=true" >> $GITHUB_OUTPUT
echo "image=ghcr.io/flyteorg/flyte/ci:pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
echo "📦 gen.Dockerfile modified - will use PR-specific image"
else
echo "modified=false" >> $GITHUB_OUTPUT
echo "image=ghcr.io/flyteorg/flyte/ci:v2" >> $GITHUB_OUTPUT
echo "📦 Using default v2 image"
fi
- name: Wait for Docker image build workflow
if: steps.docker-image.outputs.modified == 'true'
uses: actions/github-script@v7
with:
script: |
const maxAttempts = 60; // 20 minutes max
const delaySeconds = 20;
console.log('⏳ Waiting for Docker image build workflow to complete...');
for (let attempt = 0; attempt < maxAttempts; attempt++) {
// Get workflow runs for this PR
const { data: runs } = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'build-ci-image.yml',
event: 'pull_request_target',
per_page: 10
});
// For pull_request_target from forks, run.pull_requests is always empty (GitHub API limitation).
// Fall back to matching by head_sha for fork PRs.
const prNumber = context.issue.number;
const prHeadSha = context.payload.pull_request.head.sha;
const prRun = runs.workflow_runs.find(run => {
if (Array.isArray(run.pull_requests) && run.pull_requests.length > 0) {
return run.pull_requests.some(pr => pr.number === prNumber);
}
return run.head_sha === prHeadSha;
});
if (prRun) {
console.log(`Found workflow run: ${prRun.html_url}`);
console.log(`Status: ${prRun.status}, Conclusion: ${prRun.conclusion}`);
if (prRun.status === 'completed') {
if (prRun.conclusion === 'success') {
console.log('✅ Docker image build completed successfully!');
return;
} else {
core.setFailed(`❌ Docker image build failed with conclusion: ${prRun.conclusion}`);
return;
}
}
console.log(`Attempt ${attempt + 1}/${maxAttempts}: Build still running, waiting ${delaySeconds} seconds...`);
} else {
console.log(`Attempt ${attempt + 1}/${maxAttempts}: Build not started yet, waiting ${delaySeconds} seconds...`);
}
await new Promise(resolve => setTimeout(resolve, delaySeconds * 1000));
}
core.setFailed('❌ Timeout waiting for Docker image build to complete');
check-generate:
needs: setup
runs-on: ubuntu-latest
container:
image: ${{ needs.setup.outputs.image }}
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
permissions:
contents: read
packages: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache cargo artifacts
uses: actions/cache@v4
with:
path: |
/root/.cargo/registry
/root/.cargo/git
/cargo-target
key: check-gen-cargo-${{ needs.setup.outputs.image }}-${{ hashFiles('gen/rust/Cargo.lock') }}
restore-keys: |
check-gen-cargo-${{ needs.setup.outputs.image }}-
- name: Cache uv virtualenv
uses: actions/cache@v4
with:
path: /uv-venv
key: check-gen-uv-${{ needs.setup.outputs.image }}-${{ hashFiles('gen/python/uv.lock') }}
restore-keys: |
check-gen-uv-${{ needs.setup.outputs.image }}-
- name: Run buf generation and checks
env:
SETUPTOOLS_SCM_PRETEND_VERSION: "0.0.0"
UV_PROJECT_ENVIRONMENT: /uv-venv
CARGO_TARGET_DIR: /cargo-target
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
cd gen/python && uv sync --all-groups --frozen && cd ../..
make buf
git diff --exit-code -- ':!gen/rust/Cargo.lock' ':!*/mocks/*' ':!*/gocachemocks/*' ':!go.mod' ':!go.sum' || \
(echo 'Generated files are out of date. Run `make buf` and commit changes.' && exit 1)
make check-crate
check-go-tidy:
needs: setup
runs-on: ubuntu-latest
container:
image: ${{ needs.setup.outputs.image }}
permissions:
contents: read
packages: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run go mod tidy and check
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
make go-tidy
git diff --exit-code -- go.mod go.sum || \
(echo 'go.mod/go.sum are out of date. Run `go mod tidy` and commit changes.' && exit 1)
check-mocks:
needs: setup
runs-on: ubuntu-latest
container:
image: ${{ needs.setup.outputs.image }}
permissions:
contents: read
packages: read
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run mockery and check
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
make mocks
git diff --exit-code -- '*/mocks/*' '*/gocachemocks/*' || \
(echo 'Mock files are out of date. Run `make mocks` and commit changes.' && exit 1)