Skip to content

Commit

Permalink
trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Pierce committed Jul 23, 2019
1 parent 8d3e0b1 commit 3e180bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .cicd/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ env:

steps:

- label: ":webhook: Trigger Travis CI Build"
command:
- "./.cicd/travis-trigger.sh"
agents:
queue: "automation-eos-builder-fleet"

- trigger: "eosio-base-images-beta"
label: ":docker: Ensure base images exist"
build:
Expand Down
18 changes: 18 additions & 0 deletions .cicd/travis-trigger.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -eo pipefail
echo '+++ :gear: Configuring Travis CI Build'
[[ -z $TRIGGER_TRAVIS_API_KEY ]] && echo '+++ :no_entry: ERROR: TRIGGER_TRAVIS_API_KEY key not found!' && exit 1
TRAVIS_MESSAGE=${TRAVIS_MESSAGE:-"$BUILDKITE_MESSAGE - $(echo $BUILDKITE_BUILD_URL | grep -oe 'buildkite.*')"}
SOURCE_SLUG=${SOURCE_SLUG:-'eos-vm'}
[[ -z $BODY ]] && BODY="$(jq -nc '{"request":{"branch":env.BUILDKITE_BRANCH,"message":env.TRAVIS_MESSAGE}}')"
echo 'Configuration:'
echo "$BODY" | jq
echo 'This configuration is derived from the BUILDKITE_BRANCH and BUILDKITE_MESSAGE variables set for this build.'
echo '+++ :tractor: Triggering Travis CI Build'
export RESULT="$(curl -s -X POST -H "Content-Type: application/json" -H "Accept: application/json" -H "Travis-API-Version: 3" -H "Authorization: token $TRIGGER_TRAVIS_API_KEY" -d "$BODY" https://api.travis-ci.org/repo/EOSIO%2f${SOURCE_SLUG}/requests)"
echo 'API Response:'
echo "$RESULT" | jq 2>/dev/null || echo "$RESULT"
if [[ "$(echo $RESULT | jq -r '.["@type"]')" != "pending" ]]; then
echo '+++ :no_entry: ERROR: Failed to trigger Travis API!'
exit 1
fi

0 comments on commit 3e180bc

Please sign in to comment.