Skip to content

Commit 41be2b4

Browse files
committed
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.
1 parent 9ef3004 commit 41be2b4

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

template/Tiltfile

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1-
# If tilt_options.json exists read it and load the default_registry value from it
1+
# If tilt_options.json exists read it
22
settings = read_json('tilt_options.json', default={})
33
registry = settings.get('default_registry', 'oci.stackable.tech/sandbox')
44

55
# Configure default registry either read from config file above, or with default value of "oci.stackable.tech/sandbox"
66
default_registry(registry)
77

8+
# Configure which builder to use from config file, defaults to 'crate2nix'
9+
builder = settings.get('builder', 'crate2nix')
10+
811
meta = read_json('nix/meta.json')
912
operator_name = meta['operator']['name']
1013

11-
custom_build(
12-
registry + '/' + operator_name,
13-
'make regenerate-nix && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/' + operator_name + '" && ./result/load-image | docker load',
14-
deps=['rust', 'Cargo.toml', 'Cargo.lock', 'default.nix', "nix", 'build.rs', 'vendor'],
15-
ignore=['*.~undo-tree~'],
16-
# ignore=['result*', 'Cargo.nix', 'target', *.yaml],
17-
outputs_image_ref_to='result/ref',
18-
)
14+
if builder == 'crate2nix':
15+
custom_build(
16+
registry + '/' + operator_name,
17+
'make regenerate-nix && nix-build . -A docker --argstr dockerName "${EXPECTED_REGISTRY}/' + operator_name + '" && ./result/load-image | docker load',
18+
deps=['rust', 'Cargo.toml', 'Cargo.lock', 'default.nix', "nix", 'build.rs', 'vendor'],
19+
ignore=['*.~undo-tree~'],
20+
# ignore=['result*', 'Cargo.nix', 'target', *.yaml],
21+
outputs_image_ref_to='result/ref',
22+
)
23+
else if builder == 'docker':
24+
docker_build(registry + '/' + operator_name, '.', dockerfile='docker/Dockerfile')
25+
else:
26+
fail('Unsupported builder specified: [' + builder + '] - currently supported builders are: [docker, crate2nix]')
1927

2028
# Load the latest CRDs from Nix
2129
watch_file('result')

0 commit comments

Comments
 (0)