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

[deliver][pilot] use altool instead of using iTMSTransporter for Xcode 14 #20631

Merged
merged 69 commits into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
83cdc08
Use altool instead of using iTMSTransporter for Xcode 14
freddi-kit Sep 7, 2022
ec4cfee
fix linter error
freddi-kit Sep 7, 2022
f1e0575
fix linter error
freddi-kit Sep 7, 2022
c3a66db
fix linter error
freddi-kit Sep 7, 2022
39c919e
use keyword function for transporter_for_selected_team
freddi-kit Sep 9, 2022
74f681d
fix typo and move platform string handling
freddi-kit Sep 9, 2022
6d10343
remove unecessary return
freddi-kit Sep 9, 2022
ce9b12d
create should_use_altool
freddi-kit Sep 9, 2022
40337e3
fix to use unless to make code one line
freddi-kit Sep 9, 2022
0f2a3d4
make code oneline by using unless
freddi-kit Sep 9, 2022
d675551
improve error message
freddi-kit Sep 9, 2022
fa388c7
fix to support apple connect api key
freddi-kit Sep 9, 2022
dcb97a8
fix jwt check
freddi-kit Sep 9, 2022
5bd7d3f
fix to set? for boolean function
freddi-kit Sep 9, 2022
2023aa8
fix rubocup issue
freddi-kit Sep 9, 2022
7a13c48
fix rubocup issue
freddi-kit Sep 9, 2022
8df9559
fix test
freddi-kit Sep 9, 2022
ed28c90
fix to call upload without replacement
freddi-kit Sep 9, 2022
375f951
fix typo
freddi-kit Sep 9, 2022
711eb3c
fix checking apikey available or not
freddi-kit Sep 9, 2022
747178f
fix to generate p8 file for every calling altool
freddi-kit Sep 10, 2022
13afc8c
PR review fixes (Remove unused file, autogenerated by uni-tests + imp…
crazymanish Sep 10, 2022
d36bf23
Fix itunes_transporter_spec.rb which was failing in Xcode14 https://g…
crazymanish Sep 10, 2022
e4e44ac
Fix helper_spec.rb which was failing in Xcode14 https://github.com/fa…
crazymanish Sep 10, 2022
4f677a6
support base64 key_content for using altool with appstore connect apikey
freddi-kit Sep 10, 2022
9988e33
fix typo
freddi-kit Sep 10, 2022
4ebf009
fix to remove un-necessary begin
freddi-kit Sep 10, 2022
ddb437a
fix to use unless
freddi-kit Sep 10, 2022
b4f5324
improve showing error on UI
freddi-kit Sep 10, 2022
44bf7aa
fix to remove warning in altool executer
freddi-kit Sep 10, 2022
01a5873
improve error log
freddi-kit Sep 10, 2022
7490c5c
add some small fix
freddi-kit Sep 10, 2022
388726b
fix code format
freddi-kit Sep 11, 2022
b070b58
fix to remove unnecessary return
freddi-kit Sep 11, 2022
1cdc817
fix to use File.open() |p8|
freddi-kit Sep 11, 2022
c82e99a
fix to use mktmpdir for saving p8 temp
freddi-kit Sep 12, 2022
bdbacb5
fix linter issue
freddi-kit Sep 12, 2022
00c974c
fix to use wb option when making p8 file
freddi-kit Sep 12, 2022
1994860
add unit test for altool case
freddi-kit Sep 12, 2022
16249e7
fix test format
freddi-kit Sep 12, 2022
8ab40fa
remove space
freddi-kit Sep 12, 2022
22cfcec
support api json path
freddi-kit Sep 13, 2022
3fc11fa
add some comment and fix code style
freddi-kit Sep 13, 2022
980f189
add comment about error info
freddi-kit Sep 13, 2022
669bebc
compose return expression in one line
freddi-kit Sep 13, 2022
98e1a88
fix to use checking raise_error
freddi-kit Sep 13, 2022
355cc9d
use context for matching rpec
freddi-kit Sep 13, 2022
0f6bfcb
fix code's readability
freddi-kit Sep 13, 2022
f4cd020
fix lint
freddi-kit Sep 13, 2022
95e7cb8
fix lint
freddi-kit Sep 13, 2022
38f23ee
fix lint
freddi-kit Sep 13, 2022
30839b9
fix ids provider problem
freddi-kit Sep 14, 2022
a2ea2fb
add comments
freddi-kit Sep 14, 2022
874320c
add test for provider ids
freddi-kit Sep 14, 2022
ab02d6d
fix api key condition to make code more readable
freddi-kit Sep 14, 2022
71e57d6
add more detailed comment
freddi-kit Sep 14, 2022
b518207
fix typo
freddi-kit Sep 14, 2022
8d5bb62
improve specifying substring
freddi-kit Sep 14, 2022
5beca1e
fix index
freddi-kit Sep 14, 2022
4f4d3ee
fix altool providers output to parse json
freddi-kit Sep 14, 2022
cd2c504
fix code format
freddi-kit Sep 14, 2022
4b93a81
fix hash problem if user pass key via environment variable
freddi-kit Sep 14, 2022
18f460f
remove unnecessary !
freddi-kit Sep 14, 2022
ac7358d
fix null handle
freddi-kit Sep 14, 2022
07181a7
dummy commit for test
freddi-kit Sep 14, 2022
599ab2b
dummy commit for test
freddi-kit Sep 14, 2022
8be9c7e
change the implementation place of provider id parser
freddi-kit Sep 15, 2022
8e7d6f3
make absract method
freddi-kit Sep 15, 2022
c005aae
add raise for not implemented functions
freddi-kit Sep 15, 2022
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
21 changes: 14 additions & 7 deletions deliver/lib/deliver/runner.rb
Expand Up @@ -206,7 +206,7 @@ def upload_binary
pkg_path = options[:pkg]

platform = options[:platform]
transporter = transporter_for_selected_team
transporter = transporter_for_selected_team(upload: true)

case platform
when "ios", "appletvos"
Expand All @@ -216,15 +216,15 @@ def upload_binary
package_path: "/tmp",
platform: platform
)
result = transporter.upload(package_path: package_path, asset_path: ipa_path)
result = transporter.upload(package_path: package_path, asset_path: ipa_path, platform: platform)
when "osx"
package_path = FastlaneCore::PkgUploadPackageBuilder.new.generate(
app_id: Deliver.cache[:app].id,
pkg_path: pkg_path,
package_path: "/tmp",
platform: platform
)
result = transporter.upload(package_path: package_path, asset_path: pkg_path)
result = transporter.upload(package_path: package_path, asset_path: pkg_path, platform: platform)
else
UI.user_error!("No suitable file found for upload for platform: #{options[:platform]}")
end
Expand Down Expand Up @@ -270,25 +270,32 @@ def submit_for_review
# If itc_provider was explicitly specified, use it.
# If there are multiple teams, infer the provider from the selected team name.
# If there are fewer than two teams, don't infer the provider.
def transporter_for_selected_team
def transporter_for_selected_team(upload: false)
# Use JWT auth
api_token = Spaceship::ConnectAPI.token
api_key = if options[:api_key].nil? && !api_token.nil?
# Load api key info if user set api_key_path, not api_key
{ key_id: api_token.key_id, issuer_id: api_token.issuer_id, key: api_token.key_raw, is_key_content_base64: api_token.is_key_content_base64 }
elsif !options[:api_key].nil?
options[:api_key].transform_keys(&:to_sym)
Copy link
Contributor

