Skip to content

Commit

Permalink
Merge e03ccbd into 3519d1c
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Oct 25, 2017
2 parents 3519d1c + e03ccbd commit 597be01
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ after_success:
s3cmd sync --access_key="$ARTIFACTS_KEY" --secret_key="$ARTIFACTS_SECRET" -v -P ./importer/dist/build/export/export s3://weldr/$TARGET_DIR/export
s3cmd sync --access_key="$ARTIFACTS_KEY" --secret_key="$ARTIFACTS_SECRET" -v -P ./schema.sql s3://weldr/$TARGET_DIR/schema.sql
# kick off other tests which depend on the artifacts above
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
./kick_dependent_tests.sh
fi
notifications:
email:
on_failure: change
Expand Down
66 changes: 66 additions & 0 deletions kick_dependent_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/bin/bash

### NOTE. Needs TRAVIS_API_TOKEN and GITHUB_API_TOKEN

set -ex

REFERRER_COMMIT="$TRAVIS_COMMIT"
if [ -n "$TRAVIS_PULL_REQUEST_SHA" ]; then
REFERRER_COMMIT="$TRAVIS_PULL_REQUEST_SHA"
fi

before_script=$(cat <<-END
export BDCS_PR=$TRAVIS_PULL_REQUEST; \
curl -s -X POST \
-H \\"User-Agent: weldr team CI\\" \
-H \\"Authorization: token \$GITHUB_API_TOKEN\\" \
-d '{ \
\\"state\\": \\"pending\\", \
\\"target_url\\": \\"'https://travis-ci.org/\$TRAVIS_REPO_SLUG/builds/\$TRAVIS_BUILD_ID'\\", \
\\"description\\": \\"Job '\$TRAVIS_JOB_NUMBER' for '\$TRAVIS_REPO_SLUG' has been started\\", \
\\"context\\": \\"'\$TRAVIS_REPO_SLUG \$TRAVIS_JOB_NUMBER \$COMMAND'\\" \
}' \
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/$REFERRER_COMMIT
END
)

after_script=$(cat <<-END
test_result=\\"failure\\"; \
if [ \$TRAVIS_TEST_RESULT == 0 ]; then \
test_result=\\"success\\"; \
fi; \
curl -s -X POST \
-H \\"User-Agent: weldr team CI\\" \
-H \\"Authorization: token \$GITHUB_API_TOKEN\\" \
-d '{ \
\\"state\\": \\"'\$test_result'\\", \
\\"target_url\\": \\"'https://travis-ci.org/\$TRAVIS_REPO_SLUG/builds/\$TRAVIS_BUILD_ID'\\", \
\\"description\\": \\"Job '\$TRAVIS_JOB_NUMBER' for '\$TRAVIS_REPO_SLUG' has finished\\", \
\\"context\\": \\"'\$TRAVIS_REPO_SLUG \$TRAVIS_JOB_NUMBER \$COMMAND'\\" \
}' \
https://api.github.com/repos/$TRAVIS_REPO_SLUG/statuses/$REFERRER_COMMIT
END
)

body='{
"request": {
"message": "Build started by '"$TRAVIS_REPO_SLUG"' PR #'"$TRAVIS_PULL_REQUEST"'",
"branch":"master",
"config": {
"before_script": "'"$before_script"'",
"after_script": "'"$after_script"'"
}
}
}'


# trigger new builds for welder-web and bdcs-cli using the PR artifacts for testing
for target_repo in welder-web bdcs-cli; do
curl -s -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Travis-API-Version: 3" \
-H "Authorization: token $TRAVIS_API_TOKEN" \
-d "$body" \
https://api.travis-ci.org/repo/weldr%2F$target_repo/requests
done

0 comments on commit 597be01

Please sign in to comment.