Closed patbaumgartner closed 3 years ago
Hi, thanks for reporting. This is strange and I don't know why it happens.
We should check exactly HTTP request and response as urswolfer's library is a wrapper. You can capture HTTP traffic or you can check if urswolfer's library contains a logger that can log HTTP traffic.
We can also ask @uwolfer himself :D @uwolfer can you share your thought if you can read this? π
@SpOOnman: I don't think that we do any HTTP login by default in ithe gerrit-rest-java-client, but you could hook in such a logger in a quite easy way like this.
@patbaumgartner does this help with debugging with your setup?
Hi @uwolfer and @SpOOnman - thanks for your support so far.
currently, I upgraded to Gerrit 3.3.1 which did not solve the issue yet.
Adding an Interceptor like @uwolfer pointed out does not work since the request body does not get printed. I also used reflection to get access to the HttpEntity.
So I increased the log level like this where I see plenty of logging.
<logger name="pl.touk.sputnik.connector.gerrit" level="DEBUG" /> <logger name="org.apache.http" level="DEBUG" />
Continue on this, keeping you posted.
Trying to fetch the original request against Gerrit 3.3.1 looks like this
curl -i \
-H "Authorization: Basic aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa=" \
-H "Accept: application/json" \
-H "Content-Length: 177" \
-H "Content-Type: application/json; charset=UTF-8" \
-H "Connection: Keep-Alive" \
-H "User-Agent: gerrit-rest-java-client/0.8.8 using Apache-HttpClient/4.5.3 (Java/11.0.9.1)" \
-d '{"message":"Perfect!","tag":"sputnik","labels":{"Code-Review":1},"comments":{"pom.xml":[]},"strict_labels":true,"drafts":"DELETE","notify":"ALL","omit_duplicate_comments":false}' \
-X POST https://my-gerrit-server.local/gerrit/a/changes/Icdade5567dcf4a806a047b48a331078d24a7ff7e/revisions/ee87ec13019ff147b01ded8bb45f0ddfdc667bb0/review
HTTP/1.1 400 Bad Request
Server: nginx/1.18.0
Date: Thu, 07 Jan 2021 15:39:06 GMT
Content-Type: text/plain;charset=utf-8
Content-Length: 36
Connection: keep-alive
X-Frame-Options: DENY
Content-Disposition: attachment
X-Content-Type-Options: nosniff
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Invalid application/json in request
It looks like they changed the ReviewInput API in 2.15 - no longer offers the _strictlabels option.
hi, @uwolfer @SpOOnman - do you have any idea what has changed? Do we need an update on the gerrit-rest-java-client with the new HTTP entities from Gerrit?
Hey @patbaumgartner, I've just released 2.5.0 with gerrit-rest-java-client updated to 0.9.3 (#227). Can you try if this helps?
Thanks @SpOOnman with this upgrade, it works again!
Thanks for info! All credit goes to @uwolfer and @sp-atu π
After migrating, Jenkins fails with the following message. The Gerrit release documentation provided a hint - Breaking Changes in the REST API -> https://www.gerritcodereview.com/3.3.html#rest-api-changes
with the following properties. Even after commenting the score key it did not work.
Any idea how to fix this? I would love to help but have no clue how to start.
Best, Patrick