GitHub user Leemoonsoo opened a pull request:
https://github.com/apache/zeppelin/pull/2094
[ZEPPELIN-2162] [ZEPPELIN-2142] Make travis_check.py work with fork under
organization, and show guidance if travis is not configured
### What is this PR for?
When contributor uses zeppelin fork under organization, Jenkins can't check
it with current travis_check.py.
This PR updates travis_check.py to distinguish error 1 when it fails with
build fail, error 2 when it can't find build.
When it fails with 2, jenkins configuration can retry travis_check.py with
organization repo.
Even though it tried again, still get 2 in return, then print instruction
how to configure travis-ci.
Jenkins configuration is updated
from
```bash
if [ -f "travis_check.py" ]; then
git log -n 1
STATUS=$(curl -s $BUILD_URL | grep -e "GitHub pull request.*from.*" | sed
's/.*GitHub pull request <a
href=\"\(https[^"]*\).*from[^"]*.\(https[^"]*\).*/\1 \2/g')
AUTHOR=$(echo $STATUS | sed 's/.*[/]\(.*\)$/\1/g')
PR=$(echo $STATUS | awk '{print $1}' | sed 's/.*[/]\(.*\)$/\1/g')
COMMIT=$(git log -n 1 | grep "^Merge:" | awk '{print $3}')
if [ -z $COMMIT ]; then
COMMIT=$(curl -s https://api.github.com/repos/apache/zeppelin/pulls/$PR
| grep -e "\"ref\":" -e "\"sha\":" | tr '\n' ' ' | sed
's/\(.*sha[^,]*,\)\(.*ref.*\)/\1 = \2/g' | tr = '\n' | grep -v master | sed
's/.*sha.[^"]*["]\([^"]*\).*/\1/g')
fi
sleep 30 # sleep few moment to wait travis starts the build
python ./travis_check.py ${AUTHOR} ${COMMIT}
else
echo "travis_check.py does not exists"
echo "assume it's gh-pages branch"
echo "return okay"
fi
```
to
```bash
if [ -f "travis_check.py" ]; then
git log -n 1
STATUS=$(curl -s $BUILD_URL | grep -e "GitHub pull request.*from.*" | sed
's/.*GitHub pull request <a
href=\"\(https[^"]*\).*from[^"]*.\(https[^"]*\).*/\1 \2/g')
AUTHOR=$(echo $STATUS | sed 's/.*[/]\(.*\)$/\1/g')
PR=$(echo $STATUS | awk '{print $1}' | sed 's/.*[/]\(.*\)$/\1/g')
COMMIT=$(git log -n 1 | grep "^Merge:" | awk '{print $3}')
if [ -z $COMMIT ]; then
COMMIT=$(curl -s https://api.github.com/repos/apache/zeppelin/pulls/$PR
| grep -e "\"ref\":" -e "\"sha\":" | tr '\n' ' ' | sed
's/\(.*sha[^,]*,\)\(.*ref.*\)/\1 = \2/g' | tr = '\n' | grep -v master | sed
's/.*sha.[^"]*["]\([^"]*\).*/\1/g')
fi
sleep 30 # sleep few moment to wait travis starts the build
python ./travis_check.py ${AUTHOR} ${COMMIT}
RET_CODE=$?
if [ $RET_CODE -eq 2 ]; then # try with repository name when travis-ci is
not available in the account
AUTHOR=$(curl -s https://api.github.com/repos/apache/zeppelin/pulls/$PR
| grep '"full_name":' | grep -v "apache/zeppelin" | sed
's/.*[:][^"]*["]\([^/]*\).*/\1/g')
python ./travis_check.py ${AUTHOR} ${COMMIT}
RET_CODE=$?
fi
if [ $RET_CODE -eq 2 ]; then # fail with can't find build information in
the travis
echo "Looks like travis-ci is not configured for your fork."
echo "Please setup by swich on 'zeppelin' repository at
https://travis-ci.org/profile and travis-ci."
echo "And then make sure 'Build pushes' option is enabled in the
settings https://travis-ci.org/${AUTHOR}/zeppelin/settings."
echo "See
http://zeppelin.apache.org/contribution/contributions.html#continuous-integration."
fi
exit $RET_CODE
else
echo "travis_check.py does not exists"
echo "assume it's gh-pages branch"
echo "return okay"
fi
```
### What type of PR is it?
Improvement
### Todos
* [x] - distinguish error code travis_check.py
* [x] - Update jenkins configuration
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-2162
https://issues.apache.org/jira/browse/ZEPPELIN-2142
### Questions:
* Does the licenses files need update? no
* Is there breaking changes for older versions? no
* Does this needs documentation? no
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Leemoonsoo/zeppelin minor_update_travis_check
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/zeppelin/pull/2094.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #2094
----
commit 5e3ade4ab638f05ee6d9726dd185c61422ef0b59
Author: Lee moon soo <[email protected]>
Date: 2017-03-04T02:28:19Z
use different error code when can't find build in travis, to distinguish
with build fail
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---