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

[supply] Fix halted status change handling #22004

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mataku
Copy link
Contributor

@mataku mataku commented May 3, 2024

Checklist

  • I've run bundle exec rspec from the root directory to see all new and existing tests pass
  • I've followed the fastlane code style and run bundle exec rubocop -a to ensure the code style is valid
  • I see several green ci/circleci builds in the "All checks have passed" section of my PR (connect CircleCI to GitHub if not)
  • I've read the Contribution Guidelines
  • I've updated the documentation if necessary.
  • I've added or updated relevant unit tests.

Motivation and Context

Resolves #21431

We can't suspend (halt) the distribution of track on Google Play. As my comment, status updates are ignored or requested with incorrect parameters.

Fastfile
lane :halt_alpha_track do
  upload_to_play_store(
    # Target track to halt
    track: 'alpha',
    version_code: 1, # to identify the track to be halted
    # No need to specify `track_remote_to` because stage will not change
    track_promote_release_status: 'halted',
    # Skip uploading binary and metadata processing because I just want to halt
    skip_upload_apk: true,
    skip_upload_aab: true,
    skip_upload_metadata: true,
    skip_upload_changelogs: true,
    skip_upload_images: true,
    skip_upload_screenshots: true,
  )
end

Description

Added halting handling if track_remote_release_status equals halted.

Supply::Uploader#perform_upload behaves as follows, therefore halted processing was skipped.

  1. Call update_track if skip_upload_aab or skip_upload_apk is false
  2. If not step 1, call promote_track if track_promote_to is specified (but request will be failed even if specified because user_fraction will set to nil in the current code)
  3. If not steps 1 and 2, call update_rollout if rollout and track are specified

I tried to fix something in the above steps, but it should require unnecessary parameters or unnatural steps (and it will make conditional branches more complex).

When halting the track, there should be no binary change and no change to track_promote_to and rollout, so I think it's better to handle additional logic rather than modifying existing steps.

apk_version_codes = []
apk_version_codes.concat(upload_apks) unless Supply.config[:skip_upload_apk]
apk_version_codes.concat(upload_bundles) unless Supply.config[:skip_upload_aab]
upload_mapping(apk_version_codes)
track_to_update = Supply.config[:track]
apk_version_codes.concat(Supply.config[:version_codes_to_retain]) if Supply.config[:version_codes_to_retain]
if !apk_version_codes.empty?
# Only update tracks if we have version codes
# update_track handle setting rollout if needed
# Updating a track with empty version codes can completely clear out a track
update_track(apk_version_codes)
else
# Only promote or rollout if we don't have version codes
if Supply.config[:track_promote_to]
track_to_update = Supply.config[:track_promote_to]
promote_track
elsif !Supply.config[:rollout].nil? && Supply.config[:track].to_s != ""
update_rollout
end
end

It may be better to update documents too if merged.


Google Play Publisher API:
https://developers.google.com/android-publisher/tracks

Testing Steps

For alpha track:

lane :halt_alpha_track do
  upload_to_play_store(
    # Target track to halt
    track: 'alpha',
    version_code: 1, # to identify the track to be halted
    # No need to specify `track_remote_to` because stage will not change
    track_promote_release_status: 'halted',
    # Skip uploading binary and metadata processing because I just want to halt
    skip_upload_apk: true,
    skip_upload_aab: true,
    skip_upload_metadata: true,
    skip_upload_changelogs: true,
    skip_upload_images: true,
    skip_upload_screenshots: true,
  )
end

@github-actions github-actions bot added the tool: supply upload_to_playstore label May 3, 2024
@mataku mataku marked this pull request as ready for review May 3, 2024 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tool: supply upload_to_playstore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot halt staged rollout
1 participant