Skip to content

images.list with maxResults to Integer.MAX_VALUE#548

Open
gbhat618 wants to merge 1 commit intojenkinsci:developfrom
gbhat618:fix-too-many-source-image-bug
Open

images.list with maxResults to Integer.MAX_VALUE#548
gbhat618 wants to merge 1 commit intojenkinsci:developfrom
gbhat618:fix-too-many-source-image-bug

Conversation

@gbhat618
Copy link
Copy Markdown
Contributor

@gbhat618 gbhat618 commented May 8, 2026

Whenever a GCP project had more than 500 images, the list was truncated to 500 - due to GCP server side default is 500.
https://docs.cloud.google.com/compute/docs/reference/rest/v1/images/list#query-parameters

The maximum number of results per page that should be returned. If the number of available results is larger than maxResults, Compute Engine returns a nextPageToken that can be used to get the next page of results in subsequent list requests. Acceptable values are 0 to 500, inclusive. (Default: 500)

This PR fixes by - setMaxResults to higher value (Integer.MAX_VALUE) when images().list()

Testing

Reproduced the issue, with a project having 828 images.

Before After
Log line: 2026-05-08 08:35:29.516+0000 [id=97] INFO c.g.j.p.c.InstanceConfiguration$DescriptorImpl#doFillBootDiskSourceImageNameItems: listImages() returned 500 images for project tiger-team-testing Log line: 2026-05-08 08:32:21.842+0000 [id=144] INFO c.g.j.p.c.InstanceConfiguration$DescriptorImpl#doFillBootDiskSourceImageNameItems: listImages(maxResults=2147483647) returned 828 images for project tiger-team-testing
only up to 500 images image no missing images even beyond 500image
  • manual build running in jenkins works ✔️
  • ran a couple of integration tests, works ✔️

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

/**
* Lists images in {@code imageProject} with an explicit {@code maxResults}, bypassing the
* archived gcp-plugin-core-java {@code ComputeClient#listImages} which silently truncates
* at the server default of 500.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gbhat618
Copy link
Copy Markdown
Contributor Author

gbhat618 commented May 8, 2026

/label bug

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.

1 participant