Skip to content

bazel: add mirror for rules_proto#67685

Merged
ti-chi-bot[bot] merged 2 commits into
pingcap:masterfrom
hawkingrei:add_mirror_for_rules_proto
Apr 11, 2026
Merged

bazel: add mirror for rules_proto#67685
ti-chi-bot[bot] merged 2 commits into
pingcap:masterfrom
hawkingrei:add_mirror_for_rules_proto

Conversation

@hawkingrei

@hawkingrei hawkingrei commented Apr 10, 2026

Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: close #xxx

Problem Summary:

What changed and how does it work?

Download from https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException GET returned 502 Bad Gateway or Proxy Error

ERROR: An error occurred during the fetch of repository 'rules_proto':

   Traceback (most recent call last):

	File "/home/jenkins/.tidb/tmp/903aa8c667333396b92cebbde26882dc/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl

		download_info = ctx.download_and_extract(

Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz] to /home/jenkins/.tidb/tmp/903aa8c667333396b92cebbde26882dc/external/rules_proto/temp13923969556053647191/rules_proto-6.0.0.tar.gz: GET returned 502 Bad Gateway or Proxy Error

ERROR: /home/jenkins/agent/workspace/pingcap/tidb/ghpr_check2/tidb/WORKSPACE:131:13: fetching http_archive rule //external:rules_proto: Traceback (most recent call last):

	File "/home/jenkins/.tidb/tmp/903aa8c667333396b92cebbde26882dc/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl

		download_info = ctx.download_and_extract(

Error in download_and_extract: java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz] to /home/jenkins/.tidb/tmp/903aa8c667333396b92cebbde26882dc/external/rules_proto/temp13923969556053647191/rules_proto-6.0.0.tar.gz: GET returned 502 Bad Gateway or Proxy Error

ERROR: Error computing the main repository mapping: no such package '@rules_proto//proto': java.io.IOException: Error downloading [https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz] to /home/jenkins/.tidb/tmp/903aa8c667333396b92cebbde26882dc/external/rules_proto/temp13923969556053647191/rules_proto-6.0.0.tar.gz: GET returned 502 Bad Gateway or Proxy Error

make: *** [Makefile:679: bazel_ci_simple_prepare] Error 1

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

Summary by CodeRabbit

  • Chores
    • Added alternative download mirrors for a core dependency to improve build reliability and reduce download failures.
    • Improved CI workflow PR detection and stale-run checks so pull request context is resolved more reliably and runs fail fast if the PR cannot be determined.

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed do-not-merge/needs-tests-checked labels Apr 10, 2026
@hawkingrei hawkingrei added the skip-issue-check Indicates that a PR no need to check linked issue. label Apr 10, 2026
@coderabbitai

coderabbitai Bot commented Apr 10, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Extended the WORKSPACE rules_proto http_archive to include three additional download URLs (two HTTP mirrors and one alternate HTTPS cache). Updated .github/workflows/update-bazel-files.yml to resolve PR metadata from workflow_run head fields, fetch the PR via GitHub API, and use workflow_run.head_sha for the stale-run guard.

Changes

Cohort / File(s) Summary
Workspace: rules_proto
WORKSPACE
Added three alternative download URLs to the existing http_archive(name = "rules_proto", ...) urls list; no other attributes changed.
CI workflow: PR metadata & stale guard
.github/workflows/update-bazel-files.yml
Resolve PR number from workflow_run head metadata (HEAD_REPO, HEAD_OWNER, HEAD_REF, RUN_HEAD_SHA), call GitHub API repos/${REPOSITORY}/pulls filtered by head, error if PR not found, and compare PR .head.sha to RUN_HEAD_SHA for stale-run detection instead of querying actions/runs.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Workflow as "GitHub Actions\nworkflow_run"
participant Script as "Workflow Job\n(resolve PR & stale check)"
participant GitHub as "GitHub API\n(repos/:owner/:repo/pulls)"
Workflow->>Script: provide head metadata (head_repo, head_ref, head_sha)
Script->>GitHub: GET /repos/{repo}/pulls?state=open&head={owner}:{ref}
GitHub-->>Script: return PR list (pick first -> pr.number, pr.head.sha)
Script->>Script: if pr.number == null -> exit error
Script->>Script: compare pr.head.sha vs workflow_run.head_sha
Script-->>Workflow: proceed or mark run stale

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • lance6716
  • xhebox
  • AilinKid
  • YangKeao

Poem

I’m a rabbit, quick and spry,
I add mirrors to help downloads fly,
CI now asks who started the run,
Checks the head SHA to see if it's done,
Hops of code and mirrored ways — hooray! 🐇✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is incomplete: it lacks proper issue linking, provides only an error log without explaining the solution, and does not detail what changed or how it works. Complete the description by adding issue number, explaining why mirrors solve the 502 error problem, and documenting the actual changes made to the WORKSPACE and workflow files.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'bazel: add mirror for rules_proto' directly matches the main change of adding alternative download URLs/mirrors for the rules_proto dependency.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
WORKSPACE (1)

161-166: Consider reordering URLs to prioritize mirrors before GitHub.

The current ordering lists the GitHub URL first (line 162), which means if it continues experiencing 502 errors, Bazel will attempt it first before falling back to the newly added mirrors. Most other http_archive entries in this file (e.g., bazel_skylib, io_bazel_rules_go, rules_cc) list internal mirrors (bazel-cache.pingcap.net, ats.apps.svc) before the GitHub URL to prioritize faster, more reliable sources.

