From 41be2b41649fd96d9a1cffcf520ce8a7a1e1492d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Tue, 14 Feb 2023 09:48:38 +0100 Subject: [PATCH 1/3] Added option to allow the user the option of not using crate2nix but the default Docker build process instead. Not sure if this is feasible to use with Tilt due to fairly long build times, might be necessary to pause deployment of the resources in Tilt and manually triggering as and when needed. --- template/Tiltfile | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/template/Tiltfile b/template/Tiltfile index ee0941c3..24a2d8c7 100644 --- a/template/Tiltfile +++ b/template/Tiltfile @@ -1,21 +1,29 @@ -# If tilt_options.json exists read it and load the default_registry value from it +# If tilt_options.json exists read it settings = read_json('tilt_options.json', default={}) registry = settings.get('default_registry', 'oci.stackable.tech/sandbox') # Configure default registry either read from config file above, or with default value of "oci.stackable.tech/sandbox" default_registry(registry) +# Configure which builder to use from config file, defaults to 'crate2nix' +builder = settings.get('builder', 'crate2nix') + meta = read_json('nix/meta.json') operator_name = meta['operator']['name'] -custom_build( - registry + '/' + operator_name, - 'make regenerate-nix && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/' + operator_name + '" && ./result/load-image | docker load', - deps=['rust', 'Cargo.toml', 'Cargo.lock', 'default.nix', "nix", 'build.rs', 'vendor'], - ignore=['*.~undo-tree~'], - # ignore=['result*', 'Cargo.nix', 'target', *.yaml], - outputs_image_ref_to='result/ref', -) +if builder == 'crate2nix': + custom_build( + registry + '/' + operator_name, + 'make regenerate-nix && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/' + operator_name + '" && ./result/load-image | docker load', + deps=['rust', 'Cargo.toml', 'Cargo.lock', 'default.nix', "nix", 'build.rs', 'vendor'], + ignore=['*.~undo-tree~'], + # ignore=['result*', 'Cargo.nix', 'target', *.yaml], + outputs_image_ref_to='result/ref', + ) +else if builder == 'docker': + docker_build(registry + '/' + operator_name, '.', dockerfile='docker/Dockerfile') +else: + fail('Unsupported builder specified: [' + builder + '] - currently supported builders are: [docker, crate2nix]') # Load the latest CRDs from Nix watch_file('result') From 583a5c989660a79b6bc4a2643a8fd6bafb6d97ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Tue, 11 Nov 2025 15:48:53 +0100 Subject: [PATCH 2/3] Addressed comment by Nick --- template/Tiltfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/Tiltfile b/template/Tiltfile index 24a2d8c7..ebc9a29c 100644 --- a/template/Tiltfile +++ b/template/Tiltfile @@ -5,7 +5,7 @@ registry = settings.get('default_registry', 'oci.stackable.tech/sandbox') # Configure default registry either read from config file above, or with default value of "oci.stackable.tech/sandbox" default_registry(registry) -# Configure which builder to use from config file, defaults to 'crate2nix' +# Configure which builder to use from config file, defaults to 'nix' builder = settings.get('builder', 'crate2nix') meta = read_json('nix/meta.json') From cf49017615f4db116d80953209ba385e17957f97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Liebau?= Date: Tue, 11 Nov 2025 16:28:15 +0100 Subject: [PATCH 3/3] Finished renaming default builder to nix instead of crate2nix --- template/Tiltfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/template/Tiltfile b/template/Tiltfile index ebc9a29c..ed4c7c75 100644 --- a/template/Tiltfile +++ b/template/Tiltfile @@ -6,12 +6,12 @@ registry = settings.get('default_registry', 'oci.stackable.tech/sandbox') default_registry(registry) # Configure which builder to use from config file, defaults to 'nix' -builder = settings.get('builder', 'crate2nix') +builder = settings.get('builder', 'nix') meta = read_json('nix/meta.json') operator_name = meta['operator']['name'] -if builder == 'crate2nix': +if builder == 'nix': custom_build( registry + '/' + operator_name, 'make regenerate-nix && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/' + operator_name + '" && ./result/load-image | docker load',