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

Request less information from App Store Connect to detect latest build number #382

Merged
merged 10 commits into from
Dec 20, 2023

Conversation

priitlatt
Copy link
Contributor

@priitlatt priitlatt commented Dec 19, 2023

As it is now, running app-store-connect actions get-latest-testflight-build-number, get-latest-app-store-build-number and get-latest-build-number will fetch a lot of data for pre-release and App Store versions from from App Store Connect (full object representations and all their references to related objects). With more than just handful of App Store / pre-release versions listing API calls can become very slow, and as we're paginating over those resources, the problem only gets worse. In some extreme cases we've seen app-store-connect get-latest-build-number to run for more than 20 minutes, which is far from ideal.

To speed things up, ask only the bare minimum of information from App Store Connect API when paginating over the resources:

  1. just id and version attribute for pre-release versions,
  2. just id and versionString attribute for pre-release versions,
  3. just id and version attribute for build.
    By asking only specific attributes, the API does not return any other attributes nor any relationships the object has. By doing so the requests are processed faster and we get the response back with smaller waiting duration. This was achieved by specifying fields[<resourceName>] query parameter for the relevant GET requests.

For that new App Store Connect API Client methods were added:

  • codemagic.apple.app_store_connect.apps.Apps.list_app_store_versions_data to fetch application's App Store versions as list[dict].
  • codemagic.apple.app_store_connect.versioning.AppStoreVersions.read_build_data to fetch build of App Store version as plain dict.
  • codemagic.apple.app_store_connect.versioning.PreReleaseVersions.list_data to fetch pre-release versions as list[dict].
  • codemagic.apple.app_store_connect.versioning.PreReleaseVersions.list_builds_data to fetch builds of pre-release version as list[dict].

Action definitions, along with helper methods, were moved away from AppStoreConnect tool main class definition and were (re)implemented in dedicated abstract action classes which are plugged-in to main class as mix-ins.

Updated actions:

  • app-store-connect get-latest-testflight-build-number
  • app-store-connect get-latest-app-store-build-number
  • app-store-connect get-latest-build-number

@priitlatt priitlatt added the enhancement New feature or request label Dec 19, 2023
@priitlatt priitlatt marked this pull request as ready for review December 19, 2023 14:27
@priitlatt priitlatt merged commit 3670fa6 into master Dec 20, 2023
7 checks passed
@priitlatt priitlatt deleted the improvement/asc-latest-build-version branch December 20, 2023 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants