diff --git a/.github/workflows/build-publish-rh-image.yml b/.github/workflows/build-publish-rh-image.yml index eb904758f056d..67b84f66acb4f 100644 --- a/.github/workflows/build-publish-rh-image.yml +++ b/.github/workflows/build-publish-rh-image.yml @@ -64,7 +64,7 @@ jobs: platforms: linux/amd64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,deno_core,kafka,php,mysql + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,deno_core,kafka,php,mysql,csharp secrets: | rh_username=${{ secrets.RH_USERNAME }} rh_password=${{ secrets.RH_PASSWORD }} @@ -81,7 +81,7 @@ jobs: platforms: linux/arm64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,deno_core,kafka,php,mysql + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,deno_core,kafka,php,mysql,csharp secrets: | rh_username=${{ secrets.RH_USERNAME }} rh_password=${{ secrets.RH_PASSWORD }} diff --git a/.github/workflows/build-staging-image.yml b/.github/workflows/build-staging-image.yml index 8f54411c1ad66..cbb6d77572d02 100644 --- a/.github/workflows/build-staging-image.yml +++ b/.github/workflows/build-staging-image.yml @@ -62,7 +62,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,deno_core,kafka,php,mysql + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,deno_core,kafka,php,mysql,csharp tags: | ${{ steps.meta-ee-public.outputs.tags }} labels: | diff --git a/.github/workflows/build_windows_worker_.yml b/.github/workflows/build_windows_worker_.yml index d093f99f01c08..0fa179eaeb3c8 100644 --- a/.github/workflows/build_windows_worker_.yml +++ b/.github/workflows/build_windows_worker_.yml @@ -45,7 +45,7 @@ jobs: $env:OPENSSL_DIR="${Env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows-static" mkdir frontend/build && cd backend New-Item -Path . -Name "windmill-api/openapi-deref.yaml" -ItemType "File" -Force - cargo build --release --features=enterprise,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,php,mysql + cargo build --release --features=enterprise,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,php,mysql,csharp - name: Rename binary with corresponding architecture run: | diff --git a/.github/workflows/docker-image-rpi4.yml b/.github/workflows/docker-image-rpi4.yml index f7e8358a1738b..8e8f43b118549 100644 --- a/.github/workflows/docker-image-rpi4.yml +++ b/.github/workflows/docker-image-rpi4.yml @@ -67,7 +67,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=embedding,parquet,openidconnect,deno_core,php,mysql + features=embedding,parquet,openidconnect,deno_core,php,mysql,csharp tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:dev ${{ steps.meta-public.outputs.tags }} diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 69bc432e68b47..a85aaac967a3b 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -76,7 +76,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=embedding,parquet,openidconnect,jemalloc,deno_core,dind,php,mysql + features=embedding,parquet,openidconnect,jemalloc,deno_core,dind,php,mysql,csharp tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.DEV_SHA }} ${{ steps.meta-public.outputs.tags }} @@ -138,7 +138,7 @@ jobs: platforms: linux/amd64,linux/arm64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,otel,dind,php,mysql + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,otel,dind,php,mysql,csharp tags: | ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-ee:${{ env.DEV_SHA }} ${{ steps.meta-ee-public.outputs.tags }} @@ -200,7 +200,7 @@ jobs: platforms: linux/amd64 push: true build-args: | - features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,otel,dind,php,mysql + features=enterprise,enterprise_saml,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,otel,dind,php,mysql,csharp PYTHON_IMAGE=python:3.12.2-slim-bookworm tags: | ${{ steps.meta-ee-public-py312.outputs.tags }} diff --git a/.github/workflows/publish_windows_worker.yml b/.github/workflows/publish_windows_worker.yml index 50aff4fc19686..67d3d3f0bbfb0 100644 --- a/.github/workflows/publish_windows_worker.yml +++ b/.github/workflows/publish_windows_worker.yml @@ -47,7 +47,7 @@ jobs: $env:OPENSSL_DIR="${Env:VCPKG_INSTALLATION_ROOT}\installed\x64-windows-static" mkdir frontend/build && cd backend New-Item -Path . -Name "windmill-api/openapi-deref.yaml" -ItemType "File" -Force - cargo build --release --features=enterprise,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,php,mysql + cargo build --release --features=enterprise,stripe,embedding,parquet,prometheus,openidconnect,cloud,jemalloc,tantivy,deno_core,kafka,php,mysql,csharp - name: Rename binary with corresponding architecture run: | diff --git a/backend/Cargo.toml b/backend/Cargo.toml index f65aee1ddfd70..7b68ba9f62426 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -68,6 +68,7 @@ otel = ["windmill-common/otel", "windmill-worker/otel"] dind = ["windmill-worker/dind"] php = ["windmill-worker/php"] mysql = ["windmill-worker/mysql"] +csharp = ["windmill-worker/csharp"] [dependencies] anyhow.workspace = true diff --git a/backend/windmill-worker/Cargo.toml b/backend/windmill-worker/Cargo.toml index 8d9248b5b56e3..dd6099cc9b5fc 100644 --- a/backend/windmill-worker/Cargo.toml +++ b/backend/windmill-worker/Cargo.toml @@ -24,6 +24,7 @@ otel = ["windmill-common/otel", "dep:opentelemetry"] dind = ["dep:bollard"] php = ["dep:windmill-parser-php"] mysql = ["dep:mysql_async"] +csharp = ["dep:windmill-parser-csharp"] [dependencies] windmill-queue.workspace = true @@ -33,7 +34,7 @@ windmill-parser.workspace = true windmill-parser-ts.workspace = true windmill-parser-go.workspace = true windmill-parser-rust.workspace = true -windmill-parser-csharp.workspace = true +windmill-parser-csharp = { workspace = true, optional = true } windmill-parser-py.workspace = true windmill-parser-yaml.workspace = true windmill-parser-py-imports.workspace = true diff --git a/backend/windmill-worker/src/csharp_executor.rs b/backend/windmill-worker/src/csharp_executor.rs index ab5cb769b8a31..e880a0fa81f70 100644 --- a/backend/windmill-worker/src/csharp_executor.rs +++ b/backend/windmill-worker/src/csharp_executor.rs @@ -2,6 +2,7 @@ use anyhow::anyhow; use serde_json::value::RawValue; use std::{collections::HashMap, io, path::Path, process::Stdio}; use uuid::Uuid; +#[cfg(feature = "csharp")] use windmill_parser_csharp::parse_csharp_reqs; use itertools::Itertools; @@ -35,6 +36,7 @@ lazy_static::lazy_static! { const CSHARP_OBJECT_STORE_PREFIX: &str = "csharpbin/"; +#[cfg(feature = "csharp")] pub async fn generate_nuget_lockfile( job_id: &Uuid, code: &str, @@ -92,6 +94,23 @@ pub async fn generate_nuget_lockfile( Ok(req_content) } +#[cfg(not(feature = "csharp"))] +pub async fn generate_nuget_lockfile( + _job_id: &Uuid, + _code: &str, + _mem_peak: &mut i32, + _canceled_by: &mut Option, + _job_dir: &str, + _db: &sqlx::Pool, + _worker_name: &str, + _w_id: &str, + _occupancy_metrics: &mut OccupancyMetrics, +) -> error::Result { + Err(anyhow!("C# is not available because the feature is not enabled").into()) +} + + +#[cfg(feature = "csharp")] fn gen_cs_proj( code: &str, job_dir: &str, @@ -220,6 +239,7 @@ namespace WindmillScriptCSharpInternal {{ Ok(()) } +#[cfg(feature = "csharp")] async fn build_cs_proj( job_id: &Uuid, mem_peak: &mut i32, @@ -319,6 +339,26 @@ fn remove_lines_from_text(contents: &str, indices_to_remove: Vec) -> Stri result.join("\n") } +#[cfg(not(feature = "csharp"))] +pub async fn handle_csharp_job( + _mem_peak: &mut i32, + _canceled_by: &mut Option, + _job: &QueuedJob, + _db: &sqlx::Pool, + _client: &AuthedClientBackgroundTask, + _inner_content: &str, + _job_dir: &str, + _requirements_o: Option, + _shared_mount: &str, + _base_internal_url: &str, + _worker_name: &str, + _envs: HashMap, + _occupancy_metrics: &mut OccupancyMetrics, +) -> Result, Error> { + Err(anyhow!("C# is not available because the feature is not enabled").into()) +} + +#[cfg(feature = "csharp")] pub async fn handle_csharp_job( mem_peak: &mut i32, canceled_by: &mut Option,