Skip to content

Bug: Jira API error when associating > 500 Jira issue keys with a deployment

This bug issue came from this thread #431651 (comment 1971140316).

About

The Jira API can return an error response when we try to associate a deployment with > 500 Jira issue keys.

When we have more than 500 Jira issue keys associated here with a deployment, after we POST to the Jira POST /rest/deployments/0.1/bulk endpoint, we see an error.

{"errorMessages":["Sum of Association values across all association types can have a maximum of 500 elements. Found 3143."] ... }

Examples of the errors are included in this Kibana filter.

From the endpoint documentation:

image

Problem

These errors means that for the affected deployments, they are not being associated with Jira issue keys.

Proposal

In #470092 (comment 1977592412) we learned that we can POST through the associations[].values in batches of 500 values at a time to associate a deployment with > 500 values.

We currently POST a collection of deployments in one request. Although, it looks like we currently only ever operate on single deployments at a time.

  • If all deployments in the items collection here do not have any associations that have > 500 items in values then POST as normal.
  • Otherwise, slice those associations values and do subsequent POSTs using those values, repeating in batches of 500.
  • Limit total number of batched requests to 5, limiting total number of issue keys to 2,500.
Edited by Luke Duncalfe