Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure PATH to shims are absolute for the protobuf buf linter. #17367

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from dataclasses import dataclass

from pants.backend.codegen.protobuf.lint.buf.skip_field import SkipBufFormatField
Expand Down Expand Up @@ -98,7 +99,7 @@ async def run_buf_format(
output_files=request.files,
description=f"Run buf format on {pluralize(len(request.files), 'file')}.",
level=LogLevel.DEBUG,
env={"PATH": binary_shims.bin_directory},
env={"PATH": os.path.join("{chroot}", binary_shims.bin_directory)},
Copy link
Contributor

Choose a reason for hiding this comment

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

This won't work with remote execution without a wrapper script. (This is a general problem of {chroot} not specific to buf.)

Copy link
Member Author

Choose a reason for hiding this comment

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

🤔

Copy link
Contributor

@tdyas tdyas Oct 27, 2022

Choose a reason for hiding this comment

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

Coincidentally, this should be solvable in remote execution once #17290 lands because that adds a wrapper script for remote execution to support append-only caches in the remote environment. Then solving the PATH issue is just a matter of adding the additional shell code to substitute in the remote executor's input root path.

Copy link
Member Author

Choose a reason for hiding this comment

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

PATH=${PATH//\{chroot\}/$(pwd)}

),
)
return await FmtResult.create(request, result)
Expand Down