|
1 | | -# If tilt_options.json exists read it and load the default_registry value from it |
| 1 | +# If tilt_options.json exists read it |
2 | 2 | settings = read_json('tilt_options.json', default={}) |
3 | 3 | registry = settings.get('default_registry', 'oci.stackable.tech/sandbox') |
4 | 4 |
|
5 | 5 | # Configure default registry either read from config file above, or with default value of "oci.stackable.tech/sandbox" |
6 | 6 | default_registry(registry) |
7 | 7 |
|
| 8 | +# Configure which builder to use from config file, defaults to 'crate2nix' |
| 9 | +builder = settings.get('builder', 'crate2nix') |
| 10 | + |
8 | 11 | meta = read_json('nix/meta.json') |
9 | 12 | operator_name = meta['operator']['name'] |
10 | 13 |
|
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]') |
19 | 27 |
|
20 | 28 | # Load the latest CRDs from Nix |
21 | 29 | watch_file('result') |
|
0 commit comments