What is a Trigger?
Triggers in Continua CI are used to automatically queue, or 'trigger' a build based on the current configuration. Builds can be triggered from 3 types of events.
- Repository check-in occurs. Specified by a Repository Trigger
- A configuration completes. Specified by the Build Completed Trigger
- It's a certain time of the day/week/month. Specified by the various Time Trigger
Creating & Editing Triggers
Triggers can be created and edited by editing a configuration and navigating to the Triggers section of the Configuration Wizard. Each trigger type has their own properties, however every trigger type share the following properties:
The name that will be used to identify this trigger.
This is where you select the trigger type. i.e. Repository trigger, Time trigger or Build Completed trigger.
If a trigger is disabled then it will not trigger new builds.
This specifies the priority of the build that will be created by this trigger. The Build Priority determines which build to execute next if there are more builds queued than there are available agents. This can be set to either 'high', 'normal' or 'low' with 'high' given the most priority.
Force repository check
When the trigger is executed and a build is queued, the build needs to decide what to do with the Repositories attached to the Configuration. In the case of a Repository Trigger, the triggering Repository is assumed to be in a working state since it just triggered the build. However, the same can't be said for all non-triggering repositories of which there could be many. In the case of Time Trigger and the Build Completed Trigger, all repositories are non-triggering repositories. For Repository Trigger, the non-triggering repositories are all those repositories other than the one that triggered the build. When the force repository check option is set, all non-triggering repositories are checked to see if they are in an error state. If they're in an error state, an attempt will be made to fix them. If they're still in an error state then the build won't start and you'll see an entry in the Event Log with the details.
There are times however when you might not care if the repository is in an error state. When you setup a repository in Continua CI, it immediately copies your repository into a repository cache directory located in the Continua Share directory that you setup when installing Continua CI. Continua CI makes sure that the cache is always up to date by polling your repository every now and then (specified when you create a repository). If Continua can't contact your repository then it's marked as errored and as a result the cached version of your repository may not contain the latest changes. By not selecting the force repository check option, you're telling the trigger to not check the repositories (and possibly not get the latest changes from it) and instead use the latest cached version.
Override repository branch mappings
This will display a new tab for selecting the branch to build for each repository overriding the default repository branch and any repository branch mappings.
The variables drop down will contain a list of all configuration variables you have created. It gives you the ability to change a variable's value when the trigger executes the Configuration. By clicking the plus icon to the right hand side of the input field, you can set the value of additional variables.
Set the branch to build for each repository. This will override the default branch and any branch mappings.