Skip to content
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

Hitting rate limits with Travis commit message linting #24567

Closed
richardlau opened this issue Nov 22, 2018 · 16 comments
Closed

Hitting rate limits with Travis commit message linting #24567

richardlau opened this issue Nov 22, 2018 · 16 comments

Comments

@richardlau
Copy link
Member

richardlau commented Nov 22, 2018

Opening this as a separate issue for tracking/discussion:


false positive which we speculate was perhaps due to hitting the> GitHub API rate limit or a network issue (#23739 (comment)).

FTR: Here's one example where the rate limit is hit:

https://travis-ci.com/nodejs/node/jobs/158565896#L447

$ if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST}; fi
+GH_API_URL=https://api.github.com
+PR_ID=24366
+'[' -z 24366 ']'
+'[' -z 24366 ']'
++curl -s https://api.github.com/repos/nodejs/node/pulls/24366/commits
+PR_COMMITS='{
  "message": "API rate limit exceeded for 52.54.40.118. (But here'\''s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
  "documentation_url": "https://developer.github.com/v3/#rate-limiting"
}'
++node -p 'JSON.parse(process.argv[1])[0].url' '{
  "message": "API rate limit exceeded for 52.54.40.118. (But here'\''s the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
  "documentation_url": "https://developer.github.com/v3/#rate-limiting"
}'
+FIRST_COMMIT=
+echo 'Unable to determine the first commit for pull request 24366.'
Unable to determine the first commit for pull request 24366.
+exit 1
The command "if [ "${TRAVIS_PULL_REQUEST}" != "false" ]; then bash -x tools/lint-pr-commit-message.sh ${TRAVIS_PULL_REQUEST}; fi" exited with 1.

I suggest we keep an eye out for if this becomes a more common occurrence. Note that the rate limit for unauthenticated GitHub API requests is IP based so it's whatever Travis is running on that IP (so may not be entirely our jobs).

Authenticated GitHub API requests on Travis may be tricky to implement without exposing the token publicly. Encrypted environment variables are not available to pull requests from forks.

Originally posted by @richardlau in #24254 (comment)

@richardlau
Copy link
Member Author

Another occurrence: #21408 (comment)

@rvagg
Copy link
Member

rvagg commented Nov 22, 2018

A workaround might be to set up a very limited proxy that does it for us and only allow the Travis IP addresses to access it. Maybe an extension of the github-bot functionality since it has its own server.

@Trott
Copy link
Member

Trott commented Nov 22, 2018

Solution used by MozillaSecurity/orion is to not use the API but to scrape the GitHub website instead. 😱

We could do the same, replacing URLs like https://api.github.com/repos/nodejs/node/pulls/24366/commits with https://github.com/nodejs/node/pull/24366/commits and scraping for the info.

@Trott
Copy link
Member

Trott commented Nov 22, 2018

If we're careful about what we display in our Travis output, I suppose we might be able to use encrypted variables in Travis to provide Travis with authentication information so we can enable authenticated access to the API to increase our limits.

@Trott
Copy link
Member

Trott commented Nov 22, 2018

/ping @codebytere in case there's some easy way to solve this by asking GitHub. 😄

@richardlau
Copy link
Member Author

If we're careful about what we display in our Travis output, I suppose we might be able to use encrypted variables in Travis to provide Travis with authentication information so we can enable authenticated access to the API to increase our limits.

@Trott but encrypted variables are not available to pull requests from other forks.

@Trott
Copy link
Member

Trott commented Nov 22, 2018

And, of course, we can always decide to give up and remove the automatic linting for commit message format. Maybe leave the script in tools and mention it CONTRIBUTING.md or whatever.

@Trott
Copy link
Member

Trott commented Nov 22, 2018

ESLint has a commit-message status check on PRs. Looks like they created it themselves. /ping @not-an-aardvark

@Trott
Copy link
Member

Trott commented Nov 22, 2018

ESLint GitHub bot: https://github.com/eslint/eslint-github-bot
Commit message linting: https://github.com/eslint/eslint-github-bot/blob/master/src/plugins/commit-message/index.js

I guess if we switch to a bot rather than Travis for this, authenticated access to the API is not-a-problem.

@antsmartian
Copy link
Contributor

antsmartian commented Nov 22, 2018

Saw this now as well : https://travis-ci.com/nodejs/node/jobs/160333929, from #24569.

@refack
Copy link
Contributor

refack commented Nov 22, 2018

@richardlau since the other jobs in the Travis matrix take a long time anyway maybe we can sleep and retry a few times?

@refack
Copy link
Contributor

refack commented Nov 22, 2018

I guess if we switch to a bot rather than Travis for this, authenticated access to the API is not-a-problem.

Also we could run this script in Jenkins.

@richardlau
Copy link
Member Author

richardlau commented Nov 22, 2018

@richardlau since the other jobs in the Travis matrix take a long time anyway maybe we can sleep and retry a few times?

The rate limit is per hour so I'm not sure how practical that would be. The API includes information about the rate, including when it resets, in the response headers (not currently logged in the job/script).

@refack
Copy link
Contributor

refack commented Nov 23, 2018

The rate limit is per hour so I'm not sure how practical that would be.

Well it was an idea 🤷‍♂️
But we could run it in jenkins with the format I suggested in nodejs/build#1554 (independent nodejs checkout validating the "un-sanitazied" checkout)

@rvagg
Copy link
Member

rvagg commented Nov 23, 2018

simple fix proposed in #24574

Trott pushed a commit to Trott/io.js that referenced this issue Dec 1, 2018
Fixes: nodejs#24567

PR-URL: nodejs#24574
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
@Trott
Copy link
Member

Trott commented Dec 1, 2018

Fixed in 76faccc

@Trott Trott closed this as completed Dec 1, 2018
BridgeAR pushed a commit that referenced this issue Dec 5, 2018
Fixes: #24567

PR-URL: #24574
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
refack pushed a commit to refack/node that referenced this issue Jan 14, 2019
Fixes: nodejs#24567

PR-URL: nodejs#24574
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
BethGriggs pushed a commit that referenced this issue Feb 12, 2019
Fixes: #24567

PR-URL: #24574
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
rvagg added a commit that referenced this issue Feb 28, 2019
Fixes: #24567

PR-URL: #24574
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants