Use Triggers and Schedule Builds

With Triggers, build may be performing in a number of ways. For Continuous incorporation builds, it is ideal to run the construct every time a file is checkered in with a storehouse Trigger. Other regular builds, such as every night builds, are manage by schedules and kick off by Scheduled Triggers.

Builds (and deployments) may also be in progress based on random events in the system using a scripted Event Trigger. For example, event triggers can be used to look for actions such as a over build of a related scheme or completion of an originating workflow with the auto-deploy flag set to "true".

MVI supports three trigger types:

  • Event Triggers. Looks for actions mechanically thrown by MVI and initiates another action (e.g., initiates a deployment on successful completion of an originating workflow).
  • Repository Triggers. Kicks off a build when changes are dedicated to source. Most commonly used for CI.
  • Scheduled Trigger. Each agenda runs on its own timer. The build is registered with the schedule and kicked off when the schedule fires.

Event Triggers

Event Triggers use scripts to create an Event Filter that listens to events passing through the MVI Event Service. When the Event Script detects an event (e.g., that a dependency of the trigger’s workflow is used; a completed build of a related project; or a completed originating workflow with the auto-deploy flag set to "true"; etc.), it can then trigger another action by the MVI server.

In general, once configured, the scripts are immediately active and listening for events. The trigger, workflow, and project parameters provide references to the Event Trigger itself, as well as the workflow and project it belongs to. The MVI API exposes its event service so the Trigger may be configured to listen for specific events.

Prerequisites

  • You must have Administrative permissions.
  • Prior to adding an Event Trigger to the workflow, the Event Script must be created.
  • If you are unfamiliar with MVI scripting, Scripting and Tools > Developer Tools before creating an Event Trigger.

Create Event Trigger

  • Go to Administration and select the workflow the trigger is to be added to.
  • Select the Triggers tab, and click the New Trigger button.
  • Select Event Trigger from the drop-down menu and click Select.
  • Configure trigger:
  1. Name the trigger.
  2. Force. Check the box to force a build every time this trigger executes.
  3. Event Script. Select the script that returns an Event Listener. Available parameters are the workflow to be triggered (workflow); this project (project); and this trigger (trigger).
  • Click Save then Done.

Repository Triggers

For Continuous Integration builds, it is ideal to build every time a file is checked in. In this case, a post-commit script is added to the SCM that alerts MVI of source changes. Once the Repository Trigger is active for a workflow, every commit of source changes will initiate a build.

  • Go to Administration and select the workflow the trigger is to be added to.
  1. If using Subversion, triggers can be set up at the repository level. Once done, they are available to all workflows using that repository. An individual workflow trigger does not need to be created.
  • Select the Triggers tab, and click the New Trigger button.
  • Select Repository Trigger from the drop-down menu and click Select.
  • Configure trigger:
  1. Name the trigger.
  2. Force. Check the box to force a build every time this trigger executes.
  • Click Save then Done.

Scheduled Triggers

Add a Scheduled Trigger to workflows in a similar manner to the Repository Trigger. Each Schedule Trigger runs on its own timer that polls the SCM for changes. If changes are detected, the build is registered with the schedule and kicked off when the schedule fires.

Scheduled Triggers give the option to force a build regardless of whether source changes have occurred. Unless the forced option is set, MVI will not initiate a build if no source changes are detected.

Create Schedule

Before a Schedule Trigger can be activated, a schedule must be created. There are two schedule types utilized by MVI: Interval and Cron. The Interval Schedule regularly fires after a fixed interval of time, and is the simplest schedule. If an interval schedule is not sufficient, use the Cron schedule. Cron Schedules may be configured to consider nightly or weekly outages of servers (for backups), weekly builds, or builds that occur on every other Friday except in February, etc.

To create a Schedule, you must have Administrative permissions. Go to System > Schedules under the Project Support menu.

  • Click the Create Schedule button.
  • Check the schedule type:
  1. Cron Expression Schedule. Fires based on a Cron expression.
  2. Interval Schedule. Fires after a fixed interval of time passes.
  • Click Set. If using a Cron Schedule, proceed to Item 5; otherwise go to Item 7.
  • Configure Cron Schedule.
  1. Name the schedule.
  2. Description. Give a description of the schedule.
  3. Cron Expression. Provide the Cron expression to use for determining the schedule. See the New Schedule page of the MVI UI for detailed instructions.
  • Proceed to Item 8.
  • Configure Interval Schedule.
  1. Name the schedule.
  2. Description. Give a description of the schedule.
  3. Build Interval (minutes). Give the amount of minutes that will pass before the scheduled task gets run.
  4. Interval Start Time (hh:mm). Provide the time at which this schedule should start running.
  • Click Set then Done.

Add Schedule to Workflow Trigger

  • Go to Administration and select the workflow the trigger is to be added to.
  • Select the Triggers tab, and click the New Trigger button.
  • Select Scheduled Trigger from the drop-down menu and click Select.
  • Configure trigger:
  1. Name the trigger.
  2. Schedule. Select a schedule from the drop-down menu.
  3. Force. Check the box to force a build every time this trigger executes, even if source changes have not been detected.
  • Click Save then Done.