fastlane 2.189.0 → 2.193.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +92 -92
  3. data/deliver/lib/deliver/app_screenshot.rb +2 -1
  4. data/deliver/lib/deliver/app_screenshot_iterator.rb +2 -2
  5. data/deliver/lib/deliver/loader.rb +1 -1
  6. data/deliver/lib/deliver/options.rb +6 -0
  7. data/deliver/lib/deliver/runner.rb +9 -1
  8. data/deliver/lib/deliver/screenshot_comparable.rb +62 -0
  9. data/deliver/lib/deliver/sync_screenshots.rb +200 -0
  10. data/fastlane/lib/assets/completions/completion.bash +4 -1
  11. data/fastlane/lib/assets/completions/completion.zsh +6 -5
  12. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -1
  13. data/fastlane/lib/fastlane/actions/bundle_install.rb +13 -1
  14. data/fastlane/lib/fastlane/actions/clean_cocoapods_cache.rb +25 -1
  15. data/fastlane/lib/fastlane/actions/create_xcframework.rb +97 -17
  16. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +2 -2
  17. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +2 -2
  18. data/fastlane/lib/fastlane/actions/get_provisioning_profile.rb +1 -1
  19. data/fastlane/lib/fastlane/actions/notarize.rb +77 -1
  20. data/fastlane/lib/fastlane/actions/push_git_tags.rb +1 -1
  21. data/fastlane/lib/fastlane/actions/sync_code_signing.rb +1 -1
  22. data/fastlane/lib/fastlane/actions/upload_to_testflight.rb +3 -1
  23. data/fastlane/lib/fastlane/actions/zip.rb +86 -21
  24. data/fastlane/lib/fastlane/features.rb +3 -0
  25. data/fastlane/lib/fastlane/version.rb +1 -1
  26. data/fastlane/swift/Deliverfile.swift +1 -1
  27. data/fastlane/swift/DeliverfileProtocol.swift +5 -1
  28. data/fastlane/swift/Fastlane.swift +121 -25
  29. data/fastlane/swift/Gymfile.swift +1 -1
  30. data/fastlane/swift/GymfileProtocol.swift +1 -1
  31. data/fastlane/swift/Matchfile.swift +1 -1
  32. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  33. data/fastlane/swift/Precheckfile.swift +1 -1
  34. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  35. data/fastlane/swift/Scanfile.swift +1 -1
  36. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  37. data/fastlane/swift/Screengrabfile.swift +1 -1
  38. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  39. data/fastlane/swift/Snapshotfile.swift +1 -1
  40. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  41. data/fastlane/swift/formatting/Brewfile.lock.json +9 -9
  42. data/fastlane_core/lib/fastlane_core/build_watcher.rb +25 -6
  43. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +11 -4
  44. data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +1 -0
  45. data/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb +41 -0
  46. data/match/lib/match/runner.rb +5 -5
  47. data/match/lib/match/storage/.git_storage.rb.swp +0 -0
  48. data/match/lib/match/storage/.interface.rb.swp +0 -0
  49. data/pilot/lib/pilot/build_manager.rb +14 -4
  50. data/pilot/lib/pilot/manager.rb +3 -1
  51. data/pilot/lib/pilot/options.rb +20 -1
  52. data/produce/lib/produce/commands_generator.rb +28 -0
  53. data/produce/lib/produce/service.rb +16 -1
  54. data/scan/lib/scan/xcpretty_reporter_options_generator.rb +1 -1
  55. data/sigh/lib/sigh/options.rb +2 -1
  56. data/spaceship/lib/spaceship/client.rb +6 -0
  57. data/spaceship/lib/spaceship/connect_api/api_client.rb +15 -1
  58. data/spaceship/lib/spaceship/connect_api/models/app.rb +9 -1
  59. data/spaceship/lib/spaceship/connect_api/models/build.rb +4 -0
  60. data/spaceship/lib/spaceship/connect_api/models/build_beta_detail.rb +4 -0
  61. data/spaceship/lib/spaceship/connect_api/models/capabilities.rb +27 -0
  62. data/spaceship/lib/spaceship/connect_api/models/user.rb +17 -3
  63. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +26 -5
  64. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +5 -0
  65. data/spaceship/lib/spaceship/connect_api/testflight/.testflight.rb.swp +0 -0
  66. data/spaceship/lib/spaceship/connect_api/testflight/client.rb +3 -0
  67. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +46 -5
  68. data/spaceship/lib/spaceship/connect_api/token.rb +4 -1
  69. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +3 -0
  70. data/spaceship/lib/spaceship/connect_api/users/client.rb +3 -0
  71. data/spaceship/lib/spaceship/connect_api/users/users.rb +58 -3
  72. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  73. data/spaceship/lib/spaceship/tunes/tunes_client.rb +3 -0
  74. data/supply/lib/supply/client.rb +38 -5
  75. data/supply/lib/supply/options.rb +7 -0
  76. data/supply/lib/supply/uploader.rb +1 -1
  77. metadata +39 -19
