Skip to content

Commit 10f09e1

Browse files
authored
manifest: add conditional interpolation syntax (#47)
* manifest: add optional interpolation syntax * compiler: generalize conditional interpolation * compiler: fix direct template spec handling * compiler: track slot when conditions * compiler: generalize conditional interpolation to envs
1 parent 0c7635b commit 10f09e1

File tree

63 files changed

+4656
-347
lines changed

Some content is hidden

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

63 files changed

+4656
-347
lines changed

AGENTS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@
1111
* Make error messages and spans as helpful to devs as possible. Rust error messaging is a great example of usability
1212
- Create UI tests whenever adding a new error type or variant. From the perspective of a dev using the software, ensure that the error is helpful.
1313
* When adding new crates, make sure to update the dockerfiles
14+
* The compiler should try to support older versions of the manifest format and scenario IR as long as it would not introduce an undue amount of complexity or legacy code to maintain.
15+
- If supporting previous versions is feasible, later versions of the compiler take the old versions but output the later version of compiler outputs.
16+
* When a breaking change is made, you may need to bump versions of any of: the manifest format, the IR, the docker/images.json version series. If you bump the CLI docker image series, also update README.md to have the latest floating version.
17+
- Do not update versions in tests or examples unless they changed in a breaking way and NEED the newer version.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ If you want `amber` on your PATH, move it into a directory that’s already on P
5454
### Option B: Use the Dockerized CLI
5555

5656
```sh
57-
docker run --rm -v "$PWD":/work -w /work ghcr.io/rdi-foundation/amber-cli:v0.2 --help
57+
docker run --rm -v "$PWD":/work -w /work ghcr.io/rdi-foundation/amber-cli:v0.3 --help
5858
```
5959

6060
## Tutorial
@@ -102,7 +102,7 @@ amber compile amber-demo/parent.json --dot -
102102
If you're using the Dockerized CLI, replace `amber` with:
103103

104104
```sh
105-
docker run --rm -v "$PWD":/work -w /work ghcr.io/rdi-foundation/amber-cli:v0.2
105+
docker run --rm -v "$PWD":/work -w /work ghcr.io/rdi-foundation/amber-cli:v0.3
106106
```
107107

108108
### 3) Generate Docker Compose and run
@@ -127,14 +127,14 @@ Direct output only supports components that use `program.path`.
127127
- macOS: `/usr/bin/sandbox-exec`
128128

129129
The Docker Compose output references the router, provisioner, and helper images used to
130-
enforce the wiring and provision mesh identities: `ghcr.io/rdi-foundation/amber-router:v1`,
131-
`ghcr.io/rdi-foundation/amber-provisioner:v1`, and `ghcr.io/rdi-foundation/amber-helper:v1`.
130+
enforce the wiring and provision mesh identities: `ghcr.io/rdi-foundation/amber-router:v0.1`,
131+
`ghcr.io/rdi-foundation/amber-provisioner:v0.1`, and `ghcr.io/rdi-foundation/amber-helper:v0.2`.
132132
Docker Compose will pull them automatically;
133133
if you're in a restricted environment, pre-pull them ahead of time.
134134

135135
Some scenarios also use the Docker gateway component to scope Docker Engine API access
136136
per component. In that case, the compose output will reference
137-
`ghcr.io/rdi-foundation/amber-docker-gateway:v1`.
137+
`ghcr.io/rdi-foundation/amber-docker-gateway:v0.1`.
138138

139139
If you're working in this repo, the internal image list and tags live in
140140
`docker/images.json`; CI publishes and verifies those tags on `main`.

cli/src/main.rs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use amber_mesh::{
5050
use amber_resolver::Resolver;
5151
use amber_router as router;
5252
use amber_scenario::{SCENARIO_IR_SCHEMA, ScenarioIr};
53-
use amber_template::{RuntimeTemplateContext, TemplatePart, TemplateSpec};
53+
use amber_template::{ProgramArgTemplate, RuntimeTemplateContext, TemplatePart, TemplateSpec};
5454
use base64::Engine as _;
5555
use clap::{ArgAction, Args, Parser, Subcommand};
5656
use miette::{
@@ -1918,7 +1918,16 @@ fn decode_template_spec_program(raw_b64: &str) -> Result<String> {
19181918
.entrypoint
19191919
.first()
19201920
.ok_or_else(|| miette::miette!("template spec program entrypoint is empty"))?;
1921-
render_template_string_literal(path_template)
1921+
render_program_arg_template_literal(path_template)
1922+
}
1923+
1924+
fn render_program_arg_template_literal(arg: &ProgramArgTemplate) -> Result<String> {
1925+
let ProgramArgTemplate::Arg(parts) = arg else {
1926+
return Err(miette::miette!(
1927+
"internal error: template spec program entrypoint starts with a conditional arg group"
1928+
));
1929+
};
1930+
render_template_string_literal(parts)
19221931
}
19231932

19241933
fn render_template_string_literal(parts: &[TemplatePart]) -> Result<String> {

0 commit comments

Comments
 (0)