[ZEPPELIN-2162] [ZEPPELIN-2142] Make travis_check.py work with fork under organization, and show guidance if travis is not configured#2094
Closed
Leemoonsoo wants to merge 1 commit into
Conversation
…ish with build fail
felixcheung
approved these changes
Mar 5, 2017
Member
Author
|
Merge to master and branch-0.7 if no more comments. |
asfgit
pushed a commit
that referenced
this pull request
Mar 7, 2017
…nder 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
Author: Lee moon soo <moon@apache.org>
Closes #2094 from Leemoonsoo/minor_update_travis_check and squashes the following commits:
5e3ade4 [Lee moon soo] use different error code when can't find build in travis, to distinguish with build fail
(cherry picked from commit 80e09eb)
Signed-off-by: Lee moon soo <moon@apache.org>
prabhjyotsingh
pushed a commit
to prabhjyotsingh/zeppelin
that referenced
this pull request
Mar 7, 2017
…nder 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
Author: Lee moon soo <moon@apache.org>
Closes apache#2094 from Leemoonsoo/minor_update_travis_check and squashes the following commits:
5e3ade4 [Lee moon soo] use different error code when can't find build in travis, to distinguish with build fail
(cherry picked from commit 80e09eb)
Signed-off-by: Lee moon soo <moon@apache.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
to
What type of PR is it?
Improvement
Todos
What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-2162
https://issues.apache.org/jira/browse/ZEPPELIN-2142
Questions: