Skip to content

Push to bazel* caches from the main branch only#46151

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomainfrom
regis.desgroppes/push-to-bazel-cache-only-from-main
Feb 10, 2026
Merged

Push to bazel* caches from the main branch only#46151
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomainfrom
regis.desgroppes/push-to-bazel-cache-only-from-main

Conversation

@rdesgroppes
Copy link
Contributor

@rdesgroppes rdesgroppes commented Feb 9, 2026

What does this PR do?

Configure GitLab bazel* caches on ephemeral runners to use a pull-only policy by default, and pull-push only when running on the main branch.

This restriction applies only to GitLab caches - at this stage, the bazel remote cache remains indeed shared across all branches.

Motivation

  1. avoid cache pollution from feature and release branches while allowing main to populate the cache in a progressive manner,
  2. because the GitLab cache is uploaded to a shared S3 bucket, restricting uploads to main reduces S3 write contention and costs incurred by parallel cache overwrites.

Since the GitLab cache is shared across pipelines, allowing feature or release branches to push artifacts pollutes the cache with experimental entries from feature branches and meanwhile-evicted entries from oldest release branches.

Additional Notes

Release branches and feature branches behind main may fetch older dependencies, whereas feature branches ahead of main may fetch newer dependencies, but:

  • they'll still benefit from the bazel remote cache,
  • they'll no longer incur the overhead of uploading GitLab caches.

@rdesgroppes rdesgroppes added changelog/no-changelog No changelog entry needed qa/no-code-change No code change in Agent code requiring validation labels Feb 9, 2026
@github-actions github-actions bot added the short review PR is simple enough to be reviewed quickly label Feb 9, 2026
@dd-octo-sts dd-octo-sts bot added internal Identify a non-fork PR team/agent-build labels Feb 9, 2026
@agent-platform-auto-pr
Copy link
Contributor

agent-platform-auto-pr bot commented Feb 9, 2026

Gitlab CI Configuration Changes

⚠️ Diff too large to display on Github.

Changes Summary

Removed Modified Added Renamed
0 110 0 0

ℹ️ Diff available in the job log.

@rdesgroppes rdesgroppes marked this pull request as ready for review February 9, 2026 23:50
@rdesgroppes rdesgroppes requested a review from a team as a code owner February 9, 2026 23:50
@rdesgroppes rdesgroppes marked this pull request as draft February 9, 2026 23:51
Configure Bazel ephemeral cache to use `pull`-only policy by default and
`pull-push` only from the `main` branch.

This avoids cache pollution from feature branches while allowing `main`
to populate the cache.
@rdesgroppes rdesgroppes force-pushed the regis.desgroppes/push-to-bazel-cache-only-from-main branch from 0dfc9d4 to 18b8824 Compare February 10, 2026 00:39
@rdesgroppes rdesgroppes marked this pull request as ready for review February 10, 2026 01:37
@rdesgroppes rdesgroppes requested a review from a team as a code owner February 10, 2026 01:37
@rdesgroppes rdesgroppes changed the title Push to bazel* caches only from the main branch Push to bazel* caches from the main branch only Feb 10, 2026
@rdesgroppes
Copy link
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link

gh-worker-devflow-routing-ef8351 bot commented Feb 10, 2026

View all feedbacks in Devflow UI.

2026-02-10 09:01:44 UTC ℹ️ Start processing command /merge


2026-02-10 09:01:51 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 48m (p90).


2026-02-10 09:42:22 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit 0463d57 into main Feb 10, 2026
278 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the regis.desgroppes/push-to-bazel-cache-only-from-main branch February 10, 2026 09:42
@github-actions github-actions bot added this to the 7.77.0 milestone Feb 10, 2026
@rdesgroppes rdesgroppes added the backport/7.76.x Automatically create a backport PR to the 7.76.x branch once the PR is merged label Feb 10, 2026
dd-octo-sts bot added a commit that referenced this pull request Feb 10, 2026
… does this PR do? Configure GitLab `bazel*` caches on ephemeral runners to use a `pull`-only policy by default, and `pull-push` only when running on the `main` branch.

This restriction applies only to **GitLab** caches - at this stage, the `bazel` **remote** cache remains indeed shared across all branches.

### Motivation
1. avoid cache pollution from feature and release branches while allowing `main` to populate the cache in a _progressive_ manner,
2. because the GitLab cache is uploaded to a shared S3 bucket, restricting uploads to `main` reduces S3 write contention and costs incurred by parallel cache overwrites.

Because the GitLab cache is shared across pipelines, allowing feature or release branches to push artifacts pollutes the cache with _experimental_ entries from feature branches and _meanwhile-evicted_ entries from oldest release branches.

