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

[pilot] do not advertise the skip_waiting_for_build_processing option when it is already set #21730

Merged
merged 4 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions pilot/lib/pilot/build_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ def upload(options)
UI.important("`skip_waiting_for_build_processing` used and no `changelog` supplied - skipping waiting for build processing")
return
else
UI.important("`skip_waiting_for_build_processing` used and `changelog` supplied - will wait until build appears on App Store Connect, update the changelog and then skip the rest of the remaining of the processing steps.")
return_when_build_appears = true
end
end

# Calling login again here is needed if login was not called during 'start'
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could also put a UI.message in line 68, stating

UI.important("`skip_waiting_for_build_processing` used and `changelog` supplied - will wait until build appears on AppStoreConnect, update the changelog and then skip the rest of the remaining of the processing steps.")

That way we log something in all scenarios, and that would make it easier for someone with less knowledge understand better what is going on in that particular case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took care of this. I struggled a bit with creating new spec tests. Let me know if I got anything wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@lacostej Please take another look when you get a chance

login unless should_login_in_start

UI.message("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option")
UI.message("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on AppStoreConnect, update the changelog and then skip the remaining of the processing steps.")
if config[:skip_waiting_for_build_processing].nil?
UI.message("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option")
UI.message("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on App Store Connect, update the changelog and then skip the remaining of the processing steps.")
end

latest_build = wait_for_build_processing_to_be_complete(return_when_build_appears)
distribute(options, build: latest_build)
Expand Down
51 changes: 49 additions & 2 deletions pilot/spec/build_manager_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,53 @@
end

describe "#upload" do
describe "shows the correct notices" do
let(:fake_build_manager) { Pilot::BuildManager.new }
let(:fake_app_id) { 123 }
let(:fake_dir) { "fake dir" }
let(:fake_app_platform) { "ios" }
let(:upload_options) do
{
apple_id: fake_app_id,
skip_waiting_for_build_processing: true,
changelog: "changelog contents",
ipa: 'foo'
}
end

before(:each) do
allow(fake_build_manager).to receive(:login)
allow(fake_build_manager).to receive(:fetch_app_platform).and_return(fake_app_platform)
allow(Dir).to receive(:mktmpdir).and_return(fake_dir)

fake_ipauploadpackagebuilder = double
allow(fake_ipauploadpackagebuilder).to receive(:generate).with(app_id: fake_app_id, ipa_path: upload_options[:ipa], package_path: fake_dir, platform: fake_app_platform).and_return(true)
allow(FastlaneCore::IpaUploadPackageBuilder).to receive(:new).and_return(fake_ipauploadpackagebuilder)

fake_itunestransporter = double
allow(fake_itunestransporter).to receive(:upload).and_return(true)
allow(FastlaneCore::ItunesTransporter).to receive(:new).and_return(fake_itunestransporter)

fake_build = double
expect(fake_build_manager).to receive(:wait_for_build_processing_to_be_complete).and_return(fake_build)

expect(fake_build_manager).to receive(:distribute).with(upload_options, build: fake_build)
end

it "does not advertise `skip_waiting_for_build_processing` if the option is set" do
expect(FastlaneCore::UI).to_not(receive(:message).with("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option"))
expect(FastlaneCore::UI).to_not(receive(:message).with("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on App Store Connect, update the changelog and then skip the remaining of the processing steps."))

fake_build_manager.upload(upload_options)
end

it "shows notice when using `skip_waiting_for_build_processing` and changelog together" do
expect(FastlaneCore::UI).to(receive(:important).with("`skip_waiting_for_build_processing` used and `changelog` supplied - will wait until build appears on App Store Connect, update the changelog and then skip the rest of the remaining of the processing steps."))

fake_build_manager.upload(upload_options)
end
end

describe "uses Manager.login (which does spaceship login) for ipa" do
let(:fake_build_manager) { Pilot::BuildManager.new }
let(:fake_app_id) { 123 }
Expand Down Expand Up @@ -660,7 +707,7 @@
expect(fake_build).to receive(:app_version)
expect(fake_build).to receive(:version)
expect(UI).to receive(:message).with("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option")
expect(UI).to receive(:message).with("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on AppStoreConnect, update the changelog and then skip the remaining of the processing steps.")
expect(UI).to receive(:message).with("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on App Store Connect, update the changelog and then skip the remaining of the processing steps.")
expect(FastlaneCore::BuildWatcher).to receive(:wait_for_build_processing_to_be_complete).and_return(fake_build)

expect(fake_build_manager).to receive(:distribute).with(upload_options, build: fake_build)
Expand Down Expand Up @@ -698,7 +745,7 @@
expect(fake_build).to receive(:app_version)
expect(fake_build).to receive(:version)
expect(UI).to receive(:message).with("If you want to skip waiting for the processing to be finished, use the `skip_waiting_for_build_processing` option")
expect(UI).to receive(:message).with("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on AppStoreConnect, update the changelog and then skip the remaining of the processing steps.")
expect(UI).to receive(:message).with("Note that if `skip_waiting_for_build_processing` is used but a `changelog` is supplied, this process will wait for the build to appear on App Store Connect, update the changelog and then skip the remaining of the processing steps.")
expect(FastlaneCore::BuildWatcher).to receive(:wait_for_build_processing_to_be_complete).and_return(fake_build)

expect(fake_build_manager).to receive(:distribute).with(upload_options, build: fake_build)
Expand Down