Skip to content

Commit

Permalink
Never add .buckconfig to RE actions
Browse files Browse the repository at this point in the history
Summary: Backout of D69535235, plus remove the code that inserts .buckconfig to all actions.

Reviewed By: iguridi

Differential Revision: D70614437

fbshipit-source-id: c3ceb90badf4ce5043094c395b25a75e1178518f
  • Loading branch information
Ian Childs authored and facebook-github-bot committed Mar 6, 2025
1 parent 41ca152 commit 9c46f1e
Show file tree
Hide file tree
Showing 8 changed files with 2 additions and 63 deletions.
2 changes: 0 additions & 2 deletions app/buck2_action_impl/src/actions/impls/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,6 @@ impl RunAction {
.collect(),
ctx.fs(),
ctx.digest_config(),
ctx.run_action_knobs()
.add_empty_dot_buckconfig_to_re_commands,
)?;

Ok(PreparedRunAction {
Expand Down
2 changes: 0 additions & 2 deletions app/buck2_build_api/src/actions/execute/action_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -866,8 +866,6 @@ mod tests {
.collect(),
ctx.fs(),
ctx.digest_config(),
ctx.run_action_knobs()
.add_empty_dot_buckconfig_to_re_commands,
)?,
SortedVectorMap::new(),
);
Expand Down
4 changes: 0 additions & 4 deletions app/buck2_build_api/src/actions/impls/run_action_knobs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ pub struct RunActionKnobs {
/// for network actions (download_file, cas_artifact). Used to support offline
/// builds.
pub use_network_action_output_cache: bool,

/// Whether to add an empty .buckconfig file to RE commands. This is needed to safely
/// kill this behavior.
pub add_empty_dot_buckconfig_to_re_commands: bool,
}

pub trait HasRunActionKnobs {
Expand Down
2 changes: 0 additions & 2 deletions app/buck2_build_api_tests/src/actions/testings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ impl Action for SimpleAction {
.collect(),
ctx.fs(),
ctx.digest_config(),
ctx.run_action_knobs()
.add_empty_dot_buckconfig_to_re_commands,
)?,
sorted_vector_map![],
);
Expand Down
14 changes: 0 additions & 14 deletions app/buck2_execute/src/execute/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use std::sync::Arc;
use std::time::Duration;

use allocative::Allocative;
use buck2_common::file_ops::FileMetadata;
use buck2_common::file_ops::TrackedFileDigest;
use buck2_common::local_resource_state::LocalResourceState;
use buck2_core::execution_types::executor_config::MetaInternalExtraParams;
Expand All @@ -26,7 +25,6 @@ use buck2_core::fs::project_rel_path::ProjectRelativePathBuf;
use buck2_core::soft_error;
use buck2_directory::directory::directory::Directory;
use buck2_directory::directory::directory_iterator::DirectoryIterator;
use buck2_directory::directory::entry::DirectoryEntry;
use buck2_error::buck2_error;
use derive_more::Display;
use dupe::Dupe;
Expand All @@ -42,7 +40,6 @@ use starlark_map::sorted_set::SortedSet;
use super::dep_file_digest::DepFileDigest;
use crate::artifact::group::artifact_group_values_dyn::ArtifactGroupValuesDyn;
use crate::digest_config::DigestConfig;
use crate::directory::insert_entry;
use crate::directory::ActionDirectoryMember;
use crate::directory::ActionImmutableDirectory;
use crate::execute::environment_inheritance::EnvironmentInheritance;
Expand Down Expand Up @@ -218,7 +215,6 @@ impl CommandExecutionPaths {
outputs: IndexSet<CommandExecutionOutput>,
fs: &ArtifactFs,
digest_config: DigestConfig,
add_empty_dot_buckconfig: bool,
) -> buck2_error::Result<Self> {
let mut builder = inputs_directory(&inputs, fs)?;

Expand All @@ -245,16 +241,6 @@ impl CommandExecutionPaths {
})
.collect::<buck2_error::Result<Vec<_>>>()?;

if add_empty_dot_buckconfig {
insert_entry(
&mut builder,
ProjectRelativePath::unchecked_new(".buckconfig"),
DirectoryEntry::Leaf(ActionDirectoryMember::File(FileMetadata::empty(
digest_config.cas_digest_config(),
))),
)?;
}

let input_directory = builder.fingerprint(digest_config.as_directory_serializer());

let mut input_files_bytes = 0;
Expand Down
4 changes: 0 additions & 4 deletions app/buck2_server/src/ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,6 @@ impl<'a> ServerCommandContext<'a> {
.daemon
.use_network_action_output_cache,
eager_dep_files,
add_empty_dot_buckconfig_to_re_commands: self
.base_context
.daemon
.add_empty_dot_buckconfig_to_re_commands,
};

let concurrency = self
Expand Down
12 changes: 0 additions & 12 deletions app/buck2_server/src/daemon/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ pub struct DaemonStateData {
/// Whether or not to hash all commands
pub hash_all_commands: bool,

/// Whether to add an empty .buckconfig file to RE commands. This is needed to safely
/// kill this behavior.
pub add_empty_dot_buckconfig_to_re_commands: bool,

/// Whether to consult the offline-cache buck-out dir for network action
/// outputs prior to running them. If no cached output exists, the action
/// (download_file, cas_artifact) will execute normally.
Expand Down Expand Up @@ -570,13 +566,6 @@ impl DaemonState {
.unwrap_or_else(RolloutPercentage::never)
.roll();

let add_empty_dot_buckconfig_to_re_commands = root_config
.parse(BuckconfigKeyRef {
section: "buck2",
property: "add_empty_dot_buckconfig_to_re_commands",
})?
.unwrap_or(true);

let use_network_action_output_cache = root_config
.parse(BuckconfigKeyRef {
section: "buck2",
Expand Down Expand Up @@ -658,7 +647,6 @@ impl DaemonState {
forkserver,
scribe_sink,
hash_all_commands,
add_empty_dot_buckconfig_to_re_commands,
use_network_action_output_cache,
disk_state_options,
start_time: std::time::Instant::now(),
Expand Down
25 changes: 2 additions & 23 deletions app/buck2_test/src/orchestrator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use buck2_build_api::actions::artifact::get_artifact_fs::GetArtifactFs;
use buck2_build_api::actions::execute::dice_data::CommandExecutorResponse;
use buck2_build_api::actions::execute::dice_data::DiceHasCommandExecutor;
use buck2_build_api::actions::execute::dice_data::GetReClient;
use buck2_build_api::actions::impls::run_action_knobs::HasRunActionKnobs;
use buck2_build_api::analysis::calculation::RuleAnalysisCalculation;
use buck2_build_api::artifact_groups::calculation::ArtifactGroupCalculation;
use buck2_build_api::artifact_groups::ArtifactGroup;
Expand Down Expand Up @@ -1387,20 +1386,10 @@ impl<'b> BuckTestOrchestrator<'b> {
.map(|(path, create)| CommandExecutionOutput::TestPath { path, create })
.collect();
let digest_config = dice.global_data().get_digest_config();
let add_dot_buckconfig_to_re_command = dice
.per_transaction_data()
.get_run_action_knobs()
.add_empty_dot_buckconfig_to_re_commands;
let mut request = CommandExecutionRequest::new(
vec![],
cmd,
CommandExecutionPaths::new(
inputs,
outputs,
fs,
digest_config,
add_dot_buckconfig_to_re_command,
)?,
CommandExecutionPaths::new(inputs, outputs, fs, digest_config)?,
env,
);
request = request
Expand Down Expand Up @@ -1502,10 +1491,6 @@ impl<'b> BuckTestOrchestrator<'b> {
default_timeout: Duration,
) -> anyhow::Result<PreparedLocalResourceSetupContext> {
let digest_config = dice.global_data().get_digest_config();
let add_dot_buckconfig_to_re_command = dice
.per_transaction_data()
.get_run_action_knobs()
.add_empty_dot_buckconfig_to_re_commands;

let inputs = dice
.try_compute_join(context.input_artifacts, |dice, group| {
Expand All @@ -1516,13 +1501,7 @@ impl<'b> BuckTestOrchestrator<'b> {
.into_iter()
.map(|group_values| CommandExecutionInput::Artifact(Box::new(group_values)))
.collect();
let paths = CommandExecutionPaths::new(
inputs,
indexset![],
fs,
digest_config,
add_dot_buckconfig_to_re_command,
)?;
let paths = CommandExecutionPaths::new(inputs, indexset![], fs, digest_config)?;
let mut execution_request =
CommandExecutionRequest::new(vec![], context.cmd, paths, Default::default());
execution_request =
Expand Down

0 comments on commit 9c46f1e

Please sign in to comment.