### Additional Notes
Release branches and feature branches _behind_ `main` may fetch _older_ dependencies, whereas feature branches _ahead_ of `main` may fetch _newer_ dependencies, but:
- they'll still benefit from the `bazel` remote cache,
- they'll no longer incur the overhead of uploading GitLab caches.

Co-authored-by: regis.desgroppes <[email protected]>
(cherry picked from commit 0463d57)

___

Co-authored-by: Régis Desgroppes <[email protected]>
gh-worker-dd-mergequeue-cf854d bot pushed a commit that referenced this pull request Feb 11, 2026
…#46179)

Backport 0463d57 from #46151.

 ___

### What does this PR do?
Configure GitLab `bazel*` caches on ephemeral runners to use a `pull`-only policy by default, and `pull-push` only when running on the `main` branch.

This restriction applies only to **GitLab** caches - at this stage, the `bazel` **remote** cache remains indeed shared across all branches.

### Motivation
1. avoid cache pollution from feature and release branches while allowing `main` to populate the cache in a _progressive_ manner,
2. because the GitLab cache is uploaded to a shared S3 bucket, restricting uploads to `main` reduces S3 write contention and costs incurred by parallel cache overwrites.

Because the GitLab cache is shared across pipelines, allowing feature or release branches to push artifacts pollutes the cache with _experimental_ entries from feature branches and _meanwhile-evicted_ entries from oldest release branches.

### Additional Notes
Release branches and feature branches _behind_ `main` may fetch _older_ dependencies, whereas feature branches _ahead_ of `main` may fetch _newer_ dependencies, but:
- they'll still benefit from the `bazel` remote cache,
- they'll no longer incur the overhead of uploading GitLab caches.

Co-authored-by: axel.vonengel <[email protected]>
dd-octo-sts bot added a commit that referenced this pull request Feb 12, 2026
… does this PR do? Configure GitLab `bazel*` caches on ephemeral runners to use a `pull`-only policy by default, and `pull-push` only when running on the `main` branch.

This restriction applies only to **GitLab** caches - at this stage, the `bazel` **remote** cache remains indeed shared across all branches.

### Motivation
1. avoid cache pollution from feature and release branches while allowing `main` to populate the cache in a _progressive_ manner,
2. because the GitLab cache is uploaded to a shared S3 bucket, restricting uploads to `main` reduces S3 write contention and costs incurred by parallel cache overwrites.

Because the GitLab cache is shared across pipelines, allowing feature or release branches to push artifacts pollutes the cache with _experimental_ entries from feature branches and _meanwhile-evicted_ entries from oldest release branches.

### Additional Notes
Release branches and feature branches _behind_ `main` may fetch _older_ dependencies, whereas feature branches _ahead_ of `main` may fetch _newer_ dependencies, but:
- they'll still benefit from the `bazel` remote cache,
- they'll no longer incur the overhead of uploading GitLab caches.

Co-authored-by: regis.desgroppes <[email protected]>
(cherry picked from commit 0463d57)

___

Co-authored-by: Régis Desgroppes <[email protected]>
gh-worker-dd-mergequeue-cf854d bot pushed a commit that referenced this pull request Feb 12, 2026
…#46325)

Backport 0463d57 from #46151.

 ___

### What does this PR do?
Configure GitLab `bazel*` caches on ephemeral runners to use a `pull`-only policy by default, and `pull-push` only when running on the `main` branch.

This restriction applies only to **GitLab** caches - at this stage, the `bazel` **remote** cache remains indeed shared across all branches.

### Motivation
1. avoid cache pollution from feature and release branches while allowing `main` to populate the cache in a _progressive_ manner,
2. because the GitLab cache is uploaded to a shared S3 bucket, restricting uploads to `main` reduces S3 write contention and costs incurred by parallel cache overwrites.

Because the GitLab cache is shared across pipelines, allowing feature or release branches to push artifacts pollutes the cache with _experimental_ entries from feature branches and _meanwhile-evicted_ entries from oldest release branches.

### Additional Notes
Release branches and feature branches _behind_ `main` may fetch _older_ dependencies, whereas feature branches _ahead_ of `main` may fetch _newer_ dependencies, but:
- they'll still benefit from the `bazel` remote cache,
- they'll no longer incur the overhead of uploading GitLab caches.

Co-authored-by: florent.clarret <[email protected]>
rdesgroppes added a commit that referenced this pull request Feb 26, 2026
### What does this PR do?
Wire up `bazel`-managed Go and `pip` caches to `XDG_CACHE_HOME` in the
bazel wrapper scripts, and adds the corresponding paths to the
progressive GitLab runner cache keyed on `.go-version` and
`.python-version`:
```diff
-.bazel:defs:cache:ephemeral
+.bazel:defs:cache:progressive
```

