From b99ea5fbcae2946a8ecb3932fab4a4412d62f445 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Smolarek?= <34063647+Razz4780@users.noreply.github.com> Date: Tue, 21 Jan 2025 19:27:44 +0100 Subject: [PATCH] 3.130.0 (#3027) * 3.130.0 * Fixed mirrord ext * Fix on macos --- CHANGELOG.md | 34 +++++++++++ Cargo.lock | 56 +++++++++---------- Cargo.toml | 2 +- changelog.d/+added-log-leve.internal.md | 1 - .../+improve-env-config-docs.changed.md | 1 - changelog.d/2221.added.md | 1 - changelog.d/2936.fixed.md | 1 - changelog.d/3013.fixed.md | 2 - changelog.d/3024.fixed.md | 1 - mirrord/cli/src/execution.rs | 9 +-- mirrord/cli/src/extension.rs | 20 ++----- mirrord/config/src/lib.rs | 8 +-- 12 files changed, 78 insertions(+), 58 deletions(-) delete mode 100644 changelog.d/+added-log-leve.internal.md delete mode 100644 changelog.d/+improve-env-config-docs.changed.md delete mode 100644 changelog.d/2221.added.md delete mode 100644 changelog.d/2936.fixed.md delete mode 100644 changelog.d/3013.fixed.md delete mode 100644 changelog.d/3024.fixed.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 87bf68e74a9..0e23be72090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,40 @@ This project uses [*towncrier*](https://towncrier.readthedocs.io/) and the chang +## [3.130.0](https://github.com/metalbear-co/mirrord/tree/3.130.0) - 2025-01-21 + + +### Added + +- Added support for `rmdir`, `unlink` and `unlinkat`. + [#2221](https://github.com/metalbear-co/mirrord/issues/2221) + + +### Changed + +- Updated `configuration.md` and improved `.feature.env.mapping` doc. + + +### Fixed + +- Stopped mirrord entering a crash loop when trying to load into some processes + like VSCode's `watchdog.js` when the user config contained a call to + `get_env()`, which occurred due to missing env - the config is now only + rendered once and set into an env var. + [#2936](https://github.com/metalbear-co/mirrord/issues/2936) +- Fixed an issue where HTTP requests stolen with a filter would hang with a + single-threaded local HTTP server. + Improved handling of incoming connections on the local machine (e.g + introduces reuse of local HTTP connections). + [#3013](https://github.com/metalbear-co/mirrord/issues/3013) +- Moved to an older builder base image for aarch64 to support centos-7 libc. + [#3024](https://github.com/metalbear-co/mirrord/issues/3024) + + +### Internal + +- Extended `mirrord-protocol` with info logs from the agent. + ## [3.129.0](https://github.com/metalbear-co/mirrord/tree/3.129.0) - 2025-01-14 diff --git a/Cargo.lock b/Cargo.lock index 3ce40063e35..fd42ec7bb37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2400,7 +2400,7 @@ dependencies = [ [[package]] name = "fileops" -version = "3.129.0" +version = "3.130.0" dependencies = [ "libc", ] @@ -3518,7 +3518,7 @@ checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "issue1317" -version = "3.129.0" +version = "3.130.0" dependencies = [ "actix-web", "env_logger 0.11.6", @@ -3528,7 +3528,7 @@ dependencies = [ [[package]] name = "issue1776" -version = "3.129.0" +version = "3.130.0" dependencies = [ "errno 0.3.10", "libc", @@ -3537,7 +3537,7 @@ dependencies = [ [[package]] name = "issue1776portnot53" -version = "3.129.0" +version = "3.130.0" dependencies = [ "libc", "socket2", @@ -3545,14 +3545,14 @@ dependencies = [ [[package]] name = "issue1899" -version = "3.129.0" +version = "3.130.0" dependencies = [ "libc", ] [[package]] name = "issue2001" -version = "3.129.0" +version = "3.130.0" dependencies = [ "libc", ] @@ -3873,7 +3873,7 @@ checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "listen_ports" -version = "3.129.0" +version = "3.130.0" [[package]] name = "litemap" @@ -4114,7 +4114,7 @@ dependencies = [ [[package]] name = "mirrord" -version = "3.129.0" +version = "3.130.0" dependencies = [ "actix-codec", "clap", @@ -4170,7 +4170,7 @@ dependencies = [ [[package]] name = "mirrord-agent" -version = "3.129.0" +version = "3.130.0" dependencies = [ "actix-codec", "async-trait", @@ -4225,7 +4225,7 @@ dependencies = [ [[package]] name = "mirrord-analytics" -version = "3.129.0" +version = "3.130.0" dependencies = [ "assert-json-diff", "base64 0.22.1", @@ -4239,7 +4239,7 @@ dependencies = [ [[package]] name = "mirrord-auth" -version = "3.129.0" +version = "3.130.0" dependencies = [ "bcder", "chrono", @@ -4260,7 +4260,7 @@ dependencies = [ [[package]] name = "mirrord-config" -version = "3.129.0" +version = "3.130.0" dependencies = [ "base64 0.22.1", "bimap", @@ -4284,7 +4284,7 @@ dependencies = [ [[package]] name = "mirrord-config-derive" -version = "3.129.0" +version = "3.130.0" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", @@ -4294,7 +4294,7 @@ dependencies = [ [[package]] name = "mirrord-console" -version = "3.129.0" +version = "3.130.0" dependencies = [ "bincode", "drain", @@ -4310,7 +4310,7 @@ dependencies = [ [[package]] name = "mirrord-intproxy" -version = "3.129.0" +version = "3.130.0" dependencies = [ "bytes", "exponential-backoff", @@ -4338,7 +4338,7 @@ dependencies = [ [[package]] name = "mirrord-intproxy-protocol" -version = "3.129.0" +version = "3.130.0" dependencies = [ "bincode", "mirrord-protocol", @@ -4348,7 +4348,7 @@ dependencies = [ [[package]] name = "mirrord-kube" -version = "3.129.0" +version = "3.130.0" dependencies = [ "actix-codec", "async-stream", @@ -4372,7 +4372,7 @@ dependencies = [ [[package]] name = "mirrord-layer" -version = "3.129.0" +version = "3.130.0" dependencies = [ "actix-codec", "base64 0.22.1", @@ -4415,7 +4415,7 @@ dependencies = [ [[package]] name = "mirrord-layer-macro" -version = "3.129.0" +version = "3.130.0" dependencies = [ "proc-macro2", "quote", @@ -4424,7 +4424,7 @@ dependencies = [ [[package]] name = "mirrord-macros" -version = "3.129.0" +version = "3.130.0" dependencies = [ "proc-macro2", "proc-macro2-diagnostics", @@ -4434,7 +4434,7 @@ dependencies = [ [[package]] name = "mirrord-operator" -version = "3.129.0" +version = "3.130.0" dependencies = [ "base64 0.22.1", "bincode", @@ -4467,7 +4467,7 @@ dependencies = [ [[package]] name = "mirrord-progress" -version = "3.129.0" +version = "3.130.0" dependencies = [ "enum_dispatch", "indicatif", @@ -4501,7 +4501,7 @@ dependencies = [ [[package]] name = "mirrord-sip" -version = "3.129.0" +version = "3.130.0" dependencies = [ "apple-codesign", "object 0.36.7", @@ -4514,7 +4514,7 @@ dependencies = [ [[package]] name = "mirrord-vpn" -version = "3.129.0" +version = "3.130.0" dependencies = [ "futures", "ipnet", @@ -4862,7 +4862,7 @@ dependencies = [ [[package]] name = "outgoing" -version = "3.129.0" +version = "3.130.0" [[package]] name = "outref" @@ -5923,14 +5923,14 @@ dependencies = [ [[package]] name = "rust-bypassed-unix-socket" -version = "3.129.0" +version = "3.130.0" dependencies = [ "tokio", ] [[package]] name = "rust-e2e-fileops" -version = "3.129.0" +version = "3.130.0" dependencies = [ "libc", ] @@ -5946,7 +5946,7 @@ dependencies = [ [[package]] name = "rust-unix-socket-client" -version = "3.129.0" +version = "3.130.0" dependencies = [ "tokio", ] diff --git a/Cargo.toml b/Cargo.toml index 9a2b2a42cae..9f01963dc6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ resolver = "2" # latest commits on rustls suppress certificate verification [workspace.package] -version = "3.129.0" +version = "3.130.0" edition = "2021" license = "MIT" readme = "README.md" diff --git a/changelog.d/+added-log-leve.internal.md b/changelog.d/+added-log-leve.internal.md deleted file mode 100644 index 604957c5641..00000000000 --- a/changelog.d/+added-log-leve.internal.md +++ /dev/null @@ -1 +0,0 @@ -Extended `mirrord-protocol` with info logs from the agent. \ No newline at end of file diff --git a/changelog.d/+improve-env-config-docs.changed.md b/changelog.d/+improve-env-config-docs.changed.md deleted file mode 100644 index 79e19a7ced7..00000000000 --- a/changelog.d/+improve-env-config-docs.changed.md +++ /dev/null @@ -1 +0,0 @@ -Update configuration.md and improve config env.mapping list. diff --git a/changelog.d/2221.added.md b/changelog.d/2221.added.md deleted file mode 100644 index fe396a1ac03..00000000000 --- a/changelog.d/2221.added.md +++ /dev/null @@ -1 +0,0 @@ -Add rmdir / unlink / unlinkat support diff --git a/changelog.d/2936.fixed.md b/changelog.d/2936.fixed.md deleted file mode 100644 index e4dfd4792a6..00000000000 --- a/changelog.d/2936.fixed.md +++ /dev/null @@ -1 +0,0 @@ -Stopped mirrord entering a crash loop when trying to load into some processes like VSCode's `watchdog.js` when the user config contained a call to `get_env()`, which occurred due to missing env - the config is now only rendered once and set into an env var. \ No newline at end of file diff --git a/changelog.d/3013.fixed.md b/changelog.d/3013.fixed.md deleted file mode 100644 index 811ab816b8c..00000000000 --- a/changelog.d/3013.fixed.md +++ /dev/null @@ -1,2 +0,0 @@ -Fixed an issue where HTTP requests stolen with a filter would hang with a single-threaded local HTTP server. -Improved handling of incoming connections on the local machine (e.g introduces reuse of local HTTP connections). diff --git a/changelog.d/3024.fixed.md b/changelog.d/3024.fixed.md deleted file mode 100644 index c584f5269ed..00000000000 --- a/changelog.d/3024.fixed.md +++ /dev/null @@ -1 +0,0 @@ -use older builder base image for aarch64 to support centos-7 libc diff --git a/mirrord/cli/src/execution.rs b/mirrord/cli/src/execution.rs index 5d3e9657e88..611c45172ce 100644 --- a/mirrord/cli/src/execution.rs +++ b/mirrord/cli/src/execution.rs @@ -7,7 +7,7 @@ use std::{ use mirrord_analytics::{AnalyticsError, AnalyticsReporter, Reporter}; use mirrord_config::{ config::ConfigError, feature::env::mapper::EnvVarsRemapper, - internal_proxy::MIRRORD_INTPROXY_CONNECT_TCP_ENV, LayerConfig, + internal_proxy::MIRRORD_INTPROXY_CONNECT_TCP_ENV, LayerConfig, MIRRORD_RESOLVED_CONFIG_ENV, }; use mirrord_intproxy::agent_conn::AgentConnectInfo; use mirrord_operator::client::OperatorSession; @@ -269,7 +269,7 @@ impl MirrordExecution { let stdout = proxy_process.stdout.take().expect("stdout was piped"); - let address: SocketAddr = BufReader::new(stdout) + let intproxy_address: SocketAddr = BufReader::new(stdout) .lines() .next_line() .await @@ -288,9 +288,10 @@ impl MirrordExecution { )) })?; - // Provide details for layer to connect to agent via internal proxy - config.connect_tcp = Some(format!("127.0.0.1:{}", address.port())); + config.connect_tcp.replace(intproxy_address.to_string()); config.update_env_var()?; + let config_as_env = config.to_env_var()?; + env_vars.insert(MIRRORD_RESOLVED_CONFIG_ENV.to_string(), config_as_env); // Fixes // by disabling the fork safety check in the Objective-C runtime. diff --git a/mirrord/cli/src/extension.rs b/mirrord/cli/src/extension.rs index 005491a9aed..f46e91e5092 100644 --- a/mirrord/cli/src/extension.rs +++ b/mirrord/cli/src/extension.rs @@ -4,7 +4,7 @@ use mirrord_analytics::{AnalyticsError, AnalyticsReporter, Reporter}; use mirrord_config::{LayerConfig, MIRRORD_CONFIG_FILE_ENV}; use mirrord_progress::{JsonProgress, Progress, ProgressTracker}; -use crate::{config::ExtensionExecArgs, error::CliError, execution::MirrordExecution, CliResult}; +use crate::{config::ExtensionExecArgs, execution::MirrordExecution, CliResult}; /// Actually facilitate execution after all preparations were complete async fn mirrord_exec

( @@ -40,23 +40,15 @@ where pub(crate) async fn extension_exec(args: ExtensionExecArgs, watch: drain::Watch) -> CliResult<()> { let progress = ProgressTracker::try_from_env("mirrord preparing to launch") .unwrap_or_else(|| JsonProgress::new("mirrord preparing to launch").into()); - let mut env: HashMap = HashMap::new(); + // Set environment required for `LayerConfig::from_env_with_warnings`. if let Some(config_file) = args.config_file.as_ref() { - // Set canoncialized path to config file, in case forks/children are in different - // working directories. - let full_path = std::fs::canonicalize(config_file) - .map_err(|e| CliError::CanonicalizeConfigPathFailed(config_file.into(), e))?; - std::env::set_var(MIRRORD_CONFIG_FILE_ENV, full_path.clone()); - env.insert( - MIRRORD_CONFIG_FILE_ENV.into(), - full_path.to_string_lossy().into(), - ); + std::env::set_var(MIRRORD_CONFIG_FILE_ENV, config_file); } if let Some(target) = args.target.as_ref() { std::env::set_var("MIRRORD_IMPERSONATED_TARGET", target.clone()); - env.insert("MIRRORD_IMPERSONATED_TARGET".into(), target.to_string()); } + let (config, mut context) = LayerConfig::from_env_with_warnings()?; let mut analytics = AnalyticsReporter::only_error(config.telemetry, Default::default(), watch); @@ -69,14 +61,14 @@ pub(crate) async fn extension_exec(args: ExtensionExecArgs, watch: drain::Watch) #[cfg(target_os = "macos")] let execution_result = mirrord_exec( args.executable.as_deref(), - env, + Default::default(), config, progress, &mut analytics, ) .await; #[cfg(not(target_os = "macos"))] - let execution_result = mirrord_exec(env, config, progress, &mut analytics).await; + let execution_result = mirrord_exec(Default::default(), config, progress, &mut analytics).await; if execution_result.is_err() && !analytics.has_error() { analytics.set_error(AnalyticsError::Unknown); diff --git a/mirrord/config/src/lib.rs b/mirrord/config/src/lib.rs index 8414bd742df..d3f8fae7bc6 100644 --- a/mirrord/config/src/lib.rs +++ b/mirrord/config/src/lib.rs @@ -345,15 +345,15 @@ impl LayerConfig { /// Given a [`LayerConfig`], serialise it and convert to base 64 so it can be /// set into [`MIRRORD_RESOLVED_CONFIG_ENV`]. - fn to_env_var(&self) -> Result { + pub fn to_env_var(&self) -> Result { let serialized = serde_json::to_string(self) .map_err(|error| ConfigError::EnvVarEncodeError(error.to_string()))?; Ok(BASE64_STANDARD.encode(serialized)) } - /// Given the encoded config as a string, set it into [`MIRRORD_RESOLVED_CONFIG_ENV`]. - /// Must be used when updating [`LayerConfig`] after creation in order for the config - /// in env to reflect the change. + /// Encode this config with [`Self::to_env_var`] and set it into + /// [`MIRRORD_RESOLVED_CONFIG_ENV`]. Must be used when updating [`LayerConfig`] after + /// creation in order for the config in env to reflect the change. pub fn update_env_var(&self) -> Result<(), ConfigError> { std::env::set_var(MIRRORD_RESOLVED_CONFIG_ENV, self.to_env_var()?); Ok(())