Choose a reason for hiding this comment

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

👌 Nice and clean solution to handle ENV-provided values 👍

end

unless api_token.nil?
api_token.refresh! if api_token.expired?
return FastlaneCore::ItunesTransporter.new(nil, nil, false, nil, api_token.text)
return FastlaneCore::ItunesTransporter.new(nil, nil, false, nil, api_token.text, upload: upload, api_key: api_key)
end

tunes_client = Spaceship::ConnectAPI.client.tunes_client

generic_transporter = FastlaneCore::ItunesTransporter.new(options[:username], nil, false, options[:itc_provider])
generic_transporter = FastlaneCore::ItunesTransporter.new(options[:username], nil, false, options[:itc_provider], upload: upload, api_key: api_key)
return generic_transporter unless options[:itc_provider].nil? && tunes_client.teams.count > 1

begin
team = tunes_client.teams.find { |t| t['providerId'].to_s == tunes_client.team_id }
name = team['name']
provider_id = generic_transporter.provider_ids[name]
UI.verbose("Inferred provider id #{provider_id} for team #{name}.")
return FastlaneCore::ItunesTransporter.new(options[:username], nil, false, provider_id)
return FastlaneCore::ItunesTransporter.new(options[:username], nil, false, provider_id, upload: upload, api_key: api_key)
rescue => ex
UI.verbose("Couldn't infer a provider short name for team with id #{tunes_client.team_id} automatically: #{ex}. Proceeding without provider short name.")
return generic_transporter
Expand Down
6 changes: 3 additions & 3 deletions deliver/spec/runner_spec.rb
Expand Up @@ -63,7 +63,7 @@ def provider_ids
expect_any_instance_of(FastlaneCore::IpaUploadPackageBuilder).to receive(:generate)
.with(app_id: 'YI8C2AS', ipa_path: 'ACME.ipa', package_path: '/tmp', platform: 'ios')
.and_return('path')
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.ipa').and_return(true)
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.ipa', platform: 'ios').and_return(true)
runner.upload_binary
end
end
Expand All @@ -77,7 +77,7 @@ def provider_ids
expect_any_instance_of(FastlaneCore::IpaUploadPackageBuilder).to receive(:generate)
.with(app_id: 'YI8C2AS', ipa_path: 'ACME.ipa', package_path: '/tmp', platform: 'appletvos')
.and_return('path')
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.ipa').and_return(true)
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.ipa', platform: 'appletvos').and_return(true)
runner.upload_binary
end
end
Expand All @@ -93,7 +93,7 @@ def provider_ids
expect_any_instance_of(FastlaneCore::PkgUploadPackageBuilder).to receive(:generate)
.with(app_id: 'YI8C2AS', pkg_path: 'ACME.pkg', package_path: '/tmp', platform: 'osx')
.and_return('path')
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.pkg').and_return(true)
expect(transporter).to receive(:upload).with(package_path: 'path', asset_path: 'ACME.pkg', platform: 'osx').and_return(true)
runner.upload_binary
end
end
Expand Down