Skip to content

Add S-needs-code-changes if travis build fails #88

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

Closed
wants to merge 2 commits into from
Closed

Add S-needs-code-changes if travis build fails #88

wants to merge 2 commits into from

Conversation

mylainos
Copy link
Contributor

Fix #28.

Should I remove the unused functions in travisciapiprovider.py?

@highfive
Copy link
Collaborator

Heads up! This PR modifies the following files:

  • @jdm: handlers/status_update/init.py, travisciapiprovider.py, eventhandler.py, handlers/status_update/tests/build_status.json, newpr.py


# If more functionality is needed from this class, it might be a
# better decision to use travispy
class TravisCiApiProvider():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we have this along with the other API provider classes in newpr.py?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually prefer this to live separately.

@wafflespeanut
Copy link
Contributor

The relevant tests should also be updated, btw.



def get_log(self, build_data):
return urllib.urlopen(self.log_url.format(job_id=self._get_job_id(build_data))).read()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto on splitting

@jdm
Copy link
Member

jdm commented Apr 22, 2016

Great work! Let's go ahead and remove any unused code from the Travis API provider.

@mylainos
Copy link
Contributor Author

@wafflespeanut so I need to add tests for the Tavis CI Api ?

@wafflespeanut
Copy link
Contributor

Yep! They're offline tests (very similar to what we already have)

return urllib.urlopen(self.log_url.format(job_id=self._get_job_id(build_data))).read()

url = self.build_url.format(build_id=build_id)
return json.loads(urllib.urlopen(url).read())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To support testing, this should use self.get_page_content instead of urllib directly (see https://github.com/servo/highfive/blob/master/newpr.py#L201).

@mylainos
Copy link
Contributor Author

So I need to test get_build() and get_pull_request_number() from TavisCiApi? Where should I put the files and how can I test this?

@@ -33,4 +33,9 @@ def on_pr_closed(self, api, payload):
if payload['pull_request']['merged']:
api.remove_label("S-awaiting-merge")

def on_build_status(self, api, payload):
if payload['context'] == 'continuous-integration/travis-ci/pr':
if payload['state'] == 'failure' or payload['state'] == 'error':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the difference between failure and error with Tavis?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume one of them means an internal error occurred, rather than an error during the build process, but I'm not sure. Probably best to leave both right now.

@bors-servo
Copy link

☔ The latest upstream changes (presumably #111) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm
Copy link
Member

jdm commented May 16, 2016

I sincerely apologize for forgetting about this. I'll review this right now and rebase it.

# If more functionality is needed from this class, it might be a
# better decision to use travispy
class TravisCiApiProvider():
host_url = 'https://api.travis-ci.org'
Copy link
Member

@jdm jdm May 16, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably need to make this configurable somehow so we could use file:// urls for tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdm ok, I will change that, but how can I create test for this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would have a json file that contains a travis payload instead of a github payload like existing tests, and we would check for the presence of the S-needs-code-changes label in the expected output.

@wafflespeanut
Copy link
Contributor

Superseded by #133.

@mylainos Thanks for your work! I've rebased it, and I'll continue where you left off :)

Mark-Simulacrum pushed a commit to Mark-Simulacrum/highfive that referenced this pull request Sep 8, 2020
Add support for automatically labelling new PRs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants