fastlane 2.161.0 → 2.162.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +76 -76
  3. data/cert/lib/cert/options.rb +28 -1
  4. data/cert/lib/cert/runner.rb +50 -33
  5. data/deliver/lib/deliver/app_screenshot_iterator.rb +4 -4
  6. data/deliver/lib/deliver/options.rb +2 -2
  7. data/deliver/lib/deliver/upload_metadata.rb +1 -0
  8. data/deliver/lib/deliver/upload_screenshots.rb +25 -8
  9. data/fastlane/lib/fastlane/version.rb +1 -1
  10. data/fastlane/swift/Deliverfile.swift +1 -1
  11. data/fastlane/swift/DeliverfileProtocol.swift +1 -1
  12. data/fastlane/swift/Fastlane.swift +51 -3
  13. data/fastlane/swift/Gymfile.swift +1 -1
  14. data/fastlane/swift/GymfileProtocol.swift +1 -1
  15. data/fastlane/swift/Matchfile.swift +1 -1
  16. data/fastlane/swift/MatchfileProtocol.swift +15 -3
  17. data/fastlane/swift/Precheckfile.swift +1 -1
  18. data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
  19. data/fastlane/swift/Scanfile.swift +1 -1
  20. data/fastlane/swift/ScanfileProtocol.swift +1 -1
  21. data/fastlane/swift/Screengrabfile.swift +1 -1
  22. data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
  23. data/fastlane/swift/Snapshotfile.swift +1 -1
  24. data/fastlane/swift/SnapshotfileProtocol.swift +1 -1
  25. data/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb +6 -7
  26. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +2 -2
  27. data/match/lib/match/generator.rb +6 -1
  28. data/match/lib/match/importer.rb +39 -6
  29. data/match/lib/match/migrate.rb +13 -2
  30. data/match/lib/match/nuke.rb +65 -22
  31. data/match/lib/match/options.rb +26 -1
  32. data/match/lib/match/runner.rb +38 -10
  33. data/match/lib/match/spaceship_ensure.rb +27 -21
  34. data/match/lib/match/storage/google_cloud_storage.rb +20 -3
  35. data/match/lib/match/storage/s3_storage.rb +19 -3
  36. data/sigh/lib/sigh/options.rb +21 -0
  37. data/sigh/lib/sigh/runner.rb +80 -38
  38. data/spaceship/lib/spaceship/client.rb +2 -1
  39. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  40. data/spaceship/lib/spaceship/connect_api/api_client.rb +3 -3
  41. data/spaceship/lib/spaceship/connect_api/client.rb +13 -3
  42. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +3 -1
  43. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +2 -1
  44. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +42 -0
  45. data/spaceship/lib/spaceship/connect_api/models/profile.rb +7 -1
  46. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +59 -0
  47. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +28 -2
  48. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  49. data/spaceship/lib/spaceship/connect_api/users/users.rb +40 -0
  50. metadata +19 -18
@@ -196,7 +196,7 @@ module Spaceship
196
196
  self.new(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
197
197
  end
198
198
 
199
- def initialize(cookie: nil, current_team_id: nil, timeout: nil)
199
+ def initialize(cookie: nil, current_team_id: nil, csrf_tokens: nil, timeout: nil)
200
200
  options = {
201
201
  request: {
202
202
  timeout: (ENV["SPACESHIP_TIMEOUT"] || timeout || 300).to_i,
@@ -204,6 +204,7 @@ module Spaceship
204
204
  }
205
205
  }
206
206
  @current_team_id = current_team_id
207
+ @csrf_tokens = csrf_tokens
207
208
  @cookie = cookie || HTTP::CookieJar.new
208
209
 
209
210
  @client = Faraday.new(self.class.hostname, options) do |c|
@@ -15,6 +15,7 @@ require 'spaceship/connect_api/models/device'
15
15
  require 'spaceship/connect_api/models/profile'
16
16
 
17
17
  require 'spaceship/connect_api/models/user'
18
+ require 'spaceship/connect_api/models/user_invitation'
18
19
 
19
20
  require 'spaceship/connect_api/models/app'
20
21
  require 'spaceship/connect_api/models/beta_app_localization'
@@ -17,7 +17,7 @@ module Spaceship
17
17
  #####################################################
18
18
 
19
19
  # Instantiates a client with cookie session or a JWT token.
20
- def initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil)
20
+ def initialize(cookie: nil, current_team_id: nil, token: nil, csrf_tokens: nil, another_client: nil)
21
21
  params_count = [cookie, token, another_client].compact.size
