Skip to content

Commit 6bddeb8

Browse files
authored
Merge pull request #27 from norlab-ulaval/fix-build-instability-NMO-783
Refactor and enhance multiarch builds, configurations, and prompts
2 parents 91e116c + 100cd24 commit 6bddeb8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1433
-345
lines changed

.run/[DNA] run exec_build.all.bash (core, ci-tests, ci-tests-no-gpu) only.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="[DNA] run exec_build.all.bash (core, ci-tests) only" type="ShConfigurationType" folderName="[DNA] C | stability check" focusToolWindowBeforeRun="true">
3-
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.bash --service-names &quot;project-core,project-ci-tests&quot;" />
3+
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.bash --service-names &quot;project-core-pre,project-core-user,project-core,project-ci-tests&quot;" />
44
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
55
<option name="SCRIPT_PATH" value="" />
66
<option name="SCRIPT_OPTIONS" value="" />

.run/[DNA] run exec_build.all.bash (core, dev, deploy) only.run.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="[DNA] run exec_build.all.bash (core, dev, deploy) only" type="ShConfigurationType" folderName="[DNA] C | stability check" focusToolWindowBeforeRun="true">
3-
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.bash --service-names &quot;project-core,project-develop,project-deploy&quot;" />
3+
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.bash --service-names &quot;project-core-pre,project-core-user,project-core,project-develop,project-deploy&quot;" />
44
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
55
<option name="SCRIPT_PATH" value="" />
66
<option name="SCRIPT_OPTIONS" value="" />
@@ -16,4 +16,4 @@
1616
</envs>
1717
<method v="2" />
1818
</configuration>
19-
</component>
19+
</component>

.run/[DNA] run exec_build.all.bash (core, slurm, slurm-no-gpu) only.run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="[DNA] run exec_build.all.bash (core, slurm) only" type="ShConfigurationType" folderName="[DNA] C | stability check" focusToolWindowBeforeRun="true">
3-
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.bash --service-names &quot;project-core,project-slurm&quot;" />
3+
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.bash --service-names &quot;project-core-pre,project-core-user,project-core,project-slurm&quot;" />
44
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
55
<option name="SCRIPT_PATH" value="" />
66
<option name="SCRIPT_OPTIONS" value="" />

.run/[DNA] run exec_build.all.multiarch.bash (buildx multiaarch) (core,ci-tests,ci-tests-no-gpu).run.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<component name="ProjectRunConfigurationManager">
22
<configuration default="false" name="[DNA] run exec_build.all.multiarch.bash (buildx multiaarch) (core,ci-tests)" type="ShConfigurationType" folderName="[DNA] C | stability check" focusToolWindowBeforeRun="true">
3-
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.multiarch.bash --service-names &quot;project-core,project-ci-tests&quot;" />
3+
<option name="SCRIPT_TEXT" value="clear &amp;&amp; cd tests/stability_check &amp;&amp; bash exec_build.all.multiarch.bash --service-names &quot;project-core-pre,project-core-user,project-core,project-ci-tests&quot;" />
44
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
55
<option name="SCRIPT_PATH" value="" />
66
<option name="SCRIPT_OPTIONS" value="" />
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<component name="ProjectRunConfigurationManager">
2+
<configuration default="false" name="ssh REMOTE_ASSET_ACTIVE (x11)" type="ShConfigurationType" folderName="[DNA] F2 | remote host utilities">
3+
<option name="SCRIPT_TEXT" value="clear &amp;&amp; echo -e &quot;REMOTE_ASSET_ACTIVE: $REMOTE_ASSET_ACTIVE\n&quot; &amp;&amp; ssh -t -X $REMOTE_ASSET_ACTIVE 'echo &quot;kernel version $(uname -v)&quot; &amp;&amp; echo &amp;&amp; jetson_release -v &amp;&amp; echo &amp;&amp; df -ah /jetson-builtin-eMMC /media/* &amp;&amp; echo &amp;&amp; free -h &amp;&amp; echo &amp;&amp; bash -il'" />
4+
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
5+
<option name="SCRIPT_PATH" value="" />
6+
<option name="SCRIPT_OPTIONS" value="" />
7+
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
8+
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
9+
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
10+
<option name="INTERPRETER_PATH" value="/bin/zsh" />
11+
<option name="INTERPRETER_OPTIONS" value="" />
12+
<option name="EXECUTE_IN_TERMINAL" value="true" />
13+
<option name="EXECUTE_SCRIPT_FILE" value="false" />
14+
<envs />
15+
<method v="2" />
16+
</configuration>
17+
</component>