@@ -16,6 +16,10 @@ module Produce
16
16
  self.new.disable(options, args)
17
17
  end
18
18
 
19
+ def self.available_services(options, args)
20
+ self.new.available_services(options, args)
21
+ end
22
+
19
23
  def enable(options, _args)
20
24
  unless bundle_id
21
25
  UI.message("[DevCenter] App '#{Produce.config[:app_identifier]}' does not exist")
@@ -40,6 +44,17 @@ module Produce
40
44
  UI.success("Done! Disabled #{disabled} services.")
41
45
  end
42
46
 
47
+ def available_services(options, _args)
48
+ unless bundle_id
49
+ UI.message("[DevCenter] App '#{Produce.config[:app_identifier]}' does not exist")
50
+ return
51
+ end
52
+
53
+ UI.success("[DevCenter] App found '#{bundle_id.name}'")
54
+ UI.message("Fetching available services")
55
+ return Spaceship::ConnectAPI::Capabilities.all
56
+ end
57
+
43
58
  def valid_services_for(options)
44
59
  allowed_keys = [:access_wifi, :app_attest, :app_group, :apple_pay, :associated_domains, :auto_fill_credential, :car_play_audio_app, :car_play_messaging_app,
45
60
  :car_play_navigation_app, :car_play_voip_calling_app, :class_kit, :icloud, :critical_alerts, :custom_network_protocol, :data_protection,
@@ -82,7 +97,7 @@ module Produce
82
97
  bundle_id.update_capability(ACCESS_WIFI_INFORMATION, enabled: on)
83
98
  end
84
99
 
85
- if options.access_wifi
100
+ if options.app_attest
86
101
  UI.message("\tApp Attest")
87
102
  bundle_id.update_capability(APP_ATTEST, enabled: on)
88
103
  end
@@ -13,7 +13,7 @@ module Scan
13
13
  Scan.config[:xcpretty_args])
14
14
  end
15
15
 
16
- # Intialize with values from Scan.config matching these param names
16
+ # Initialize with values from Scan.config matching these param names
17
17
  def initialize(open_report, output_types, output_files, output_directory, use_clang_report_name, xcpretty_args)
18
18
  @open_report = open_report
19
19
  @output_types = output_types
@@ -149,7 +149,8 @@ module Sigh
149
149
  env_name: "SIGH_SKIP_CERTIFICATE_VERIFICATION",
150
150
  description: "Skips the verification of the certificates for every existing profiles. This will make sure the provisioning profile can be used on the local machine",
151
151
  is_string: false,
