Skip to content

Commit

Permalink
Merge branch 'main' into TRAB-646
Browse files Browse the repository at this point in the history
  • Loading branch information
kitallis authored Jan 21, 2025
2 parents 9e2800a + 8a96728 commit dec657b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
19 changes: 6 additions & 13 deletions app/models/play_store_rollout.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def start_release!(retry_on_review_fail: false)
complete!
event_stamp!(reason: :completed, kind: :success, data: stamp_data)
else
fail!(result.error, review_failure: !retry_on_review_fail)
fail!(result.error)
end
end
end
Expand All @@ -86,7 +86,7 @@ def move_to_next_stage!(retry_on_review_fail: true)
fully_release!
return
end
fail!(result.error, review_failure: !retry_on_review_fail)
fail!(result.error)
end
end
end
Expand Down Expand Up @@ -141,20 +141,13 @@ def rollout_in_progress?

private

def fail!(error, review_failure: false)
def fail!(error)
elog(error)
errors.add(:base, error)
event_stamp!(reason: :failed, kind: :error, data: stamp_data)

if review_failure
event_stamp!(reason: :failed, kind: :error, data: stamp_data)
play_store_submission.fail_with_review_rejected!(error)
return
end

if play_store_submission.auto_rollout?
event_stamp!(reason: :failed, kind: :error, data: stamp_data)
play_store_submission.fail_with_error!(error)
end
return if play_store_submission.fail_with_review_rejected!(error)
play_store_submission.fail_with_error!(error) if play_store_submission.auto_rollout?
end

def rollout(value, retry_on_review_fail: false)
Expand Down
8 changes: 8 additions & 0 deletions app/models/play_store_submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class PlayStoreSubmission < StoreSubmission
transitions to: :failed
end

event :retry_rollout, after_commit: :on_retry_rollout! do
transitions from: :failed, to: :prepared
end

event :fail_with_sync_option, before: :set_failure_context do
transitions from: [:preparing, :prepared, :failed_with_action_required, :finished_manually], to: :failed_with_action_required
end
Expand Down Expand Up @@ -299,6 +303,10 @@ def on_prepare!
play_store_rollout.start_release!(retry_on_review_fail: internal_channel?) if auto_rollout?
end

def on_retry_rollout!
play_store_rollout.start_release!(retry_on_review_fail: internal_channel?) if auto_rollout?
end

def on_fail!(args = nil)
failure_error = args&.fetch(:error, nil)
event_stamp!(reason: :failed, kind: :error, data: stamp_data(failure_message: failure_error&.message))
Expand Down

0 comments on commit dec657b

Please sign in to comment.