documentation/command/config.md

Lines changed: 147 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,45 @@
11
# dna config
22

3-
Show Docker Compose configuration (In Development).
3+
Show Docker Compose configuration file.
44

55
## Synopsis
66

77
```bash
8-
dna config MODE [PLATFORM] [OPTIONS]
8+
dna config [OPTIONS] MODE [--] [DOCKER_CONFIG_FLAGS|DOCKER_BAKE_FLAGS]
99
```
1010

1111
## Description
1212

1313
The `dna config` command displays the resolved Docker Compose configuration for different DNA modes and platforms. This is useful for debugging configuration issues, understanding service definitions, and validating environment variable interpolation.
1414

15-
> **⚠️ Note**: This command is currently in development and not yet fully released.
15+
The command uses `docker compose config` or `docker buildx bake` under the hood and can consume their respective option flags.
16+
17+
### Features
18+
- **Multiple output formats**: Docker Compose YAML, Docker Buildx Bake JSON
19+
- **Extensible**: Supports additional Docker command flags via pass-through
20+
- **Docker integration**: Native docker compose config and docker buildx bake support
21+
- **Flexible mode support**: Development, deployment, CI/CD, SLURM, and build configurations
22+
- **Architecture support**: Native and multi-architecture
23+
- **Platform support**: MacOs, Ubunt, L4T (Jetson OS)
24+
25+
26+
## Options
27+
28+
| Option | Description |
29+
|--------|-------------|
30+
| `--bake` | Use 'docker buildx bake' instead of 'docker compose config' |
31+
| `--compose-to-bake` | Print the compose file converted to bake format |
32+
| `-q`, `--quiet` | Skip DNA messages, only print docker command output |
33+
| `--help`, `-h` | Show help message and exit |
1634

1735
## Modes
1836

1937
| Mode | Description |
2038
|------|-------------|
39+
| `build-core` | Core only (pre, user, final) native build config |
40+
| `build-core-ma` | Core only (pre, user, final) multi-architecture build config |
41+
| `build` | All native build config |
42+
| `build-ma` | All multi-architecture build config |
2143
| `dev` | Development mode configuration |
2244
| `deploy` | Deployment mode configuration |
2345
| `ci-tests` | CI tests mode configuration |
@@ -32,12 +54,6 @@ The `dna config` command displays the resolved Docker Compose configuration for
3254
| `linux` | Linux configuration |
3355
| `jetson` | NVIDIA Jetson configuration |
3456

35-
## Options
36-
37-
| Option | Description |
38-
|--------|-------------|
39-
| `--help`, `-h` | Show help message and exit |
40-
4157
## Examples
4258

4359
### Basic Configuration Display
@@ -51,6 +67,25 @@ dna config deploy
5167

5268
# Show CI tests configuration
5369
dna config ci-tests
70+
71+
# Show SLURM configuration
72+
dna config slurm
73+
```
74+
75+
### Build Configuration
76+
77+
```bash
78+
# Show core-only native build configuration
79+
dna config build-core
80+
81+
# Show core-only multi-architecture build configuration
82+
dna config build-core-ma
83+
84+
# Show all native build configuration
85+
dna config build
86+
87+
# Show all multi-architecture build configuration
88+
dna config build-ma
5489
```
5590

5691
### Platform-Specific Configuration
@@ -64,16 +99,38 @@ dna config dev linux
6499

65100
# Show development configuration for Jetson
66101
dna config dev jetson
102+
103+
# Show deployment configuration for specific platform
104+
dna config deploy jetson
67105
```
68106

69-
### Advanced Usage
107+
### Using Docker Buildx Bake
70108