152
- default_value: false),
152
+ default_value: !FastlaneCore::Helper.mac?,
153
+ default_value_dynamic: true),
153
154
  FastlaneCore::ConfigItem.new(key: :platform,
154
155
  short_option: '-p',
155
156
  env_name: "SIGH_PLATFORM",
@@ -41,6 +41,7 @@ module Spaceship
41
41
  attr_accessor :logger
42
42
 
43
43
  attr_accessor :csrf_tokens
44
+ attr_accessor :additional_headers
44
45
 
45
46
  attr_accessor :provider
46
47
 
@@ -717,8 +718,13 @@ module Spaceship
717
718
  @csrf_tokens || {}
718
719
  end
719
720
 
721
+ def additional_headers
722
+ @additional_headers || {}
723
+ end
724
+
720
725
  def request(method, url_or_path = nil, params = nil, headers = {}, auto_paginate = false, &block)
721
726
  headers.merge!(csrf_tokens)
727
+ headers.merge!(additional_headers)
722
728
  headers['User-Agent'] = USER_AGENT
723
729
 
724
730
  # Before encoding the parameters, log them
@@ -208,7 +208,13 @@ module Spaceship
208
208
  # Overridden from Spaceship::Client
209
209
  def handle_error(response)
210
210
  body = response.body.empty? ? {} : response.body
211
- body = JSON.parse(body) if body.kind_of?(String)
211
+
212
+ # Setting body nil if invalid JSON which can happen if 502
213
+ begin
214
+ body = JSON.parse(body) if body.kind_of?(String)
215
+ rescue
216
+ nil
217
+ end
212
218
 
213
219
  case response.status.to_i
214
220
  when 401
@@ -221,6 +227,14 @@ module Spaceship
221
227
  else
222
228
  raise AccessForbiddenError, format_errors(response)
223
229
  end
230
+ when 502
231
+ # Issue - https://github.com/fastlane/fastlane/issues/19264
232
+ # This 502 with "Could not process this request" body sometimes
233
+ # work and sometimes doesn't
234
+ # Usually retrying once or twice will solve the issue
235
+ if body && body.include?("Could not process this request")
236
+ raise BadGatewayError, "Could not process this request"
237
+ end
224
238
  end
225
239
  end
226
240
 
@@ -385,11 +385,12 @@ module Spaceship
385
385
  return resps.flat_map(&:to_models)
386
386
  end
387
387
 
388
- def create_beta_group(client: nil, group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false)
388
+ def create_beta_group(client: nil, group_name: nil, is_internal_group: false, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false)
389
389
  client ||= Spaceship::ConnectAPI
390
390
  resps = client.create_beta_group(
391
391
  app_id: id,
392
392
  group_name: group_name,
393
+ is_internal_group: is_internal_group,
393
394
  public_link_enabled: public_link_enabled,
394
395
  public_link_limit: public_link_limit,
395
396
  public_link_limit_enabled: public_link_limit_enabled
@@ -423,6 +424,13 @@ module Spaceship
423
424
  client.add_user_visible_apps(user_id: user_id, app_ids: [id])
424
425
  end
425
426
  end
427
+
428
+ def remove_users(client: nil, user_ids: nil)
429
+ client ||= Spaceship::ConnectAPI
430
+ user_ids.each do |user_id|
431
+ client.delete_user_visible_apps(user_id: user_id, app_ids: [id])
432
+ end
433
+ end
426
434
  end
427
435
  end
428
436
  end
@@ -86,6 +86,10 @@ module Spaceship
86
86
  return build_beta_detail.nil? == false && build_beta_detail.ready_for_internal_testing?
87
87
  end
88
88
 
89
+ def ready_for_external_testing?
90
+ return build_beta_detail.nil? == false && build_beta_detail.ready_for_external_testing?
91
+ end
92
+
89
93
  def ready_for_beta_submission?
90
94
  raise "No build_beta_detail included" unless build_beta_detail
91
95
  return build_beta_detail.ready_for_beta_submission?
@@ -53,6 +53,10 @@ module Spaceship
53
53
  return internal_build_state == InternalState::READY_FOR_BETA_TESTING
54
54
  end
55
55
 
56
+ def processed?
57
+ return internal_build_state != InternalState::PROCESSING && external_build_state != ExternalState::PROCESSING
58
+ end
59
+
56
60
  def ready_for_beta_submission?
57
61
  return external_build_state == ExternalState::READY_FOR_BETA_SUBMISSION
58
62
  end
@@ -0,0 +1,27 @@
1
+ require_relative '../model'
2
+
3
+ module Spaceship
4
+ class ConnectAPI
5
+ class Capabilities
6
+ include Spaceship::ConnectAPI::Model
7
+
8
+ attr_accessor :name
9
+ attr_accessor :description
10
+
11
+ attr_mapping({
12
+ "name" => "name",
13
+ "description" => "description",
14
+ })
15
+
16
+ def self.type
17
+ return "capabilities"
18
+ end
19
+
20
+ def self.all(client: nil)
21
+ client ||= Spaceship::ConnectAPI
22
+ resp = client.get_available_bundle_id_capabilities(bundle_id_id: id).all_pages
23
+ return resp.flat_map(&:to_models)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -16,6 +16,8 @@ module Spaceship
16
16
  attr_accessor :email_vetting_required
17
17
  attr_accessor :notifications
18
18
 
19
+ attr_accessor :visible_apps
20
+
19
21
  attr_mapping({
20
22
  "username" => "username",
21
23
  "firstName" => "first_name",
@@ -27,9 +29,15 @@ module Spaceship
27
29
  "allAppsVisible" => "all_apps_visible",
28
30
  "provisioningAllowed" => "provisioning_allowed",
29
31
  "emailVettingRequired" => "email_vetting_required",
30
- "notifications" => "notifications"
32
+ "notifications" => "notifications",
33
+
34
+ "visibleApps" => "visible_apps"
31
35
  })
32
36
 
37
+ ESSENTIAL_INCLUDES = [
38
+ "visibleApps"
39
+ ].join(",")
40
+
33
41
  def self.type
34
42
  return "users"
35
43
  end
@@ -38,16 +46,22 @@ module Spaceship
38
46
  # API
39
47
  #
40
48
 
41
- def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
49
+ def self.all(client: nil, filter: {}, includes: ESSENTIAL_INCLUDES, limit: nil, sort: nil)
42
50
  client ||= Spaceship::ConnectAPI
43
51
  resps = client.get_users(filter: filter, includes: includes).all_pages
44
52
  return resps.flat_map(&:to_models)
45
53
  end
46
54
 
47
- def self.find(client: nil, email: nil, includes: nil)
55
+ def self.find(client: nil, email: nil, includes: ESSENTIAL_INCLUDES)
48
56
  client ||= Spaceship::ConnectAPI
49
57
  return all(client: client, filter: { email: email }, includes: includes)
50
58
  end
59
+
60
+ def get_visible_apps(client: nil, limit: nil)
61
+ client ||= Spaceship::ConnectAPI
62
+ resp = client.get_user_visible_apps(user_id: id, limit: limit)
63
+ return resp.to_models
64
+ end
51
65
  end
52
66
  end
53
67
  end
@@ -11,15 +11,23 @@ module Spaceship
11
11
  attr_accessor :all_apps_visible
12
12
  attr_accessor :provisioning_allowed
13
13
 
14
+ attr_accessor :visible_apps
15
+
14
16
  attr_mapping({
15
17
  "firstName" => "first_name",
16
18
  "lastName" => "last_name",
17
19
  "email" => "email",
18
20
  "roles" => "roles",
19
21
  "allAppsVisible" => "all_apps_visible",
20
- "provisioningAllowed" => "provisioning_allowed"
22
+ "provisioningAllowed" => "provisioning_allowed",
23
+
24
+ "visibleApps" => "visible_apps"
21
25
  })
22
26
 
27
+ ESSENTIAL_INCLUDES = [
28
+ "visibleApps"
29
+ ].join(",")
30
+
23
31
  module UserRole
24
32
  ADMIN = "ADMIN"
25
33
  FINANCE = "FINANCE"
@@ -42,18 +50,23 @@ module Spaceship
42
50
  # Managing invitations
43
51
  #
44
52
 
45
- def self.all(client: nil, filter: {}, includes: nil, sort: nil)
53
+ def self.all(client: nil, filter: {}, includes: ESSENTIAL_INCLUDES, sort: nil)
46
54
  client ||= Spaceship::ConnectAPI
47
55
  resps = client.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
48
56
  return resps.flat_map(&:to_models)
49
57
  end
50
58
 
51
- def self.find(client: nil, email: nil, includes: nil)
59
+ def self.find(client: nil, email: nil, includes: ESSENTIAL_INCLUDES)
52
60
  client ||= Spaceship::ConnectAPI
53
61
  return all(client: client, filter: { email: email }, includes: includes)
54
62
  end
55
63
 
56
- def self.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)
64
+ # Create and post user invitation
65
+ # App Store Connect allows for the following combinations of `all_apps_visible` and `visible_app_ids`:
66
+ # - if `all_apps_visible` is `nil`, you don't have to provide values for `visible_app_ids`
67
+ # - if `all_apps_visible` is true, you must provide values for `visible_app_ids`.
68
+ # - if `all_apps_visible` is false, you must not provide values for `visible_app_ids`.
69
+ def self.create(client: nil, email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil, visible_app_ids: [])
57
70
  client ||= Spaceship::ConnectAPI
58
71
  resp = client.post_user_invitation(
59
72
  email: email,
@@ -61,7 +74,8 @@ module Spaceship
61
74
  last_name: last_name,
62
75
  roles: roles,
63
76
  provisioning_allowed: provisioning_allowed,
64
- all_apps_visible: all_apps_visible
77
+ all_apps_visible: all_apps_visible,
78
+ visible_app_ids: visible_app_ids
65
79
  )
66
80
  return resp.to_models.first
67
81
  end
@@ -70,6 +84,13 @@ module Spaceship
70
84
  client ||= Spaceship::ConnectAPI
71
85
  client.delete_user_invitation(user_invitation_id: id)
72
86
  end
87
+
88
+ # Get visible apps for invited user
89
+ def get_visible_apps(client: nil, limit: nil)
90
+ client ||= Spaceship::ConnectAPI
91
+ resp = client.get_user_invitation_visible_apps(user_invitation_id: id, limit: limit)
92
+ return resp.to_models
93
+ end
73
94
  end
74
95
  end
75
96
  end
@@ -54,6 +54,11 @@ module Spaceship
54
54
  provisioning_request_client.get("bundleIds/#{bundle_id_id}/bundleIdCapabilities", params)
55
55
  end
56
56
 
57
+ def get_available_bundle_id_capabilities(bundle_id_id:)
58
+ params = provisioning_request_client.build_params(filter: { bundleId: bundle_id_id })
59
+ provisioning_request_client.get("capabilities", params)
60
+ end
61
+
57
62
  def post_bundle_id_capability(bundle_id_id:, capability_type:, settings: [])
58
63
  body = {
59
64
  data: {
@@ -11,6 +11,9 @@ module Spaceship
11
11
 
12
12
  super(cookie: cookie, current_team_id: current_team_id, token: token, another_client: another_client)
13
13
 
14
+ # Used by most iris requests starting in July 2021
15
+ @additional_headers = { 'x-csrf-itc': '[asc-ui]' } if another_client
16
+
14
17
  self.extend(Spaceship::ConnectAPI::TestFlight::API)
15
18
  self.test_flight_request_client = self
16
19
  end
@@ -191,11 +191,26 @@ module Spaceship
191
191
  test_flight_request_client.post("builds/#{build_id}/relationships/betaGroups", body)
192
192
  end
193
193
 
194
- def create_beta_group(app_id: nil, group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false)
194
+ def delete_beta_groups_from_build(build_id: nil, beta_group_ids: [])
195
+ body = {
196
+ data: beta_group_ids.map do |id|
197
+ {
198
+ type: "betaGroups",
199
+ id: id
200
+ }
201
+ end
202
+ }
203
+
204
+ test_flight_request_client.delete("builds/#{build_id}/relationships/betaGroups", nil, body)
205
+ end
206
+
207
+ def create_beta_group(app_id: nil, group_name: nil, is_internal_group: false, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false)
195
208
  body = {
196
209
  data: {
197
210
  attributes: {
198
211
  name: group_name,
212
+ isInternalGroup: is_internal_group,
213
+ hasAccessToAllBuilds: is_internal_group ? true : false, # Undocumented of 2021-08-02 in ASC API docs and ASC Open API spec. This is the default behavior on App Store Connect and does work with both Apple ID and API Token
199
214
  publicLinkEnabled: public_link_enabled,
200
215
  publicLinkLimit: public_link_limit,
201
216
  publicLinkLimitEnabled: public_link_limit_enabled
@@ -205,11 +220,11 @@ module Spaceship
205
220
  data: {
206
221
  id: app_id,
207
222
  type: "apps"
208
- }
209
- }
223
+ },
224
+ },
210
225
  },
211
- type: "betaGroups"
212
- }
226
+ type: "betaGroups",
227
+ },
213
228
  }
