Files
windmill/docker/dev.nu
T
pyranota 11dd4118ce feat: add ruby support (#5939)
* implement single line pin

* make panic-safe

* use pin even if multiple modules imported withing single statement

* add repins and make imports respect pins

* keep all pins

* Allow multiple pins

* add comments + handle stuff more safely

* fix fully qualified imports

* remove ignore

* sort nested

* apply unique to output requirements list

* fix typo

* remove mut

* update sqlx

* sort imports

* sort imports

* fix formatter and format

* feat: add ruby support

* fix

* update sqlx

* add ruby to flake.nix

Signed-off-by: pyranota <pyra@duck.com>

* upgrade par_install_language_dependencies helper

rename fields + allow passing custom payload

Signed-off-by: pyranota <pyra@duck.com>

* change migrations

Signed-off-by: pyranota <pyra@duck.com>

* make full pipeline work!

Signed-off-by: pyranota <pyra@duck.com>

* do a bit fixing

* stage

Signed-off-by: pyranota <pyra@duck.com>

* add ruby in dockerfiles

Signed-off-by: pyranota <pyra@duck.com>

* implement auto-require + 'windmill/inline'

Signed-off-by: pyranota <pyra@duck.com>

* create 'windmill/inline' only if does not exist

Signed-off-by: pyranota <pyra@duck.com>

* add nsjail

Signed-off-by: pyranota <pyra@duck.com>

* update global settings

Signed-off-by: pyranota <pyra@duck.com>

* add ruby icon

* generate lockfile on deploy (but broken)

Signed-off-by: pyranota <pyra@duck.com>

* fix(frontend): display deployed script lockfile and other info

Signed-off-by: pyranota <pyra@duck.com>

* feat: add mini-wmill client

Methods:
- get_resource
- get_variable

Additionally add shortcuts on frontend

Signed-off-by: pyranota <pyra@duck.com>

* add nit warning

Signed-off-by: pyranota <pyra@duck.com>

* support private repos credentials

Signed-off-by: pyranota <pyra@duck.com>

* fix compilation error

Signed-off-by: pyranota <pyra@duck.com>

* found rustc bug + refactor universal installer

Signed-off-by: pyranota <pyra@duck.com>

* more refactor + fixes

Signed-off-by: pyranota <pyra@duck.com>

* bug fixing + polishing

Signed-off-by: pyranota <pyra@duck.com>

* cleanup

Signed-off-by: pyranota <pyra@duck.com>

* change 'windmill/inline'

Signed-off-by: pyranota <pyra@duck.com>

* delegate env_clear to universal installer

Signed-off-by: pyranota <pyra@duck.com>

* update init script

Signed-off-by: pyranota <pyra@duck.com>

* add cli support

Signed-off-by: pyranota <pyra@duck.com>

* unhardcode frontend

Signed-off-by: pyranota <pyra@duck.com>

* fix cli

Signed-off-by: pyranota <pyra@duck.com>

* fix init script

Signed-off-by: pyranota <pyra@duck.com>

* make it work on ms windows

Signed-off-by: pyranota <pyra@duck.com>

* do not clean env in the end

Signed-off-by: pyranota <pyra@duck.com>

* fix windows (again)

Signed-off-by: pyranota <pyra@duck.com>

* include PROXY_ENVS (untested)

Signed-off-by: pyranota <pyra@duck.com>

* feat: self-signed certs + proxy support (tested)

Signed-off-by: pyranota <pyra@duck.com>

* flake: pin ruby to 3.4

* merge follow-ups

Signed-off-by: pyranota <pyra@duck.com>

* remove obsolete libc crate

Signed-off-by: pyranota <pyra@duck.com>

* cleanup parser

Signed-off-by: pyranota <pyra@duck.com>

* fix java ci

Signed-off-by: pyranota <pyra@duck.com>

* cleanup

Signed-off-by: pyranota <pyra@duck.com>

* fix nits

Signed-off-by: pyranota <pyra@duck.com>

* Update backend/windmill-worker/src/universal_pkg_installer.rs

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* Update backend/windmill-worker/src/ruby_executor.rs

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>

* add nsjail for lock stage

Signed-off-by: pyranota <pyra@duck.com>

* fix merge

Signed-off-by: pyranota <pyra@duck.com>

* Update common.rs

* regen windmill-api-client

Signed-off-by: pyranota <pyra@duck.com>

* fix tests

Signed-off-by: pyranota <pyra@duck.com>

* fix tests again

Signed-off-by: pyranota <pyra@duck.com>

* reference published ruby parser

Signed-off-by: pyranota <pyra@duck.com>

---------

Signed-off-by: pyranota <pyra@duck.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
2025-08-15 13:03:32 +00:00

174 lines
5.6 KiB
Nu
Executable File

#! /usr/bin/env nu
# ------------------------------------ #
# Build and Test docker images locally #
# run: #
# docker/dev.nu --help #
# ------------------------------------ #
# NOTE:
# Does not work if built from git worktree branch
let branch = git branch --show-current;
# cp -f Caddyfile .dev-docker/Caddyfile
# --- Constraints --- #
def constraints [
custom_dockerfile?: path
features?: string
] {
# if ($features | str contains "enterprise") {
# print "Building in EE mode"
# print "Is windmill ee private repo mounted? [Y/n]";
# let inp = input listen --types [key]
# if ($inp.code != "y") {
# # print "You can use --auto-substitute(-s) to automatically mount ee private repo (TODO)"
# print "Aborted"
# return;
# }
# }
if not ($features | str contains "static_frontend") {
panic "If you compile without 'static_frontend' you won't be able to load frontend"
}
if ($features | str contains "enterprise") and not ($features | str contains "license") {
panic "If you build enterprise you also need to include 'license' feature"
}
}
# --- Patches --- #
# ./Dockerfile
def patch_main_dockerfile [
features?: string
wasm_pkg?: string
] {
let dockerfile = open ./Dockerfile
# Spread wasm parser
if $wasm_pkg != null {
$dockerfile
| str replace '# -- MACRO-SPREAD-WASM-PARSER-DEV-ONLY -- #' $"COPY ./backend/parsers/windmill-parser-wasm/pkg-($wasm_pkg) ./node_modules/windmill-parser-wasm-($wasm_pkg)"
| return $in
}
print $dockerfile
return $dockerfile
}
# ./docker/Dockerfile*
def patch_custom_dockerfile [
custom_dockerfile: path
features?: string
] {
open $custom_dockerfile
| str replace 'ghcr.io/windmill-labs/windmill-ee:dev' (get_ident -f $features)
| str replace 'ghcr.io/windmill-labs/windmill:dev' (get_ident -f $features)
| return $in
}
# ./docker-compose.yml
def patch_docker_compose [
custom_dockerfile?: path
features?: string
] {
mut compose = open ./docker-compose.yml
$compose.services.windmill_worker.pull_policy = "never"
$compose.services.windmill_worker_native.pull_policy = "never"
$compose.services.windmill_server.pull_policy = "never"
$compose.services.windmill_indexer.pull_policy = "never"
if ($custom_dockerfile | default 'none' | path basename) == "DockerfileNsjail" {
$compose.services.windmill_worker.privileged = true
$compose.services.windmill_worker_native.privileged = true
$compose.services.windmill_worker.environment ++= ["DISABLE_NSJAIL=false"]
$compose.services.windmill_worker_native.environment ++= ["DISABLE_NSJAIL=false"]
}
return ($compose | to yaml)
}
# Build and Test docker images
#
# For more info run:
# docker.nu up --help
# docker.nu build --help
#
# Should be invoked in repo root
def main [] {
./docker/dev.nu --help;
}
# TODO:
# Also we need single tmpdir for it
def kill [] {}
# Get tag for dockerfile + features
def "main tag" [
custom_dockerfile?: path # Any dockerfile that depends on root Dockerfile
--features(-f): string # Features that will be passed to base Dockerfile to compile windmill
] {
get_ident $custom_dockerfile -f $features
}
# Run and Build (if not yet) docker image
def "main up" [
custom_dockerfile?: path # Any dockerfile that depends on root Dockerfile
--features(-f): string = "static_frontend" # Features that will be passed to base Dockerfile to compile windmill
--wasm-pkg: string # Include unreleased wasm parser in docker image
--rebuild(-r) # Rebuild if there is existing image with same tag
--yes(-y) # Say yes for every confirmation (TODO)
--podman(-p) # Use podman as a backend (TODO)
] {
constraints $custom_dockerfile $features
# let base_ident = get_ident -f $features;
let ident = get_ident $custom_dockerfile -f $features;
if $rebuild or not (docker images | into string | str contains $ident) {
let base_ident = get_ident -f $features;
if $rebuild or not (docker images | into string | str contains $base_ident) {
print $"Building base image with ident: ($base_ident)"
docker build . -t ($base_ident) -f (wrap "Dockerfile" (patch_main_dockerfile $features $wasm_pkg)) --build-arg features=($features)
}
if $custom_dockerfile != null {
# let ident = get_ident $custom_dockerfile -f $features;
print $"Building image by path ($custom_dockerfile) with ident: ($ident)"
docker build -f (wrap "DockerfileCustom" (patch_custom_dockerfile $custom_dockerfile $features)) -t $ident /
}
} else {
print $"($ident) was found"
}
print $"Running: ($ident)"
WM_IMAGE=$"($ident)" docker compose -f (wrap "docker-compose.yml" (patch_docker_compose $custom_dockerfile $features)) up
}
# TODO
def clone_ee_private [] {
let rev = open backend/ee-repo-ref.txt
git clone --depth 1 git@github.com:windmill-labs/windmill-ee-private.git .docker.nu/private-ee-repo-rev-($rev)
# git checkout ddcfdfc18a9833a5fc4e62ad62a265ef1e06a0aa)
}
def get_ident [ custom_dockerfile?: path, --features(-f): string ] {
let feat_postfix = if $features != null {
$features | split row ',' | each { |e| $e | str trim --left --right } | sort | str join "-";
} else {
"no-features"
}
if $custom_dockerfile != null {
let df_postfix = $"($custom_dockerfile)" | split row "Dockerfile" | get 1 | str downcase;
return ($branch | append $df_postfix | append $feat_postfix | str join "__");
} else {
return ($branch | append $feat_postfix | str join "-");
}
}
def wrap [ filename content ] {
let tmpfile = ".dev-docker-wrapper-" ++ $filename;
$content | save -f $tmpfile
return $tmpfile
}