71109
```bash
72-
# Show SLURM configuration
73-
dna config slurm
110+
# Use docker buildx bake instead of docker compose config
111+
dna config --bake build
74112

75-
# Show release configuration
76-
dna config release
113+
# Convert compose file to bake format
114+
dna config --compose-to-bake build-core
115+
116+
# Use bake with multi-architecture build
117+
dna config --bake build-ma
118+
```
119+
120+
### Quiet Mode and Docker Flags
121+
122+
```bash
123+
# Skip DNA messages, show only docker output
124+
dna config --quiet dev
125+
126+
# Pass additional docker compose config flags
127+
dna config dev -- --services
128+
129+
# Pass docker compose config flags with quiet mode
130+
dna config --quiet dev -- --volumes
131+
132+
# Use bake with additional docker buildx bake flags
133+
dna config --bake build -- --load
77134
```
78135

79136
## What it Shows
@@ -104,11 +161,35 @@ The command displays the resolved Docker Compose configuration including:
104161
# Debug development configuration issues
105162
dna config dev
106163

164+
# Debug with quiet mode to focus on docker output
165+
dna config --quiet dev
166+
107167
# Check if environment variables are resolved correctly
108168
dna config dev | grep -A 5 environment
109169

110170
# Verify volume mount configurations
111171
dna config dev | grep -A 10 volumes
172+
173+
# Debug specific services only
174+
dna config dev -- --services
175+
```
176+
177+
### Build Configuration Analysis
178+
179+
```bash
180+
# Analyze core build configuration
181+
dna config build-core
182+
183+
# Compare native vs multi-architecture builds
184+
dna config build > native-build.yaml
185+
dna config build-ma > multiarch-build.yaml
186+
diff native-build.yaml multiarch-build.yaml
187+
188+
# Use bake format for build analysis
189+
dna config --bake build-core
190+
191+
# Convert compose to bake format
192+
dna config --compose-to-bake build
112193
```
113194

114195
### Platform Validation
@@ -121,6 +202,9 @@ dna config dev jetson
121202

122203
# Compare configurations across platforms
123204
diff <(dna config dev darwin) <(dna config dev linux)
205+
206+
# Quiet comparison without DNA messages
207+
diff <(dna config --quiet dev darwin) <(dna config --quiet dev linux)
124208
```
125209

126210
### CI/CD Integration
@@ -131,6 +215,12 @@ dna config ci-tests
131215

132216
# Check SLURM configuration for cluster deployment
133217
dna config slurm
218+
219+
# Validate build configuration in CI
220+
dna config --quiet build-ma -- --services
221+
222+
# Generate bake configuration for CI
223+
dna config --bake build-ma > ci-bake-config.json
134224
```
135225

136226
### Documentation and Sharing
@@ -141,6 +231,12 @@ dna config deploy > deployment-config.yaml
141231

142232
# Share configuration with team
143233
dna config dev > team-dev-config.yaml
234+
235+
# Generate build documentation
236+
dna config build-core > build-config.yaml
237+
238+
# Create bake configuration files
239+
dna config --bake build > build.json
144240
```
145241

146242
## Configuration Sources
@@ -187,62 +283,68 @@ services:
187283
188284
## Troubleshooting
189285
190-
### Command Not Available
191-
192-
**Problem**: "Command not released yet" message.
286+
### Configuration Errors
193287
194-
**Explanation**: The config command is still in development.
288+
**Problem**: Invalid configuration displayed or command fails.
195289
196-
**Alternatives**:
197-
1. **Use docker-compose directly**:
290+
**Solutions**:
291+
1. **Use quiet mode**: Focus on docker output without DNA messages
198292
```bash
199-
docker-compose -f .dockerized_norlab/configuration/docker-compose.yml config
293+
dna config --quiet dev
200294
```
201295

202-
2. **Use dna project dotenv**: Check environment variables
296+
2. **Validate environment**: Check environment variable resolution
203297
```bash
204298
dna project dotenv
205299
```
206300

207-
### Configuration Errors
301+
3. **Check compose files**: Validate Docker Compose syntax directly
302+
```bash
303+
docker compose -f .dockerized_norlab/core/docker/compose-file.yaml config --quiet
304+
```
208305