22
22
  if params_count != 1
23
23
  raise "Must initialize with one of :cookie, :token, or :another_client"
@@ -25,10 +25,10 @@ module Spaceship
25
25
 
26
26
  if token.nil?
27
27
  if another_client.nil?
28
- super(cookie: cookie, current_team_id: current_team_id, timeout: 1200)
28
+ super(cookie: cookie, current_team_id: current_team_id, csrf_tokens: csrf_tokens, timeout: 1200)
29
29
  return
30
30
  end
31
- super(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
31
+ super(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id, csrf_tokens: another_client.csrf_tokens)
32
32
  else
33
33
  options = {
34
34
  request: {
@@ -97,8 +97,18 @@ module Spaceship
97
97
  end
98
98
 
99
99
  def portal_team_id
100
- return nil if @portal_client.nil?
101
- return @portal_client.team_id
100
+ if token
101
+ message = [
102
+ "Cannot determine portal team id via the App Store Connect API (yet)",
103
+ "Look to see if you can get the portal team id from somewhere else",
104
+ "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
105
+ ]
106
+ raise message.join('. ')
107
+ elsif @portal_client
108
+ return @portal_client.team_id
109
+ else
110
+ raise "No App Store Connect API token or Portal Client set"
111
+ end
102
112
  end
103
113
 
104
114
  def tunes_team_id
@@ -126,7 +136,7 @@ module Spaceship
126
136
  "Or set the 'SPACESHIP_CONNECT_API_IN_HOUSE' environment variable to 'true'",
127
137
  "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
128
138
  ]
129
- raise message.join('\n')
139
+ raise message.join('. ')
130
140
  end
131
141
  return !!token.in_house
132
142
  elsif @portal_client
@@ -111,7 +111,9 @@ module Spaceship
111
111
  timeout_minutes = (ENV["SPACESHIP_SCREENSHOT_UPLOAD_TIMEOUT"] || 20).to_i
112
112
 
113
113
  loop do
114
- puts("Waiting for screenshot to appear before uploading...")
114
+ # This error handling needs to be revised since any error occured can reach here.
115
+ # It should handle errors based on what status code is.
116
+ puts("Waiting for screenshots to appear before uploading. This is unlikely to be recovered unless it's 503 error. error=\"#{error}\"")
115
117
  sleep(30)
116
118
 
117
119
  screenshots = Spaceship::ConnectAPI::AppScreenshotSet
@@ -35,7 +35,8 @@ module Spaceship
35
35
  #
36
36
 
37
37
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
38
- return Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes)
38
+ resps = Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes).all_pages
39
+ return resps.flat_map(&:to_models)
39
40
  end
40
41
 
41
42
  def self.find(email: nil, includes: nil)
@@ -1,4 +1,7 @@
1
1
  require_relative '../model'
2
+
3
+ require 'openssl'
4
+
2
5
  module Spaceship
3
6
  class ConnectAPI
4
7
  class Certificate
@@ -6,6 +9,7 @@ module Spaceship
6
9
 
7
10
  attr_accessor :certificate_content
8
11
  attr_accessor :display_name
12
+ attr_accessor :expiration_date
9
13
  attr_accessor :name
10
14
  attr_accessor :platform
