This is an automated email from the ASF dual-hosted git repository.
hello-stephen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7f42e38913d [chore](ci) Run master PR checks in a single Code Style
job (#71303)
7f42e38913d is described below
commit 7f42e38913d71e3edac793af440edb6a937a16d9
Author: shuke <[email protected]>
AuthorDate: Wed Dec 2 20:53:20 2026 +0800
[chore](ci) Run master PR checks in a single Code Style job (#71303)
### Background
Master PRs currently allocate separate runners for Code Style, Gitleaks
and license headers. Each runner queues and checks out Doris. License
Check also builds the Go tool for each run.
### What problem does this PR solve?
Issue Number: None
Related PR: #71294, #71301
PR Type: Build/CI/Chore
Problem Summary: Run all three checks on one Ubuntu runner with one
Doris checkout. This removes two runner allocations per master PR. The
required Code Style check reports failures from either scanner as well
as the selected Java and C++ checks.
### Details
- **Change map:** Three files define the shared scanners. Three
workflows select and run the checks. Two lines in the master ruleset
retire the individual required contexts.
- **Affected:** Pull requests targeting master. Other targets keep the
standalone job names.
- **Developer and release impact:** Contributors see the scan results as
Code Style steps and can download the redacted Gitleaks report. The
existing large-file warning remains advisory. No release-branch
backports are needed.
- **License and third-party:** Gitleaks remains pinned to 8.30.0. The
job verifies the official Apache SkyWalking Eyes 0.8.0 binary
distribution against its SHA-512 on every use, including cache hits.
- **Rollback:** Revert this change to reinstate the two independent
master jobs and their required contexts.
- **CI permissions and secrets:** The jobs retain read-only contents and
pull-request permissions. Checkout credentials are not persisted.
- **Behavior change:** The secret scan reads non-merge commits in the
event's base-to-head range. License Eye checks changed paths with the
repository's ignore rules. Changes to its config or an incomplete file
list trigger a full scan. Either scanner can fail while the remaining
checks still run. Skipped standalone jobs on master cover the interval
before the ruleset update takes effect.
### Testing
Actionlint passed on all three changed workflows. Real Gitleaks fixtures
passed on a clean PR and detected a redacted finding in an intermediate
commit that was later removed. The real License Eye binary passed a
valid header and ignored paths, rejected a missing header and found it
during full-config fallback. Also checked deleted files, renamed
configuration, a 300-file compare, a moved PR head, incomplete
pagination and the 3,000-file API limit. Verified the Linux release
archive checksum and executable extraction. All 22 resolver and checkout
unit tests, 13 style-selection cases and both 3,002-file comparisons
passed.
### Release note
None.
### Check List (For Author)
- Behavior changed: Yes (see Details).
- Does this need documentation: No.
- Pre-submission status: Partially verified. GitHub-hosted execution and
queue measurements are pending.
### AI Disclosure
- Tool: OpenAI Codex.
- Generated: Implementation, validation fixtures and PR description.
- Human review: Pending.
---
.asf.yaml | 2 -
.github/actions/pr-gitleaks/action.yml | 76 +++++++++++++++++++++++++++++
.github/actions/pr-license/action.yml | 49 +++++++++++++++++++
.github/actions/pr-license/check.py | 85 +++++++++++++++++++++++++++++++++
.github/workflows/code-style.yml | 17 +++++--
.github/workflows/gitleaks-pr-check.yml | 54 ++-------------------
.github/workflows/license-eyes.yml | 75 ++---------------------------
7 files changed, 231 insertions(+), 127 deletions(-)
diff --git a/.asf.yaml b/.asf.yaml
index efbb5d15abb..aba612f22bd 100644
--- a/.asf.yaml
+++ b/.asf.yaml
@@ -66,8 +66,6 @@ github:
parameters:
strict_required_status_checks_policy: false
required_status_checks:
- - context: License Check
- - context: Check for secrets
- context: Code Style
- context: TeamCity/p0
- context: TeamCity/nonconcurrent
diff --git a/.github/actions/pr-gitleaks/action.yml
b/.github/actions/pr-gitleaks/action.yml
new file mode 100644
index 00000000000..9b9fe68ed32
--- /dev/null
+++ b/.github/actions/pr-gitleaks/action.yml
@@ -0,0 +1,76 @@
+# 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: PR secret scan
+description: Scan the non-merge commits in the PR and retain a redacted report.
+runs:
+ using: composite
+ steps:
+ - name: Fetch PR history
+ shell: bash
+ env:
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ # The source checkout already contains the merge tree. Fetch only the
two
+ # histories and let Git fetch historical blobs on demand when scanning
patches.
+ if [[ "$(git rev-parse --is-shallow-repository)" == "true" ]]; then
+ git fetch --no-tags --no-recurse-submodules --unshallow
--filter=blob:none origin "$BASE_SHA" "$HEAD_SHA"
+ fi
+ git rev-parse --verify "${BASE_SHA}^{commit}" > /dev/null
+ git rev-parse --verify "${HEAD_SHA}^{commit}" > /dev/null
+
+ - name: Install Gitleaks
+ shell: bash
+ env:
+ GITLEAKS_VERSION: 8.30.0
+ GITLEAKS_SHA256:
79a3ab579b53f71efd634f3aaf7e04a0fa0cf206b7ed434638d1547a2470a66e
+ run: |
+ cd "$RUNNER_TEMP"
+ curl -fsSL --retry 2 -o gitleaks.tar.gz \
+
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
+ echo "$GITLEAKS_SHA256 gitleaks.tar.gz" | sha256sum -c -
+ tar -xzf gitleaks.tar.gz gitleaks
+
+ - name: Run Gitleaks
+ id: scan
+ shell: bash
+ env:
+ BASE_SHA: ${{ github.event.pull_request.base.sha }}
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
+ run: |
+ "$RUNNER_TEMP/gitleaks" git . --redact \
+ --log-opts="--no-merges ${BASE_SHA}..${HEAD_SHA}" \
+ --report-format json --report-path
"$RUNNER_TEMP/gitleaks-report.json"
+
+ - name: Summarize Gitleaks findings
+ if: "!cancelled() && (steps.scan.outcome == 'success' ||
steps.scan.outcome == 'failure')"
+ shell: bash
+ run: |
+ if [[ -f "$RUNNER_TEMP/gitleaks-report.json" ]]; then
+ jq -r '"gitleaks findings: \(length)", (.[:20][] | [.RuleID, .File,
.StartLine, .Description] | @tsv)' \
+ "$RUNNER_TEMP/gitleaks-report.json"
+ fi
+
+ - name: Upload Gitleaks report
+ if: "!cancelled() && (steps.scan.outcome == 'success' ||
steps.scan.outcome == 'failure')"
+ uses: actions/upload-artifact@v4
+ with:
+ name: gitleaks-report
+ path: ${{ runner.temp }}/gitleaks-report.json
+ if-no-files-found: error
diff --git a/.github/actions/pr-license/action.yml
b/.github/actions/pr-license/action.yml
new file mode 100644
index 00000000000..d40a83b9d9a
--- /dev/null
+++ b/.github/actions/pr-license/action.yml
@@ -0,0 +1,49 @@
+# 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: PR license headers
+description: Check license headers using the pinned Apache SkyWalking Eyes
release.
+runs:
+ using: composite
+ steps:
+ - name: Cache the Apache release archive
+ uses: actions/cache@v4
+ with:
+ path: ${{ runner.temp }}/skywalking-license-eye-0.8.0-bin.tgz
+ key: license-eye-dist-0.8.0-8493745585a39e24
+
+ - name: Verify and extract license-eye
+ shell: bash
+ env:
+ LICENSE_EYE_SHA512:
8493745585a39e2464a71a4187fddef5b02c539725fba598d97cf7e37755a2e00f2b58cbc83de4995232787450dac4b43d22f2f80fe82e4f45dd9f4dceb8d43a
+ run: |
+ cd "$RUNNER_TEMP"
+ archive=skywalking-license-eye-0.8.0-bin.tgz
+ if [[ ! -f "$archive" ]]; then
+ curl -fsSL --retry 2 -o "$archive"
"https://dlcdn.apache.org/skywalking/eyes/0.8.0/$archive" ||
+ curl -fsSL --retry 2 -o "$archive"
"https://archive.apache.org/dist/skywalking/eyes/0.8.0/$archive"
+ fi
+ echo "$LICENSE_EYE_SHA512 $archive" | sha512sum -c -
+ tar -xzf "$archive" --strip-components=3
skywalking-license-eye-0.8.0-bin/bin/linux/license-eye
+
+ - name: Check license headers
+ shell: bash
+ env:
+ GH_TOKEN: ${{ github.token }}
+ GITHUB_TOKEN: ${{ github.token }}
+ run: python3 -I "$GITHUB_ACTION_PATH/check.py" "$RUNNER_TEMP/license-eye"
diff --git a/.github/actions/pr-license/check.py
b/.github/actions/pr-license/check.py
new file mode 100644
index 00000000000..c12ea61c0e6
--- /dev/null
+++ b/.github/actions/pr-license/check.py
@@ -0,0 +1,85 @@
+# 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.
+
+import errno
+import json
+import os
+from pathlib import Path
+import subprocess
+import sys
+
+
+def changed_files(pr):
+ """Return the exact file list, or None to request a full check."""
+ snapshot = Path(os.environ["RUNNER_TEMP"]) / "code-style-files.json"
+ if snapshot.is_file():
+ files = json.loads(snapshot.read_text())["files"]
+ if len(files) < 300:
+ return files
+
+ endpoint = f"repos/{os.environ['GITHUB_REPOSITORY']}/pulls/{pr['number']}"
+ files = json.loads(subprocess.check_output([
+ "gh", "api", "--paginate", "--slurp", f"{endpoint}/files?per_page=100",
+ "--jq", "add | map({filename, previous_filename, status})",
+ ]))
+ current = json.loads(subprocess.check_output([
+ "gh", "api", endpoint, "--jq", "[.base.sha, .head.sha]",
+ ]))
+ if current == [pr["base"]["sha"], pr["head"]["sha"]] and len(files) ==
pr["changed_files"]:
+ return files
+ return None
+
+
+def license_paths(files):
+ if files is None or len(files) >= 3000:
+ return None
+ paths = []
+ for f in files:
+ path = f["filename"]
+ if ".licenserc.yaml" in (path, f.get("previous_filename")):
+ return None
+ if f["status"] != "removed":
+ # License Eye interprets its path arguments as glob patterns.
+ if any(c in path for c in "*?[]{}\\"):
+ return None
+ paths.append(path)
+ return paths
+
+
+def main(binary):
+ pr =
json.loads(Path(os.environ["GITHUB_EVENT_PATH"]).read_text())["pull_request"]
+ try:
+ paths = license_paths(changed_files(pr))
+ except (OSError, ValueError, KeyError, TypeError,
subprocess.CalledProcessError):
+ print("Changed files unavailable; checking the full license
configuration.", flush=True)
+ paths = None
+
+ command = [binary, "-c", ".licenserc.yaml", "header", "check"]
+ if paths == []:
+ print("No added or modified files to check.")
+ return 0
+ if paths is not None:
+ try:
+ return subprocess.run([*command, "--", *paths]).returncode
+ except OSError as error:
+ if error.errno != errno.E2BIG:
+ raise
+ return subprocess.run(command).returncode
+
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv[1]))
diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml
index 8bcf3b45de1..0c118079a86 100644
--- a/.github/workflows/code-style.yml
+++ b/.github/workflows/code-style.yml
@@ -153,13 +153,21 @@ jobs:
- name: Checkout source
id: source
- if: steps.paths.outputs.java == 'true' || steps.paths.outputs.cpp ==
'true'
uses: actions/checkout@v7
with:
persist-credentials: false
+ - name: Check for secrets
+ if: "!cancelled() && steps.source.outcome == 'success'"
+ uses: ./.github/actions/pr-gitleaks
+
+ - name: Check license headers
+ if: "!cancelled() && steps.source.outcome == 'success'"
+ uses: ./.github/actions/pr-license
+
- name: Checkout clang-format action
- if: steps.paths.outputs.cpp == 'true'
+ id: clang-action
+ if: "!cancelled() && steps.source.outcome == 'success' &&
steps.paths.outputs.cpp == 'true'"
uses: actions/checkout@v7
with:
repository: DoozyX/clang-format-lint-action
@@ -168,13 +176,14 @@ jobs:
persist-credentials: false
- name: Set up Python for clang-format
- if: steps.paths.outputs.cpp == 'true'
+ id: clang-python
+ if: "!cancelled() && steps.clang-action.outcome == 'success'"
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Run Clang Formatter
- if: steps.paths.outputs.cpp == 'true'
+ if: "!cancelled() && steps.clang-python.outcome == 'success'"
uses: ./.github/actions/clang-format-lint-action
with:
source: 'be/src be/test cloud/src cloud/test'
diff --git a/.github/workflows/gitleaks-pr-check.yml
b/.github/workflows/gitleaks-pr-check.yml
index d8670f73665..252bc9218f5 100644
--- a/.github/workflows/gitleaks-pr-check.yml
+++ b/.github/workflows/gitleaks-pr-check.yml
@@ -28,13 +28,12 @@ permissions:
jobs:
gitleaks:
name: Check for secrets
+ # On master this scan is enforced by the required Code Style job.
+ if: github.base_ref != 'master'
runs-on: ubuntu-24.04
concurrency:
group: gitleaks-${{ github.event.pull_request.number || github.run_id
}}-${{ github.sha }}
cancel-in-progress: true
- env:
- GITLEAKS_VERSION: 8.30.0
- GITLEAKS_SHA256:
79a3ab579b53f71efd634f3aaf7e04a0fa0cf206b7ed434638d1547a2470a66e
steps:
- name: Verify current PR head
env:
@@ -51,52 +50,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
- fetch-depth: 0
persist-credentials: false
- - name: Install Gitleaks
- run: |
- curl -sSL \
- -o /tmp/gitleaks.tar.gz \
-
"https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
- echo "${GITLEAKS_SHA256} /tmp/gitleaks.tar.gz" | sha256sum -c -
- tar -xzf /tmp/gitleaks.tar.gz -C /tmp gitleaks
- chmod +x /tmp/gitleaks
-
- - name: Run Gitleaks
- env:
- BASE_SHA: ${{ github.event.pull_request.base.sha }}
- HEAD_SHA: ${{ github.event.pull_request.head.sha }}
- run: |
- /tmp/gitleaks git . \
- --redact \
- --log-opts="--no-merges ${BASE_SHA}..${HEAD_SHA}" \
- --report-format json \
- --report-path gitleaks-report.json
-
- - name: Summarize Gitleaks findings
- if: always() && hashFiles('gitleaks-report.json') != ''
- run: |
- python3 - <<'PY'
- import json
- from pathlib import Path
-
- findings = json.loads(Path("gitleaks-report.json").read_text())
- print(f"gitleaks findings: {len(findings)}")
- for finding in findings[:20]:
- rule_id = finding.get("RuleID", "unknown-rule")
- file_name = finding.get("File", "unknown-file")
- line = finding.get("StartLine", "?")
- description = finding.get("Description", "")
- print(f"- {rule_id} {file_name}:{line} {description}")
- if len(findings) > 20:
- print(f"... {len(findings) - 20} more findings in
gitleaks-report.json")
- PY
-
- - name: Upload Gitleaks report
- if: always() && hashFiles('gitleaks-report.json') != ''
- uses: actions/upload-artifact@v4
- with:
- name: gitleaks-report
- path: gitleaks-report.json
- if-no-files-found: error
+ - name: Check for secrets
+ uses: ./.github/actions/pr-gitleaks
diff --git a/.github/workflows/license-eyes.yml
b/.github/workflows/license-eyes.yml
index 1002bec707b..34675df7d29 100644
--- a/.github/workflows/license-eyes.yml
+++ b/.github/workflows/license-eyes.yml
@@ -32,7 +32,8 @@ jobs:
concurrency:
group: license-check-${{ github.event.pull_request.number ||
github.run_id }}-${{ github.sha }}
cancel-in-progress: true
- if: github.event_name == 'pull_request'
+ # On master this check is enforced by the required Code Style job.
+ if: github.event_name == 'pull_request' && github.base_ref != 'master'
steps:
- name: Verify current PR head
if: github.event_name == 'pull_request'
@@ -52,73 +53,5 @@ jobs:
with:
persist-credentials: false
- - name: Get changed files
- if: github.event_name == 'pull_request'
- id: changed-files
- env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: |
- if ! all=$(gh api repos/${{ github.repository }}/pulls/${{
github.event.pull_request.number }}/files \
- --paginate --jq '.[].filename' 2>/dev/null); then
- echo "config_file=.licenserc.yaml" >> "$GITHUB_OUTPUT"
- exit 0
- fi
- if [ "$(echo "$all" | wc -l)" -ge 3000 ]; then
- echo "config_file=.licenserc.yaml" >> "$GITHUB_OUTPUT"
- exit 0
- fi
- if echo "$all" | grep -qxF '.licenserc.yaml'; then
- echo "config_file=.licenserc.yaml" >> "$GITHUB_OUTPUT"
- exit 0
- fi
- if ! acmr=$(gh api repos/${{ github.repository }}/pulls/${{
github.event.pull_request.number }}/files \
- --paginate --jq '.[] | select(.status != "removed") | .filename'
2>/dev/null); then
- echo "config_file=.licenserc.yaml" >> "$GITHUB_OUTPUT"
- exit 0
- fi
- if [ -z "$acmr" ]; then
- exit 0
- fi
- # Hand the list over as a file, not as a step output consumed
through an
- # environment variable: a single env string is capped at
MAX_ARG_STRLEN
- # (128KiB), and a large PR blows past it, so exec'ing the next step's
- # shell fails with "Argument list too long". Keep it out of the
- # workspace, where the full-config fallback would license-check it.
- printf '%s\n' "$acmr" > "${RUNNER_TEMP}/licenserc-changed-files.txt"
- echo "changed_files_file=${RUNNER_TEMP}/licenserc-changed-files.txt"
>> "$GITHUB_OUTPUT"
- echo "config_file=.licenserc-incremental.yaml" >> "$GITHUB_OUTPUT"
-
- - name: Generate incremental licenserc
- if: >-
- github.event_name == 'pull_request' &&
- steps.changed-files.outputs.changed_files_file != ''
- env:
- CHANGED_FILES_FILE: ${{
steps.changed-files.outputs.changed_files_file }}
- run: |
- python3 - <<'EOF'
- import sys
- # Prevent fork-supplied files from shadowing stdlib modules
- sys.path = [p for p in sys.path if p not in ('', '.')]
- import yaml, os
-
- with open('.licenserc.yaml') as f:
- config = yaml.safe_load(f)
-
- with open(os.environ['CHANGED_FILES_FILE']) as f:
- changed = [p.strip() for p in f if p.strip()]
-
- config['header']['paths'] = changed
-
- with open('.licenserc-incremental.yaml', 'w') as f:
- yaml.dump(config, f, default_flow_style=False,
allow_unicode=True)
- EOF
-
- - name: Check License
- if: >-
- github.event_name != 'pull_request' ||
- steps.changed-files.outputs.config_file != ''
- uses: apache/[email protected]
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- with:
- config: ${{ steps.changed-files.outputs.config_file ||
'.licenserc.yaml' }}
+ - name: Check license headers
+ uses: ./.github/actions/pr-license
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]