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

Treat 409 upload status as warning, not error #268

Merged
merged 1 commit into from
Dec 4, 2017

Conversation

chrishulton
Copy link
Contributor

@chrishulton chrishulton commented Dec 4, 2017

Depending on CI setup, it is possible that CI can run multiple times for
the same commit. The v1/test_reports endpoint returns 409 when
receiving a request to create a test report when one already exists for
the commit. This exception currently is bubbled through the reporter
causing the run to ultimately exit with non-zero code.

This changes the behavior to treat the 409 status separately as a
"warning" rather than an "error," which better reflects the situation.
The exit status in this case will be 0 and a warning will be logged.

Another alternative considered was changing the endpoint to be
create-or-update, but that has been deferred for now.

before:

Error: response from https://api.codeclimate.com/v1/test_reports.
HTTP 409: A test report for commit cf4f59d96036b8e01e87934a1882f949681dcfa5 already exists
Usage:
  cc-test-reporter after-build [flags]
...

after:

time="2017-12-04T19:32:32Z" level=warning msg="Conflict when uploading: A test report for commit 6295df9ddd0bc327d2d16c96aee1f4fee7d247b4 already exists, skipping upload"

Depending on CI setup, it is possible that CI can run multiple times for
the same commit. The `v1/test_reports` endpoint returns 409 when
receiving a request to create a test report when one already exists for
the commit. This exception currently is bubbled through the reporter
causing the run to ultimately exit with status 1.

This changes the behavior to treat the 409 status separately as a
"warning" rather than an "error," which better reflects the situation.
The exit status in this case will be 0 and a warning will be logged.

Another alternative considered was changing the endpoint to be
create-or-update, but that has been deferred for now.
@CLAassistant
Copy link

CLAassistant commented Dec 4, 2017

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

None yet

3 participants