allez provision¶
Create and configure one branch workspace per sub-folder, named [<repo>]-[<branch-slug>]-[<sub-folder>]. <repo> is branch-workspace.git.repository. The slug is the branch name with each run of non-alphanumeric characters replaced by a single - (feature/foo_bar → feature-foo-bar). The workspace is created empty.
Usage¶
Arguments¶
| Argument | Description |
|---|---|
PATH |
Solution root (fabric/) or a single workspace sub-folder. Default: . |
Options¶
| Option | Description |
|---|---|
--env, -e <str> |
The environment key used to resolve allez.yml for the branch workspaces: feature. An environment that config.yml maps to a named environment's workspace is refused. Required. |
--branch, -b <str> |
Branch to provision branch workspaces for. Default: the current one. Pass it on a CI agent, which checks out a detached HEAD. |
--plan |
Preview every fab call without creating or changing anything. |
Examples¶
allez provision fabric --env feature --plan # every fab call a run would make, nothing created
allez provision fabric --env feature # what the provision pipeline runs on a branch
What a run does¶
For each sub-folder:
- Create the workspace, on the capacity that
allez.ymlbranch-workspacedeclares for--env, withfab mkdir -P capacityName=…. Skipped if the workspace exists; then, if it sits on another capacity, it is moved withfab assign .capacities/<capacity>.Capacity -W <name>.Workspace(branch-workspace). - Configure from the same block: description, settings (
fab set), roles (fab acl set), workspace identity, then the domain (fab api …/assignToDomain, by id) and the tags (fab api …/applyTags, one call for the tags not already there).--planprints the block as resolved for--env, then these calls (branch-workspace).
Then fill the workspaces with allez deploy --env feature --branch-workspace --commit-to-git, not by updating from git (why).
Behaviour¶
- Safe to re-run. Each step checks the current state first, so a run can be repeated after a failure. A re-run reports what it skipped and applies the config again.
- Every sub-folder, given the root. One workspace each, whether or not the branch changes that sub-folder. A
PATHnaming one sub-folder limits a run to it. - Refused for named environments and protected branches. An
--envthatconfig.ymlmaps to a named workspace (dev,test,prod) is refused, as is a protected branch, before anyfabcall. - Domains and tags only warn. One Fabric refuses is reported and provisioning continues (tenant setup).
- A role needs an id. A
roles:entry without anid:beside itsprincipal:is reported and skipped (roles).