Repository navigation
Support private GitHub release assets as SDP archives - #169
Merged
Merged
Conversation
Bazel 8 cannot download GitHub release assets through the REST API (https://api.github.com/repos/<owner>/<repo>/releases/assets/<id>), which is the only way to fetch assets of private repositories. Its downloader always appends a browser-like Accept header, so GitHub answers with the JSON asset metadata instead of the archive and the checksum check fails. A credential helper cannot fix this, because it can only add headers. The downloader was fixed in Bazel 9 (bazelbuild/bazel@80d531eb7ce2). Add a github_release_archive repository rule that the gcc extension uses for such URLs instead of http_archive. The gcc.sdp API is unchanged. On a repository cache miss, tools/fetch_github_release_asset.py downloads the asset and the rule hands it to Bazel as a local file, so the checksum check and the repository cache still apply. The short-lived signed download URL never reaches Bazel and therefore never shows up in the console output or the Build Event Protocol. Regenerate tests/MODULE.bazel.lock for the changed extension. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4og
requested review from
AlexanderLanin,
antonkri,
dcalavrezo-qorix,
nradakovic and
odra
as code owners
October 27, 2026 09:28
Keep the GitHub release asset workaround out of the gcc extension. The new rules/http_archive.bzl provides an http_archive with the same arguments the extension uses and decides which repository rule to call: github_release_archive for GitHub REST API release asset URLs, the native http_archive otherwise. The extension only changes its load statement, so the workaround can be removed in one place once Bazel 9 is required. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nradakovic
approved these changes
Oct 28, 2026
4og
added a commit
to eclipse-score/baselibs
that referenced
this pull request
Oct 30, 2026
The QNX SDP 8.0.5 is published as an asset of a private GitHub release (eclipse-score/qnx_sdp_pkg). Bazel 8 cannot download such assets, so the SDP is fetched through the http_archive wrapper of score_bazel_cpp_toolchains (eclipse-score/bazel_cpp_toolchains#169). Add score-qnx-{x86_64,aarch64}-sdp_8.0.5 configs that inherit the existing QNX configs and register the 8.0.5 qcc and IFS toolchains last, so they take precedence. The default configs and local development are unchanged and do not fetch the private SDP. Run the QNX coverage workflow with the new SDP on pull_request instead of pull_request_target and without the GitHub Actions Bazel cache. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
We want to host a QNX SDP as a release asset of a private GitHub repository and consume it via
gcc.sdp(url = ...). Private assets can only be downloaded through the REST API:GitHub returns the archive (via a 302 to a short-lived signed URL) only if
application/octet-streamis the soleAcceptvalue. Otherwise it returns the asset's JSON metadata.Bazel 8 cannot do this:
HttpConnectoralways addsAccept: text/html, image/gif, image/jpeg, */*, and headers from a credential helper are added to it, not replacing it. GitHub then sends the JSON metadata, and the fetch fails with a checksum mismatch (Checksum was <sha of ~640 byte JSON> but wanted <sha of archive>).headersandexpiresfrom its response, so it cannot remove the default header or change the URL.https://github.com/<owner>/<repo>/releases/download/<tag>/<file>does not accept API tokens for private repositories (it returns 404).What
http_archivewrapper (rules/http_archive.bzl) with the same arguments thegccextension passes today. It decides which repository rule to call:github_release_archiveifurlsis a singlehttps://api.github.com/repos/<owner>/<repo>/releases/assets/<id>URL, the nativehttp_archiveotherwise. The only change inextensions/gcc.bzlis itsloadstatement, so the workaround acts as a plug-in and can be removed in one place once Bazel 9 is required.github_release_archiverepository rule (rules/github_release_archive.bzl) that does the actual fetch.gcc.sdpAPI is unchanged. It accepts the same attributes (build_file,patches,patch_*,files,strip_prefix, ...). For these URLs,sha256andtypeare mandatory.tools/fetch_github_release_asset.pyresolves the signed URL and downloads the asset. Bazel then ingests it throughrctx.download(url = "file://...", sha256 = ..., canonical_id = ...), so:bazel clean --expunge) need no token and no network;SCORE_GITHUB_TOKEN/GITHUB_TOKEN/GH_TOKENor from netrc (api.github.comorgithub.com). It is only sent toapi.github.comand never to the redirect target. It is not part of the repository definition, so rotating it does not trigger a refetch.docs/extension_api.md,docs/qnx_integration.md.tests/MODULE.bazel.lockwas regenerated. Only the extension digest and attribute order changed.Once all consumers use Bazel 9, this rule can be dropped and
http_archivewith a credential helper used instead.Testing
Tested in
eclipse-score/baselibswith Bazel 8.6.0 and alocal_path_override, usinggcc.sdp(url = "https://api.github.com/repos/.../releases/assets/<id>", type = "tar.gz", ...)(~1.7 GB SDP),bazel build --config=score-qnx-x86_64 -- //score/bitmanipulation/...:--build_event_json_filecontain no signed URL. The only fetch URL for the SDP is the localfile:path.bazel clean --expunge, then a build with no token: served from the repository cache, so it passes.GitHub API returned HTTP 404. Check that a token with read access is available.tests/:--config=x86_64-linuxbuild of//:language_and_standards_tests //:feature_verification_testsand//:guardrail_testspass, so thehttp_archivepath is unchanged.bazel mod show_repoconfirms the SDP repository is agithub_release_archiveand the GCC packages are still nativehttp_archive.//:format.check,//:copyright.check