214
229
  test_flight_request_client.post("betaGroups", body)
215
230
  end
@@ -340,6 +355,32 @@ module Spaceship
340
355
  test_flight_request_client.post("betaTesters/#{beta_tester_id}/relationships/builds", body)
341
356
  end
342
357
 
358
+ def add_beta_testers_to_build(build_id: nil, beta_tester_ids: [])
359
+ body = {
360
+ data: beta_tester_ids.map do |id|
361
+ {
362
+ type: "betaTesters",
363
+ id: id
364
+ }
365
+ end
366
+ }
367
+
368
+ test_flight_request_client.post("builds/#{build_id}/relationships/individualTesters", body)
369
+ end
370
+
371
+ def delete_beta_testers_from_build(build_id: nil, beta_tester_ids: [])
372
+ body = {
373
+ data: beta_tester_ids.map do |id|
374
+ {
375
+ type: "betaTesters",
376
+ id: id
377
+ }
378
+ end
379
+ }
380
+
381
+ test_flight_request_client.delete("builds/#{build_id}/relationships/individualTesters", nil, body)
382
+ end
383
+
343
384
  #
344
385
  # betaTesterMetrics
345
386
  #
@@ -13,6 +13,7 @@ module Spaceship
13
13
  class Token
14
14
  # maximum expiration supported by AppStore (20 minutes)
15
15
  MAX_TOKEN_DURATION = 1200
16
+ DEFAULT_TOKEN_DURATION = 500
16
17
 
17
18
  attr_reader :key_id
18
19
  attr_reader :issuer_id
@@ -20,6 +21,8 @@ module Spaceship
20
21
  attr_reader :duration
21
22
  attr_reader :expiration
22
23
 
24
+ attr_reader :key_raw
25
+
23
26
  # Temporary attribute not needed to create the JWT text
24
27
  # There is no way to determine if the team associated with this
25
28
  # key is for App Store or Enterprise so this is the temporary workaround
@@ -80,7 +83,7 @@ module Spaceship
80
83
  @duration = duration
81
84
  @in_house = in_house
82
85
 
83
- @duration ||= MAX_TOKEN_DURATION
86
+ @duration ||= DEFAULT_TOKEN_DURATION
84
87
  @duration = @duration.to_i if @duration
85
88
 
86
89
  refresh!