(my bad, "ephemeral" was kind of misleading: indeed used by ephemeral
_runners_, but not ephemeral in itself since it's _stored_ to S3)

### Motivation
Extend #43274's XDG-as-single-cache-root design to Go and `pip`, whose
XDG support has been steadlessly growing from "Partial" to "Supported":
https://wiki.archlinux.org/title/XDG_Base_Directory.

By landing in `$XDG_CACHE_HOME`, they inherit the progressive-cache
policy from #46151: only main pushes to them, keeping growth bounded.
Keying on language version files further contains growth by resetting
the cache at upgrade boundaries rather than accumulating superseded
artifacts.

### Additional Notes
No worry: the new cache paths are already excluded from omnibus source
trees via `**/.cache/**/*` source filters.

Coming soon: we might want to leverage upcoming `--strict_repo_env`
(with `bazel` 8.6+), for which we'll anyway have to list allowed
environment variables.

Near future: as the omnibus-bazel transition progresses, other caches
(`cache_omnibus_ruby_deps`, `go_deps`, `go_tools_deps`,
`go_tools_deps_arm64`, etc.) are expected to shrink until no longer
applicable.
rdesgroppes added a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
```diff
-.bazel:defs:cache:ephemeral
+.bazel:defs:cache:progressive
```

### Motivation
My bad, "ephemeral" was kind of misleading: admittedly used by ephemeral
_runners_, but not ephemeral in itself since it's stored to S3.

### Additional Notes
"progressive" better reflects the controlled policy introduced in #46151:
only `main` pushes to the cache, keeping it growing incrementally rather
than going back and forth depending on the last pushing branch - whether
antiquated or exploratory.
rdesgroppes added a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
```diff
-.bazel:defs:cache:ephemeral
+.bazel:defs:cache:progressive
```

### Motivation
My bad, "ephemeral" was kind of misleading: admittedly used by ephemeral
_runners_, but not ephemeral in itself since it's stored to S3.

### Additional Notes
"progressive" better reflects the controlled policy introduced in #46151:
only `main` pushes to the cache, keeping it growing incrementally rather
than going back and forth depending on the last pushing branch - whether
antiquated or exploratory.
rdesgroppes added a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
Wire up `bazel`-managed Go and `pip` caches to `XDG_CACHE_HOME` in the
bazel wrapper scripts, and adds the corresponding paths to the
progressive GitLab runner cache keyed on `.go-version` and
`.python-version`.

### Motivation
Extend #43274's XDG-as-single-cache-root design to Go and `pip`, whose
XDG support has been steadlessly growing from "Partial" to "Supported":
https://wiki.archlinux.org/title/XDG_Base_Directory.

By landing in `$XDG_CACHE_HOME`, they inherit the progressive-cache
policy from #46151: only `main` pushes to them, keeping growth bounded.
Keying on language version files further contains growth by resetting
the cache at version upgrade boundaries rather than accumulating
superseded artifacts.

### Additional Notes
No worry: the new cache paths are already excluded from omnibus source
trees via `**/.cache/**/*` source filters.

Coming soon: we might want to leverage upcoming `--strict_repo_env`
(with `bazel` 8.6+), for which we'll anyway have to list allowed
environment variables.

Near future: as the omnibus-bazel transition progresses, other caches
(`cache_omnibus_ruby_deps`, `go_deps`, `go_tools_deps`,
`go_tools_deps_arm64`, etc.) are expected to shrink until no longer
applicable.
rdesgroppes added a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
Wire up `bazel`-managed Go and `pip` caches to `XDG_CACHE_HOME` in the
`tools/bazel*` scripts, and add the corresponding paths to the
progressive GitLab runner cache keyed on `.go-version` and
`.python-version`.

### Motivation
Extend #43274's XDG-as-single-cache-root design to Go and `pip`, whose
XDG support has been steadlessly growing from "Partial" to "Supported":
https://wiki.archlinux.org/title/XDG_Base_Directory.

By landing in `$XDG_CACHE_HOME`, they inherit the progressive-cache
policy from #46151: only `main` pushes to them, keeping growth bounded.
Keying on language version files further contains growth by resetting
the cache at version upgrade boundaries rather than accumulating
superseded artifacts.

### Additional Notes
No worry: the new cache paths are already excluded from omnibus source
trees via `**/.cache/**/*` source filters.

Coming soon: we might want to leverage upcoming `--strict_repo_env`
(with `bazel` 8.6+), for which we'll anyway have to list allowed
environment variables.

Near future: as the omnibus-bazel transition progresses, other caches
(`cache_omnibus_ruby_deps`, `go_deps`, `go_tools_deps`,
`go_tools_deps_arm64`, etc.) are expected to shrink until no longer
applicable.
rdesgroppes added a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
Wire up `bazel`-managed Go and `pip` caches to `XDG_CACHE_HOME` in the
`tools/bazel*` scripts, and add the corresponding paths to the
progressive GitLab runner cache keyed on `.go-version` and
`.python-version`.

### Motivation
Extend #43274's XDG-as-single-cache-root design to Go and `pip`, whose
XDG support has been steadlessly growing from "Partial" to "Supported":
https://wiki.archlinux.org/title/XDG_Base_Directory.

By landing in `$XDG_CACHE_HOME`, they inherit the progressive-cache
policy from #46151: only `main` pushes to them, keeping growth bounded.
Keying on language version files further contains growth by resetting
the cache at version upgrade boundaries rather than accumulating
superseded artifacts.

### Additional Notes
No worry: the new cache paths are already excluded from omnibus source
trees via `**/.cache/**/*` source filters.

Coming soon: we might want to leverage upcoming `--strict_repo_env`
(with `bazel` 8.6+), for which we'll anyway have to list allowed
environment variables.

Near future: as the omnibus-bazel transition progresses, other caches
(`cache_omnibus_ruby_deps`, `go_deps`, `go_tools_deps`,
`go_tools_deps_arm64`, etc.) are expected to shrink until no longer
applicable.
rdesgroppes added a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
Wire up `bazel`-managed Go and `pip` caches to `XDG_CACHE_HOME` in the
`tools/bazel*` scripts, and add the corresponding paths to the
progressive GitLab runner cache keyed on `.go-version` and
`.python-version`.

### Motivation
Extend #43274's XDG-as-single-cache-root design to Go and `pip`, whose
XDG support has been steadlessly growing from "Partial" to "Supported":
https://wiki.archlinux.org/title/XDG_Base_Directory.

By landing in `$XDG_CACHE_HOME`, they inherit the progressive-cache
policy from #46151: only `main` pushes to them, keeping growth bounded.
Keying on language version files further contains growth by resetting
the cache at version upgrade boundaries rather than accumulating
superseded artifacts.

### Additional Notes
No worry: the new cache paths are already excluded from omnibus source
trees via `**/.cache/**/*` source filters.

Coming soon: we might want to leverage upcoming `--strict_repo_env`
(with `bazel` 8.6+), for which we'll anyway have to list allowed
environment variables.

Near future: as the omnibus-bazel transition progresses, other caches
(`cache_omnibus_ruby_deps`, `go_deps`, `go_tools_deps`,
`go_tools_deps_arm64`, etc.) are expected to shrink until no longer
applicable.
gh-worker-dd-mergequeue-cf854d bot pushed a commit that referenced this pull request Feb 27, 2026
### What does this PR do?
Wire up `bazel`-managed Go and `pip` caches to `XDG_CACHE_HOME` in the `tools/bazel*` scripts, and add the corresponding paths to the progressive GitLab runner cache keyed on `.go-version` and `.python-version`.

### Motivation
Extend #43274's XDG-as-single-cache-root design to Go and `pip`, whose XDG support has been steadlessly growing from "Partial" to "Supported": https://wiki.archlinux.org/title/XDG_Base_Directory.

By landing in `$XDG_CACHE_HOME`, they inherit the progressive-cache policy from #46151: only `main` pushes to them, keeping growth bounded.
Keying on language version files further contains growth by resetting the cache at version upgrade boundaries rather than accumulating superseded artifacts.

### Additional Notes
No worry: the new cache paths are already excluded from omnibus source trees via `**/.cache/**/*` source filters.

Coming soon: we might want to leverage upcoming `--strict_repo_env` (with `bazel` 8.6.0, #47011), for which we'll anyway have to list propagated environment variables.

Near future: as the omnibus-bazel transition progresses, other caches (`cache_omnibus_ruby_deps`, `go_deps`, `go_tools_deps`, `go_tools_deps_arm64`, etc.) are expected to shrink until no longer applicable.

Co-authored-by: regis.desgroppes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/7.76.x Automatically create a backport PR to the 7.76.x branch once the PR is merged changelog/no-changelog No changelog entry needed internal Identify a non-fork PR qa/no-code-change No code change in Agent code requiring validation short review PR is simple enough to be reviewed quickly team/agent-build team/agent-devx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants