Ensure pull request number is int

Currently manual enqueue of github pull requests to gate pipelines is
broken because the pull request number can be of type string instead
of int which breaks the graphql query.

To fix this centrally force the pull request number to int in
_getChange in order to prevent this and potential similar side effects
of str vs. int.

Change-Id: I0ad241e0308feb60b173182375f04313b008dce6
This commit is contained in:
Tobias Henkel 2020-06-02 16:22:48 +02:00
parent ba94d07e8a
commit b79a83f323
No known key found for this signature in database
GPG Key ID: 03750DEC158E5FA2
1 changed files with 4 additions and 0 deletions

View File

@ -1200,6 +1200,10 @@ class GithubConnection(BaseConnection):
def _getChange(self, project, number, patchset=None, refresh=False,
event=None):
# Note(tobiash): We force the pull request number to int centrally here
# because it can originate from different sources (github event, manual
# enqueue event) where some might just parse the string and forward it.
number = int(number)
key = (project.name, number, patchset)
change = self._change_cache.get(key)
if change and not refresh: