From 35b9ab898d2727822af4319d298e989641106ede Mon Sep 17 00:00:00 2001 From: matejcik Date: Wed, 23 May 2018 17:08:32 +0200 Subject: [PATCH] travis: also trigger trezor-mcu when running tests because now it should be ALL GREEN --- trigger-travis.sh | 64 ++++++++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/trigger-travis.sh b/trigger-travis.sh index 238f34b96c..12a2ff6b24 100755 --- a/trigger-travis.sh +++ b/trigger-travis.sh @@ -2,9 +2,6 @@ # adapted from https://github.com/stephanmg/travis-dependent-builds # variables -USER=trezor -REPO=trezor-core -BRANCH=master SOURCE=trezor/python-trezor if [ "$TRAVIS_REPO_SLUG" != "$SOURCE" ]; then @@ -22,31 +19,42 @@ if [[ "$TRAVIS_JOB_NUMBER" != *.1 ]]; then exit 0; fi -MESSAGE=",\"message\": \"Triggered from upstream build of $TRAVIS_REPO_SLUG by commit "`git rev-parse --short HEAD`"\"" +function trigger_build() { + USER="$1" + REPO="$2" + BRANCH="$3" + echo "attempting to trigger build of $USER/$REPO" -# curl POST request content body -BODY="{ - \"request\": { - \"branch\":\"$BRANCH\" - $MESSAGE -}}" + MESSAGE=",\"message\": \"Triggered from upstream build of $TRAVIS_REPO_SLUG by commit "`git rev-parse --short HEAD`"\"" -echo "attempting to trigger build of $USER/$REPO" -# make a POST request with curl (note %2F could be replaced with -# / and additional curl arguments, however this works too!) -curl -s -X POST \ - -H "Content-Type: application/json" \ - -H "Accept: application/json" \ - -H "Travis-API-Version: 3" \ - -H "Authorization: token ${TRAVIS_TOKEN}" \ - -d "$BODY" \ - https://api.travis-ci.org/repo/${USER}%2F${REPO}/requests \ - | tee /tmp/travis-request-output.$$.txt + # curl POST request content body + BODY="{ + \"request\": { + \"branch\":\"$BRANCH\" + $MESSAGE + }}" -if grep -q '"@type": "error"' /tmp/travis-request-output.$$.txt; then - cat /tmp/travis-request-output.$$.txt - exit 1 -elif grep -q 'access denied' /tmp/travis-request-output.$$.txt; then - cat /tmp/travis-request-output.$$.txt - exit 1 -fi + # make a POST request with curl (note %2F could be replaced with + # / and additional curl arguments, however this works too!) + curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -H "Travis-API-Version: 3" \ + -H "Authorization: token ${TRAVIS_TOKEN}" \ + -d "$BODY" \ + https://api.travis-ci.org/repo/${USER}%2F${REPO}/requests \ + | tee /tmp/travis-request-output.$$.txt + echo + + if grep -q '"@type": "error"' /tmp/travis-request-output.$$.txt; then + cat /tmp/travis-request-output.$$.txt + exit 1 + elif grep -q 'access denied' /tmp/travis-request-output.$$.txt; then + cat /tmp/travis-request-output.$$.txt + exit 1 + fi +} + +# trigger both core and mcu +trigger_build trezor trezor-core master +trigger_build trezor trezor-mcu master