Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CodeBuild.Paginator.ListBuildsForProject - incorrect 'MaxItems' #4320

Open
1 task
ashmeet-kandhari opened this issue Oct 28, 2024 · 1 comment
Open
1 task
Assignees
Labels
bug This issue is a confirmed bug. codebuild p2 This is a standard priority issue pagination response-requested Waiting on additional information or feedback.

Comments

@ashmeet-kandhari
Copy link

Describe the bug

When using paginator api for codebuild's list_builds_for_project api the response still fetches the default size which is 100 items but the iterator gives only MaxItems configured and misses the rest of them

For example if MaxItems is configured as 20 the response_iterator returns only 20 items then fetches next 100 items and returns first 20 again

response_iterator = paginator.paginate(
    projectName='string',
    sortOrder='DESCENDING',
    PaginationConfig={
        'MaxItems': 123
    }
)

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Maxitems should fetch only 20 items and then iterate to fetch next 20

Current Behavior

MaxItems only iterates over the configured value from the fetched list and misses the rest of them when it iterates again

Reproduction Steps

response_iterator = paginator.paginate(
    projectName='string',
    sortOrder='DESCENDING',
    PaginationConfig={
        'MaxItems': 123
    }
)

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.35.49

Environment details (OS name and version, etc.)

Mac

@ashmeet-kandhari ashmeet-kandhari added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Oct 28, 2024
@tim-finnigan tim-finnigan self-assigned this Nov 4, 2024
@tim-finnigan tim-finnigan added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Nov 4, 2024
@tim-finnigan
Copy link
Contributor

Thanks for reaching out. Here is the Boto3 documentation on pagination for reference: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/paginators.html

It sounds like the behavior you're expecting applies to PageSize, which controls the number of items returned per page of each result. But PageSize is not supported for the ListBuildsForProject paginator.

Regarding this:

For example if MaxItems is configured as 20 the response_iterator returns only 20 items then fetches next 100 items and returns first 20 again

With this code I only get 20 items, so MaxItems is behaving as expected:

import boto3

codebuild = boto3.client('codebuild')

paginator = codebuild.get_paginator('list_builds_for_project')

response_iterator = paginator.paginate(
    projectName='test-project',
    sortOrder='DESCENDING',
    PaginationConfig={
        'MaxItems': 20,
    }
)

for page in response_iterator:
    i = 1
    for build_id in page['ids']:
        print(f"{i}build_id")
        i += 1

If you're seeing different results then please share your debug logs (with any sensitive info redacted) by adding boto3.set_stream_logger('') to your script.

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. p2 This is a standard priority issue pagination codebuild and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a confirmed bug. codebuild p2 This is a standard priority issue pagination response-requested Waiting on additional information or feedback.
Projects
None yet
Development

No branches or pull requests

2 participants