From 63a655767e58e9f166d3222541de395453c4928a Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Tue, 29 Oct 2024 09:44:14 +0100 Subject: [PATCH 1/3] Add a retry on TOO_MANY_REQUESTS (429) --- .../jira/service/jira/client/JiraRestClientBuilder.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/hibernate/infra/replicate/jira/service/jira/client/JiraRestClientBuilder.java b/src/main/java/org/hibernate/infra/replicate/jira/service/jira/client/JiraRestClientBuilder.java index bad9877..a6d0145 100644 --- a/src/main/java/org/hibernate/infra/replicate/jira/service/jira/client/JiraRestClientBuilder.java +++ b/src/main/java/org/hibernate/infra/replicate/jira/service/jira/client/JiraRestClientBuilder.java @@ -316,6 +316,12 @@ private boolean shouldRetryOnException(Throwable throwable) { // no point in retrying that ... return false; } + if (Response.Status.TOO_MANY_REQUESTS.getStatusCode() == exception.statusCode()) { + // we probably were trying to assign to an inactive or incorrectly configured + // user and the request failed, + // no point in retrying that ... + return false; + } } return false; } From 0e1640389cdf09da3f58dcf8776235e19cb534ac Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Tue, 29 Oct 2024 09:57:58 +0100 Subject: [PATCH 2/3] Start a short "Troubleshooting guide" --- README.adoc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.adoc b/README.adoc index 253ebde..32b3ecc 100644 --- a/README.adoc +++ b/README.adoc @@ -260,6 +260,36 @@ JIRA_API_TOKEN_REDHAT=your-PAT We also use https://smee.io/ to get web hooks delivered to the local env. +== Troubleshooting + +Sometimes attempting to make REST requests to Jira API may result in an `Internal Server Error` without much additional +details, e.g.: +[source,json] +---- +{ + "errorMessages": [ + "Internal server error" + ], + "errors": {} +} +---- + +If the request constantly fails even after several retries, it most likely mean that the request contains some fields +that are not present on the "view" the rest request is trying to update. To help track down the reason behind it: + +- Enable the request/response logging for a particular rest client (most likely for the "destination" one): ++ +[source,json] +---- +jira.project-group."".destination.log-requests=true +---- ++ +- Get the request body of the failing request +- Use your favorite tool for sending REST requests to send a failing request "manually" +- Start removing any fields from the JSON that are "optional" and send requests with modified JSON + * Keep doing so until you identify the field causing the problem + + [[license]] == License From 09d481bd618702ca6a4133863ab10d0864bd8ad2 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Tue, 29 Oct 2024 09:58:43 +0100 Subject: [PATCH 3/3] Constantly use `oc get imagestream` instead of `oc registry info` --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0d1ddd6..6778ff4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -78,7 +78,7 @@ jobs: -Drevision="${{ steps.app-version.outputs.value }}" \ -Dquarkus.container-image.build=true \ -Dquarkus.container-image.push=true \ - -Dquarkus.container-image.registry="$(oc registry info)" \ + -Dquarkus.container-image.registry="$(oc get imagestream -o json | jq -r '.items[0].status.publicDockerImageRepository' | awk -F"[/]" '{print $1}')" \ -Dquarkus.container-image.group="$(oc project --short)" \ -Dquarkus.container-image.additional-tags=latest