Skip to content

Add support for archived tree path mapping.#29567

Closed
dabanki wants to merge 2 commits into
bazelbuild:masterfrom
dabanki:change-326450
Closed

Add support for archived tree path mapping.#29567
dabanki wants to merge 2 commits into
bazelbuild:masterfrom
dabanki:change-326450

Conversation

@dabanki
Copy link
Copy Markdown
Contributor

@dabanki dabanki commented May 18, 2026

Description

This PR enables output path mapping (config stripping) for ArchivedTreeArtifacts.

ArchivedTreeArtifacts are compressed .zip container directories generated for remote transfer that inject a virtual prefix segment (:archived_tree_artifacts) immediately after the output root (e.g. bazel-out/:archived_tree_artifacts/k8-fastbuild/bin/...).

Previously, StrippingPathMapper hardcoded the configuration segment location at segment index 1 and the root-relative path at segment index 2. This caused Bazel to strip the :archived_tree_artifacts prefix instead of the configuration prefix, leading to incorrect string length calculations and path translations.

We resolved this by:

  1. Introducing a dynamic getConfigSegmentIndex(execPath) method that shifts the configuration segment index from 1 to 2 when the :archived_tree_artifacts prefix is present.
  2. Consolidating the string-stripping regex pattern inside StringStripper into a single, pattern using an optional capturing group (:archived_tree_artifacts/)?.
  3. Adding unit and integration tests to cover the newly added functionality.

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: Enabled output path mapping (config stripping) support for ArchivedTreeArtifacts to improve action caching under --experimental_output_paths=strip.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 18, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dabanki dabanki requested review from aranguyen and fmeum May 18, 2026 20:07
@dabanki dabanki marked this pull request as ready for review May 18, 2026 20:07
@dabanki dabanki requested a review from a team as a code owner May 18, 2026 20:07
@github-actions github-actions Bot added team-Configurability platforms, toolchains, cquery, select(), config transitions awaiting-review PR is awaiting review from an assigned reviewer labels May 18, 2026
expect_log_n 'Hello, stdout!' 2
}

function test_path_stripping_archived_tree_artifacts() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Could you also add a test that covers archived tree artifacts in runfiles?

// TODO(bazel-team): Add path mapping support for archived tree artifacts.
is a TODO that would probably need to be resolved for this, but it may be very easy (just mapForRunfiles the location).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Updated.

@github-actions github-actions Bot added the community-reviewed Reviewed by a trusted community contributor label May 18, 2026
@dabanki dabanki changed the title trying to support archived tree path mapping. Add support for archived tree path mapping. May 18, 2026
@pzembrod pzembrod 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 May 19, 2026
@dabanki
Copy link
Copy Markdown
Contributor Author

dabanki commented May 20, 2026

Thanks! I'll handle pulling this one in internally, there are a couple other changes that need to be made on top of this to land.

@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 May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-reviewed Reviewed by a trusted community contributor team-Configurability platforms, toolchains, cquery, select(), config transitions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants