Skip to content

Include rctx.os.{name,arch} in the pre declared inputs hash#29148

Closed
fmeum wants to merge 1 commit intobazelbuild:masterfrom
fmeum:patch-47
Closed

Include rctx.os.{name,arch} in the pre declared inputs hash#29148
fmeum wants to merge 1 commit intobazelbuild:masterfrom
fmeum:patch-47

Conversation

@fmeum
Copy link
Copy Markdown
Collaborator

@fmeum fmeum commented Mar 30, 2026

Description

Motivation

Fixes bazel-contrib/rules_go#4581

Build API Changes

No

Checklist

  • I have added tests for the new use cases (if any).
  • I have updated the documentation (if applicable).

Release Notes

RELNOTES: The local and remote repo contents cache now include the host OS and CPU architecture in the cache key.

@github-actions github-actions bot added team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. awaiting-review PR is awaiting review from an assigned reviewer labels Mar 30, 2026
@fmeum fmeum requested review from Wyverald and meteorcloudy March 30, 2026 17:42
@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Mar 30, 2026

@bazel-io fork 9.0.2

@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Mar 30, 2026

@bazel-io fork 9.1.0

@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Mar 30, 2026

@bazel-io fork 8.7.0

@meteorcloudy
Copy link
Copy Markdown
Member

I guess there is no easy way to only add those when the repo rule inspects the value? Does http_archive actually do that?

@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Mar 31, 2026

We could track access to these fields as recorded inputs. That is a bit more complicated, but it could get us this behavior. I can try that instead if you think it's worth it - I could see this go both ways.

@Wyverald
Copy link
Copy Markdown
Member

Wyverald commented Mar 31, 2026

We could track access to these fields as recorded inputs.

This is probably not very easy -- these are marked structField = true (code), which means that they don't get access to a StarlarkThread. So we'd have to make StarlarkOS a smart object (bleugh...).

I guess counting os.name/arch as predeclared inputs is the least harmful way to go about this. (in which case please add a small RELNOTES)

@fmeum
Copy link
Copy Markdown
Collaborator Author

fmeum commented Mar 31, 2026

Done. Always including these values in the key also avoids nasty surprises if the output implicitly depends on the OS. Since cross-platform testing is rare, such issues would be very difficult to find for ruleset authors.

@meteorcloudy meteorcloudy added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Apr 1, 2026
@copybara-service copybara-service bot closed this in 2ec24b4 Apr 2, 2026
@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Apr 2, 2026
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Apr 2, 2026
…uild#29148)

### Description

### Motivation
Fixes bazel-contrib/rules_go#4581

### Build API Changes

No

### Checklist

- [ ] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: The local and remote repo contents cache now include the host OS and CPU architecture in the cache key.

Closes bazelbuild#29148.

PiperOrigin-RevId: 893352625
Change-Id: I02c0ded7ffe2b5aa9bc2ef489dc5240b5716ebdf
bazel-io pushed a commit to bazel-io/bazel that referenced this pull request Apr 2, 2026
…uild#29148)

### Description

### Motivation
Fixes bazel-contrib/rules_go#4581

### Build API Changes

No

### Checklist

- [ ] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: The local and remote repo contents cache now include the host OS and CPU architecture in the cache key.

Closes bazelbuild#29148.

PiperOrigin-RevId: 893352625
Change-Id: I02c0ded7ffe2b5aa9bc2ef489dc5240b5716ebdf
@fmeum fmeum deleted the patch-47 branch April 3, 2026 20:23
github-merge-queue bot pushed a commit that referenced this pull request Apr 3, 2026
…#29148) (#29195)

### Description

### Motivation
Fixes bazel-contrib/rules_go#4581

### Build API Changes

No

### Checklist

- [ ] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: The local and remote repo contents cache now include the host
OS and CPU architecture in the cache key.

Closes #29148.

PiperOrigin-RevId: 893352625
Change-Id: I02c0ded7ffe2b5aa9bc2ef489dc5240b5716ebdf

Commit
2ec24b4

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
github-merge-queue bot pushed a commit that referenced this pull request Apr 7, 2026
…#29148) (#29194)

### Description

### Motivation
Fixes bazel-contrib/rules_go#4581

### Build API Changes

No

### Checklist

- [ ] I have added tests for the new use cases (if any).
- [ ] I have updated the documentation (if applicable).

### Release Notes

RELNOTES: The local and remote repo contents cache now include the host
OS and CPU architecture in the cache key.

Closes #29148.

PiperOrigin-RevId: 893352625
Change-Id: I02c0ded7ffe2b5aa9bc2ef489dc5240b5716ebdf

Commit
2ec24b4

Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

go_download_sdk host SDK has platform-blind cache key, breaking --repository_cache across platforms (Bazel 8.3+)

3 participants