11
15
  attr_accessor :serial_number
@@ -47,6 +51,26 @@ module Spaceship
47
51
  Time.parse(expiration_date) > Time.now
48
52
  end
49
53
 
54
+ # Create a new code signing request that can be used to
55
+ # generate a new certificate
56
+ # @example
57
+ # Create a new certificate signing request
58
+ # csr, pkey = Spaceship.certificate.create_certificate_signing_request
59
+ #
60
+ # # Use the signing request to create a new distribution certificate
61
+ # Spaceship.certificate.production.create!(csr: csr)
62
+ def self.create_certificate_signing_request
63
+ key = OpenSSL::PKey::RSA.new(2048)
64
+ csr = OpenSSL::X509::Request.new
65
+ csr.version = 0
66
+ csr.subject = OpenSSL::X509::Name.new([
67
+ ['CN', 'PEM', OpenSSL::ASN1::UTF8STRING]
68
+ ])
69
+ csr.public_key = key.public_key
70
+ csr.sign(key, OpenSSL::Digest::SHA1.new)
71
+ return [csr, key]
72
+ end
73
+
50
74
  #
51
75
  # API
52
76
  #
@@ -55,6 +79,24 @@ module Spaceship
55
79
  resps = Spaceship::ConnectAPI.get_certificates(filter: filter, includes: includes).all_pages
56
80
  return resps.flat_map(&:to_models)
57
81
  end
82
+
83
+ def self.create(certificate_type: nil, csr_content: nil)
84
+ attributes = {
85
+ certificateType: certificate_type,
86
+ csrContent: csr_content
87
+ }
88
+ resp = Spaceship::ConnectAPI.post_certificate(attributes: attributes)
89
+ return resp.to_models.first
90
+ end
91
+
92
+ def self.get(certificate_id: nil, includes: nil)
93
+ resp = Spaceship::ConnectAPI.get_certificate(certificate_id: certificate_id, includes: includes)
94
+ return resp.to_models.first
95
+ end
96
+
97
+ def delete!
98
+ Spaceship::ConnectAPI.delete_certificate(certificate_id: id)
99
+ end
58
100
  end
59
101
  end
60
102
  end
@@ -27,7 +27,8 @@ module Spaceship
27
27
  "expirationDate" => "expiration_date",
28
28
 
29
29
  "bundleId" => "bundle_id",
30
- "certificates" => "certificates"
30
+ "certificates" => "certificates",
31
+ "devices" => "devices"
31
32
  })
32
33
 
33
34
  module ProfileState
@@ -83,6 +84,11 @@ module Spaceship
83
84
  return resp.to_models.first
84
85
  end
85
86
 
87
+ def fetch_all_devices(filter: {}, includes: nil, sort: nil)
88
+ resps = Spaceship::ConnectAPI.get_devices(profile_id: id, filter: filter, includes: includes).all_pages
89
+ return resps.flat_map(&:to_models)
90
+ end
91
+
86
92
  def delete!
87
93
  return Spaceship::ConnectAPI.delete_profile(profile_id: id)
88
94
  end
