match/lib/match/storage/s3_storage.rb in fastlane-2.161.0 vs match/lib/match/storage/s3_storage.rb in fastlane-2.162.0
- old
+ new
@@ -17,10 +17,12 @@
attr_reader :s3_object_prefix
attr_reader :readonly
attr_reader :username
attr_reader :team_id
attr_reader :team_name
+ attr_reader :api_key_path
+ attr_reader :api_key
def self.configure(params)
s3_region = params[:s3_region]
s3_access_key = params[:s3_access_key]
s3_secret_access_key = params[:s3_secret_access_key]
@@ -41,11 +43,13 @@
s3_bucket: s3_bucket,
s3_object_prefix: s3_object_prefix,
readonly: params[:readonly],
username: params[:username],
team_id: params[:team_id],
- team_name: params[:team_name]
+ team_name: params[:team_name],
+ api_key_path: params[:api_key_path],
+ api_key: params[:api_key]
)
end
def initialize(s3_region: nil,
s3_access_key: nil,
@@ -53,19 +57,23 @@
s3_bucket: nil,
s3_object_prefix: nil,
readonly: nil,
username: nil,
team_id: nil,
- team_name: nil)
+ team_name: nil,
+ api_key_path: nil,
+ api_key: nil)
@s3_bucket = s3_bucket
@s3_region = s3_region
@s3_client = Fastlane::Helper::S3ClientHelper.new(access_key: s3_access_key, secret_access_key: s3_secret_access_key, region: s3_region)
@s3_object_prefix = s3_object_prefix.to_s
@readonly = readonly
@username = username
@team_id = team_id
@team_name = team_name
+ @api_key_path = api_key_path
+ @api_key = api_key
end
# To make debugging easier, we have a custom exception here
def prefixed_working_directory
# We fall back to "*", which means certificates and profiles
@@ -178,12 +186,20 @@
if self.readonly
# In readonly mode, we still want to see if the user provided a team_id
# see `prefixed_working_directory` comments for more details
return self.team_id
else
- spaceship = SpaceshipEnsure.new(self.username, self.team_id, self.team_name)
+ UI.user_error!("The `team_id` option is required. fastlane cannot automatically determine portal team id via the App Store Connect API (yet)") if self.team_id.to_s.empty?
+
+ spaceship = SpaceshipEnsure.new(self.username, self.team_id, self.team_name, api_token)
return spaceship.team_id
end
+ end
+
+ def api_token
+ api_token ||= Spaceship::ConnectAPI::Token.create(self.api_key) if self.api_key
+ api_token ||= Spaceship::ConnectAPI::Token.from_json_file(self.api_key_path) if self.api_key_path
+ return api_token
end
end
end
end