♻️ Suggested URL reordering
     urls = [
-        "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
-        "https://cache.hawkingrei.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
         "http://bazel-cache.pingcap.net:8080/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
         "http://ats.apps.svc/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
+        "https://cache.hawkingrei.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
+        "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
     ],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@WORKSPACE` around lines 161 - 166, Reorder the urls array for the rules_proto
http_archive so internal mirrors are tried before GitHub: move the
bazel-cache.pingcap.net and ats.apps.svc entries (and any other internal mirror
like cache.hawkingrei.com) to appear before the GitHub URL in the urls list for
the rules_proto declaration; this matches other http_archive entries (e.g.,
bazel_skylib, io_bazel_rules_go, rules_cc) and ensures Bazel will attempt the
faster internal mirrors first when resolving rules_proto-6.0.0.tar.gz.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@WORKSPACE`:
- Around line 161-166: Reorder the urls array for the rules_proto http_archive
so internal mirrors are tried before GitHub: move the bazel-cache.pingcap.net
and ats.apps.svc entries (and any other internal mirror like
cache.hawkingrei.com) to appear before the GitHub URL in the urls list for the
rules_proto declaration; this matches other http_archive entries (e.g.,
bazel_skylib, io_bazel_rules_go, rules_cc) and ensures Bazel will attempt the
faster internal mirrors first when resolving rules_proto-6.0.0.tar.gz.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 0af3fa2b-77b8-494f-a1a8-223754f838e9

📥 Commits

Reviewing files that changed from the base of the PR and between cb1e1e6 and f02e3a9.

📒 Files selected for processing (1)
  • WORKSPACE

@ti-chi-bot ti-chi-bot Bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 10, 2026
@codecov

codecov Bot commented Apr 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.4341%. Comparing base (cb1e1e6) to head (6237c98).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #67685        +/-   ##
================================================
- Coverage   77.5947%   77.4341%   -0.1607%     
================================================
  Files          1981       1965        -16     
  Lines        548157     548328       +171     
================================================
- Hits         425341     424593       -748     
- Misses       122006     123733      +1727     
+ Partials        810          2       -808     
Flag Coverage Δ
integration 40.9756% <ø> (+6.6359%) ⬆️
unit 76.6678% <ø> (+0.3291%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 61.5065% <ø> (ø)
parser ∅ <ø> (∅)
br 49.9220% <ø> (-10.5044%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hawkingrei

Copy link
Copy Markdown
Member Author

/retest

1 similar comment
@hawkingrei

Copy link
Copy Markdown
Member Author

/retest

@ti-chi-bot ti-chi-bot Bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 10, 2026
@ti-chi-bot

ti-chi-bot Bot commented Apr 10, 2026

Copy link
Copy Markdown

[LGTM Timeline notifier]

Timeline:

  • 2026-04-10 07:30:10.68765846 +0000 UTC m=+1114215.893018517: ☑️ agreed by winoros.
  • 2026-04-10 09:13:50.417207185 +0000 UTC m=+1120435.622567252: ☑️ agreed by AilinKid.

@ti-chi-bot

ti-chi-bot Bot commented Apr 10, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, winoros, YangKeao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [AilinKid,YangKeao,winoros]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot Bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/update-bazel-files.yml:
- Around line 47-50: The workflow should treat a missing pull request as a no-op
instead of failing; update the block that checks pr_number (the if that
references pr_number, HEAD_OWNER and HEAD_REF) to not call exit 1 when pr_number
is empty or "null" — instead log a clear message (e.g., "No pull request found
for ${HEAD_OWNER}:${HEAD_REF}, skipping.") and exit with success (exit 0) or
simply return/continue so the job ends cleanly when state=open yields no PR.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d4eb8077-618f-4cae-ab1d-562e747b4e31

📥 Commits

Reviewing files that changed from the base of the PR and between f02e3a9 and 6237c98.

📒 Files selected for processing (1)
  • .github/workflows/update-bazel-files.yml

Comment on lines +47 to +50
if [[ -z "${pr_number}" || "${pr_number}" == "null" ]]; then
echo "Unable to resolve pull request for ${HEAD_OWNER}:${HEAD_REF}." >&2
exit 1
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Treat missing PR as a no-op instead of a workflow failure.

With state=open, this can legitimately happen if the PR is closed/merged before this job runs. Exiting 1 makes the automation noisy without actionable failure.

Suggested adjustment
-          if [[ -z "${pr_number}" || "${pr_number}" == "null" ]]; then
-            echo "Unable to resolve pull request for ${HEAD_OWNER}:${HEAD_REF}." >&2
-            exit 1
-          fi
+          if [[ -z "${pr_number}" || "${pr_number}" == "null" ]]; then
+            echo "No open pull request for ${HEAD_OWNER}:${HEAD_REF}; skipping."
+            exit 0
+          fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/update-bazel-files.yml around lines 47 - 50, The workflow
should treat a missing pull request as a no-op instead of failing; update the
block that checks pr_number (the if that references pr_number, HEAD_OWNER and
HEAD_REF) to not call exit 1 when pr_number is empty or "null" — instead log a
clear message (e.g., "No pull request found for ${HEAD_OWNER}:${HEAD_REF},
skipping.") and exit with success (exit 0) or simply return/continue so the job
ends cleanly when state=open yields no PR.

@wjhuang2016

Copy link
Copy Markdown
Member

@pantheon-bot please review this PR

@hawkingrei

Copy link
Copy Markdown
Member Author

/retest

2 similar comments
@hawkingrei

Copy link
Copy Markdown
Member Author

/retest

@hawkingrei

Copy link
Copy Markdown
Member Author

/retest

@hawkingrei

Copy link
Copy Markdown
Member Author

/test all

@hawkingrei

Copy link
Copy Markdown
Member Author

/retest

@ti-chi-bot ti-chi-bot Bot merged commit 6ee0edf into pingcap:master Apr 11, 2026
35 checks passed
premal pushed a commit to premal/tidb that referenced this pull request Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. skip-issue-check Indicates that a PR no need to check linked issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants