Skip to content

World's most powerful open data catalog for building a high-performance, geo-distributed and federated metadata lake.

[#12544] feat(ci): run pull request tests with contributor fork resources (#13049)

roryqi641c58f4c07f
diff --git a/.asf.yaml b/.asf.yaml
index 08c78ea4b4..032b533fa7 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -47,6 +47,10 @@ github:
main:
required_status_checks:
strict: true
+ # Mirrored from the contributor fork by the Fork CI Status workflows.
+ contexts:
+ - Fork CI
+ - ASF Allowlist Check
required_pull_request_reviews:
dismiss_stale_reviews: true
required_approving_review_count: 1
diff --git a/.github/actions/checkout-and-sync/action.yml b/.github/actions/checkout-and-sync/action.yml
new file mode 100644
index 0000000000..b2f77145ec
--- /dev/null
+++ b/.github/actions/checkout-and-sync/action.yml
@@ -0,0 +1,139 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Checkout and sync
+description: Check out the upstream base branch and merge the contributor branch for fork CI.
+
+inputs:
+ base-ref:
+ description: Fixed upstream branch selected by Fork CI.
+ required: false
+ default: ''
+ base-sha:
+ description: Fixed upstream commit selected by Fork CI.
+ required: false
+ default: ''
+ head-repository:
+ description: Repository containing the contributor commit.
+ required: false
+ default: ''
+ head-sha:
+ description: Fixed contributor commit to test.
+ required: false
+ default: ''
+ sync:
+ description: Whether to merge the contributor commit onto the fixed base.
+ required: false
+ default: ''
+ persist-credentials:
+ description: Whether to keep the token in the git config of the checkout.
+ required: false
+ default: 'false'
+
+outputs:
+ base-ref:
+ description: Upstream branch used as the comparison base.
+ value: ${{ steps.base.outputs.base_ref }}
+ base-sha:
+ description: Upstream commit checked out before merging contributor changes.
+ value: ${{ steps.upstream.outputs.base_sha }}
+ head-sha:
+ description: Commit tested after contributor changes are merged.
+ value: ${{ steps.head.outputs.head_sha }}
+ synced:
+ description: Whether contributor changes were merged onto the upstream base.
+ value: ${{ steps.base.outputs.should_sync }}
+ pull-request:
+ description: Whether a pull request is tested, through Fork CI or a pull_request event.
+ value: ${{ steps.base.outputs.should_sync == 'true' || github.event_name == 'pull_request' }}
+
+runs:
+ using: composite
+ steps:
+ - name: Resolve pull request base branch
+ id: base
+ shell: bash
+ env:
+ EVENT_BASE_REF: ${{ github.base_ref }}
+ GH_TOKEN: ${{ github.token }}
+ HEAD_OWNER: ${{ github.repository_owner }}
+ HEAD_BRANCH: ${{ github.ref_name }}
+ HEAD_REPOSITORY: ${{ inputs.head-repository || github.repository }}
+ HEAD_SHA: ${{ inputs.head-sha || github.sha }}
+ FIXED_BASE_REF: ${{ inputs.base-ref }}
+ FIXED_BASE_SHA: ${{ inputs.base-sha }}
+ FIXED_SYNC: ${{ inputs.sync }}
+ run: |
+ set -euo pipefail
+ if [[ -n "${FIXED_BASE_SHA}" ]]; then
+ [[ "${FIXED_BASE_SHA}" =~ ^[0-9a-f]{40}$ ]] || exit 1
+ git check-ref-format "refs/heads/${FIXED_BASE_REF}"
+ [[ "${FIXED_SYNC}" == "true" || "${FIXED_SYNC}" == "false" ]] || exit 1
+ echo "base_ref=${FIXED_BASE_REF}" >> "${GITHUB_OUTPUT}"
+ echo "should_sync=${FIXED_SYNC}" >> "${GITHUB_OUTPUT}"
+ else
+ # Legacy direct/manual/nightly callers test their own checkout. Fork CI always
+ # supplies the context resolved once by eligibility; suites never re-query PRs.
+ echo "base_ref=${EVENT_BASE_REF:-${GITHUB_REF_NAME}}" >> "${GITHUB_OUTPUT}"
+ echo "should_sync=false" >> "${GITHUB_OUTPUT}"
+ fi
+
+ - name: Checkout upstream base branch
+ if: steps.base.outputs.should_sync == 'true'
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ repository: apache/gravitino
+ ref: ${{ inputs.base-sha }}
+ persist-credentials: ${{ inputs.persist-credentials }}
+
+ - name: Resolve upstream base commit
+ id: upstream
+ shell: bash
+ run: echo "base_sha=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
+
+ - name: Merge contributor branch
+ if: steps.base.outputs.should_sync == 'true'
+ shell: bash
+ env:
+ BASE_REF: ${{ steps.base.outputs.base_ref }}
+ HEAD_REPOSITORY: ${{ inputs.head-repository || github.repository }}
+ HEAD_SHA: ${{ inputs.head-sha || github.sha }}
+ run: |
+ set -euo pipefail
+
+ [[ "${HEAD_SHA}" =~ ^[0-9a-f]{40}$ ]] || exit 1
+ [[ "${HEAD_REPOSITORY}" =~ ^[A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+$ ]] || exit 1
+ # Fetch the pushed commit rather than the branch tip, which may have moved since.
+ git fetch "https://github.com/${HEAD_REPOSITORY}.git" "${HEAD_SHA}"
+ if ! git \
+ -c user.name='Apache Gravitino CI' \
+ -c user.email='[email protected]' \
+ merge --no-commit --no-ff "${HEAD_SHA}"; then
+ git diff --name-only --diff-filter=U | sed 's/^/Conflict: /'
+ echo "::error::${HEAD_SHA} does not merge cleanly into ${BASE_REF}. Merge or rebase onto the latest ${BASE_REF} and push again."
+ exit 1
+ fi
+ git \
+ -c user.name='Apache Gravitino CI' \
+ -c user.email='[email protected]' \
+ commit --allow-empty -m 'Merge contributor branch for CI'
+
+ - name: Resolve tested commit
+ id: head
+ shell: bash
+ run: echo "head_sha=$(git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
diff --git a/.github/scripts/allowlist-pr.cjs b/.github/scripts/allowlist-pr.cjs
new file mode 100644
index 0000000000..bdbdb337a7
--- /dev/null
+++ b/.github/scripts/allowlist-pr.cjs
@@ -0,0 +1,93 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+const fs = require('node:fs/promises');
+const path = require('node:path');
+const MAX_FILE = 1024 * 1024;
+const MAX_TOTAL = 8 * MAX_FILE;
+
+function yamlEntries(tree) {
+ if (tree.truncated) throw new Error('Refusing a truncated .github tree.');
+ return tree.tree.filter(entry => /\.ya?ml$/.test(entry.path)).map(entry => {
+ if (!['100644', '100755'].includes(entry.mode) || entry.type !== 'blob' ||
+ entry.path.split('/').some(part => part === '..' || part === '.' || !part) ||
+ path.isAbsolute(entry.path) || entry.path.includes('\\') || entry.size > MAX_FILE) {
+ throw new Error('Unsafe or oversized workflow data path.');
+ }
+ return entry;
+ });
+}
+async function prepare({ github, context, core, fetchImpl = fetch, directory = path.join(process.env.RUNNER_TEMP, 'fork-ci-allowlist') }) {
+ let prs;
+ if (context.eventName === 'workflow_dispatch') {
+ const number = context.payload.inputs?.['pull-request'];
+ if (!/^[1-9][0-9]*$/.test(String(number))) throw new Error('A PR number is required.');
+ prs = [(await github.rest.pulls.get({ ...context.repo, pull_number: Number(number) })).data];
+ } else {
+ const sha = context.payload.workflow_run.head_sha;
+ if (!/^[0-9a-f]{40}$/.test(sha)) throw new Error('Invalid signal SHA.');
+ // listPullRequestsAssociatedWithCommit does not return PRs whose head commit is in a fork.
+ const run = context.payload.workflow_run;
+ prs = (await github.paginate(github.rest.pulls.list, { ...context.repo, state: 'open',
+ head: `${run.head_repository.owner.login}:${run.head_branch}`, per_page: 100 }))
+ .filter(pr => pr.head.sha === sha);
+ }
+ prs = prs.filter(pr => pr.state === 'open' && pr.head.repo);
+ if (!prs.length) { core.setOutput('prs', '[]'); return; }
+ if (prs.some(pr => pr.head.sha !== prs[0].head.sha)) throw new Error('Inconsistent signal heads.');
+ const pr = prs[0];
+ const target = { owner: pr.head.repo.owner.login, repo: pr.head.repo.name };
+ const { data: root } = await github.rest.git.getTree({ ...target, tree_sha: pr.head.sha });
+ const entry = root.tree.find(e => e.path === '.github');
+ if (!entry || entry.type !== 'tree') throw new Error('The PR has no .github directory.');
+ const { data: tree } = await github.rest.git.getTree({ ...target, tree_sha: entry.sha, recursive: '1' });
+ await fs.rm(directory, { recursive: true, force: true });
+ let total = 0;
+ for (const file of yamlEntries(tree)) {
+ const url = `https://raw.githubusercontent.com/${target.owner}/${target.repo}/${pr.head.sha}/.github/` +
+ file.path.split('/').map(encodeURIComponent).join('/');
+ const response = await fetchImpl(url, { redirect: 'error', signal: AbortSignal.timeout(30000) });
+ if (!response.ok) throw new Error(`Could not read workflow data: HTTP ${response.status}.`);
+ const chunks = [];
+ let size = 0;
+ for await (const chunk of response.body) {
+ size += chunk.length;
+ total += chunk.length;
+ if (size > MAX_FILE || total > MAX_TOTAL) throw new Error('Workflow data size limit exceeded.');
+ chunks.push(chunk);
+ }
+ const destination = path.join(directory, '.github', file.path);
+ await fs.mkdir(path.dirname(destination), { recursive: true });
+ await fs.writeFile(destination, Buffer.concat(chunks));
+ }
+ // These are data files outside the trusted checkout. Never source, install or execute them.
+ core.setOutput('prs', JSON.stringify(prs.map(pr => ({ number: pr.number, sha: pr.head.sha }))));
+ core.setOutput('scan-glob', `${directory}/.github/**/*.y*ml`);
+}
+async function publish({ github, context, core }) {
+ const prs = JSON.parse(process.env.SCANNED_PRS || '[]');
+ for (const pr of prs) {
+ const { data: current } = await github.rest.pulls.get({ ...context.repo, pull_number: pr.number });
+ if (current.state !== 'open' || current.head.sha !== pr.sha) continue;
+ const success = process.env.SCAN_OUTCOME === 'success';
+ await github.rest.checks.create({ ...context.repo, name: 'ASF Allowlist Check', head_sha: pr.sha,
+ status: 'completed', conclusion: success ? 'success' : 'failure',
+ details_url: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
+ output: { title: success ? 'Workflow actions are allowlisted' : 'Workflow allowlist scan failed',
+ summary: 'Scanned PR YAML as data with the reviewed default-branch workflow. No PR code was executed.' } });
+ }
+ if (process.env.SCAN_OUTCOME !== 'success' && prs.length) core.setFailed('ASF allowlist scan failed.');
+}
+module.exports = { yamlEntries, prepare, publish };
diff --git a/.github/scripts/fork-ci-status.cjs b/.github/scripts/fork-ci-status.cjs
new file mode 100644
index 0000000000..e3508f4c69
--- /dev/null
+++ b/.github/scripts/fork-ci-status.cjs
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+const UPSTREAM = { owner: 'apache', repo: 'gravitino' };
+const SUITES = ['build', 'backend', 'spark', 'flink', 'trino', 'iceberg_rest_trino', 'python',
+ 'frontend', 'access_control', 'idp_basic', 'mcp', 'maintenance', 'web_ui', 'charts',
+ 'contrib_catalog', 'asf_allowlist'];
+const requiredName = (pr, baseSha = pr.base.sha) => `Required CI / ${pr.base.ref} / ${baseSha} / ${pr.head.sha}`;
+const requiredAction = note => ({ status: 'completed', conclusion: 'action_required',
+ title: 'Fork CI needs attention', note });
+
+function evaluate(pr, run, jobs, baseSha = pr.base.sha) {
+ const required = jobs.find(job => job.name === requiredName(pr, baseSha));
+ if (run.status !== 'completed') return { status: 'in_progress', title: 'Fork CI is running' };
+ if (run.conclusion !== 'success') return { status: 'completed',
+ conclusion: ['failure', 'cancelled', 'timed_out', 'action_required'].includes(run.conclusion)
+ ? run.conclusion : 'action_required', title: `Fork CI ${run.conclusion}` };
+ if (!required || required.conclusion !== 'success') {
+ return requiredAction('The run did not finish Required CI for this exact head, base branch and base SHA. ' +
+ 'Update the branch and push again, or ask a committer to dispatch a trusted Fork CI run.');
+ }
+ for (const suite of SUITES) {
+ const children = jobs.filter(job => job.name.startsWith(`${suite} / `));
+ if (!children.length || !children.some(job => job.conclusion === 'success') ||
+ children.some(job => !['success', 'skipped'].includes(job.conclusion))) {
+ return requiredAction(`The ${suite} caller did not report successful jobs. Open the run and verify its suites.`);
+ }
+ }
+ return { status: 'completed', conclusion: 'success', title: 'All required suites passed' };
+}
+
+function createService(github) {
+ const definitions = new Map();
+ const trees = new Map();
+ async function ciTree(owner, repo, sha) {
+ const key = `${owner}/${repo}@${sha}`;
+ if (!trees.has(key)) trees.set(key, (async () => {
+ const { data: root } = await github.rest.git.getTree({ owner, repo, tree_sha: sha });
+ const entries = Object.fromEntries(root.tree.map(e => [e.path, e]));
+ const githubTree = entries['.github'];
+ const result = { policy: entries['.asf.yaml']?.sha || null };
+ if (!githubTree) return result;
+ const { data: dirs } = await github.rest.git.getTree({ owner, repo, tree_sha: githubTree.sha });
+ for (const name of ['workflows', 'actions', 'scripts']) result[name] = dirs.tree.find(e => e.path === name)?.sha || null;
+ return result;
+ })());
+ return trees.get(key);
+ }
+ async function unchanged(pr) {
+ const key = `${pr.head.repo.full_name}@${pr.head.sha}:${pr.base.sha}`;
+ if (definitions.has(key)) return definitions.get(key);
+ const [base, head] = await Promise.all([
+ ciTree(UPSTREAM.owner, UPSTREAM.repo, pr.base.sha),
+ ciTree(pr.head.repo.owner.login, pr.head.repo.name, pr.head.sha)
+ ]);
+ const same = JSON.stringify(base) === JSON.stringify(head);
+ definitions.set(key, same);
+ return same;
+ }
+ async function jobsFor(owner, repo, run) {
+ // Partial re-runs retain earlier successful jobs. Take each named job's newest
+ // execution, rather than requiring every caller to execute in the latest attempt.
+ const jobs = await github.paginate('GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs',
+ { owner, repo, run_id: run.id, filter: 'all', per_page: 100 });
+ const latest = new Map();
+ for (const job of jobs) {
+ if ((job.run_attempt || 1) > run.run_attempt) continue;
+ const previous = latest.get(job.name);
+ if (!previous || (job.run_attempt || 1) > (previous.run_attempt || 1) ||
+ ((job.run_attempt || 1) === (previous.run_attempt || 1) && job.id > previous.id)) {
+ latest.set(job.name, job);
+ }
+ }
+ return [...latest.values()];
+ }
+ async function testedBase(pr, jobs) {
+ // pr.base.sha is not refreshed by later pushes, so runs usually test a newer base commit.
+ // Accept that commit only if it is on the PR base branch. The check can stay green after the
+ // branch moves on; strict branch protection, not this check, requires an up-to-date branch.
+ const prefix = `Required CI / ${pr.base.ref} / `;
+ const suffix = ` / ${pr.head.sha}`;
+ const job = jobs.find(job => job.name.startsWith(prefix) && job.name.endsWith(suffix));
+ const sha = job?.name.slice(prefix.length, -suffix.length);
+ if (!sha || sha === pr.base.sha || !/^[0-9a-f]{40}$/.test(sha)) return pr.base.sha;
+ const { data } = await github.rest.repos.compareCommitsWithBasehead({ ...UPSTREAM,
+ basehead: `${sha}...${pr.base.ref}`, per_page: 1 });
+ return ['ahead', 'identical'].includes(data.status) ? sha : pr.base.sha;
+ }
+ async function findRun(pr, trusted) {
+ const target = trusted ? UPSTREAM : { owner: pr.head.repo.owner.login, repo: pr.head.repo.name };
+ const all = await github.paginate(github.rest.actions.listWorkflowRuns, { ...target, workflow_id: 'fork-ci.yml',
+ event: trusted ? 'workflow_dispatch' : 'push', head_sha: trusted ? pr.base.sha : pr.head.sha, per_page: 100 });
+ const runs = all.filter(run => run.path === '.github/workflows/fork-ci.yml' &&
+ run.head_sha === (trusted ? pr.base.sha : pr.head.sha) &&
+ (!trusted || run.display_title === `Trusted Fork CI #${pr.number}`)).sort((a, b) => b.id - a.id);
+ return runs[0] && { ...target, run: runs[0], trusted };
+ }
+ async function mirror(pr) {
+ if (!pr.head.repo) return { result: requiredAction('The PR head repository no longer exists.') };
+ // Read trusted metadata only. Nothing in the contributor repository is checked out or executed.
+ let ordinary = await findRun(pr, false);
+ const sameDefinitions = await unchanged(pr);
+ const trusted = await findRun(pr, true);
+ let selected = trusted && (!ordinary || (trusted.run.updated_at || trusted.run.created_at) >= (ordinary.run.updated_at || ordinary.run.created_at) || !sameDefinitions)
+ ? trusted : ordinary;
+ if (!selected) return { result: requiredAction('Enable Actions in the fork and push the branch, or dispatch trusted Fork CI.') };
+ const { owner, repo, run } = selected;
+ if (!selected.trusted && !sameDefinitions) return { ...selected, fork: ordinary?.run,
+ result: requiredAction('CI workflow/action/script definitions or branch protection differ from the base. ' +
+ 'A committer must dispatch Fork CI from the current upstream default branch with this PR number.') };
+ // A manual upstream run uses the workflow definitions at run.head_sha, not the PR definitions.
+ const jobs = await jobsFor(owner, repo, run);
+ const base = selected.trusted ? pr.base.sha : await testedBase(pr, jobs);
+ return { ...selected, fork: ordinary?.run, base, result: evaluate(pr, run, jobs, base) };
+ }
+ return { mirror, unchanged, findRun };
+}
+module.exports = { SUITES, requiredName, evaluate, createService };
diff --git a/.github/scripts/resolve-fork-ci.cjs b/.github/scripts/resolve-fork-ci.cjs
new file mode 100644
index 0000000000..483d747594
--- /dev/null
+++ b/.github/scripts/resolve-fork-ci.cjs
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+const UPSTREAM = 'apache/gravitino';
+
+async function resolve({ github, context, core }) {
+ const repository = `${context.repo.owner}/${context.repo.repo}`;
+ let headRepository = repository;
+ let headSha = context.sha;
+ let baseRef = context.ref.replace(/^refs\/heads\//, '');
+ let baseSha = headSha;
+ let sync = false;
+ if (context.eventName === 'workflow_dispatch') {
+ if (repository !== UPSTREAM) throw new Error('Trusted runs must be dispatched in apache/gravitino.');
+ const number = context.payload.inputs?.['pull-request'];
+ if (!/^[1-9][0-9]*$/.test(String(number))) throw new Error('A pull request number is required.');
+ const { data: pr } = await github.rest.pulls.get({ ...context.repo, pull_number: Number(number) });
+ if (pr.state !== 'open' || !pr.head.repo) throw new Error('The pull request must be open with an existing head repository.');
+ baseRef = pr.base.ref;
+ if (baseRef !== context.payload.repository.default_branch || context.sha !== pr.base.sha) {
+ throw new Error('Dispatch the trusted workflow from the current default branch; release branches use their own CI.');
+ }
+ headSha = pr.head.sha;
+ headRepository = pr.head.repo.full_name;
+ baseSha = pr.base.sha;
+ sync = true;
+ } else if (repository === UPSTREAM && (baseRef === 'main' || baseRef.startsWith('branch-'))) {
+ // Post-merge CI tests the pushed upstream commit itself.
+ } else {
+ const { data: repo } = await github.rest.repos.get(context.repo);
+ if (repo.fork && repo.source?.full_name === UPSTREAM) {
+ const prs = await github.paginate(github.rest.pulls.list, {
+ owner: 'apache', repo: 'gravitino', state: 'open',
+ head: `${context.repo.owner}:${baseRef}`, per_page: 100
+ });
+ const matches = prs.filter(pr => pr.head.sha === headSha && pr.head.repo?.full_name === repository);
+ if (matches.length > 1) throw new Error('More than one open PR matches this pushed commit.');
+ if (matches.length === 1) {
+ baseRef = matches[0].base.ref;
+ } else {
+ const { data: upstream } = await github.rest.repos.get({ owner: 'apache', repo: 'gravitino' });
+ const branches = await github.paginate(github.rest.repos.listBranches, {
+ owner: 'apache', repo: 'gravitino', per_page: 100
+ });
+ const releases = branches.map(b => b.name).filter(n => /^branch-\d+\.\d+$/.test(n))
+ .sort((a, b) => a.localeCompare(b, 'en', { numeric: true })).slice(-3);
+ const candidates = [...new Set([upstream.default_branch, ...releases])];
+ let fewest = Infinity;
+ for (const candidate of candidates) {
+ const { data: comparison } = await github.rest.repos.compareCommitsWithBasehead({
+ owner: 'apache', repo: 'gravitino',
+ basehead: `${candidate}...${context.repo.owner}:${headSha}`, per_page: 1
+ });
+ if (comparison.ahead_by < fewest) { fewest = comparison.ahead_by; baseRef = candidate; }
+ }
+ core.notice(`No open PR: testing against ${baseRef}; results require a matching PR base.`);
+ }
+ const { data: base } = await github.rest.repos.getBranch({ owner: 'apache', repo: 'gravitino', branch: baseRef });
+ baseSha = base.commit.sha;
+ sync = true;
+ } else if (repository === UPSTREAM) {
+ // Same-repository feature branches may also belong to an open PR.
+ const prs = await github.paginate(github.rest.pulls.list, {
+ ...context.repo, state: 'open', head: `${context.repo.owner}:${baseRef}`, per_page: 100
+ });
+ const matches = prs.filter(pr => pr.head.sha === headSha && pr.head.repo?.full_name === repository);
+ if (matches.length === 0) { core.setOutput('valid', 'false'); return; }
+ if (matches.length !== 1) throw new Error('More than one PR matches this branch.');
+ baseRef = matches[0].base.ref;
+ const { data: base } = await github.rest.repos.getBranch({ ...context.repo, branch: baseRef });
+ baseSha = base.commit.sha;
+ sync = true;
+ }
+ // Standalone copies and unrelated fork networks test their own commit, without Apache sync.
+ }
+ if (!/^[0-9a-f]{40}$/.test(headSha) || !/^[0-9a-f]{40}$/.test(baseSha)) throw new Error('Invalid commit SHA.');
+ if (!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(headRepository)) throw new Error('Invalid head repository.');
+ for (const [name, value] of Object.entries({
+ 'base-ref': baseRef, 'base-sha': baseSha, 'head-sha': headSha,
+ 'head-repository': headRepository, sync: String(sync), valid: 'true'
+ })) core.setOutput(name, value);
+}
+module.exports = { resolve };
diff --git a/.github/scripts/tests/fork-ci.test.cjs b/.github/scripts/tests/fork-ci.test.cjs
new file mode 100644
index 0000000000..f494acec49
--- /dev/null
+++ b/.github/scripts/tests/fork-ci.test.cjs
@@ -0,0 +1,453 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+'use strict';
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { mkdtemp, readFile, rm } = require('node:fs/promises');
+const os = require('node:os');
+const path = require('node:path');
+const { SUITES, requiredName, evaluate, createService } = require('../fork-ci-status.cjs');
+const { resolve } = require('../resolve-fork-ci.cjs');
+const { yamlEntries, prepare } = require('../allowlist-pr.cjs');
+const A = 'a'.repeat(40), B = 'b'.repeat(40), C = 'c'.repeat(40);
+const pr = () => ({ number: 7, state: 'open', head: { sha: A, repo: { owner: { login: 'fork' }, name: 'repo', full_name: 'fork/repo' } },
+ base: { ref: 'main', sha: B }, updated_at: '2026-01-01T00:00:00Z', html_url: 'https://github.com/apache/gravitino/pull/7' });
+const run = () => ({ id: 1, run_attempt: 1, path: '.github/workflows/fork-ci.yml', head_sha: A,
+ status: 'completed', conclusion: 'success', created_at: '2026-01-01T00:00:00Z' });
+const jobs = p => [{ name: requiredName(p), conclusion: 'success' },
+ ...SUITES.map(suite => ({ name: `${suite} / changes`, conclusion: 'success' }))];
+
+test('a same-named empty Required CI job cannot satisfy the gate', () => {
+ assert.equal(evaluate(pr(), run(), [{ name: 'Required CI', conclusion: 'success' }]).conclusion, 'action_required');
+});
+test('every real caller must have successful jobs, with only path-based skips allowed', () => {
+ const p = pr();
+ assert.equal(evaluate(p, run(), jobs(p)).conclusion, 'success');
+ for (const suite of SUITES) {
+ assert.equal(evaluate(p, run(), jobs(p).filter(job => !job.name.startsWith(suite + ' / '))).conclusion, 'action_required');
+ }
+ const children = [...jobs(p), { name: 'build / coverage', conclusion: 'skipped' }];
+ assert.equal(evaluate(p, run(), children).conclusion, 'success');
+ children.at(-1).conclusion = 'failure';
+ assert.equal(evaluate(p, run(), children).conclusion, 'action_required');
+});
+test('the head, base branch and base SHA must all match the tested context', () => {
+ const p = pr(), oldJobs = jobs(p);
+ for (const change of [q => q.head.sha = C, q => q.base.sha = C, q => q.base.ref = 'branch-1.3']) {
+ const q = pr(); change(q);
+ assert.equal(evaluate(q, run(), oldJobs).conclusion, 'action_required');
+ }
+});
+test('running and failed reruns cannot remain successful', () => {
+ assert.equal(evaluate(pr(), { ...run(), status: 'in_progress' }, jobs(pr())).status, 'in_progress');
+ for (const conclusion of ['failure', 'timed_out', 'cancelled']) {
+ assert.equal(evaluate(pr(), { ...run(), conclusion }, jobs(pr())).conclusion, conclusion);
+ }
+});
+// Mirrors Octokit, which returns the workflow_runs array when paginating listWorkflowRuns.
+const runsOf = (github, endpoint, args) => endpoint === github.rest.actions.listWorkflowRuns
+ ? endpoint(args).then(response => response.data.workflow_runs) : undefined;
+function serviceMock({ changed = false, trusted = false, forkJobs = jobs(pr()), trustedJobs = jobs(pr()), trustedSha = B } = {}) {
+ const github = { rest: {
+ git: { getTree: async ({ owner, tree_sha }) => ({ data: { tree: tree_sha.length === 40
+ ? [{ path: '.github', sha: 'github-tree' }, { path: '.asf.yaml', sha: 'policy' }]
+ : ['workflows', 'actions', 'scripts'].map(name => ({ path: name, sha: changed && owner === 'fork' ? 'changed-' + name : name })) } }) },
+ actions: { listWorkflowRuns: async ({ event }) => ({ data: { workflow_runs: event === 'push' ? [run()] : trusted
+ ? [{ ...run(), id: 2, head_sha: trustedSha, display_title: 'Trusted Fork CI #7', created_at: '2026-01-02T00:00:00Z' }] : [] } }) }
+ } };
+ github.paginate = async (endpoint, args) => runsOf(github, endpoint, args) ?? (args.run_id === 2 ? trustedJobs : forkJobs);
+ return github;
+}
+test('changed workflow definitions cannot self-attest a successful fork run', async () => {
+ const service = createService(serviceMock({ changed: true }));
+ assert.equal((await service.mirror(pr())).result.conclusion, 'action_required');
+});
+test('unchanged definitions and all caller jobs permit a normal fork success', async () => {
+ assert.equal((await createService(serviceMock()).mirror(pr())).result.conclusion, 'success');
+});
+test('only a trusted default-branch run for the exact PR and current base covers CI edits', async () => {
+ const result = await createService(serviceMock({ changed: true, trusted: true })).mirror(pr());
+ assert.equal(result.result.conclusion, 'success'); assert.equal(result.trusted, true);
+ assert.equal((await createService(serviceMock({ changed: true, trusted: true, trustedSha: C })).mirror(pr())).result.conclusion, 'action_required');
+});
+test('a trusted rerun failure overrides an earlier fork success', async () => {
+ const github = serviceMock({ trusted: true });
+ const list = github.rest.actions.listWorkflowRuns;
+ github.rest.actions.listWorkflowRuns = async args => {
+ const response = await list(args);
+ if (args.event === 'workflow_dispatch') response.data.workflow_runs[0].conclusion = 'failure';
+ return response;
+ };
+ assert.equal((await createService(github).mirror(pr())).result.conclusion, 'failure');
+});
+
+function context(repository, fork = false) {
+ const [owner, repo] = repository.split('/');
+ return { repo: { owner, repo }, eventName: 'push', ref: 'refs/heads/topic', sha: A,
+ payload: { repository: { fork, default_branch: 'main' } } };
+}
+const coreFor = output => ({ setOutput: (key, value) => output[key] = value, notice: () => {} });
+test('standalone repositories run their own commit without Apache sync', async () => {
+ const output = {};
+ await resolve({ context: context('copy/repo'), core: coreFor(output),
+ github: { rest: { repos: { get: async () => ({ data: { fork: false } }) } } } });
+ assert.equal(output.valid, 'true'); assert.equal(output.sync, 'false'); assert.equal(output['base-sha'], A);
+});
+test('fork pushes resolve the PR base once', async () => {
+ const output = {};
+ await resolve({ context: context('fork/repo', true), core: coreFor(output), github: {
+ rest: { pulls: { list() {} }, repos: { get: async () => ({ data: { fork: true, source: { full_name: 'apache/gravitino' } } }),
+ getBranch: async () => ({ data: { commit: { sha: B } } }) } }, paginate: async () => [pr()] } });
+ assert.equal(output['base-sha'], B); assert.equal(output['base-ref'], 'main'); assert.equal(output.sync, 'true');
+});
+test('pre-PR base discovery paginates branches, including later release branches', async () => {
+ const output = {}; let paginated = false;
+ const listBranches = () => {};
+ await resolve({ context: context('fork/repo', true), core: coreFor(output), github: {
+ rest: { pulls: { list() {} }, repos: { listBranches,
+ get: async args => ({ data: args.owner === 'fork' ? { fork: true, source: { full_name: 'apache/gravitino' } } : { default_branch: 'main' } }),
+ compareCommitsWithBasehead: async args => ({ data: { ahead_by: args.basehead.startsWith('branch-9.9...') ? 1 : 99 } }),
+ getBranch: async () => ({ data: { commit: { sha: B } } }) } },
+ paginate: async endpoint => { if (endpoint === listBranches) { paginated = true; return [{ name: 'branch-9.9' }]; } return []; }
+ } });
+ assert.equal(paginated, true); assert.equal(output['base-ref'], 'branch-9.9');
+});
+test('trusted dispatch rejects an arbitrary ref or a non-upstream repository', async () => {
+ const ctx = context('fork/repo');ctx.eventName = 'workflow_dispatch';ctx.payload.inputs = { 'pull-request': '7' };
+ await assert.rejects(resolve({ context: ctx, core: coreFor({}), github: {} }), /apache/);
+ const upstream = context('apache/gravitino');upstream.eventName = 'workflow_dispatch';upstream.payload.inputs = { 'pull-request': '7' };
+ await assert.rejects(resolve({ context: upstream, core: coreFor({}), github: { rest: { pulls: { get: async () => ({ data: pr() }) } } } }), /current default branch/);
+});
+
+test('allowlist scan rejects paths, symlinks, oversized files and truncated listings', () => {
+ const file = { path: 'workflows/build.yml', mode: '100644', type: 'blob', size: 10 };
+ assert.equal(yamlEntries({ tree: [file] }).length, 1);
+ for (const entry of [{ ...file, path: '../escape.yml' }, { ...file, mode: '120000' }, { ...file, size: 2000000 }]) {
+ assert.throws(() => yamlEntries({ tree: [entry] }));
+ }
+ assert.throws(() => yamlEntries({ tree: [file], truncated: true }));
+});
+test('allowlist downloads only immutable YAML data outside the trusted checkout', async () => {
+ const directory = await mkdtemp(path.join(os.tmpdir(), 'fork-ci-allowlist-test-'));
+ const output = {};
+ try {
+ const ctx = context('apache/gravitino');ctx.eventName = 'workflow_dispatch';ctx.payload.inputs = { 'pull-request': '7' };
+ await prepare({ context: ctx, core: coreFor(output), directory,
+ github: { rest: { pulls: { get: async () => ({ data: pr() }) }, git: { getTree: async args => ({ data: { tree: args.tree_sha === A
+ ? [{ path: '.github', type: 'tree', sha: 'github' }]
+ : [{ path: 'workflows/build.yml', mode: '100644', type: 'blob', size: 8 }, { path: 'scripts/danger.sh', type: 'blob' }] } }) } } },
+ fetchImpl: async url => { assert.ok(url.includes('/' + A + '/')); return { ok: true, body: [Buffer.from('on: push')] }; }
+ });
+ assert.equal(await readFile(path.join(directory, '.github/workflows/build.yml'), 'utf8'), 'on: push');
+ assert.equal(JSON.parse(output.prs)[0].sha, A);
+ await assert.rejects(readFile(path.join(directory, '.github/scripts/danger.sh')));
+ } finally { await rm(directory, { recursive: true, force: true }); }
+});
+
+test('a newer fork rerun failure is not hidden by an older trusted success', async () => {
+ const github = serviceMock({ trusted: true });
+ const list = github.rest.actions.listWorkflowRuns;
+ github.rest.actions.listWorkflowRuns = async args => {
+ const response = await list(args);
+ if (args.event === 'push') Object.assign(response.data.workflow_runs[0], { conclusion: 'failure', updated_at: '2026-01-03T00:00:00Z' });
+ return response;
+ };
+ assert.equal((await createService(github).mirror(pr())).result.conclusion, 'failure');
+});
+
+test('all reusable calls and checkout actions forward the frozen context', () => {
+ const fs = require('node:fs');
+ const directory = path.resolve(__dirname, '../../workflows');
+ const visited = new Set();
+ const fields = ['base-ref', 'base-sha', 'head-repository', 'head-sha', 'sync'];
+ function visit(name) {
+ if (visited.has(name)) return;
+ visited.add(name);
+ const source = fs.readFileSync(path.join(directory, name), 'utf8');
+ if (name !== 'fork-ci.yml') for (const field of fields) assert.ok(source.includes(` ${field}:`), `${name} accepts ${field}`);
+ const lines = source.split('\n');
+ for (let i = 0; i < lines.length; i++) {
+ const match = lines[i].match(/uses: \.\/\.github\/(workflows\/([^\s]+)|actions\/checkout-and-sync)/);
+ if (!match) continue;
+ const indent = lines[i].match(/^ */)[0].length;
+ let block = '';
+ if (match[2] && name === 'fork-ci.yml') {
+ block = lines.slice(Math.max(0, i - 7), i).join('\n');
+ } else {
+ for (let j = i + 1; j < lines.length && (!lines[j].trim() || lines[j].match(/^ */)[0].length >= indent); j++) {
+ if (lines[j].match(/^ */)[0].length === indent && lines[j].trim().startsWith('- ')) break;
+ block += lines[j] + '\n';
+ }
+ }
+ for (const field of fields) assert.ok(block.includes(`${field}: $` + '{{'), `${name} forwards ${field}`);
+ if (match[2]) visit(match[2]);
+ }
+ }
+ visit('fork-ci.yml');
+ assert.ok(visited.size > 20, 'nested matrix workflows are included');
+});
+
+test('immutable CI definition comparisons are cached by repository, head and base', async () => {
+ const github = serviceMock(); let calls = 0;
+ const get = github.rest.git.getTree;
+ github.rest.git.getTree = async args => { calls++; return get(args); };
+ const service = createService(github);
+ assert.equal(await service.unchanged(pr()), true);
+ assert.equal(calls, 4);
+ assert.equal(await service.unchanged(pr()), true);
+ assert.equal(calls, 4);
+ const changedBase = pr(); changedBase.base.sha = C;
+ await service.unchanged(changedBase);
+ assert.equal(calls, 6);
+ assert.equal(await createService(github).unchanged(pr()), true);
+ assert.equal(calls, 10);
+});
+
+const { update } = require('../update-fork-ci.cjs');
+function publisherMock({ current = pr(), latest, rerun = run(), failTrees = false } = {}) {
+ const github = serviceMock();
+ const writes = [];
+ const counters = { runs: 0 };
+ const listForRef = () => {};
+ const listPulls = () => {};
+ let reads = 0;
+ github.rest.pulls = { list: listPulls, get: async () => ({ data: ++reads === 1 ? pr() : current }) };
+ github.rest.repos = { getContent: async () => ({ data: {} }) };
+ github.rest.rateLimit = { get: async () => ({ data: { resources: { core: { remaining: 900, limit: 1000 } } } }) };
+ github.rest.checks = { listForRef,
+ create: async args => { writes.push({ create: args }); },
+ update: async args => { writes.push({ update: args }); } };
+ github.rest.actions.listWorkflowRuns = async args => {
+ counters.runs++;
+ return { data: { workflow_runs: args.event === 'push' ? [rerun] : [] } };
+ };
+ if (failTrees) github.rest.git.getTree = async () => { throw new Error('API unavailable'); };
+ github.paginate = async (endpoint, args) => runsOf(github, endpoint, args) ?? (endpoint === listPulls ? [pr()]
+ : endpoint === listForRef ? (latest ? [latest] : []) : jobs(pr()));
+ github.hook = { before() {} };
+ return { github, writes, counters };
+}
+async function withPublisher(fn) {
+ const directory = await mkdtemp(path.join(os.tmpdir(), 'fork-ci-publisher-test-'));
+ const stateFile = path.join(directory, 'state.json');
+ const ctx = context('apache/gravitino');ctx.eventName = 'workflow_dispatch';ctx.payload.inputs = { 'pull-request': '7' };
+ const failures = [];
+ const core = { info() {}, warning() {}, setFailed: message => failures.push(message) };
+ try { await fn({ ctx, stateFile, core, failures }); }
+ finally { await rm(directory, { recursive: true, force: true }); }
+}
+test('publisher binds the check to the exact base and current run attempt', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ const { github, writes } = publisherMock();
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes.length, 1);
+ const check = writes[0].create;
+ assert.equal(check.conclusion, 'success');assert.equal(check.head_sha, A);
+ assert.equal(JSON.parse(check.output.text).base_sha, B);
+ assert.equal(JSON.parse(check.output.text).run_attempt, 1);
+}));
+test('a push or retarget during publication cannot publish stale success', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ const changed = pr(); changed.base.sha = C;
+ const { github, writes } = publisherMock({ current: changed });
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes.length, 0);
+}));
+test('manual publication refreshes a cached final success and observes a failed rerun', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ const old = { id: 55, app: { slug: 'github-actions' }, status: 'completed', conclusion: 'success',
+ output: { text: JSON.stringify({ run_id: 1, run_attempt: 1, base_sha: B, base_ref: 'main' }) } };
+ const fs = require('node:fs/promises');
+ await fs.writeFile(stateFile, JSON.stringify({ cursor: 0, prs: { 7: { sha: A, base: B, base_ref: 'main',
+ updated_at: pr().updated_at, status: 'completed', checked_at: new Date().toISOString(), completed_at: new Date().toISOString() } } }));
+ const { github, writes, counters } = publisherMock({ latest: old, rerun: { ...run(), run_attempt: 2, conclusion: 'failure' } });
+ await update({ github, context: ctx, core, stateFile });
+ assert.ok(counters.runs > 0); assert.equal(writes[0].create.conclusion, 'failure');
+ assert.equal(JSON.parse(writes[0].create.output.text).run_attempt, 2);
+}));
+test('publisher failures remain observable and are retried instead of cached', async () => withPublisher(async ({ ctx, stateFile, core, failures }) => {
+ const { github, writes } = publisherMock({ failTrees: true });
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes.length, 0); assert.equal(failures.length, 1);
+ await assert.rejects(readFile(stateFile, 'utf8'), { code: 'ENOENT' });
+}));
+test('PR signals prioritize their head and bypass settled state', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ ctx.eventName = 'workflow_run';delete ctx.payload.inputs;
+ ctx.payload.workflow_run = { name: 'Fork CI PR Signal', head_sha: A, event: 'pull_request' };
+ const { github, writes } = publisherMock();
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes.length, 1);
+}));
+
+test('scheduled publication ignores poisoned cache state and recomputes definitions', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ ctx.eventName = 'schedule'; delete ctx.payload.inputs;
+ await require('node:fs/promises').writeFile(stateFile, JSON.stringify({ cursor: 0, prs: { 7: {
+ sha: A, base: B, base_ref: 'main', repository: 'fork/repo', definitions_equal: true,
+ updated_at: pr().updated_at, status: 'completed', checked_at: new Date().toISOString(), completed_at: new Date().toISOString()
+ } } }));
+ const { github, writes } = publisherMock();
+ github.rest.git = serviceMock({ changed: true }).rest.git;
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes[0].create.conclusion, 'action_required');
+ const workflow = await readFile(path.join(__dirname, '../../workflows/fork-ci-status-update.yml'), 'utf8');
+ assert.ok(!workflow.includes('actions/cache/'));
+}));
+
+test('partial reruns retain successful callers but use each job newest result', async () => {
+ const p = pr();
+ const github = serviceMock();
+ github.rest.actions.listWorkflowRuns = async ({ event }) => ({ data: {
+ workflow_runs: event === 'push' ? [{ ...run(), run_attempt: 2 }] : []
+ } });
+ let rerunConclusion = 'success';
+ github.paginate = async (endpoint, args) => {
+ const runs = runsOf(github, endpoint, args);
+ if (runs) return runs;
+ assert.equal(endpoint, 'GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs');
+ assert.equal(args.filter, 'all');
+ return [
+ ...jobs(p).map((job, i) => ({ ...job, id: i + 1, run_attempt: 1 })),
+ { name: requiredName(p), id: 100, run_attempt: 2, conclusion: 'success' },
+ { name: 'backend / changes', id: 101, run_attempt: 2, conclusion: rerunConclusion }
+ ].reverse();
+ };
+ assert.equal((await createService(github).mirror(p)).result.conclusion, 'success');
+ rerunConclusion = 'failure';
+ assert.equal((await createService(github).mirror(p)).result.conclusion, 'action_required');
+});
+
+test('allowlist signals find fork PRs by head branch', async () => {
+ const directory = await mkdtemp(path.join(os.tmpdir(), 'fork-ci-allowlist-test-'));
+ const output = {};
+ try {
+ const ctx = context('apache/gravitino');ctx.eventName = 'workflow_run';
+ ctx.payload.workflow_run = { head_sha: A, head_branch: 'topic', head_repository: { owner: { login: 'fork' } } };
+ const list = () => {};
+ let head;
+ await prepare({ context: ctx, core: coreFor(output), directory,
+ github: { paginate: async (endpoint, args) => { assert.equal(endpoint, list); head = args.head; return [pr(), { ...pr(), number: 8, head: { ...pr().head, sha: C } }]; },
+ rest: { pulls: { list }, git: { getTree: async args => ({ data: { tree: args.tree_sha === A
+ ? [{ path: '.github', type: 'tree', sha: 'github' }]
+ : [{ path: 'workflows/build.yml', mode: '100644', type: 'blob', size: 8 }] } }) } } },
+ fetchImpl: async () => ({ ok: true, body: [Buffer.from('on: push')] })
+ });
+ assert.equal(head, 'fork:topic');
+ assert.deepEqual(JSON.parse(output.prs), [{ number: 7, sha: A }]);
+ } finally { await rm(directory, { recursive: true, force: true }); }
+});
+
+test('a run against a newer commit of the PR base branch is accepted', async () => {
+ for (const [status, conclusion] of [['ahead', 'success'], ['identical', 'success'], ['diverged', 'action_required']]) {
+ const tested = pr(); tested.base.sha = C;
+ const github = serviceMock({ forkJobs: jobs(tested) });
+ let basehead;
+ github.rest.repos = { compareCommitsWithBasehead: async args => { basehead = args.basehead; return { data: { status } }; } };
+ const mirror = await createService(github).mirror(pr());
+ assert.equal(mirror.result.conclusion, conclusion);
+ assert.equal(basehead, `${C}...main`);
+ assert.equal(mirror.base, conclusion === 'success' ? C : B);
+ }
+});
+
+test('scheduled sweeps probe recently updated PRs first and refresh only running or rerun checks', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ ctx.eventName = 'schedule'; delete ctx.payload.inputs;
+ const { github, writes } = publisherMock();
+ const recent = new Date().toISOString();
+ const old = Array.from({ length: 20 }, (_, i) => ({ ...pr(), number: 100 + i,
+ head: { ...pr().head, sha: (100 + i).toString(16).padStart(40, 'd') } }));
+ const settled = { ...pr(), number: 8, updated_at: recent, head: { ...pr().head, sha: 'e'.repeat(40) } };
+ const failed = { ...pr(), updated_at: recent };
+ const all = [...old, settled, failed];
+ const listPulls = github.rest.pulls.list;
+ const listForRef = github.rest.checks.listForRef;
+ const paginate = github.paginate;
+ // Any completed result, not only success, is final until the fork run id or attempt changes.
+ const check = completed => ({ id: 1, app: { slug: 'github-actions' }, status: completed ? 'completed' : 'in_progress',
+ conclusion: completed ? 'cancelled' : null, output: { text: JSON.stringify({ run_id: 1, run_attempt: 1 }) } });
+ github.paginate = async (endpoint, args) => endpoint === listPulls ? all
+ : endpoint === listForRef ? [check(args.ref === settled.head.sha)] : paginate(endpoint, args);
+ github.rest.pulls.get = async ({ pull_number }) => ({ data: all.find(p => p.number === pull_number) });
+ const runsFor = [];
+ const list = github.rest.actions.listWorkflowRuns;
+ github.rest.actions.listWorkflowRuns = async args => {
+ runsFor.push(args.head_sha);
+ const response = await list(args);
+ response.data.workflow_runs = response.data.workflow_runs.map(run => ({ ...run, head_sha: args.head_sha }));
+ return response;
+ };
+ await update({ github, context: ctx, core, stateFile });
+ // The settled check is probed for its fork run once, which is unchanged, so it is not refreshed.
+ const written = writes.map(write => write.create || write.update);
+ assert.equal(runsFor.filter(sha => sha === settled.head.sha).length, 1);
+ assert.equal(written[0].conclusion, 'success');
+ assert.match(written[0].output.summary, /^\[See fork CI results\]\(https:\/\/github\.com\/fork\/repo\/actions\/runs\/1\)/);
+}));
+
+test('a failed fork run is not summarized as verified', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ const { github, writes } = publisherMock({ rerun: { ...run(), conclusion: 'failure' } });
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes[0].create.conclusion, 'failure');
+ assert.doesNotMatch(writes[0].create.output.summary, /Verified/);
+}));
+
+test('PR signals do not share a concurrency group', async () => {
+ const workflow = await readFile(path.join(__dirname, '../../workflows/fork-ci-status-update.yml'), 'utf8');
+ assert.match(workflow, /github\.event\.workflow_run\.head_sha \|\| 'sweep'/);
+});
+
+test('scheduled sweeps refresh a settled check when its fork run is rerun', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ ctx.eventName = 'schedule'; delete ctx.payload.inputs;
+ const green = { id: 55, app: { slug: 'github-actions' }, status: 'completed', conclusion: 'success',
+ output: { text: JSON.stringify({ owner: 'fork', repo: 'repo', run_id: 1, run_attempt: 1, fork_run_id: 1, fork_run_attempt: 1 }) } };
+ const recent = { ...pr(), updated_at: new Date().toISOString() };
+ const { github, writes } = publisherMock({ latest: green, rerun: { ...run(), run_attempt: 2, conclusion: 'failure' } });
+ const listPulls = github.rest.pulls.list, paginate = github.paginate;
+ github.paginate = async (endpoint, args) => endpoint === listPulls ? [recent] : paginate(endpoint, args);
+ github.rest.pulls.get = async () => ({ data: recent });
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes.length, 1);
+ assert.equal(writes[0].create.conclusion, 'failure');
+ assert.equal(JSON.parse(writes[0].create.output.text).fork_run_attempt, 2);
+}));
+
+test('a publisher that observed an older attempt does not overwrite a newer result', async () => withPublisher(async ({ ctx, stateFile, core }) => {
+ for (const [latest, observed] of [
+ [{ status: 'completed', conclusion: 'failure', attempt: 2 }, { conclusion: 'success', run_attempt: 1 }],
+ [{ status: 'completed', conclusion: 'success', attempt: 1 }, { status: 'in_progress', conclusion: null, run_attempt: 1 }]]) {
+ const check = { id: 55, app: { slug: 'github-actions' }, status: latest.status, conclusion: latest.conclusion,
+ output: { text: JSON.stringify({ owner: 'fork', repo: 'repo', run_id: 1, run_attempt: latest.attempt }) } };
+ const { github, writes } = publisherMock({ latest: check, rerun: { ...run(), ...observed } });
+ await update({ github, context: ctx, core, stateFile });
+ assert.equal(writes.length, 0);
+ }
+}));
+
+test('fork runs are paginated so an older run cannot win', async () => {
+ const github = serviceMock();
+ let paginated = false;
+ const paginate = github.paginate;
+ github.paginate = async (endpoint, args) => {
+ if (endpoint === github.rest.actions.listWorkflowRuns) {
+ paginated = true;
+ return [{ ...run(), id: 1, conclusion: 'success' }, { ...run(), id: 9, conclusion: 'failure' }];
+ }
+ return paginate(endpoint, args);
+ };
+ const found = await createService(github).findRun(pr(), false);
+ assert.ok(paginated); assert.equal(found.run.id, 9);
+});
+
+test('checkout-and-sync does not persist credentials by default', async () => {
+ const action = await readFile(path.join(__dirname, '../../actions/checkout-and-sync/action.yml'), 'utf8');
+ assert.match(action, /persist-credentials:\n(?:\s+.*\n)*?\s+default: 'false'/);
+});
diff --git a/.github/scripts/update-fork-ci.cjs b/.github/scripts/update-fork-ci.cjs
new file mode 100644
index 0000000000..d993e01f35
--- /dev/null
+++ b/.github/scripts/update-fork-ci.cjs
@@ -0,0 +1,149 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+const { createService } = require('./fork-ci-status.cjs');
+
+const RECENT_MS = 6 * 60 * 60 * 1000;
+
+async function update({ github, context, core }) {
+ const signal = context.eventName === 'workflow_run' && context.payload.workflow_run.name === 'Fork CI PR Signal';
+ const trustedSignal = context.eventName === 'workflow_run' &&
+ context.payload.workflow_run.event === 'workflow_dispatch' &&
+ /^Trusted Fork CI #([1-9][0-9]*)$/.exec(context.payload.workflow_run.display_title || '');
+ const manual = context.eventName === 'workflow_dispatch' || !!trustedSignal || signal;
+ const requested = context.payload.inputs?.['pull-request'] || (trustedSignal && trustedSignal[1]);
+ if (requested && !/^[1-9][0-9]*$/.test(requested)) throw new Error('Invalid PR number.');
+ let prs = requested
+ ? [(await github.rest.pulls.get({ ...context.repo, pull_number: Number(requested) })).data]
+ : await github.paginate(github.rest.pulls.list, { ...context.repo, state: 'open', per_page: 100 });
+ if (signal) prs = prs.filter(pr => pr.head.sha === context.payload.workflow_run.head_sha);
+ const now = Date.now();
+ // Never restore decisions or scheduling state from Actions caches: PR code dispatched
+ // on the default branch can write those caches using its runner runtime token.
+ const service = createService(github);
+ const availableBases = new Map();
+ const rate = (await github.rest.rateLimit.get()).data.resources.core;
+ // Bound work even while settled successes are watched. Rotate the starting PR to avoid starving
+ // older PRs, and leave quota for signal workflows and other repository automation.
+ const budget = manual ? Math.max(0, rate.remaining - 100) : Math.min(60, Math.max(0, rate.remaining - 100));
+ let calls = 0;
+ github.hook.before('request', () => { calls++; });
+ const failures = [];
+ const recordOf = check => { try { return JSON.parse(check?.output?.text || '{}'); } catch { return {}; } };
+ async function latestCheck(pr) {
+ const checks = await github.paginate(github.rest.checks.listForRef, {
+ ...context.repo, ref: pr.head.sha, check_name: 'Fork CI', per_page: 100, filter: 'all'
+ });
+ return checks.filter(check => check.app?.slug === 'github-actions').sort((a, b) => b.id - a.id)[0];
+ }
+ async function refresh(pr) {
+ // Release branches without this CI migration keep their own pull_request workflows.
+ if (!availableBases.has(pr.base.sha)) {
+ availableBases.set(pr.base.sha, github.rest.repos.getContent({ ...context.repo,
+ path: '.github/workflows/fork-ci.yml', ref: pr.base.sha }).then(() => true, error => {
+ if (error.status === 404) return false;
+ throw error;
+ }));
+ }
+ if (!(await availableBases.get(pr.base.sha))) return;
+ const mirror = await service.mirror(pr);
+ const { result, run } = mirror;
+ const note = result.note || (result.status !== 'completed' ? 'Waiting for the fork run.'
+ : result.conclusion === 'success' ? 'Verified all caller suites.' : 'Open the run to see which jobs did not succeed.');
+ const testedBase = mirror.base && mirror.base !== pr.base.sha ? `\nTested base: ${mirror.base}` : '';
+ const record = { owner: mirror.owner, repo: mirror.repo, run_id: run?.id,
+ run_attempt: run?.run_attempt, base_ref: pr.base.ref, base_sha: pr.base.sha, trusted: mirror.trusted || false,
+ fork_run_id: mirror.fork?.id, fork_run_attempt: mirror.fork?.run_attempt };
+ const details = run ? `https://github.com/${mirror.owner}/${mirror.repo}/actions/runs/${run.id}` : pr.html_url;
+ const output = { title: result.title,
+ // GitHub ignores details_url for checks created with GITHUB_TOKEN, so link the run here.
+ summary: (run ? `[See fork CI results](${details})\n\n` : '') + note +
+ `\n\nBase: ${pr.base.ref} @ ${pr.base.sha}${testedBase}`,
+ text: JSON.stringify(record) };
+ // Re-read before publishing so a push or retarget during the API calls cannot get a stale success.
+ const { data: current } = await github.rest.pulls.get({ ...context.repo, pull_number: pr.number });
+ if (current.head.sha !== pr.head.sha || current.base.sha !== pr.base.sha || current.base.ref !== pr.base.ref || current.state !== 'open') return;
+ const params = { ...context.repo, ...result, output, details_url: details };
+ delete params.title;
+ delete params.note;
+ // Signals and sweeps can publish concurrently. Read the check last and never replace a newer
+ // attempt of a run from the same repository, or a completed result with a running one.
+ const latest = await latestCheck(pr);
+ const oldRecord = recordOf(latest);
+ if (oldRecord.owner === record.owner && oldRecord.repo === record.repo && record.run_id &&
+ (oldRecord.run_id > record.run_id || (oldRecord.run_id === record.run_id &&
+ (oldRecord.run_attempt > record.run_attempt ||
+ (oldRecord.run_attempt === record.run_attempt && latest.status === 'completed' && result.status !== 'completed'))))) return;
+ const sameRun = oldRecord.run_id === record.run_id && oldRecord.run_attempt === record.run_attempt && oldRecord.base_sha === record.base_sha && oldRecord.base_ref === record.base_ref;
+ if (!latest || (latest.status === 'completed' && (!sameRun || result.status !== 'completed'))) {
+ await github.rest.checks.create({ ...params, name: 'Fork CI', head_sha: pr.head.sha });
+ } else if (!sameRun || latest.status !== result.status || latest.conclusion !== (result.conclusion || null) || latest.output?.summary !== output.summary || latest.output?.text !== output.text) {
+ await github.rest.checks.update({ ...params, check_run_id: latest.id });
+ }
+ }
+ async function visit(pr, work) {
+ processed++;
+ visited.add(pr.number);
+ if (pr.state !== 'open') return;
+ try {
+ await work();
+ } catch (error) {
+ failures.push(pr.number);
+ core.warning(`Could not refresh #${pr.number}: ${error.message}`);
+ }
+ }
+ let processed = 0;
+ const visited = new Set();
+ // Fork runs, including reruns, finish without an upstream event. Such PRs were updated recently,
+ // so probe those first. A completed result changes only with a push or a trusted run, which both
+ // signal a refresh, or with a fork rerun, so refresh it only when the fork run id or attempt changed.
+ const recent = manual ? [] : prs.filter(pr => now - Date.parse(pr.updated_at) < RECENT_MS)
+ .sort((a, b) => Date.parse(b.updated_at) - Date.parse(a.updated_at));
+ // Probes take two calls, so rotate them too and keep a third of the budget for older PRs.
+ const recentBudget = Math.floor(budget * 2 / 3);
+ const recentStart = !recent.length ? 0 : (Math.floor(now / 300000) * Math.max(1, Math.floor(recentBudget / 4))) % recent.length;
+ let probed = 0;
+ for (let offset = 0; offset < recent.length; offset++) {
+ if (calls + 15 > recentBudget) break; // One PR may need trees, runs, paginated jobs and a check write.
+ const pr = recent[(recentStart + offset) % recent.length];
+ probed++;
+ await visit(pr, async () => {
+ const latest = await latestCheck(pr);
+ if (latest?.status === 'completed') {
+ if (!pr.head.repo) return;
+ const record = recordOf(latest);
+ const fork = (await service.findRun(pr, false))?.run;
+ if (!fork || (fork.id === (record.fork_run_id ?? record.run_id) &&
+ fork.run_attempt === (record.fork_run_attempt ?? record.run_attempt))) return;
+ }
+ await refresh(pr);
+ });
+ }
+ // Rotate the rest using trusted wall-clock time, so old PRs are eventually visited without
+ // accepting a contributor-writable cursor. Advance by about one sweep's capacity.
+ const step = Math.max(1, Math.floor(budget / 20));
+ const start = manual || !prs.length ? 0 : (Math.floor(now / 300000) * step) % prs.length;
+ for (let offset = 0; offset < prs.length; offset++) {
+ if (calls + 15 > budget) break;
+ const pr = prs[(start + offset) % prs.length];
+ if (visited.has(pr.number)) continue;
+ await visit(pr, () => refresh(pr));
+ }
+ core.info(`Visited ${processed}/${prs.length} PRs (probed ${probed}/${recent.length} recently updated); ` +
+ `${calls}/${budget} API calls; starting index ${start}.`);
+ if (manual && processed < prs.length) core.setFailed('API budget exhausted; dispatch again for a specific PR after the quota resets.');
+ if (failures.length) core.setFailed(`Unable to refresh: ${failures.map(n => `#${n}`).join(', ')}`);
+}
+module.exports = { update };
diff --git a/.github/workflows/access-control-integration-test-action.yml b/.github/workflows/access-control-integration-test-action.yml
index 9b30e26773..6ece98580f 100644
--- a/.github/workflows/access-control-integration-test-action.yml
+++ b/.github/workflows/access-control-integration-test-action.yml
@@ -3,6 +3,26 @@ name: Access Control Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -21,6 +41,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/access-control-integration-test.yml b/.github/workflows/access-control-integration-test.yml
index c77633a557..3a92262d57 100644
--- a/.github/workflows/access-control-integration-test.yml
+++ b/.github/workflows/access-control-integration-test.yml
@@ -2,14 +2,32 @@ name: Access Control Integration Test
# Controls when the workflow will run
on:
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
# Triggers the workflow on push or pull request events but only for the "main" branch
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-access-control-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -17,11 +35,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -58,5 +88,10 @@ jobs:
java-version: [ 17 ]
uses: ./.github/workflows/access-control-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/asf-allowlist-check.yml b/.github/workflows/asf-allowlist-check.yml
index 58156855f0..84946d8d6f 100644
--- a/.github/workflows/asf-allowlist-check.yml
+++ b/.github/workflows/asf-allowlist-check.yml
@@ -20,15 +20,29 @@
name: "ASF Allowlist Check"
on:
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
workflow_dispatch:
- pull_request:
- paths:
- - ".github/**"
- push:
- branches:
- - main
- paths:
- - ".github/**"
permissions:
contents: read
@@ -40,6 +54,14 @@ jobs:
- uses: actions/checkout@v4
with:
persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ persist-credentials: false
- uses: apache/infrastructure-actions/allowlist-check@main
with:
scan-glob: ".github/**/*.y*ml"
diff --git a/.github/workflows/asf-allowlist-trusted.yml b/.github/workflows/asf-allowlist-trusted.yml
new file mode 100644
index 0000000000..950eaed107
--- /dev/null
+++ b/.github/workflows/asf-allowlist-trusted.yml
@@ -0,0 +1,65 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.
+#
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: Trusted ASF Allowlist
+on:
+ workflow_run:
+ workflows: [Fork CI PR Signal]
+ types: [completed]
+ workflow_dispatch:
+ inputs:
+ pull-request:
+ description: 'Pull request whose YAML files should be scanned'
+ required: true
+ type: string
+permissions: {}
+jobs:
+ scan:
+ name: Scan PR workflow files
+ if: >-
+ github.repository == 'apache/gravitino' &&
+ (github.event_name == 'workflow_dispatch' || github.event.workflow_run.event == 'pull_request')
+ runs-on: ubuntu-latest
+ timeout-minutes: 10
+ permissions:
+ contents: read
+ pull-requests: read
+ checks: write
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.repository.default_branch }}
+ persist-credentials: false
+ - uses: actions/github-script@v7
+ id: data
+ with:
+ script: |
+ await require('./.github/scripts/allowlist-pr.cjs').prepare({ github, context, core });
+ - uses: apache/infrastructure-actions/allowlist-check@main
+ id: scan
+ if: steps.data.outputs.prs != '[]'
+ continue-on-error: true
+ with:
+ scan-glob: ${{ steps.data.outputs.scan-glob }}
+ - uses: actions/github-script@v7
+ if: always() && steps.data.outputs.prs != ''
+ env:
+ SCANNED_PRS: ${{ steps.data.outputs.prs }}
+ SCAN_OUTCOME: ${{ steps.scan.outcome }}
+ with:
+ script: |
+ await require('./.github/scripts/allowlist-pr.cjs').publish({ github, context, core });
diff --git a/.github/workflows/auto-cherry-pick.yml b/.github/workflows/auto-cherry-pick.yml
index 43093ae961..9b571f97c8 100644
--- a/.github/workflows/auto-cherry-pick.yml
+++ b/.github/workflows/auto-cherry-pick.yml
@@ -7,6 +7,9 @@ on:
jobs:
detect-cherry-pick-labels:
+ # Contributor forks run workflows for Fork CI; cherry-picks only apply to the
+ # repository the pull requests were merged into.
+ if: ${{ !github.event.repository.fork }}
runs-on: ubuntu-latest
name: Detect cherry-pick labels from merged PR
outputs:
diff --git a/.github/workflows/backend-integration-test-action.yml b/.github/workflows/backend-integration-test-action.yml
index d5cf1bd57e..02dfc374b0 100644
--- a/.github/workflows/backend-integration-test-action.yml
+++ b/.github/workflows/backend-integration-test-action.yml
@@ -4,6 +4,26 @@ name: Backend Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -25,11 +45,20 @@ jobs:
start-runner:
name: JDK${{ inputs.java-version }}-${{ inputs.test-mode }}-${{ inputs.backend }}
runs-on: ubuntu-22.04
- timeout-minutes: 120
+ timeout-minutes: 180
env:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/backend-integration-test.yml b/.github/workflows/backend-integration-test.yml
index 5e4f45aa83..67b917cb32 100644
--- a/.github/workflows/backend-integration-test.yml
+++ b/.github/workflows/backend-integration-test.yml
@@ -2,13 +2,31 @@ name: Backend Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-backend-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -17,12 +35,23 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
+ persist-credentials: false
fetch-depth: 0
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -53,9 +82,9 @@ jobs:
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}
- BackendIT-on-push:
+ BackendIT:
needs: changes
- if: (github.event_name == 'push' && needs.changes.outputs.source_changes == 'true')
+ if: needs.changes.outputs.source_changes == 'true'
strategy:
matrix:
architecture: [linux/amd64]
@@ -71,29 +100,11 @@ jobs:
backend: 'h2'
uses: ./.github/workflows/backend-integration-test-action.yml
with:
- architecture: ${{ matrix.architecture }}
- java-version: ${{ matrix.java-version }}
- backend: ${{ matrix.backend }}
- test-mode: ${{ matrix.test-mode }}
-
- BackendIT-on-pr:
- needs: changes
- if: (github.event_name == 'pull_request' && needs.changes.outputs.source_changes == 'true')
- strategy:
- matrix:
- architecture: [ linux/amd64 ]
- java-version: [ 17 ]
- backend: [ h2, mysql, postgresql ]
- test-mode: [ embedded, deploy ]
- exclude:
- - test-mode: 'embedded'
- backend: 'mysql'
- - test-mode: 'embedded'
- backend: 'postgresql'
- - test-mode: 'deploy'
- backend: 'h2'
- uses: ./.github/workflows/backend-integration-test-action.yml
- with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
backend: ${{ matrix.backend }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 98dd113bb7..8414697266 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -2,20 +2,31 @@ name: build
# Controls when the workflow will run
on:
- # Triggers the workflow on push or pull request events but only for the "main" branch
- push:
- branches: [ "main", "branch-*" ]
- paths-ignore:
- - 'docs/assets/**'
- - 'web-v2/**'
- pull_request:
- branches: [ "main", "branch-*" ]
- paths-ignore:
- - 'docs/assets/**'
- - 'web-v2/**'
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-build-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
@@ -24,13 +35,27 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Test source license-reference checker
run: bash dev/release/test-check-license.sh
+ - name: Test Fork CI contracts
+ run: node --test .github/scripts/tests/*.test.cjs
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
list-files: shell
filters: |
source_changes:
@@ -105,6 +130,15 @@ jobs:
if: needs.changes.outputs.source_changes != 'true'
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: ./.github/actions/setup-java-toolchains
with:
@@ -122,6 +156,15 @@ jobs:
if: needs.changes.outputs.spark_connector_changes == 'true'
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
@@ -152,13 +195,23 @@ jobs:
strategy:
matrix:
java-version: [ 17 ]
- timeout-minutes: 120
+ timeout-minutes: 180
needs: changes
if: needs.changes.outputs.source_changes == 'true'
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: build-checkout
- uses: ./.github/actions/setup-java-toolchains
with:
@@ -226,7 +279,7 @@ jobs:
./gradlew "${gradle_args[@]}"
- name: Upload coverage data
- if: github.event_name == 'pull_request'
+ if: steps.build-checkout.outputs.pull-request == 'true'
uses: actions/upload-artifact@v7
with:
name: jacoco-build
@@ -279,6 +332,15 @@ jobs:
needs.changes.outputs.maintenance_module_only_changes != 'true'
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: ./.github/actions/setup-java-toolchains
with:
@@ -330,36 +392,53 @@ jobs:
needs: [ changes, build, core-test ]
if: >-
always() &&
- github.event_name == 'pull_request' &&
needs.build.result == 'success' &&
(needs.changes.outputs.maintenance_module_only_changes == 'true' ||
needs['core-test'].result == 'success')
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: coverage-checkout
- uses: ./.github/actions/setup-java-toolchains
- if: needs.changes.outputs.maintenance_module_only_changes != 'true'
+ if: >-
+ steps.coverage-checkout.outputs.pull-request == 'true' &&
+ needs.changes.outputs.maintenance_module_only_changes != 'true'
with:
java-version: 17
- name: Fetch base branch for coverage diff
- run: git fetch origin ${{ github.base_ref }} --depth=1
+ if: steps.coverage-checkout.outputs.pull-request == 'true'
+ run: git fetch origin ${{ steps.coverage-checkout.outputs.base-ref }} --depth=1
- name: Download coverage data
+ if: steps.coverage-checkout.outputs.pull-request == 'true'
uses: actions/download-artifact@v4
with:
pattern: jacoco-*
merge-multiple: true
- name: Download core test evidence
- if: needs.changes.outputs.maintenance_module_only_changes != 'true'
+ if: >-
+ steps.coverage-checkout.outputs.pull-request == 'true' &&
+ needs.changes.outputs.maintenance_module_only_changes != 'true'
uses: actions/download-artifact@v4
with:
pattern: core-*-test-evidence
path: core-test-evidence
- name: Generate combined core coverage
- if: needs.changes.outputs.maintenance_module_only_changes != 'true'
+ if: >-
+ steps.coverage-checkout.outputs.pull-request == 'true' &&
+ needs.changes.outputs.maintenance_module_only_changes != 'true'
run: |
mkdir -p core/build/jacoco
for task in coreUnitTest coreH2Test coreMySQLTest corePostgreSQLTest; do
@@ -375,21 +454,23 @@ jobs:
- name: Generate Coverage Report
id: coverage
+ if: steps.coverage-checkout.outputs.pull-request == 'true'
run: |
python3 dev/ci/jacoco_report.py \
- --base-ref "${{ github.base_ref }}" \
- --head-sha "${{ github.event.pull_request.head.sha }}" \
- --repo-url "${{ github.event.pull_request.head.repo.html_url }}" \
+ --base-ref "${{ steps.coverage-checkout.outputs.base-ref }}" \
+ --head-sha "${{ github.event.pull_request.head.sha || github.sha }}" \
+ --repo-url "${{ github.event.pull_request.head.repo.html_url || format('{0}/{1}', github.server_url, github.repository) }}" \
--min-overall 40 \
--min-changed 60 \
--output coverage-report.md
+ # coverage-comment.yml posts the report for pull_request runs in this repository.
- name: Save PR number
- if: steps.coverage.outputs.has_reports == 'true'
+ if: github.event_name == 'pull_request' && steps.coverage.outputs.has_reports == 'true'
run: echo "${{ github.event.pull_request.number }}" > pr-number.txt
- name: Upload Coverage Report
- if: steps.coverage.outputs.has_reports == 'true'
+ if: steps.coverage-checkout.outputs.pull-request == 'true' && steps.coverage.outputs.has_reports == 'true'
uses: actions/upload-artifact@v7
with:
name: coverage-report
@@ -398,7 +479,7 @@ jobs:
pr-number.txt
- name: Output Coverage Info
- if: steps.coverage.outputs.has_reports == 'true'
+ if: steps.coverage-checkout.outputs.pull-request == 'true' && steps.coverage.outputs.has_reports == 'true'
run: |
echo "Total coverage ${{ steps.coverage.outputs.coverage-overall }}"
echo "Changed Files coverage ${{ steps.coverage.outputs.coverage-changed-files }}"
diff --git a/.github/workflows/chart-test.yaml b/.github/workflows/chart-test.yaml
index 697b5b7c15..6e31278202 100644
--- a/.github/workflows/chart-test.yaml
+++ b/.github/workflows/chart-test.yaml
@@ -2,11 +2,31 @@ name: Test Charts
# Controls when the workflow will run
on:
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-charts-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -14,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/workflows/**
@@ -33,7 +65,16 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
+ persist-credentials: false
fetch-depth: 0
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Set up Helm
uses: azure/setup-helm@9bc31f4ebc9c6b171d7bfbaa5d006ae7abdb4310
@@ -92,7 +133,7 @@ jobs:
- name: List changed
id: list-changed
run: |
- changed=$(ct list-changed --chart-dirs=dev/charts --target-branch ${{ github.event.pull_request.base.ref }})
+ changed=$(ct list-changed --chart-dirs=dev/charts --target-branch ${{ steps.checkout.outputs.base-ref }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
@@ -101,7 +142,7 @@ jobs:
if: steps.list-changed.outputs.changed == 'true'
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
- ct lint --chart-dirs=dev/charts --chart-yaml-schema=dev/ci/chart_schema.yaml --lint-conf=dev/ci/lintconf.yaml --target-branch ${{ github.event.pull_request.base.ref }} --check-version-increment=false
+ ct lint --chart-dirs=dev/charts --chart-yaml-schema=dev/ci/chart_schema.yaml --lint-conf=dev/ci/lintconf.yaml --target-branch ${{ steps.checkout.outputs.base-ref }} --check-version-increment=false
- name: Set up helm-unittest
if: steps.list-changed.outputs.changed == 'true'
@@ -172,19 +213,19 @@ jobs:
- name: Run chart-testing (install default,gravitino)
if: steps.list-changed.outputs.changed == 'true'
- run: ct install --charts dev/charts/gravitino --target-branch ${{ github.event.pull_request.base.ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino"
+ run: ct install --charts dev/charts/gravitino --target-branch ${{ steps.checkout.outputs.base-ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino"
- name: Run chart-testing (install default,gravitino-iceberg-rest-server)
if: steps.list-changed.outputs.changed == 'true'
- run: ct install --charts dev/charts/gravitino-iceberg-rest-server --target-branch ${{ github.event.pull_request.base.ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino-iceberg-rest"
+ run: ct install --charts dev/charts/gravitino-iceberg-rest-server --target-branch ${{ steps.checkout.outputs.base-ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino-iceberg-rest"
- name: Run chart-testing (install gravitino with mysql enable,replicas 2)
if: steps.list-changed.outputs.changed == 'true'
- run: ct install --charts=dev/charts/gravitino --helm-extra-set-args "--values dev/charts/gravitino/resources/scenarios/ci-values.yaml --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino" --target-branch ${{ github.event.pull_request.base.ref }}
+ run: ct install --charts=dev/charts/gravitino --helm-extra-set-args "--values dev/charts/gravitino/resources/scenarios/ci-values.yaml --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino" --target-branch ${{ steps.checkout.outputs.base-ref }}
- name: Run chart-testing (install gravitino with postgresql enable)
if: steps.list-changed.outputs.changed == 'true'
- run: ct install --charts=dev/charts/gravitino --helm-extra-set-args "--values dev/charts/gravitino/resources/scenarios/pg-values.yaml --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino" --target-branch ${{ github.event.pull_request.base.ref }}
+ run: ct install --charts=dev/charts/gravitino --helm-extra-set-args "--values dev/charts/gravitino/resources/scenarios/pg-values.yaml --set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino" --target-branch ${{ steps.checkout.outputs.base-ref }}
- name: Run chart-testing (install default,gravitino-lance-rest-server)
if: steps.list-changed.outputs.changed == 'true'
@@ -196,4 +237,4 @@ jobs:
-H "Accept: application/vnd.gravitino.v1+json" \
-d '{"name":"lrs_test","comment":"Quick setup"}' \
http://gravitino.test:8090/api/metalakes
- ct install --charts dev/charts/gravitino-lance-rest-server --target-branch ${{ github.event.pull_request.base.ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino-lance-rest --set lanceRest.gravitinoUri=http://gravitino.test:8090 --set lanceRest.gravitinoMetalake=lrs_test"
+ ct install --charts dev/charts/gravitino-lance-rest-server --target-branch ${{ steps.checkout.outputs.base-ref }} --helm-extra-set-args "--set image.registry="" --set image.repository=${KIND_REGISTRY}/gravitino-lance-rest --set lanceRest.gravitinoUri=http://gravitino.test:8090 --set lanceRest.gravitinoMetalake=lrs_test"
diff --git a/.github/workflows/contrib-catalog-test.yml b/.github/workflows/contrib-catalog-test.yml
index f2fe60a26c..c3586948ad 100644
--- a/.github/workflows/contrib-catalog-test.yml
+++ b/.github/workflows/contrib-catalog-test.yml
@@ -1,14 +1,32 @@
name: Contrib Catalog Test
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
workflow_dispatch:
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-contrib-catalog-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -17,12 +35,23 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
+ persist-credentials: false
fetch-depth: 0
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/workflows/contrib-catalog-test.yml
@@ -39,7 +68,10 @@ jobs:
- name: Detect changed catalogs-contrib modules
id: contrib
run: |
- if [ "${{ github.event_name }}" = "pull_request" ]; then
+ if [ "${{ steps.checkout.outputs.synced }}" = "true" ]; then
+ BASE_SHA="${{ steps.checkout.outputs.base-sha }}"
+ HEAD_SHA="$(git rev-parse HEAD)"
+ elif [ "${{ github.event_name }}" = "pull_request" ]; then
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
else
@@ -75,6 +107,15 @@ jobs:
timeout-minutes: 90
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/cron-integration-test.yml b/.github/workflows/cron-integration-test.yml
index 654244770b..f5f81e66c7 100644
--- a/.github/workflows/cron-integration-test.yml
+++ b/.github/workflows/cron-integration-test.yml
@@ -52,7 +52,8 @@ concurrency:
jobs:
select-suites:
name: Select suites
- if: github.event_name != 'schedule' || github.repository == 'apache/gravitino'
+ # Other copies of the repository set ENABLE_SCHEDULED_TESTS to run it on schedule.
+ if: github.event_name != 'schedule' || github.repository == 'apache/gravitino' || vars.ENABLE_SCHEDULED_TESTS == 'true'
runs-on: ubuntu-latest
outputs:
backend: ${{ steps.parse.outputs.backend }}
@@ -241,7 +242,8 @@ jobs:
- trino-multi-version
- lance
- multi-instance
- if: always()
+ # Scheduled runs are skipped outside the upstream repository; do not report them as failures.
+ if: always() && (github.event_name != 'schedule' || github.repository == 'apache/gravitino' || vars.ENABLE_SCHEDULED_TESTS == 'true')
runs-on: ubuntu-latest
steps:
- name: Write summary
diff --git a/.github/workflows/flink-integration-test-action.yml b/.github/workflows/flink-integration-test-action.yml
index db792b457c..22ce998495 100644
--- a/.github/workflows/flink-integration-test-action.yml
+++ b/.github/workflows/flink-integration-test-action.yml
@@ -4,6 +4,26 @@ name: Flink Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -22,6 +42,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/flink-integration-test.yml b/.github/workflows/flink-integration-test.yml
index 42d3985550..6bf6963e99 100644
--- a/.github/workflows/flink-integration-test.yml
+++ b/.github/workflows/flink-integration-test.yml
@@ -2,13 +2,31 @@ name: Flink Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-flink-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -49,26 +79,19 @@ jobs:
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}
- FlinkIT-on-push:
+ FlinkIT:
needs: changes
- if: (github.event_name == 'push' && needs.changes.outputs.source_changes == 'true')
+ if: needs.changes.outputs.source_changes == 'true'
strategy:
matrix:
architecture: [linux/amd64]
java-version: [ 17 ]
uses: ./.github/workflows/flink-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
-
- FlinkIT-on-pr:
- needs: changes
- if: (github.event_name == 'pull_request' && needs.changes.outputs.source_changes == 'true')
- strategy:
- matrix:
- architecture: [linux/amd64]
- java-version: [ 17 ]
- uses: ./.github/workflows/flink-integration-test-action.yml
- with:
- architecture: ${{ matrix.architecture }}
- java-version: ${{ matrix.java-version }}
\ No newline at end of file
diff --git a/.github/workflows/fork-ci-status-update.yml b/.github/workflows/fork-ci-status-update.yml
new file mode 100644
index 0000000000..30ee724606
--- /dev/null
+++ b/.github/workflows/fork-ci-status-update.yml
@@ -0,0 +1,63 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.
+#
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+name: Update Fork CI Status
+on:
+ workflow_run:
+ workflows: [Fork CI PR Signal, Fork CI]
+ types: [completed]
+ schedule:
+ - cron: '*/5 * * * *'
+ workflow_dispatch:
+ inputs:
+ pull-request:
+ description: 'Optional PR number to force-refresh, including settled checks'
+ required: false
+ type: string
+permissions: {}
+# A group keeps only one pending run, so each PR signal gets its own group: a burst of
+# signals must not cancel each other. Sweeps share one group.
+concurrency:
+ group: >-
+ fork-ci-status-update-${{ github.event.workflow_run.name == 'Fork CI PR Signal' &&
+ github.event.workflow_run.head_sha || 'sweep' }}
+ cancel-in-progress: false
+jobs:
+ update:
+ if: >-
+ github.repository == 'apache/gravitino' &&
+ (github.event_name != 'workflow_run' ||
+ github.event.workflow_run.event == 'pull_request' ||
+ github.event.workflow_run.event == 'workflow_dispatch' ||
+ github.event.workflow_run.event == 'push')
+ runs-on: ubuntu-slim
+ timeout-minutes: 10
+ permissions:
+ actions: read
+ checks: write
+ contents: read
+ pull-requests: read
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ ref: ${{ github.event.repository.default_branch }}
+ persist-credentials: false
+ - uses: actions/github-script@v7
+ with:
+ retries: 3
+ script: |
+ await require('./.github/scripts/update-fork-ci.cjs').update({ github, context, core });
diff --git a/.github/workflows/fork-ci-status.yml b/.github/workflows/fork-ci-status.yml
new file mode 100644
index 0000000000..e4caa9483a
--- /dev/null
+++ b/.github/workflows/fork-ci-status.yml
@@ -0,0 +1,28 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.
+#
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This unprivileged event only wakes the default-branch status publisher.
+name: Fork CI PR Signal
+on:
+ pull_request:
+ types: [opened, synchronize, reopened, edited]
+permissions: {}
+jobs:
+ signal:
+ runs-on: ubuntu-slim
+ steps:
+ - run: echo 'The default-branch publisher validates current PR metadata.'
diff --git a/.github/workflows/fork-ci.yml b/.github/workflows/fork-ci.yml
new file mode 100644
index 0000000000..6ec755a8d8
--- /dev/null
+++ b/.github/workflows/fork-ci.yml
@@ -0,0 +1,298 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Run the complete CI entry point from branch pushes in the contributor's repository.
+name: Fork CI
+run-name: "${{ github.event_name == 'workflow_dispatch' && format('Trusted Fork CI #{0}', inputs.pull-request) || format('Fork CI {0}', github.ref_name) }}"
+
+on:
+ push:
+ branches: ['**']
+ workflow_dispatch:
+ inputs:
+ pull-request:
+ description: 'PR to test using the reviewed workflows on the default branch (committers only)'
+ required: true
+ type: string
+
+permissions:
+ contents: read
+ actions: read
+ pull-requests: read
+
+concurrency:
+ group: fork-ci-${{ github.event_name }}-${{ inputs.pull-request || github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ eligibility:
+ name: Resolve fork CI eligibility
+ if: vars.DISABLE_FORK_CI != 'true'
+ runs-on: ubuntu-slim
+ outputs:
+ base-ref: ${{ steps.resolve.outputs.base-ref }}
+ base-sha: ${{ steps.resolve.outputs.base-sha }}
+ head-repository: ${{ steps.resolve.outputs.head-repository }}
+ head-sha: ${{ steps.resolve.outputs.head-sha }}
+ sync: ${{ steps.resolve.outputs.sync }}
+ valid: ${{ steps.resolve.outputs.valid == 'true' && (steps.resolve.outputs.sync != 'true' || steps.merge.outcome == 'success') }}
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - name: Resolve one immutable test context
+ id: resolve
+ uses: actions/github-script@v7
+ with:
+ script: |
+ await require('./.github/scripts/resolve-fork-ci.cjs').resolve({ github, context, core });
+
+ - name: Check the frozen merge before starting suites
+ id: merge
+ if: steps.resolve.outputs.sync == 'true'
+ env:
+ BASE_SHA: ${{ steps.resolve.outputs.base-sha }}
+ HEAD_SHA: ${{ steps.resolve.outputs.head-sha }}
+ HEAD_REPOSITORY: ${{ steps.resolve.outputs.head-repository }}
+ run: |
+ set -euo pipefail
+ mkdir -p "${RUNNER_TEMP}/merge-check"
+ cd "${RUNNER_TEMP}/merge-check"
+ git init --quiet
+ git fetch --quiet --no-tags https://github.com/apache/gravitino.git "${BASE_SHA}"
+ git fetch --quiet --no-tags "https://github.com/${HEAD_REPOSITORY}.git" "${HEAD_SHA}"
+ git merge-tree --write-tree --name-only "${BASE_SHA}" "${HEAD_SHA}"
+
+ build:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/build.yml
+
+ backend:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/backend-integration-test.yml
+
+ spark:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/spark-integration-test.yml
+
+ flink:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/flink-integration-test.yml
+
+ trino:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/trino-integration-test.yml
+
+ iceberg_rest_trino:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/iceberg-rest-trino-integration-test.yml
+
+ python:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/python-integration-test.yml
+
+ frontend:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/frontend-integration-test.yml
+
+ access_control:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/access-control-integration-test.yml
+
+ idp_basic:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/idp-basic-test.yml
+
+ mcp:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/mcp-integration-test.yml
+
+ maintenance:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/maintenance-integration-test.yml
+
+ web_ui:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/web-ui-tests.yml
+
+ charts:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/chart-test.yaml
+
+ contrib_catalog:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/contrib-catalog-test.yml
+
+ asf_allowlist:
+ needs: eligibility
+ if: needs.eligibility.outputs.valid == 'true'
+ with:
+ base-ref: ${{ needs.eligibility.outputs.base-ref }}
+ base-sha: ${{ needs.eligibility.outputs.base-sha }}
+ head-repository: ${{ needs.eligibility.outputs.head-repository }}
+ head-sha: ${{ needs.eligibility.outputs.head-sha }}
+ sync: ${{ needs.eligibility.outputs.sync }}
+ uses: ./.github/workflows/asf-allowlist-check.yml
+
+ required_ci:
+ name: Required CI / ${{ needs.eligibility.outputs.base-ref }} / ${{ needs.eligibility.outputs.base-sha }} / ${{ needs.eligibility.outputs.head-sha }}
+ # !cancelled() rather than always(), so a cancelled run does not wait for a runner here.
+ if: ${{ !cancelled() && needs.eligibility.outputs.valid == 'true' }}
+ needs:
+ - eligibility
+ - build
+ - backend
+ - spark
+ - flink
+ - trino
+ - iceberg_rest_trino
+ - python
+ - frontend
+ - access_control
+ - idp_basic
+ - mcp
+ - maintenance
+ - web_ui
+ - charts
+ - contrib_catalog
+ - asf_allowlist
+ runs-on: ubuntu-latest
+ steps:
+ - name: Verify required CI suites
+ env:
+ RESULTS: ${{ toJSON(needs) }}
+ run: |
+ set -euo pipefail
+ echo "Required CI suite results:"
+ jq -r 'to_entries[] | "\(.key)=\(.value.result)"' <<< "${RESULTS}"
+ failures="$(
+ jq -r '
+ to_entries[]
+ | select(.value.result != "success" and .value.result != "skipped")
+ | "\(.key)=\(.value.result)"
+ ' <<< "${RESULTS}"
+ )"
+ if [ -n "${failures}" ]; then
+ echo "::error::One or more required CI suites did not succeed."
+ echo "${failures}"
+ exit 1
+ fi
diff --git a/.github/workflows/frontend-integration-test.yml b/.github/workflows/frontend-integration-test.yml
index 73beff5a9b..f019d636d9 100644
--- a/.github/workflows/frontend-integration-test.yml
+++ b/.github/workflows/frontend-integration-test.yml
@@ -2,13 +2,31 @@ name: Frontend Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-frontend-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -69,6 +99,15 @@ jobs:
PLATFORM: ${{ matrix.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: ./.github/actions/setup-java-toolchains
with:
@@ -106,4 +145,4 @@ jobs:
distribution/package/logs/gravitino-server.log
catalogs/**/*.log
catalogs/**/*.tar
- web-v2/integration-test/build/*.log
\ No newline at end of file
+ web-v2/integration-test/build/*.log
diff --git a/.github/workflows/iceberg-rest-trino-integration-test-action.yml b/.github/workflows/iceberg-rest-trino-integration-test-action.yml
index d7f1640293..a104dade2e 100644
--- a/.github/workflows/iceberg-rest-trino-integration-test-action.yml
+++ b/.github/workflows/iceberg-rest-trino-integration-test-action.yml
@@ -3,6 +3,26 @@ name: Iceberg REST Trino Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -21,6 +41,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
# Installs the primary JDK plus JDK 24 and registers JDK 24 with the Gradle
# toolchain, which the trino-iceberg-rest module requires.
diff --git a/.github/workflows/iceberg-rest-trino-integration-test.yml b/.github/workflows/iceberg-rest-trino-integration-test.yml
index dc73df65d2..87da6f3a75 100644
--- a/.github/workflows/iceberg-rest-trino-integration-test.yml
+++ b/.github/workflows/iceberg-rest-trino-integration-test.yml
@@ -5,13 +5,31 @@ name: Iceberg REST Trino Integration Test
# The module uses a Java 24 toolchain (Trino 478) and runs in deploy mode against
# the built distribution, so it needs its own job rather than the catch-all backend IT.
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-iceberg-rest-trino-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -19,11 +37,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -52,5 +82,10 @@ jobs:
java-version: [ 17 ]
uses: ./.github/workflows/iceberg-rest-trino-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/idp-basic-test-action.yml b/.github/workflows/idp-basic-test-action.yml
index 5f4a18c663..c3bcb64eef 100644
--- a/.github/workflows/idp-basic-test-action.yml
+++ b/.github/workflows/idp-basic-test-action.yml
@@ -3,6 +3,26 @@ name: IdP Basic Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
java-version:
required: true
description: 'Java version'
@@ -15,6 +35,15 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/idp-basic-test.yml b/.github/workflows/idp-basic-test.yml
index 676a2d66c3..3dfc3eff71 100644
--- a/.github/workflows/idp-basic-test.yml
+++ b/.github/workflows/idp-basic-test.yml
@@ -1,14 +1,32 @@
name: IdP Basic Test
on:
- push:
- branches: ["main", "branch-*"]
- pull_request:
- branches: ["main", "branch-*"]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
workflow_dispatch:
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-idp-basic-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- plugins/idp-basic/**
@@ -53,4 +83,9 @@ jobs:
if: needs.changes.outputs.source_changes == 'true' && needs.changes.outputs.module_exists == 'true'
uses: ./.github/workflows/idp-basic-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
java-version: '17'
diff --git a/.github/workflows/lance-compatibility-matrix-test.yml b/.github/workflows/lance-compatibility-matrix-test.yml
index a64283e9ae..955d6a14c4 100644
--- a/.github/workflows/lance-compatibility-matrix-test.yml
+++ b/.github/workflows/lance-compatibility-matrix-test.yml
@@ -21,6 +21,9 @@ concurrency:
jobs:
lance-matrix:
+ # Forks inherit the weekly schedule; only run it upstream, but keep manual runs anywhere.
+ # Other copies of the repository set ENABLE_SCHEDULED_TESTS to run it on schedule.
+ if: github.event_name != 'schedule' || github.repository == 'apache/gravitino' || vars.ENABLE_SCHEDULED_TESTS == 'true'
uses: ./.github/workflows/lance-compatibility-matrix-test-action.yml
with:
lance_spark_versions: ${{ github.event.inputs.lance_spark_versions || '0.2.0,0.4.0,0.5.1' }}
diff --git a/.github/workflows/maintenance-integration-test-action.yml b/.github/workflows/maintenance-integration-test-action.yml
index 36c380c11c..cfb3967d5f 100644
--- a/.github/workflows/maintenance-integration-test-action.yml
+++ b/.github/workflows/maintenance-integration-test-action.yml
@@ -4,6 +4,26 @@ name: Maintenance Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -22,6 +42,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/maintenance-integration-test.yml b/.github/workflows/maintenance-integration-test.yml
index 83c40ec169..f89a5e2e07 100644
--- a/.github/workflows/maintenance-integration-test.yml
+++ b/.github/workflows/maintenance-integration-test.yml
@@ -2,13 +2,31 @@ name: Maintenance Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-maintenance-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -47,26 +77,19 @@ jobs:
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}
- MaintenanceIT-on-push:
- needs: changes
- if: (github.event_name == 'push' && needs.changes.outputs.source_changes == 'true')
- strategy:
- matrix:
- architecture: [linux/amd64]
- java-version: [ 17 ]
- uses: ./.github/workflows/maintenance-integration-test-action.yml
- with:
- architecture: ${{ matrix.architecture }}
- java-version: ${{ matrix.java-version }}
-
- MaintenanceIT-on-pr:
+ MaintenanceIT:
needs: changes
- if: (github.event_name == 'pull_request' && needs.changes.outputs.source_changes == 'true')
+ if: needs.changes.outputs.source_changes == 'true'
strategy:
matrix:
architecture: [linux/amd64]
java-version: [ 17 ]
uses: ./.github/workflows/maintenance-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/mcp-integration-test-action.yml b/.github/workflows/mcp-integration-test-action.yml
index b51f4a6806..2acaecd989 100644
--- a/.github/workflows/mcp-integration-test-action.yml
+++ b/.github/workflows/mcp-integration-test-action.yml
@@ -21,6 +21,26 @@ name: MCP Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
java-version:
required: true
description: 'Java version'
@@ -33,6 +53,15 @@ jobs:
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: ./.github/actions/setup-java-toolchains
with:
diff --git a/.github/workflows/mcp-integration-test.yml b/.github/workflows/mcp-integration-test.yml
index 82a0a5c935..5eb898671c 100644
--- a/.github/workflows/mcp-integration-test.yml
+++ b/.github/workflows/mcp-integration-test.yml
@@ -19,13 +19,31 @@
name: mcp-integration-test
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-mcp-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -35,11 +53,23 @@ jobs:
mcp_or_authz_changes: ${{ steps.filter.outputs.mcp_or_authz_changes }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
mcp_or_authz_changes:
- 'mcp-server/**'
@@ -54,4 +84,9 @@ jobs:
if: needs.changes.outputs.mcp_or_authz_changes == 'true'
uses: ./.github/workflows/mcp-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
java-version: '17'
diff --git a/.github/workflows/python-integration-test-action.yml b/.github/workflows/python-integration-test-action.yml
index c35d8e82ca..44ee341a74 100644
--- a/.github/workflows/python-integration-test-action.yml
+++ b/.github/workflows/python-integration-test-action.yml
@@ -3,6 +3,26 @@ name: Python Client Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -21,6 +41,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/python-integration-test.yml b/.github/workflows/python-integration-test.yml
index e2c02591d2..653ee4e8fb 100644
--- a/.github/workflows/python-integration-test.yml
+++ b/.github/workflows/python-integration-test.yml
@@ -2,13 +2,31 @@ name: Python Client Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-python-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -55,5 +85,10 @@ jobs:
java-version: [ 17 ]
uses: ./.github/workflows/python-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/spark-integration-test-action.yml b/.github/workflows/spark-integration-test-action.yml
index baa3eb9ad0..f45f8df06a 100644
--- a/.github/workflows/spark-integration-test-action.yml
+++ b/.github/workflows/spark-integration-test-action.yml
@@ -4,6 +4,26 @@ name: Spark Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -32,6 +52,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: actions/setup-java@v4
with:
diff --git a/.github/workflows/spark-integration-test.yml b/.github/workflows/spark-integration-test.yml
index 0f3c23584e..cf45626b65 100644
--- a/.github/workflows/spark-integration-test.yml
+++ b/.github/workflows/spark-integration-test.yml
@@ -2,13 +2,31 @@ name: Spark Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-spark-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -48,9 +78,9 @@ jobs:
outputs:
source_changes: ${{ steps.filter.outputs.source_changes }}
- SparkIT-on-push:
+ SparkIT:
needs: changes
- if: (github.event_name == 'push' && needs.changes.outputs.source_changes == 'true')
+ if: needs.changes.outputs.source_changes == 'true'
strategy:
matrix:
# Integration test for AMD64 architecture
@@ -60,24 +90,12 @@ jobs:
test-mode: [ embedded, deploy ]
uses: ./.github/workflows/spark-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
scala-version: ${{ matrix.scala-version }}
test-mode: ${{ matrix.test-mode }}
-
- SparkIT-on-pr:
- needs: changes
- if: (github.event_name == 'pull_request' && needs.changes.outputs.source_changes == 'true')
- strategy:
- matrix:
- # Integration test for AMD64 architecture
- architecture: [linux/amd64]
- java-version: [ 17 ]
- scala-version: [ 2.12 ]
- test-mode: [ embedded, deploy ]
- uses: ./.github/workflows/spark-integration-test-action.yml
- with:
- architecture: ${{ matrix.architecture }}
- java-version: ${{ matrix.java-version }}
- scala-version: ${{ matrix.scala-version }}
- test-mode: ${{ matrix.test-mode }}
\ No newline at end of file
diff --git a/.github/workflows/trino-integration-test-action.yml b/.github/workflows/trino-integration-test-action.yml
index 8435aa0494..dafa86e7e2 100644
--- a/.github/workflows/trino-integration-test-action.yml
+++ b/.github/workflows/trino-integration-test-action.yml
@@ -3,6 +3,26 @@ name: Trino Integration Test Action
on:
workflow_call:
inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
architecture:
required: true
description: 'Architecture of the platform'
@@ -21,6 +41,15 @@ jobs:
PLATFORM: ${{ inputs.architecture }}
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- uses: ./.github/actions/setup-java-toolchains
with:
diff --git a/.github/workflows/trino-integration-test.yml b/.github/workflows/trino-integration-test.yml
index d53f227093..2fc26ef028 100644
--- a/.github/workflows/trino-integration-test.yml
+++ b/.github/workflows/trino-integration-test.yml
@@ -2,13 +2,31 @@ name: Trino Integration Test
# Controls when the workflow will run
on:
- push:
- branches: [ "main", "branch-*" ]
- pull_request:
- branches: [ "main", "branch-*" ]
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
concurrency:
- group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+ group: fork-ci-trino-${{ inputs.head-sha || github.ref }}
cancel-in-progress: true
jobs:
@@ -16,11 +34,23 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
- name: Disable Git automatic maintenance
run: git config --local maintenance.auto false
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
id: filter
with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
filters: |
source_changes:
- .github/**
@@ -58,5 +88,10 @@ jobs:
java-version: [ 17 ]
uses: ./.github/workflows/trino-integration-test-action.yml
with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
architecture: ${{ matrix.architecture }}
java-version: ${{ matrix.java-version }}
diff --git a/.github/workflows/web-ui-tests.yml b/.github/workflows/web-ui-tests.yml
index f2324d48b2..b0ebbc58f8 100644
--- a/.github/workflows/web-ui-tests.yml
+++ b/.github/workflows/web-ui-tests.yml
@@ -1,24 +1,77 @@
name: Web UI Tests
on:
- push:
- branches: [ "main", "branch-*" ]
- paths:
- - 'web/web/**'
- - '.github/workflows/web-ui-tests.yml'
- pull_request:
- branches: [ "main", "branch-*" ]
- paths:
- - 'web/web/**'
- - '.github/workflows/web-ui-tests.yml'
+ workflow_call:
+ inputs:
+ base-ref:
+ type: string
+ required: false
+ default: ''
+ base-sha:
+ type: string
+ required: false
+ default: ''
+ head-repository:
+ type: string
+ required: false
+ default: ''
+ head-sha:
+ type: string
+ required: false
+ default: ''
+ sync:
+ type: string
+ required: false
+ default: ''
+
+concurrency:
+ group: fork-ci-web-ui-${{ inputs.head-sha || github.ref }}
+ cancel-in-progress: true
jobs:
+ changes:
+ runs-on: ubuntu-latest
+ outputs:
+ source_changes: ${{ steps.filter.outputs.source_changes }}
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ persist-credentials: false
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
+ id: checkout
+ - name: Disable Git automatic maintenance
+ run: git config --local maintenance.auto false
+ - uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d
+ id: filter
+ with:
+ base: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.base-sha || steps.checkout.outputs.base-ref }}
+ ref: ${{ steps.checkout.outputs.synced == 'true' && steps.checkout.outputs.head-sha || github.ref }}
+ filters: |
+ source_changes:
+ - 'web/web/**'
+ - '.github/**'
+
test:
+ needs: changes
+ if: needs.changes.outputs.source_changes == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
+ - uses: ./.github/actions/checkout-and-sync
+ with:
+ base-ref: ${{ inputs.base-ref }}
+ base-sha: ${{ inputs.base-sha }}
+ head-repository: ${{ inputs.head-repository }}
+ head-sha: ${{ inputs.head-sha }}
+ sync: ${{ inputs.sync }}
- name: Setup pnpm
uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e887fee575..a2931f2f30 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -92,7 +92,27 @@ Contributors who participate actively and constructively may be invited to becom
## 🧪 Continuous Integration
-All PRs are automatically tested using GitHub Actions. Please check test results and fix failures before requesting a review.
+Pull request tests run with GitHub Actions in your fork, not in `apache/gravitino`:
+
+1. Enable GitHub Actions in your fork (the **Actions** tab of your fork).
+2. Push your branch to your fork. **Fork CI** resolves one upstream base commit and every suite tests the same merge of that base and your pushed commit.
+3. Open the pull request. Its **Fork CI** check verifies the suite jobs and the exact tested head, base branch and base SHA. A pre-PR run is accepted only if its inferred base matches the PR. After retargeting a PR, push again or ask a committer for a trusted run. The separate **ASF Allowlist Check** scans the PR's workflow YAML using reviewed upstream code.
+4. Keep your branch up to date before merging. Required checks use strict branch protection. If the base changes, update your branch and run CI again. The **Fork CI** check can stay green after the base branch moves on; strict branch protection, not the check, blocks the merge until the branch is updated.
+
+If the check asks you to enable Fork CI, enable Actions in your fork, merge or rebase your branch onto the latest base branch, and push again. To re-run flaky tests, re-run the failed jobs in your fork; reviewers cannot re-run them for you. Please fix failures before requesting a review.
+
+Known limitations of Fork CI:
+
+* New/edited PR notifications wake a default-branch publisher. Fork run completions and reruns, including reruns of successful runs, are polled on a five-minute schedule, subject to GitHub scheduling delays and a bounded API budget. All open PRs, including settled successes, remain watched. The starting PR rotates on each scheduled interval; large queues can take longer. Committers can force-refresh a particular PR using **Update Fork CI Status** with its PR number.
+* A pull request last pushed before this migration needs an update and another push. Old runs without the tested-context metadata cannot satisfy the new check.
+* Coverage comments remain available for release branches. For PRs to `main`, inspect the fork run's `build / coverage` log and `coverage-report` artifact.
+* Release branches (`branch-*`) keep their own upstream CI until this change is backported.
+* CI workflow, action, helper-script or `.asf.yaml` changes cannot approve themselves. After reviewing those changes, a committer runs **Fork CI** in `apache/gravitino`, from the current default branch, and supplies the PR number. This explicit exception uses upstream runner resources, reviewed default-branch workflow definitions, a read-only token and no repository secrets; it tests the exact contributor head against the current base. Any later push or base change requires another matching run.
+* The independent allowlist scanner downloads bounded YAML data outside its trusted checkout and never executes PR code. It reports the required **ASF Allowlist Check** on every PR, including PRs that do not change `.github/`. A committer can re-run **Trusted ASF Allowlist** with the PR number.
+
+The migration requires a coordinated branch-protection cutover: replace the old individual suite contexts with **Fork CI** and **ASF Allowlist Check**, and retain strict/up-to-date protection. The initial rollout must be reviewed and validated under the existing upstream checks before that protection changes. Announce the cutover so authors know to update existing branches. Release-branch protection is unchanged.
+
+The trusted publishers use `workflow_run` and `schedule`, rather than `pull_request_target`. `actions/*`, `github/*` and `apache/*` actions are exempt from ASF's external-action SHA requirement; external third-party actions still require an approved SHA.
## 🆘 Need Help?
@@ -149,6 +169,7 @@ Reviewing and triaging helps maintain the project. You can:
* Add labels to categorize
* Suggest improvements on PRs
* Review code and give feedback
+* Review changes under `.github/` and `.asf.yaml` carefully, then dispatch a trusted upstream **Fork CI** run for those changes. Check the displayed tested base SHA and all caller suite results before merging.
* Please add Copilot before you review. That is recommended, not required. Do not wait on Copilot if you are ready to review.
## 🔃 Creating Pull Requests