Skip to content

Commit

Permalink
ADd feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
wendrul committed Dec 12, 2024
1 parent d311592 commit 9a16e3f
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-publish-rh-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-staging-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_windows_worker_.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-image-rpi4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_windows_worker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
1 change: 1 addition & 0 deletions backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion backend/windmill-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
40 changes: 40 additions & 0 deletions backend/windmill-worker/src/csharp_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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<CanceledBy>,
_job_dir: &str,
_db: &sqlx::Pool<sqlx::Postgres>,
_worker_name: &str,
_w_id: &str,
_occupancy_metrics: &mut OccupancyMetrics,
) -> error::Result<String> {
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,
Expand Down Expand Up @@ -220,6 +239,7 @@ namespace WindmillScriptCSharpInternal {{
Ok(())
}

#[cfg(feature = "csharp")]
async fn build_cs_proj(
job_id: &Uuid,
mem_peak: &mut i32,
Expand Down Expand Up @@ -319,6 +339,26 @@ fn remove_lines_from_text(contents: &str, indices_to_remove: Vec<usize>) -> Stri
result.join("\n")
}

#[cfg(not(feature = "csharp"))]
pub async fn handle_csharp_job(
_mem_peak: &mut i32,
_canceled_by: &mut Option<CanceledBy>,
_job: &QueuedJob,
_db: &sqlx::Pool<sqlx::Postgres>,
_client: &AuthedClientBackgroundTask,
_inner_content: &str,
_job_dir: &str,
_requirements_o: Option<String>,
_shared_mount: &str,
_base_internal_url: &str,
_worker_name: &str,
_envs: HashMap<String, String>,
_occupancy_metrics: &mut OccupancyMetrics,
) -> Result<Box<RawValue>, 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<CanceledBy>,
Expand Down

0 comments on commit 9a16e3f

Please sign in to comment.