making linters happy
Some checks failed
CI / Rust Blocking Checks (push) Failing after 22s
CI / Web Blocking Checks (push) Failing after 26s
CI / Security Blocking Checks (push) Successful in 9s
CI / Web Advisory Checks (push) Successful in 32s
CI / Security Advisory Checks (push) Has been cancelled
Some checks failed
CI / Rust Blocking Checks (push) Failing after 22s
CI / Web Blocking Checks (push) Failing after 26s
CI / Security Blocking Checks (push) Successful in 9s
CI / Web Advisory Checks (push) Successful in 32s
CI / Security Advisory Checks (push) Has been cancelled
This commit is contained in:
@@ -381,14 +381,12 @@ async fn setup_environments_for_pack(
|
||||
)
|
||||
.await;
|
||||
// Also set up version-specific environments
|
||||
let versions = match RuntimeVersionRepository::find_available_by_runtime(
|
||||
db_pool, runtime_id,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(v) => v,
|
||||
Err(_) => Vec::new(),
|
||||
};
|
||||
let versions: Vec<attune_common::models::RuntimeVersion> =
|
||||
RuntimeVersionRepository::find_available_by_runtime(
|
||||
db_pool, runtime_id,
|
||||
)
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
setup_version_environments_from_list(
|
||||
&versions,
|
||||
&rt_name,
|
||||
|
||||
@@ -63,6 +63,7 @@ fn normalize_api_url(raw_url: &str) -> String {
|
||||
|
||||
impl ActionExecutor {
|
||||
/// Create a new action executor
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
pool: PgPool,
|
||||
runtime_registry: RuntimeRegistry,
|
||||
@@ -359,18 +360,16 @@ impl ActionExecutor {
|
||||
|
||||
// Add context data as environment variables from config
|
||||
if let Some(config) = &execution.config {
|
||||
if let Some(context) = config.get("context") {
|
||||
if let JsonValue::Object(map) = context {
|
||||
for (key, value) in map {
|
||||
let env_key = format!("ATTUNE_CONTEXT_{}", key.to_uppercase());
|
||||
let env_value = match value {
|
||||
JsonValue::String(s) => s.clone(),
|
||||
JsonValue::Number(n) => n.to_string(),
|
||||
JsonValue::Bool(b) => b.to_string(),
|
||||
_ => serde_json::to_string(value)?,
|
||||
};
|
||||
env.insert(env_key, env_value);
|
||||
}
|
||||
if let Some(JsonValue::Object(map)) = config.get("context") {
|
||||
for (key, value) in map {
|
||||
let env_key = format!("ATTUNE_CONTEXT_{}", key.to_uppercase());
|
||||
let env_value = match value {
|
||||
JsonValue::String(s) => s.clone(),
|
||||
JsonValue::Number(n) => n.to_string(),
|
||||
JsonValue::Bool(b) => b.to_string(),
|
||||
_ => serde_json::to_string(value)?,
|
||||
};
|
||||
env.insert(env_key, env_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ impl WorkerRegistration {
|
||||
let worker_type = config
|
||||
.worker
|
||||
.as_ref()
|
||||
.and_then(|w| w.worker_type.clone())
|
||||
.and_then(|w| w.worker_type)
|
||||
.unwrap_or(WorkerType::Local);
|
||||
|
||||
let worker_role = WorkerRole::Action;
|
||||
@@ -180,8 +180,8 @@ impl WorkerRegistration {
|
||||
"#,
|
||||
)
|
||||
.bind(&self.worker_name)
|
||||
.bind(&self.worker_type)
|
||||
.bind(&self.worker_role)
|
||||
.bind(self.worker_type)
|
||||
.bind(self.worker_role)
|
||||
.bind(self.runtime_id)
|
||||
.bind(&self.host)
|
||||
.bind(self.port)
|
||||
|
||||
@@ -35,6 +35,7 @@ impl NativeRuntime {
|
||||
}
|
||||
|
||||
/// Execute a native binary with parameters and environment variables
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn execute_binary(
|
||||
&self,
|
||||
binary_path: PathBuf,
|
||||
|
||||
@@ -117,7 +117,7 @@ pub fn create_parameter_file(
|
||||
) -> Result<NamedTempFile, RuntimeError> {
|
||||
let formatted = format_parameters(parameters, format)?;
|
||||
|
||||
let mut temp_file = NamedTempFile::new().map_err(|e| RuntimeError::IoError(e))?;
|
||||
let mut temp_file = NamedTempFile::new().map_err(RuntimeError::IoError)?;
|
||||
|
||||
// Set restrictive permissions (owner read-only)
|
||||
#[cfg(unix)]
|
||||
@@ -126,20 +126,20 @@ pub fn create_parameter_file(
|
||||
let mut perms = temp_file
|
||||
.as_file()
|
||||
.metadata()
|
||||
.map_err(|e| RuntimeError::IoError(e))?
|
||||
.map_err(RuntimeError::IoError)?
|
||||
.permissions();
|
||||
perms.set_mode(0o400); // Read-only for owner
|
||||
temp_file
|
||||
.as_file()
|
||||
.set_permissions(perms)
|
||||
.map_err(|e| RuntimeError::IoError(e))?;
|
||||
.map_err(RuntimeError::IoError)?;
|
||||
}
|
||||
|
||||
temp_file
|
||||
.write_all(formatted.as_bytes())
|
||||
.map_err(|e| RuntimeError::IoError(e))?;
|
||||
.map_err(RuntimeError::IoError)?;
|
||||
|
||||
temp_file.flush().map_err(|e| RuntimeError::IoError(e))?;
|
||||
temp_file.flush().map_err(RuntimeError::IoError)?;
|
||||
|
||||
debug!(
|
||||
"Created parameter file at {:?} with format {:?}",
|
||||
|
||||
@@ -83,6 +83,7 @@ pub async fn execute_streaming(
|
||||
/// * `max_stderr_bytes` - Maximum stderr size before truncation
|
||||
/// * `output_format` - How to parse stdout (Text, Json, Yaml, Jsonl)
|
||||
/// * `cancel_token` - Optional cancellation token for graceful process termination
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub async fn execute_streaming_cancellable(
|
||||
mut cmd: Command,
|
||||
secrets: &HashMap<String, String>,
|
||||
|
||||
@@ -61,6 +61,7 @@ impl ShellRuntime {
|
||||
}
|
||||
|
||||
/// Execute with streaming and bounded log collection
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn execute_with_streaming(
|
||||
&self,
|
||||
mut cmd: Command,
|
||||
@@ -383,6 +384,7 @@ impl ShellRuntime {
|
||||
}
|
||||
|
||||
/// Execute shell script from file
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
async fn execute_shell_file(
|
||||
&self,
|
||||
script_path: PathBuf,
|
||||
|
||||
@@ -220,7 +220,7 @@ impl SecretManager {
|
||||
.map_err(|e| Error::Internal(format!("Encryption failed: {}", e)))?;
|
||||
|
||||
// Format: "nonce:ciphertext" (both base64-encoded)
|
||||
let nonce_b64 = BASE64.encode(&nonce);
|
||||
let nonce_b64 = BASE64.encode(nonce);
|
||||
let ciphertext_b64 = BASE64.encode(&ciphertext);
|
||||
|
||||
Ok(format!("{}:{}", nonce_b64, ciphertext_b64))
|
||||
|
||||
@@ -443,6 +443,7 @@ impl WorkerService {
|
||||
/// 3. Wait for in-flight tasks with timeout
|
||||
/// 4. Close MQ connection
|
||||
/// 5. Close DB connection
|
||||
///
|
||||
/// Verify which runtime versions are available on this host/container.
|
||||
///
|
||||
/// Runs each version's verification commands (from `distributions` JSONB)
|
||||
@@ -634,7 +635,7 @@ impl WorkerService {
|
||||
shutdown_timeout
|
||||
);
|
||||
|
||||
let timeout_duration = Duration::from_secs(shutdown_timeout as u64);
|
||||
let timeout_duration = Duration::from_secs(shutdown_timeout);
|
||||
match tokio::time::timeout(timeout_duration, self.wait_for_in_flight_tasks()).await {
|
||||
Ok(_) => info!("All in-flight tasks completed"),
|
||||
Err(_) => warn!("Shutdown timeout reached - some tasks may have been interrupted"),
|
||||
|
||||
@@ -90,7 +90,7 @@ pub async fn verify_all_runtime_versions(
|
||||
let rt_base_name = version
|
||||
.runtime_ref
|
||||
.split('.')
|
||||
.last()
|
||||
.next_back()
|
||||
.unwrap_or(&version.runtime_ref)
|
||||
.to_lowercase();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user