Add, edit and publish Stitch rules
Branches
Branches allow you to stage or verify and dry run newly developed features, before using them in live deployments. Branches represent sets of Stitch rules and macros that are defined on Stitch branches of a specific source. Each branch is actually a fork of the main branch and you can use existing rules for editing, or add new rules to it.
Branches can be maintained using the Stitch Workbench or using your usual way of developing, directly from the IDE of your choice and doing commits to a Git repository branch.
You can perform these actions with branches:
- synchronize them
- view the sync log for them
- verify them using the dry run
- published them after the dry run was run successfully
- delete them
Traceability - User credentials
In order to execute GitOps operations (add, edit, dry-run and publish) on a Git Source, you must have your User credentials set. User credentials are set using the gear icon on top left side of the screen and selecting the User profile
item. Your credentials data is used during commits or merges on a Git repository, to ensure change traceability.
Adding and editing rules
You can add and edit rules within a branch
- either by clicking the
Add new rule
button on a Branches screen - or on the Rules screen,
- or by clicking the
Edit rule
button on the rule details screen.
Remember: Rules are always added or edited inside a branch of the selected Git Source.
For adding a rule:
- Select the Git Source and the list of existing Stitch branches (see the reference of
branchRegexp
on Git Source) Note: If you want to create a new branch for a selected source, you can enter a new branch name which will trigger the forking of the current main branch for a selected source. - Enter a relative path and specify the name of Stitch rules file according to the Stitch rules files naming convention
- After you specify the file name, you can add a rule. Note: Rules are parsed and validated, before they are saved.
For editing a rule you have to specify either existing or new branch in order to edit selected rule.
Verifying branch - Dry run
You can use the Dry run feature to verify all your changes on the branch. A dry run will run Stitch transformations with the selected package and environment. The processors used in the transformations will be from the rules and macros in the system with the exception that instead of using rules and macros from the main branch, for the selected Branch the rules from that branch will be used.
Publishing a branch
In the workbench, once the Dry run executes successfully, you will be able to publish a Branch. Publishing a Branch will merge that branch into the main branch of the source. The source will be automatically synchronised and all the rules published from the branch will then be used for live deployments.
If you don't use the workbench for publishing and merging branch in the end, please be sure to verify the changes by running the Dry run from the CLI.