-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skip push builds if there is a pull request #5156
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5156 +/- ##
==============================================
- Coverage 86.714% 86.66% -0.054%
- Complexity 29399 29413 +14
==============================================
Files 1815 1813 -2
Lines 136044 136388 +344
Branches 15091 15028 -63
==============================================
+ Hits 117969 118194 +225
- Misses 12644 12749 +105
- Partials 5431 5445 +14
|
@droazen I implemented the pr skipping on push builds if there's a pr branch. It seems to work. It has to spin up a vm to do the check, but that takes about a minute instead of many, and it avoids running tests and downloading lfs. The good things is that if it fails for some reason it should just continue on with the build, so flakiness in the github api or network connectivitiy will just result in some extra builds completing rather than extra failures. I think I should add a github token though so we don't get api throttling. Should I just add one from my own account? |
… ever leave you'll probably have to update it.
testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review complete, back to @lbergelson. Merge after addressing comments.
.travis.yml
Outdated
- if [[ ${TRAVIS_EVENT_TYPE} == push ]]; | ||
then | ||
PULL_REQUESTS=$(curl -v -H "Authorization':' token $GITHUB_API_TOKEN" https://api.github.com/repos/broadinstitute/gatk/pulls\?state\=open\&head="broadinstitute:${TRAVIS_BRANCH}"); | ||
if [[ $( grep -c "commits" <<< ${PULL_REQUESTS} ) -gt 0 ]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of grepping for a specific term, perhaps it would be better to check that the result is non-empty after trimming [ ]
. Eg., check that:
curl https://api.github.com/repos/broadinstitute/gatk/pulls\?state\=open\&head="broadinstitute:lb_skip_push_buildsfoo" | sed 's/\[//g' | sed 's/\]//g' | tr -d '[:space:]' | wc -c
is non-zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to skip this because I'm not convinced it's any more robust to changes in the returned format.
.travis.yml
Outdated
#skip push builds if there's an associated PR because we don't look at them anway | ||
- if [[ ${TRAVIS_EVENT_TYPE} == push ]]; | ||
then | ||
PULL_REQUESTS=$(curl -v -H "Authorization':' token $GITHUB_API_TOKEN" https://api.github.com/repos/broadinstitute/gatk/pulls\?state\=open\&head="broadinstitute:${TRAVIS_BRANCH}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a separate account tied to this token instead of using your personal account?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFFIRMATIVE
Does not compute. |
testing if this skips the push builds.