#327 Send an email if a pull-request build fails and Jenkins is unable to flag the pull-request
Opened 5 years ago by rayson. Modified 5 years ago

from @lholecek :

If the authentication fails [1] next time I would expect Jenkins sends an e-mail. The failures were silently ignored.

[1] ...or anything else unexpected happens...

Here is relevant error from Jenkins console:

[Pipeline] script
[Pipeline] {
[Pipeline] withCredentials
13:19:45  Masking only exact matches of $TOKEN
[Pipeline] {
[Pipeline] httpRequest
13:19:45  HttpMethod: POST
13:19:45  URL: https://pagure.io/api/0/waiverdb/c/41a3a21432ce5bb03b606d51cd385e7451db49c0/flag
13:19:45  Content-type: application/x-www-form-urlencoded; charset=ISO-8859-1
13:19:45  Accept: application/json
13:19:45  Authorization: *****
13:19:45  Sending request to url: https://pagure.io/api/0/waiverdb/c/41a3a21432ce5bb03b606d51cd385e7451db49c0/flag
13:19:46  Response Code: HTTP/1.1 401 UNAUTHORIZED
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] echo
13:19:46  Error updating commit 41a3a21432ce5bb03b606d51cd385e7451db49c0 status to PASS: java.lang.IllegalStateException: hudson.AbortException: Fail: the returned code 401 is not in the accepted range: [[100‥399]]
[Pipeline] }
[Pipeline] // script

This is how it looks like on success:

[Pipeline] script
[Pipeline] {
[Pipeline] withCredentials
06:51:48  Masking only exact matches of $TOKEN
[Pipeline] {
[Pipeline] httpRequest
06:51:48  HttpMethod: POST
06:51:48  URL: https://pagure.io/api/0/waiverdb/pull-request/325/flag
06:51:48  Content-type: application/x-www-form-urlencoded; charset=ISO-8859-1
06:51:48  Accept: application/json
06:51:48  Authorization: *****
06:51:48  Sending request to url: https://pagure.io/api/0/waiverdb/pull-request/325/flag
06:51:50  Response Code: HTTP/1.1 200 OK
06:51:50  Success code from [100‥399]
[Pipeline] readJSON
[Pipeline] }
[Pipeline] // withCredentials
[Pipeline] echo
06:51:50  Updated PR #325 status to PASS.
[Pipeline] }
[Pipeline] // script

Maybe the fix should go to https://pagure.io/c3i-library instead. I think throwing an exception would send the e-mail.

@lholecek The 401 code returned from Pagure API is incorrect. This error happens when the uid is used in another commit, which I've verified with curl.

https://pagure.io/waiverdb/pull-request/326 solves the error.

Log in to comment on this ticket.

Metadata