209-
**Problem**: Invalid configuration displayed.
306+
### Platform Issues
307+
308+
**Problem**: Platform-specific configuration not working.
210309

211310
**Solutions**:
212-
1. **Validate environment**: Check environment variable resolution
311+
1. **Use explicit platform**: Specify platform explicitly
213312
```bash
214-
dna project dotenv
313+
dna config dev linux # instead of just 'dna config dev'
215314
```
216315

217-
2. **Check compose files**: Validate Docker Compose syntax
316+
2. **Check supported platforms**: Verify the platform is supported (darwin, linux, jetson)
317+
318+
### Build Mode Issues
319+
320+
**Problem**: Build modes not working or showing unexpected results.
321+
322+
**Solutions**:
323+
1. **Use appropriate build mode**: Choose the right mode for your needs
218324
```bash
219-
docker-compose -f compose-file.yml config --quiet
325+
dna config build-core # For core-only builds
326+
dna config build # For complete builds
220327
```
221328

222-
### Platform Issues
329+
2. **Try bake format**: Use bake format for build configuration analysis
330+
```bash
331+
dna config --bake build-core
332+
```
223333

224-
**Problem**: Platform-specific configuration not working.
334+
### Docker Flags Not Working
335+
336+
**Problem**: Additional Docker flags are not being passed correctly.
225337

226338
**Solutions**:
227-
1. **Check platform detection**: Verify platform is correctly detected
228-
2. **Use explicit platform**: Specify platform explicitly
339+
1. **Use double dash separator**: Separate DNA options from Docker flags
229340
```bash
230-
dna config dev linux # instead of just 'dna config dev'
341+
dna config dev -- --services --volumes
231342
```
232343

233-
## Development Status
234-
235-
### Current Implementation
236-
- ✅ Basic command structure
237-
- ✅ Mode and platform parsing
238-
- ✅ Docker Compose file selection
239-
- ⚠️ Limited functionality (in development)
344+
2. **Check flag compatibility**: Ensure flags are compatible with the underlying Docker command
345+
- For compose config: `docker compose config --help`
346+
- For buildx bake: `docker buildx bake --help`
240347

241-
### Planned Features
242-
- 🔄 Full mode support
243-
- 🔄 Enhanced platform detection
244-
- 🔄 Configuration validation
245-
- 🔄 Output formatting options
246348

247349
## See Also
248350

documentation/command/run.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ The `dna run` command creates and runs new container instances with unique ident
5151
5252
| Option | Description |
5353
|--------|-------------|
54-
| `--log-name=<name>` | Log file name without postfix |
55-
| `--log-path=<path>` | Absolute path to SLURM log directory |
54+
| `--log-name <name>` | Log file name without postfix |
55+
| `--log-path <path>` | Absolute path to SLURM log directory |
5656
| `--skip-core-force-rebuild` | Skip automatic core image rebuild |
5757
| `--hydra-dry-run` | Dry-run SLURM job using registered hydra flag |
5858
| `--register-hydra-dry-run-flag` | Hydra flag used by '--hydra-dry-run' |
@@ -114,7 +114,7 @@ dna run ci-tests pytest tests/ --junit-xml=results.xml
114114
dna run slurm job-001 -- python3 train_model.py --epochs 100
115115

116116
# Run with custom log configuration
117-
dna run --log-name="training" --log-path="/logs" slurm job-002 -- python3 experiment.py
117+
dna run --log-name "training" --log-path "/logs" slurm job-002 -- python3 experiment.py
118118

119119
# Dry run SLURM job
120120
dna run --hydra-dry-run slurm job-003 -- python3 simulation.py

src/bin/dna

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ DOCUMENTATION_BUFFER_DNA=$( cat <<'EOF'
2020
# project Super project commands
2121
# save Save DNA Docker image to file for offline use
2222
# load Load DNA Docker image from file for offline use
23-
# config (In-progress) Show configuration
23+
# config Show parsed docker compose configuration
2424
# version Show DNA version
2525
# help Show this help message
2626
#

0 commit comments

Comments
 (0)