Skip to content

Commit

Permalink
Merge e007271 into d638d20
Browse files Browse the repository at this point in the history
  • Loading branch information
juancarlostong committed Oct 2, 2018
2 parents d638d20 + e007271 commit 62613df
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ install:
before_script: "rubocop"
addons:
srcclr: true
script: "rake spec"
script:
- "rake spec"
- "./ci/run.sh"
after_success: "coveralls"
58 changes: 58 additions & 0 deletions ci/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# helper functions

function trigger_job {

local repo_slug=$1

local body=$(cat <<EOF
{
"request": {
"message": "Override the commit message: this is an api request",
"branch": "jtong/travisci",
"config": {
"merge_mode": "replace",
"env": {
"UPSTREAM_SHA": "$TRAVIS_PULL_REQUEST_SHA",
"UPSTREAM_REPO": "$TRAVIS_PULL_REQUEST_SLUG",
"global": {
"DOCKER_COMPOSE_VERSION": "1.22.0",
"DEFAULT_RUN_ALL": false,
"DEFAULT_SDK_BRANCH": "master",
"DEFAULT_TESTAPP_TAG": "latest",
"TESTAPP_IMAGE": "",
"TESTAPP_REPO": "quay.io/optimizely",
"PERF": false,
"PERF_NUM_RUNS": 50,
"RESULTS_DIR": "./test_results",
"COMPOSE_PROJECT_NAME": "fullstack-compat-${TRAVIS_BRANCH}-${TRAVIS_BUILD_NUMBER}",
"TESTAPP_PORT_BINDING": 3000
},
"matrix": {
"COMPOSE_PROJECT_NAME": "${COMPOSE_PROJECT_NAME}-ruby"
}
},
"before_script": "STATE=pending ./update_build_status.sh",
"script": ["./ci.sh"],
"after_success": "STATE=success ./update_build_status.sh",
"after_failure": "STATE=failure ./update_build_status.sh"
}
}
}
EOF
)

echo $body

local REPO="https://api.travis-ci.com/repo/$repo_slug/requests"

local results=$(curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TOKEN" \
-d "$body" \
$REPO)

echo $results

echo $results | jq .id
6 changes: 6 additions & 0 deletions ci/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

. "./functions.sh"

repo="optimizely/fullstack-sdk-compatibility-suite"
id=$(trigger_job $repo)

0 comments on commit 62613df

Please sign in to comment.