@@ -0,0 +1,59 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class UserInvitation
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :first_name
8
+ attr_accessor :last_name
9
+ attr_accessor :email
10
+ attr_accessor :roles
11
+ attr_accessor :all_apps_visible
12
+ attr_accessor :provisioning_allowed
13
+
14
+ attr_mapping({
15
+ "firstName" => "first_name",
16
+ "lastName" => "last_name",
17
+ "email" => "email",
18
+ "roles" => "roles",
19
+ "allAppsVisible" => "all_apps_visible",
20
+ "provisioningAllowed" => "provisioning_allowed"
21
+ })
22
+
23
+ module UserRole
24
+ ADMIN = "ADMIN"
25
+ FINANCE = "FINANCE"
26
+ TECHNICAL = "TECHNICAL"
27
+ SALES = "SALES"
28
+ MARKETING = "MARKETING"
29
+ DEVELOPER = "DEVELOPER"
30
+ ACCOUNT_HOLDER = "ACCOUNT_HOLDER"
31
+ READ_ONLY = "READ_ONLY"
32
+ APP_MANAGER = "APP_MANAGER"
33
+ ACCESS_TO_REPORTS = "ACCESS_TO_REPORTS"
34
+ CUSTOMER_SUPPORT = "CUSTOMER_SUPPORT"
35
+ end
36
+
37
+ def self.type
38
+ return "userInvitations"
39
+ end
40
+
41
+ #
42
+ # Managing invitations
43
+ #
44
+
45
+ def self.all(filter: {}, includes: nil, sort: nil)
46
+ resps = Spaceship::ConnectAPI.get_user_invitations(filter: filter, includes: includes, sort: sort).all_pages
47
+ return resps.flat_map(&:to_models)
48
+ end
49
+
50
+ def self.find(email: nil, includes: nil)
51
+ return all(filter: { email: email }, includes: includes)
52
+ end
53
+
54
+ def delete!
55
+ Spaceship::ConnectAPI.delete_user_invitation(user_invitation_id: id)
56
+ end
57
+ end
58
+ end
59
+ end
@@ -36,13 +36,39 @@ module Spaceship
36
36
  provisioning_request_client.get("certificates", params)
37
37
  end
38
38
 
39
+ def get_certificate(certificate_id: nil, includes: nil)
40
+ params = provisioning_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
41
+ provisioning_request_client.get("certificates/#{certificate_id}", params)
42
+ end
43
+
44
+ def post_certificate(attributes: {})
45
+ body = {
46
+ data: {
47
+ attributes: attributes,
48
+ type: "certificates"
49
+ }
50
+ }
51
+
52
+ provisioning_request_client.post("certificates", body)
53
+ end
54
+
55
+ def delete_certificate(certificate_id: nil)
56
+ raise "Certificate id is nil" if certificate_id.nil?
57
+
58
+ provisioning_request_client.delete("certificates/#{certificate_id}")
59
+ end
60
+
39
61
  #
40
62
  # devices
41
63
  #
42
64
 
