You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **Refactor**
* Unified environment and path-mapping across build, run, and install
flows; consolidated workdir resolution and local vs container branching.
* **New Features**
* Verbose path-mapping output and two-stage placeholder resolution for
paths and env vars.
* New env-update behavior supporting prepend/append semantics and
templated replacements.
* Exposed configurable CLI prefix for path resolution.
* **Bug Fixes**
* Improved env precedence, language-aware defaults, and clearer
build/run/install messaging.
* **Tests**
* Expanded tests for placeholder replacement, mode env precedence, and
isolated environment handling.
* **Documentation**
* Expanded CLI docs with modes, examples, env precedence, and migration
guidance.
<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Signed-off-by: B Hashemian <[email protected]>
@@ -102,7 +107,7 @@ Use `-h` or `--help` to view a complete list of commands or subcommand options.
102
107
./holohub build myapp --benchmark
103
108
```
104
109
105
-
### **Development Environment**
110
+
### **Development Environment**
106
111
107
112
Development commands remain familiar:
108
113
@@ -122,6 +127,7 @@ Development commands remain familiar:
122
127
## New Capabilities & Enhancements
123
128
124
129
### **Project Creation and Testing**
130
+
125
131
The new CLI introduces development lifecycle features:
126
132
127
133
```bash
@@ -142,10 +148,13 @@ The new CLI introduces development lifecycle features:
142
148
```
143
149
144
150
### Application Modes
151
+
145
152
HoloHub applications with a 'modes' field in their `metadata.json` now support multiple **modes** - pre-configured setups for different use cases, hardware configurations, or deployment scenarios. This eliminates the need to remember complex command-line arguments for different use cases.
146
153
147
154
#### **Understanding Modes**
155
+
148
156
Modes potentially provide typical configurations for:
157
+
149
158
-**Different hardware**
150
159
-**Deployment scenarios** (e.g. development vs. production vs. cloud inference)
151
160
-**Data sources** (e.g. live video vs. recorded files vs. distributed streaming)
@@ -181,6 +190,7 @@ CLI parameters can be used in addition to modes. When provided, CLI parameters w
181
190
182
191
**Mode Priority Rules:**
183
192
When CLI parameters are **not** provided, mode settings are used:
193
+
184
194
- If mode defines `run.docker_run_args` and no `--docker-opts` → Mode's docker options are used
185
195
- If mode defines `build.depends` and no `--build-with` → Mode's dependencies are used
186
196
- If mode defines `build.docker_build_args` and no `--build-args` → Mode's build args are used
@@ -189,9 +199,11 @@ When CLI parameters are **not** provided, mode settings are used:
189
199
When CLI parameters **are** provided, they always override mode settings.
190
200
191
201
#### **For Application Developers**
202
+
192
203
Applications can define modes in their `metadata.json`. Here's the complete field reference:
193
204
194
205
##### **Mode Structure**
206
+
195
207
Each mode is defined as a named object under the `modes` key:
196
208
197
209
```json
@@ -208,16 +220,20 @@ Each mode is defined as a named object under the `modes` key:
208
220
```
209
221
210
222
##### **Application-Level Fields**
223
+
211
224
**Optional Fields:**
225
+
212
226
-**`default_mode`***(string)*: Specifies which mode to use when no mode is explicitly provided. Only needed when there are multiple modes (2 or more).
213
227
214
228
##### **Supported Fields for Each Mode**
215
229
216
230
**Required Fields:**
231
+
217
232
-**`description`***(string)*: Human-readable description of what this mode does
218
233
-**`run`***(object)*: Run configuration (see run command fields below)
219
234
220
235
**Optional Fields:**
236
+
221
237
-**`requirements`***(array of strings)*: List of dependency IDs required for this mode
222
238
-**`build`***(object)*: Build configuration (see build configuration fields below)
223
239
-**`env`***(object)*: Environment variables to set for both build and run operations
@@ -226,6 +242,7 @@ Each mode is defined as a named object under the `modes` key:
-**`depends`***(array of strings)*: List of operators/dependencies to build with this mode
230
247
-**`docker_build_args`***(string or array)*: Docker **build** arguments (equivalent to CLI `--build-args`)
231
248
- Can be a single string: `"--build-arg CUSTOM=value"`
@@ -237,6 +254,7 @@ Each mode is defined as a named object under the `modes` key:
237
254
-**Note**: For environment variables needed during both build and run, use the top-level `env` field instead
238
255
239
256
##### **Run Command Fields (`run` object):**
257
+
240
258
-**`command`***(string)*: Complete command to execute including all arguments
241
259
-**`workdir`***(string)*: Working directory for command execution
242
260
-**`docker_run_args`***(string or array)*: Docker **run** arguments used for both build and application containers (equivalent to CLI `--docker-opts`)
@@ -344,6 +362,7 @@ For cases where build and run containers need different Docker configurations, y
344
362
```
345
363
346
364
**Usage:**
365
+
347
366
```bash
348
367
# Phase 1: Build with network access
349
368
./holohub build myapp production_build
@@ -355,13 +374,33 @@ For cases where build and run containers need different Docker configurations, y
355
374
Both modes automatically share the same Docker image name (`holohub:myapp`), so the run mode can use the image built by the build mode.
356
375
357
376
##### **Key Points for Mode Development**
377
+
358
378
-**`default_mode`** is required only if your project defines two or more modes; with a single mode, it is selected automatically. The default mode is used when no mode is explicitly specified on the command line.
359
379
-**Mode names** must match pattern `^[a-zA-Z_][a-zA-Z0-9_]*$` (alphanumeric + underscore, can't start with number)
360
380
-**Environment variables** can be specified at two levels:
361
-
- Top-level `env`: Environment variables for **both build and run** operations
362
-
- Can affect CLI behavior (e.g., `HOLOHUB_BUILD_LOCAL` to force local builds)
363
-
-`run.env`: Environment variables **only for runtime** (local runs only)
364
-
- When both are specified, they are merged with `run.env` taking precedence
381
+
- Top-level `env`: Environment variables for **both build and run**
382
+
-`mode_name.build.env`: Set environment variables **only for build and install**
383
+
-`mode_name.run.env`: Set environment variables **only for run**
384
+
- They can affect CLI behavior (e.g., `HOLOHUB_BUILD_LOCAL` to force local builds)
385
+
- You can append to the existing environment variables by using `:`, like
386
+
387
+
```json
388
+
"modes": {
389
+
"mode_name": {
390
+
"run": {
391
+
"env": {
392
+
"PATH": "<PATH>:<holohub_app_bin>/bin"# append to the updated PATH by mode_name.env
393
+
"CMAKE_BUILD_TYPE": "Release"# override the existing CMAKE_BUILD_TYPE
394
+
}
395
+
},
396
+
"env": {
397
+
"PATH": "<holohub_bin>/bin:<PATH>"# prepend to the existing PATH in the environment
398
+
}
399
+
}
400
+
}
401
+
```
402
+
403
+
- The inner `env` object takes the precedence over the top-level `env` object, and the top-level `env` object takes precedence over the CLI environment variables.
365
404
- **Docker arguments** can be specified in two places for different purposes:
366
405
- `build.docker_build_args`: Docker **build** arguments for container image building (equivalent to CLI `--build-args`)
367
406
- `run.docker_run_args`: Docker **run** arguments for both build and application containers (equivalent to CLI `--docker-opts`)
@@ -375,19 +414,21 @@ Both modes automatically share the same Docker image name (`holohub:myapp`), so
375
414
- **Requirements** reference dependency IDs defined elsewhere in the metadata
376
415
- **Modes provide complete control** over both build and runtime behavior for different deployment scenarios
377
416
378
-
379
417
### **Granular Build Control**
418
+
380
419
The new architecture provides precise control over your development workflow.
381
420
382
421
**Default Behavior:**
383
422
By default, `./holohub run` operates in a 'containerized mode', which means it will:
423
+
384
424
1. Build the container image (unless skipped, e.g. using `--no-docker-build`)
385
425
2. Build the application inside the container
386
426
3. Run the application inside the container
387
427
388
428
This container-first approach ensures consistency and reproducibility across different development environments.
389
429
390
430
**Command-line Options:**
431
+
391
432
- **`--local`**: Explicit local development mode
392
433
- **`--no-local-build`**: Skip application rebuild for faster iteration
393
434
- **`--no-docker-build`**: Use existing container images
@@ -398,11 +439,13 @@ This container-first approach ensures consistency and reproducibility across dif
398
439
The CLI supports the following environment variables for customization:
399
440
400
441
**Build and Execution Control:**
442
+
401
443
- **`HOLOHUB_BUILD_LOCAL`**: Forces local mode (equivalent to `--local`), skips the container build steps and runs on the host directly.
402
444
- **`HOLOHUB_ALWAYS_BUILD`**: Set to `false` to skip builds with `--no-local-build` and `--no-docker-build`.
403
445
- **`HOLOHUB_ENABLE_SCCACHE`**: Defaults to `false`. Set to `true` to enable rapids-sccache for the build. You can configure sccache with `SCCACHE_*` environment variables per the [sccache documentation](https://github.com/rapidsai/sccache/tree/rapids/docs).
404
446
405
447
**Paths and Directories:**
448
+
406
449
- **`HOLOHUB_ROOT`**: HoloHub repository root directory, used to resolve relative paths for components, build artifacts, data, and other resources.
407
450
- **`HOLOHUB_BUILD_PARENT_DIR`**: Root directory for all builds (default: `<HOLOHUB_ROOT>/build`).
408
451
- **`HOLOHUB_DATA_DIR`**: Root data (such as models, datasets downloading during component building) directory (default: `<HOLOHUB_ROOT>/data`).
@@ -412,6 +455,7 @@ The CLI supports the following environment variables for customization:
412
455
- **`HOLOSCAN_SDK_ROOT`**: Path to local Holoscan SDK root directory (source or build tree), used for mounting local Holoscan SDK development trees into containers.
413
456
414
457
**Container Configuration:**
458
+
415
459
- **`HOLOHUB_REPO_PREFIX`**: Repository prefix for naming defaults (default: `holohub`). Used as the default value for container-related variables below.
416
460
- **`HOLOHUB_CONTAINER_PREFIX`**: Docker container name prefix (default: `HOLOHUB_REPO_PREFIX`).
417
461
- **`HOLOHUB_WORKSPACE_NAME`**: Workspace directory name in container (default: `HOLOHUB_REPO_PREFIX`). The `<HOLOHUB_ROOT>` directory is mounted in the container as `/workspace/<HOLOHUB_WORKSPACE_NAME>`.
@@ -421,6 +465,7 @@ The CLI supports the following environment variables for customization:
421
465
**Docker Images:**
422
466
423
467
By default, the Dockerfile used to build a container image for your project is chosen in that order:
468
+
424
469
1. Specified in your project's `metadata.json` file.
425
470
2. `<app_source>/Dockerfile`
426
471
3. `<app_source>/<language>/Dockerfile`
@@ -430,6 +475,7 @@ By default, the Dockerfile used to build a container image for your project is c
430
475
This can be overridden by the `--docker-file` option.
431
476
432
477
If the selected Dockerfile has `ARG BASE_IMAGE`, the value of `BASE_IMAGE` will be automatically populated by the `./holohub build-container`, defaulting to `{base_image}:v{sdk_version}-{cuda_tag}` where:
478
+
433
479
- `{base_image}` defaults to `nvcr.io/nvidia/clara-holoscan/holoscan` and can be overridden by the **`HOLOHUB_BASE_IMAGE`** env variable.
434
480
- `{sdk_version}` defaults to the latest available Holoscan SDK version (e.g. `3.8.0`) and can be overridden by the **`HOLOHUB_BASE_SDK_VERSION`** env variable.
435
481
- `{cuda_tag}` is the Holoscan SDK container cuda tag. For Holoscan 3.7+, the default cuda major version is based on your host driver version, and can be overridden with the `--cuda <major_version>` option.
@@ -438,6 +484,7 @@ If the selected Dockerfile has `ARG BASE_IMAGE`, the value of `BASE_IMAGE` will
438
484
The whole base image (`<repo:tag>`) can be overridden by the `--base-img` option.
439
485
440
486
The name of the output image generated by `./holohub build-container [project]` varies based on the following factors:
487
+
441
488
- Legacy tags:
442
489
- If the project is using the default Dockerfile, the name will default to `{container_prefix}:ngc-v{sdk_version}-{cuda_tag}` where:
443
490
- `{container_prefix}` defaults to **`HOLOHUB_REPO_PREFIX`** and can be overridden by the **`HOLOHUB_CONTAINER_PREFIX`** env variable.
@@ -456,20 +503,22 @@ The name of the output image generated by `./holohub build-container [project]`
456
503
These output tags can be overridden by the `--img` option.
457
504
458
505
**Docker Runtime:**
506
+
459
507
- **`HOLOHUB_DEFAULT_DOCKER_BUILD_ARGS`**: Additional default arguments passed to `docker build` commands. Typically used to set global build arguments for all applications in the codebase, applications and commands can override these arguments.
460
508
- **`HOLOHUB_DEFAULT_DOCKER_RUN_ARGS`**: Additional default arguments passed to `docker run` commands. Typically used to set global runtime arguments for all applications in the codebase, applications and commands can override these arguments.
- When adding option that looks like an argument, use `=` instead of whitespace `` (because of [Python argparse design choice](https://github.com/python/cpython/issues/53580)):
565
+
514
566
```bash
515
567
--run-args="--verbose"# instead of --run-args "--verbose"
0 commit comments