mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
fix: c#: nsjail image, default langs and feature cage imports (#4917)
* fix: nsjail image, default langs and feature cage csharp imports * Fix unused imports with csharp flag
This commit is contained in:
@@ -1,39 +1,56 @@
|
||||
use anyhow::anyhow;
|
||||
use serde_json::value::RawValue;
|
||||
use std::{collections::HashMap, io, path::Path, process::Stdio};
|
||||
#[cfg(feature = "csharp")]
|
||||
use std::{io, path::Path, process::Stdio};
|
||||
|
||||
use std::collections::HashMap;
|
||||
use uuid::Uuid;
|
||||
#[cfg(feature = "csharp")]
|
||||
use windmill_parser_csharp::parse_csharp_reqs;
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
use itertools::Itertools;
|
||||
#[cfg(feature = "csharp")]
|
||||
use tokio::{fs::File, io::AsyncReadExt, process::Command};
|
||||
#[cfg(feature = "csharp")]
|
||||
use windmill_common::{
|
||||
error::{self, Error},
|
||||
jobs::QueuedJob,
|
||||
utils::calculate_hash,
|
||||
worker::{save_cache, write_file},
|
||||
};
|
||||
use windmill_queue::{append_logs, CanceledBy};
|
||||
|
||||
use windmill_common::error::{self, Error};
|
||||
use windmill_common::jobs::QueuedJob;
|
||||
#[cfg(feature = "csharp")]
|
||||
use windmill_queue::append_logs;
|
||||
|
||||
use windmill_queue::CanceledBy;
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
use crate::{
|
||||
common::{
|
||||
check_executor_binary_exists, create_args_and_out_file, get_reserved_variables,
|
||||
read_result, start_child_process, OccupancyMetrics,
|
||||
read_result, start_child_process,
|
||||
},
|
||||
handle_child::handle_child,
|
||||
AuthedClientBackgroundTask, CSHARP_CACHE_DIR, DISABLE_NSJAIL, DISABLE_NUSER, DOTNET_PATH,
|
||||
HOME_ENV, NSJAIL_PATH, NUGET_CONFIG, PATH_ENV, TZ_ENV,
|
||||
CSHARP_CACHE_DIR, DISABLE_NSJAIL, DISABLE_NUSER, DOTNET_PATH, HOME_ENV, NSJAIL_PATH,
|
||||
NUGET_CONFIG, PATH_ENV, TZ_ENV,
|
||||
};
|
||||
|
||||
use crate::common::OccupancyMetrics;
|
||||
use crate::AuthedClientBackgroundTask;
|
||||
|
||||
#[cfg(windows)]
|
||||
use crate::SYSTEM_ROOT;
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
const NSJAIL_CONFIG_RUN_CSHARP_CONTENT: &str = include_str!("../nsjail/run.csharp.config.proto");
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
lazy_static::lazy_static! {
|
||||
static ref HOME_DIR: String = std::env::var("HOME").expect("Could not find the HOME environment variable");
|
||||
}
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
const CSHARP_OBJECT_STORE_PREFIX: &str = "csharpbin/";
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
@@ -109,7 +126,6 @@ pub async fn generate_nuget_lockfile(
|
||||
Err(anyhow!("C# is not available because the feature is not enabled").into())
|
||||
}
|
||||
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
fn gen_cs_proj(
|
||||
code: &str,
|
||||
@@ -327,6 +343,7 @@ async fn build_cs_proj(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "csharp")]
|
||||
fn remove_lines_from_text(contents: &str, indices_to_remove: Vec<usize>) -> String {
|
||||
let mut result = Vec::new();
|
||||
|
||||
|
||||
@@ -30,4 +30,7 @@ COPY --from=rust:1.80.1 /usr/local/rustup /usr/local/rustup
|
||||
|
||||
RUN pip3 install ansible
|
||||
|
||||
COPY --from=bitnami/dotnet-sdk:9.0.101-debian-12-r0 /opt/bitnami/dotnet-sdk /opt/dotnet-sdk
|
||||
RUN ln -s /opt/dotnet-sdk/bin/dotnet /usr/bin/dotnet
|
||||
|
||||
COPY --from=nsjail /nsjail/nsjail /bin/nsjail
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
php: 'PHP',
|
||||
rust: 'Rust',
|
||||
ansible: 'Ansible Playbook',
|
||||
csharp: 'C sharpo'
|
||||
csharp: 'C#'
|
||||
}
|
||||
|
||||
const langToComponent: Record<
|
||||
|
||||
@@ -128,7 +128,7 @@ export function processLangs(selected: string | undefined, langs: string[]): str
|
||||
let ls = langs.filter((lang) => lang !== 'nativets')
|
||||
|
||||
//those languages are newer and may not be in the saved list
|
||||
let nl = ['bunnative', 'rust', 'ansible']
|
||||
let nl = ['bunnative', 'rust', 'ansible', 'csharp']
|
||||
nl.forEach((lang) => {
|
||||
if (!ls.includes(lang)) {
|
||||
ls.push(lang)
|
||||
|
||||
Reference in New Issue
Block a user