cd-ci-glue
Functions
Travis CI

Functions

 is_travis_branch_push (branch)
 Check if invoked from Travis CI due to a push event on a specific branch. More...
 
 is_travis_master_push ()
 Check if invoked from Travis CI due to push on master branch. More...
 
 is_travis_cron ()
 Check if invoked from Travis CI due to a cron event. More...
 

Detailed Description

Function Documentation

◆ is_travis_branch_push()

is_travis_branch_push ( branch  )

Check if invoked from Travis CI due to a push event on a specific branch.

Parameters
branchBranch name to compare to
Environment variables
TRAVIS_EVENT_TYPE Variable set by Travis CI during build-time, indicating event type.
TRAVIS_BRANCH Variable set by Travis CI during build-time, indicating which branch we're on.

Return a zero status code if this is refering to a push on the branch given as argument. If any of the required environment variables are missing, will emit error message on stderr, but containue anyway and assume that this is not a push event on the desired branch. Please note that this might break your script execution if running with -o pipefail and/or set -eE. A work-around for that fact is described below in the example section.

Example
# Below will fail on -opipefail, -eE etc.
$ is_travis_branch_push devel && dockerhub_push_image madworx/qemu:dev
# Below is a work-around for above behaviour.
$ ! is_travis_branch_push devel && true || dockerhub_push_image madworx/qemu:dev

◆ is_travis_cron()

is_travis_cron ( )

Check if invoked from Travis CI due to a cron event.

Environment variables
TRAVIS_EVENT_TYPE Variable set by Travis CI during build-time, indicating event type.

Return a zero status code if this is triggerd by Travis cron.

◆ is_travis_master_push()

is_travis_master_push ( )

Check if invoked from Travis CI due to push on master branch.

Environment variables
TRAVIS_EVENT_TYPE Variable set by Travis CI during build-time, indicating event type.
TRAVIS_BRANCH Variable set by Travis CI during build-time, indicating which branch we're on.

Return a zero status code if this is referring to a push to the master branch.

Example
# Below will fail on -opipefail, -eE etc.
$ is_travis_master_push && dockerhub_push_image madworx/qemu
# Below is a work-around for above behaviour.
$ ! is_travis_master_push && true || dockerhub_push_image madworx/qemu