Repository navigation
feat!: add per-service roles for builds, environment and secrets - #1
Merged
Merged
Conversation
Replace `targets` with `roles`, keyed by Compose service name. A role can
build an image (`build` with optional `target`, `workingDirectory`,
`dockerfile` and `context`, falling back to the top-level fields) and give
its container `environment` and `secrets`. Compoza applies these through a
generated Compose override, last in client, local and SSH runs, which never
holds secret values.
- Images are named `<name>-<role>:<tag>` and tagged per Git repository;
`--tag` is repeatable and accepts `<role>=<tag>`.
- Roles are validated against the selected Compose files before anything is
built, also by `check` and dry runs.
- The 1Password allowlist is `variables` plus every role secret.
- Destinations and `local` can change a role's environment and secrets.
BREAKING CHANGE: `targets` and the `<TARGET>_IMAGE` Compose variables are
removed. Move each target to `roles.<service>.build.target` and drop the
`image: ${<TARGET>_IMAGE}` lines; see "Migrating from 0.6.0" in
docs/configuration.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A
deploy.yamldescribes one Compose stack, but builds, environment and secrets could only be set for the whole stack. A service's container variables had to be mapped by hand in Compose (FOO: ${FOO}), and every image had to come from one Dockerfile. This replacestargetswithroles, keyed by Compose service name.What changes
buildtakes optionaltarget,workingDirectory,dockerfileandcontext, each falling back to the top-level field. Withouttargetthe final stage is built. Roles can build from different Dockerfiles or repositories.<name>-<role>:<tag>. Each Git repository is checked once, and its roles are tagged with its commit.--tagis repeatable:--tag <tag>for every role withbuild,--tag <role>=<tag>for one role. Tags are validated against Docker's tag rules.environment(literal values) andsecrets(names from the stack's secret source) reach only that service's container. The top-levelenvironmentandsecretsstay Compose interpolation inputs. The 1Password allowlist isvariablesplus every role secret.compoza.roles.yamlwith each built service'simageand each role's environment, and applies it as the last Compose file. Client and--localruns use a private temporary file. SSH runs merge it into the flatcompose.yaml. The file holds${NAME}references for secrets, never their values.--dry-runprints it in every mode.checkand dry runs, a role is rejected if:environment:. This follows!reset/!override,extends, YAML merge keys, andinclude:for client and--localruns.environmentand in itssecretsenvironmentlocalcan change a role'senvironment(merged per key) andsecrets(replaced), but not itsbuild..compoza.jsonrecordstagsper role instead of onetag. The stack.envno longer holds image variables.Breaking change
targetsand the<TARGET>_IMAGECompose variables are removed. A config withtargetsfails with a message naming the replacement. To migrate:roles.<service>.build.target.image: ${<TARGET>_IMAGE}lines from your Compose files. A${X_IMAGE:-fallback}default can stay.Where a role name differs from its old target name, the image name changes, so earlier tags can't be reused with
--tag. See "Migrating from 0.6.0" indocs/configuration.md.Docs
The README,
docs/and both agent skills (.claudeand.agents) are updated, including a new Roles section and a "Reusing images" section in the command reference. Older example names were made generic along the way.Testing
pnpm checkpasses.pnpm test: 518 passed, 2 skipped. The real-Compose runtime tests check that the merged model gets the override's image, a literal$value and a resolved secret, with no secret written to the file.pnpm packpluspnpm test:packagepass on the installed tarball.--localand SSH modes print the expected override and build commands.Not covered: no deploy against a real host was run.
Not in this PR
statusdoesn't show the per-role tags yet. They are recorded in.compoza.json.--localrun can't remove a role.--tagis accepted and ignored on stacks that build nothing.🤖 Generated with Claude Code