Triggers
A trigger is an event that causes a workflow to run. Currently, BeetleboxCI uses three types of triggers to run workflows:
- Push—workflows can be set to run when new code is pushed to the version control system.
- Schedule—workflows can be set up to run automatically at a particular time, on a recurring basis.
- Manual—the user chooses to run a particular workflow through the BeetleboxCI web application
Push
BeetleboxCI will detect if new code has been pushed to any branch of linked git repositories.
If the commit hash changed on a particular branch, BeetleboxCI will run a workflow on that branch if the config file on that branch has a push
trigger.
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
jobs:
hello-world:
runner: local-runner
steps:
- run:
name: Say Hello World
command: |
echo "Hello World"
workflows:
hello-world-workflow:
triggers:
- push
jobs:
- hello-world
Schedule
The schedule trigger allows workflows to be run at a set time. It is is based on the Cron syntax, and more information about Cron can be found here.
The example below shows a workflow that is scheduled to run at 9:30am each day.
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
jobs:
hello-world:
runner: local-runner
steps:
- run:
name: Say Hello World
command: |
echo "Hello World"
workflows:
hello-world-workflow:
triggers:
- schedule:
cron: "30 9 * * *"
jobs:
- hello-world
If the user wants a workflow to run on two different schedules, the workflow will need to be duplicated and the duplicate can have a different schedule set for it. The example shows a workflow that is set to run at 9:30am each day and its duplicate is set to run at 9:30pm each day.
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
jobs:
hello-world:
runner: local-runner
steps:
- run:
name: Say Hello World
command: |
echo "Hello World"
workflows:
hello-world-workflow1:
triggers:
- schedule:
cron: "30 21 * * *"
jobs:
- hello-world
hello-world-workflow2:
triggers:
- schedule:
cron: "30 9 * * *"
jobs:
- hello-world
Manual
Manual triggers are the most basic of the of the trigger options available.
The user can always click the run button on any workflow in the BeetleboxCI web application to run that workflow at any time, regardless of whether or not a manual trigger is specified in the config file.
Even in the case where only push and/or schedule triggers are defined, it is still possible for the user to run the workflow manually.
BeetleboxCI will, however, accept manual
as an option in the triggers
list.
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
jobs:
hello-world:
runner: local-runner
steps:
- run:
name: Say Hello World
command: |
echo "Hello World"
workflows:
hello-world-workflow:
triggers:
- manual
jobs:
- hello-world
Multiple Triggers
A workflow may have multiple triggers. In such a case, any of the triggers specified can trigger the workflow (as mentioned previously, workflows can be triggered manually in any case, regardless of whether or not a manual trigger is specified) The example below shows a workflow that is controlled by 3 different triggers:
runners:
local-runner:
image: public.ecr.aws/y2s4f3y9/ubuntu-generic:latest
jobs:
hello-world:
runner: local-runner
steps:
- run:
name: Say Hello World
command: |
echo "Hello World"
workflows:
hello-world-workflow:
triggers:
- manual
- push
- schedule:
cron: "30 21 * * *"
jobs:
- hello-world