Unverified Commit d6431e7f authored by Yt's avatar Yt Committed by GitHub
Browse files

Windmill 1.410.3 -> 1.474.0 (#387629)

parents 4b825d85 e3e6db3d
Loading
Loading
Loading
Loading
+4925 −1625

File changed.

Preview size limit exceeded, changes collapsed.

+37 −0
Original line number Diff line number Diff line
diff --git a/windmill-worker/nsjail/download.py.config.proto b/windmill-worker/nsjail/download.py.config.proto
index 5c2989417..7896bde7a 100644
--- a/windmill-worker/nsjail/download.py.config.proto
+++ b/windmill-worker/nsjail/download.py.config.proto
@@ -22,17 +22,24 @@ keep_caps: true
 keep_env: true
 mount_proc: true
 
+mount {
+    src: "/nix/store"
+    dst: "/nix/store"
+	is_bind: true
+}
 
 mount {
     src: "/bin"
     dst: "/bin"
 	is_bind: true
+    mandatory: false
 }
 
 mount {
     src: "/lib"
     dst: "/lib"
 	is_bind: true
+    mandatory: false
 }
 
 mount {
@@ -46,6 +53,7 @@ mount {
     src: "/usr"
     dst: "/usr"
 	is_bind: true
+    mandatory: false
 }
 
 mount {
+20 −0
Original line number Diff line number Diff line
# not a stable interface, do not reference outside the windmill package but make a copy if you need
{
  lib,
  stdenv,
  fetchurl,
}:

{
  fetchLibrustyV8 =
    args:
    fetchurl {
      name = "librusty_v8-${args.version}";
      url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a.gz";
      sha256 = args.shas.${stdenv.hostPlatform.system};
      meta = {
        inherit (args) version;
        sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
      };
    };
}
+11 −0
Original line number Diff line number Diff line
# auto-generated file -- DO NOT EDIT!
{ fetchLibrustyV8 }:

fetchLibrustyV8 {
  version = "130.0.7";
  shas = {
    # NOTE; Follows supported platforms of package (see meta.platforms attribute)!
    x86_64-linux = "0pdp6h7vbjvq5l9lh25qilmp6xrxg7mj8m263h44f0lv9swnqix6";
    aarch64-linux = "0nli54vqcrfh9nkz7ma7230k0xmhcrk0jmfbyxcp3rxybarygvxy";
  };
}
+148 −97
Original line number Diff line number Diff line
{
  lib,
  callPackage,
  rustPlatform,
  fetchFromGitHub,
  buildNpmPackage,
@@ -21,123 +22,117 @@
  rustfmt,
  stdenv,
  swagger-cli,
  perl,
  _experimental-update-script-combinators,
  nix-update-script,
  writeScript,
  librusty_v8 ? (
    callPackage ./librusty_v8.nix {
      inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8;
    }
  ),
  libxml2,
  xmlsec,
  libxslt,
  flock,
  powershell,
  uv,
  bun,
  dotnet-sdk_9,
  php,
  procps,
  cargo,
  coreutils,
  withEnterpriseFeatures ? false,
}:

let
  pname = "windmill";
  version = "1.410.3";
  version = "1.474.0";

  src = fetchFromGitHub {
    owner = "windmill-labs";
    repo = "windmill";
    rev = "v${version}";
    hash = "sha256-QPabzgSs+zxgI2dHcMY9ki4jEwm5jQbzwSMaIfBbFG8=";
  };

  pythonEnv = python3.withPackages (ps: [ ps.pip-tools ]);

  frontend-build = buildNpmPackage {
    inherit version src;

    pname = "windmill-ui";

    sourceRoot = "${src.name}/frontend";

    npmDepsHash = "sha256-3AeDGd/4dGHm8kGKEH3sqNOuQ1LPjP5n4qOEaqVMm0w=";

    # without these you get a
    # FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
    env.NODE_OPTIONS = "--max-old-space-size=8192";

    preBuild = ''
      npm run generate-backend-client
    '';

    buildInputs = [
      pixman
      cairo
      pango
      giflib
    ];
    nativeBuildInputs = [
      python3
      pkg-config
    ];

    installPhase = ''
      mkdir -p $out/share
      mv build $out/share/windmill-frontend
    '';
    hash = "sha256-9BtItmqyW4NbG4istssAYn4CWlfYAv33CE1enL+5LtE=";
  };
in
rustPlatform.buildRustPackage {
  inherit pname version;
  src = "${src}/backend";
rustPlatform.buildRustPackage (finalAttrs: {
  inherit pname version src;
  sourceRoot = "${src.name}/backend";

  env = {
    SQLX_OFFLINE = "true";
    RUSTY_V8_ARCHIVE =
      let
        fetch_librusty_v8 =
          args:
          fetchurl {
            name = "librusty_v8-${args.version}";
            url = "https://github.com/denoland/rusty_v8/releases/download/v${args.version}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a";
            sha256 =
              args.shas.${stdenv.hostPlatform.system}
                or (throw "Unsupported platform ${stdenv.hostPlatform.system}");
            meta = {
              inherit (args) version;
              sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
            };
          };
      in
      fetch_librusty_v8 {
        version = "0.83.2";
        shas = {
          x86_64-linux = "sha256-RJNdy5jRZK3dTgrHsWuZZAHUyy1EogyNNuBekZ3Arrk=";
          aarch64-linux = "sha256-mpOmuqtd7ob6xvrgH4P/6GLa/hXTS/ok0WOYo7+7ZhI=";
          x86_64-darwin = "sha256-2o8CvJ3r5+4PLNGTySqPPDTqbU0piX4D1UtZMscMdHU=";
          aarch64-darwin = "sha256-WHeITWSHjZxfQJndxcjsp4yIERKrKXSHFZ0UBc43p8o=";
        };
      };
    FRONTEND_BUILD_DIR = "${finalAttrs.passthru.web-ui}/share/windmill-frontend";
    RUSTY_V8_ARCHIVE = librusty_v8;
  };

  cargoLock = {
    lockFile = ./Cargo.lock;
    outputHashes = {
      "php-parser-rs-0.1.3" = "sha256-ZeI3KgUPmtjlRfq6eAYveqt8Ay35gwj6B9iOQRjQa9A=";
      "postgres-native-tls-0.5.0" = "sha256-hhvZkdc2KnU6IkgeTHY4M2dp9//NL8DQjOIcAh3sSRM=";
      "progenitor-0.3.0" = "sha256-F6XRZFVIN6/HfcM8yI/PyNke45FL7jbcznIiqj22eIQ=";
      "rustpython-ast-0.3.1" = "sha256-q9N+z3F6YICQuUMp3a10OS792tCq0GiSSlkcaLxi3Gs=";
      "tiberius-0.12.2" = "sha256-s/S0K3hE+JNCrNVxoSCSs4myLHvukBYTwk2A5vZ7Ae8=";
      "tinyvector-0.1.0" = "sha256-NYGhofU4rh+2IAM+zwe04YQdXY8Aa4gTmn2V2HtzRfI=";
    };
  };

  buildFeatures =
    [
      "embedding"
      "parquet"
      "prometheus"
      "openidconnect"
      "cloud"
      "jemalloc"
      "deno_core"
      "license"
      "http_trigger"
      "zip"
      "oauth2"
      "kafka"
      "otel"
      "dind"
      "php"
      "mysql"
      "mssql"
      "bigquery"
      "websocket"
      "python"
      "smtp"
      "csharp"
      "static_frontend"
      # "rust" # compiler environment is incomplete
    ]
    ++ (lib.optionals withEnterpriseFeatures [
      "enterprise"
      "enterprise_saml"
      "tantivy"
      "stripe"
    ]);

  patches = [
    ./swagger-cli.patch
    ./download.py.config.proto.patch
    ./python_executor.patch
    ./run.ansible.config.proto.patch
    ./run.bash.config.proto.patch
    ./run.bun.config.proto.patch
    ./run.csharp.config.proto.patch
    ./run.go.config.proto.patch
    ./run.php.config.proto.patch
    ./run.powershell.config.proto.patch
    ./run.python3.config.proto.patch
    ./run.bash.config.proto.patch
    ./run.rust.config.proto.patch
    ./rust_executor.patch
    ./swagger-cli.patch
  ];

  postPatch = ''
    substituteInPlace windmill-worker/src/bash_executor.rs \
      --replace '"/bin/bash"' '"${bash}/bin/bash"'
    substituteInPlace windmill-common/src/utils.rs \
      --replace-fail 'unknown-version' 'v${version}'

    substituteInPlace windmill-api/src/lib.rs \
      --replace 'unknown-version' 'v${version}'

    substituteInPlace src/main.rs \
      --replace 'unknown-version' 'v${version}'

    pushd ..

    mkdir -p frontend/build
    cp -R ${frontend-build}/share/windmill-frontend/* frontend/build
    cp ${src}/openflow.openapi.yaml .

    popd
    substituteInPlace windmill-worker/src/python_executor.rs \
      --replace-fail 'unknown_system_python_version' '${python3.version}'
  '';

  buildInputs = [
@@ -145,38 +140,94 @@ rustPlatform.buildRustPackage {
    rustfmt
    lld
    (lib.getLib stdenv.cc.cc)
    libxml2
    xmlsec
    libxslt
  ];

  nativeBuildInputs = [
    pkg-config
    makeWrapper
    swagger-cli
    cmake # for libz-ng-sys crate
    perl
  ];

  # needs a postgres database running
  doCheck = false;

  # TODO; Check if the rpath is still required
  # patchelf --set-rpath ${lib.makeLibraryPath [ openssl ]} $out/bin/windmill
  postFixup = ''
    patchelf --set-rpath ${lib.makeLibraryPath [ openssl ]} $out/bin/windmill

    wrapProgram "$out/bin/windmill" \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc ]} \
      --prefix PATH : ${
        lib.makeBinPath [
          go
          pythonEnv
          deno
          nsjail
          bash
          python3 # uv searches PATH for system python
          procps # bash_executor
          coreutils # bash_executor
        ]
      } \
      --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ stdenv.cc.cc ]} \
      --set PYTHON_PATH "${pythonEnv}/bin/python3" \
      --set PYTHON_PATH "${python3}/bin/python3" \
      --set GO_PATH "${go}/bin/go" \
      --set DENO_PATH "${deno}/bin/deno" \
      --set NSJAIL_PATH "${nsjail}/bin/nsjail"
      --set NSJAIL_PATH "${nsjail}/bin/nsjail" \
      --set FLOCK_PATH "${flock}/bin/flock" \
      --set BASH_PATH "${bash}/bin/bash" \
      --set POWERSHELL_PATH "${powershell}/bin/pwsh" \
      --set BUN_PATH "${bun}/bin/bun" \
      --set UV_PATH "${uv}/bin/uv" \
      --set DOTNET_PATH "${dotnet-sdk_9}/bin/dotnet" \
      --set DOTNET_ROOT "${dotnet-sdk_9}/share/dotnet" \
      --set PHP_PATH "${php}/bin/php" \
      --set CARGO_PATH "${cargo}/bin/cargo"
  '';

  passthru.web-ui = buildNpmPackage {
    inherit version src;

    pname = "windmill-ui";

    sourceRoot = "${src.name}/frontend";

    npmDepsHash = "sha256-liWoAgAIgU8+J1x2mR7bGl9MOpCuGIf0Qa1nEouFnBU=";

    # without these you get a
    # FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
    env.NODE_OPTIONS = "--max-old-space-size=8192";

    postUnpack = ''
      cp ${src}/openflow.openapi.yaml .
    '';

    preBuild = ''
      npm run generate-backend-client
    '';

    buildInputs = [
      pixman
      cairo
      pango
    ];
    nativeBuildInputs = [
      pkg-config
    ];

    installPhase = ''
      mkdir -p $out/share
      mv build $out/share/windmill-frontend
    '';
  };

  passthru.updateScript = _experimental-update-script-combinators.sequence [
    (nix-update-script {
      extraArgs = [
        "--subpackage"
        "web-ui"
      ];
    })
    (./update-librusty.sh)
  ];

  meta = {
    changelog = "https://github.com/windmill-labs/windmill/blob/${src.rev}/CHANGELOG.md";
    description = "Open-source developer platform to turn scripts into workflows and UIs";
@@ -194,4 +245,4 @@ rustPlatform.buildRustPackage {
      "aarch64-linux"
    ];
  };
}
})
Loading