43
- def get_devices(filter: {}, includes: nil, limit: nil, sort: nil)
65
+ def get_devices(profile_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
44
66
  params = provisioning_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
45
- provisioning_request_client.get("devices", params)
67
+ if profile_id.nil?
68
+ provisioning_request_client.get("devices", params)
69
+ else
70
+ provisioning_request_client.get("profiles/#{profile_id}/devices", params)
71
+ end
46
72
  end
47
73
 
48
74
  #
@@ -277,6 +277,19 @@ module Spaceship
277
277
  test_flight_request_client.delete("betaTesters/#{beta_tester_id}/relationships/betaGroups", nil, body)
278
278
  end
279
279
 
280
+ def delete_beta_testers_from_app(beta_tester_ids: [], app_id: nil)
281
+ body = {
282
+ data: beta_tester_ids.map do |id|
283
+ {
284
+ type: "betaTesters",
285
+ id: id
286
+ }
287
+ end
288
+ }
289
+
290
+ test_flight_request_client.delete("apps/#{app_id}/relationships/betaTesters", nil, body)
291
+ end
292
+
280
293
  #
281
294
  # betaTesterMetrics
282
295
  #
@@ -17,11 +17,18 @@ module Spaceship
17
17
  # users
18
18
  #
19
19
 
20
+ # Get list of users
20
21
  def get_users(filter: {}, includes: nil, limit: nil, sort: nil)
21
22
  params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
22
23
  users_request_client.get("users", params)
23
24
  end
24
25
 
26
+ # Delete existing user
27
+ def delete_user(user_id: nil)
28
+ users_request_client.delete("users/#{user_id}")
29
+ end
30
+
31
+ # Change app permissions for user
25
32
  def add_user_visible_apps(user_id: nil, app_ids: nil)
26
33
  body = {
27
34
  data: app_ids.map do |app_id|
@@ -34,6 +41,39 @@ module Spaceship
34
41
 
35
42
  users_request_client.post("users/#{user_id}/relationships/visibleApps", body)
36
43
  end
44
+
45
+ #
46
+ # invitations (invited users)
47
+ #
48
+
49
+ # Get all invited users (not yet accepted)
50
+ def get_user_invitations(filter: {}, includes: nil, limit: nil, sort: nil)
51
+ params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
52
+ users_request_client.get("userInvitations", params)
53
+ end
54
+
55
+ # Invite new users to App Store Connect
56
+ def post_user_invitation(email: nil, first_name: nil, last_name: nil, roles: [], provisioning_allowed: nil, all_apps_visible: nil)
57
+ body = {
58
+ data: {
59
+ type: "userInvitations",
60
+ attributes: {
61
+ email: email,
62
+ firstName: first_name,
63
+ lastName: last_name,
64
+ roles: roles,
65
+ provisioningAllowed: provisioning_allowed,
66
+ allAppsVisible: all_apps_visible
67
+ }
68
+ }
69
+ }
70
+ users_request_client.post("userInvitations", body)
71
+ end
72
+
73
+ # Remove invited user from team (not yet accepted)
74
+ def delete_user_invitation(user_invitation_id: nil)
75
+ users_request_client.delete("userInvitations/#{user_invitation_id}")
76
+ end
37
77
  end
38
78
  end
39
79
  end
metadata CHANGED
@@ -1,35 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.161.0
4
+ version: 2.162.0
5
5
  platform: ruby
6
6
  authors:
7
- - Jan Piotrowski
8
7
  - Kohki Miki
9
- - Manu Wallner
10
- - Josh Holtz
11
- - Jérôme Lacoste
12
- - Jimmy Dee
8
+ - Danielle Tomlinson
9
+ - Aaron Brager
10
+ - Fumiya Nakamura
13
11
  - Maksym Grebenets
12
+ - Felix Krause
13
+ - Joshua Liebowitz
14
+ - Jérôme Lacoste
14
15
  - Iulian Onofrei
15
- - Helmut Januschka
16
- - Luka Mirosevic
17
- - Olivier Halligon
18
- - Jorge Revuelta H
19
16
  - Max Ott
20
- - Felix Krause
21
- - Danielle Tomlinson
22
17
  - Daniel Jankowski
23
- - Fumiya Nakamura
24
- - Joshua Liebowitz
25
- - Aaron Brager
26
- - Matthew Ellis
27
- - Andrew McBurney
18
+ - Josh Holtz
19
+ - Olivier Halligon
28
20
  - Stefan Natchev
21
+ - Andrew McBurney
22
+ - Luka Mirosevic
23
+ - Jimmy Dee
24
+ - Matthew Ellis
25
+ - Manu Wallner
26
+ - Helmut Januschka
27
+ - Jorge Revuelta H
28
+ - Jan Piotrowski
29
29
  autorequire:
30
30
  bindir: bin
31
31
  cert_chain: []
32
- date: 2020-09-28 00:00:00.000000000 Z
32
+ date: 2020-10-01 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: slack-notifier
@@ -1662,6 +1662,7 @@ files:
1662
1662
  - spaceship/lib/spaceship/connect_api/models/sandbox_tester.rb
1663
1663
  - spaceship/lib/spaceship/connect_api/models/territory.rb
1664
1664
  - spaceship/lib/spaceship/connect_api/models/user.rb
1665
+ - spaceship/lib/spaceship/connect_api/models/user_invitation.rb
1665
1666
  - spaceship/lib/spaceship/connect_api/provisioning/client.rb
1666
1667
  - spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb
1667
1668
  - spaceship/lib/spaceship/connect_api/response.rb