fastlane 2.179.0 → 2.183.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +82 -82
- data/cert/lib/cert/commands_generator.rb +2 -1
- data/deliver/lib/assets/summary.html.erb +10 -10
- data/deliver/lib/deliver/commands_generator.rb +2 -1
- data/deliver/lib/deliver/languages.rb +1 -1
- data/deliver/lib/deliver/options.rb +2 -2
- data/deliver/lib/deliver/submit_for_review.rb +3 -3
- data/deliver/lib/deliver/upload_metadata.rb +1 -1
- data/fastlane/lib/fastlane/actions/actions_helper.rb +2 -2
- data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +1 -1
- data/fastlane/lib/fastlane/actions/backup_xcarchive.rb +1 -1
- data/fastlane/lib/fastlane/actions/clipboard.rb +3 -6
- data/fastlane/lib/fastlane/actions/danger.rb +7 -1
- data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
- data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +18 -1
- data/fastlane/lib/fastlane/actions/ensure_env_vars.rb +2 -6
- data/fastlane/lib/fastlane/actions/get_managed_play_store_publishing_rights.rb +3 -1
- data/fastlane/lib/fastlane/actions/git_branch.rb +1 -1
- data/fastlane/lib/fastlane/actions/git_commit.rb +3 -1
- data/fastlane/lib/fastlane/actions/git_pull.rb +4 -10
- data/fastlane/lib/fastlane/actions/git_submodule_update.rb +16 -8
- data/fastlane/lib/fastlane/actions/hipchat.rb +2 -1
- data/fastlane/lib/fastlane/actions/import_from_git.rb +5 -5
- data/fastlane/lib/fastlane/actions/jira.rb +61 -14
- data/fastlane/lib/fastlane/actions/notarize.rb +98 -51
- data/fastlane/lib/fastlane/actions/notification.rb +1 -1
- data/fastlane/lib/fastlane/actions/slack.rb +155 -133
- data/fastlane/lib/fastlane/actions/sourcedocs.rb +164 -0
- data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +4 -2
- data/fastlane/lib/fastlane/actions/xcodebuild.rb +5 -5
- data/fastlane/lib/fastlane/cli_tools_distributor.rb +1 -1
- data/fastlane/lib/fastlane/commands_generator.rb +2 -1
- data/fastlane/lib/fastlane/fast_file.rb +10 -2
- data/fastlane/lib/fastlane/fastlane_require.rb +7 -1
- data/fastlane/lib/fastlane/helper/git_helper.rb +9 -1
- data/fastlane/lib/fastlane/lane_manager.rb +3 -2
- data/fastlane/lib/fastlane/notification/slack.rb +56 -0
- data/fastlane/lib/fastlane/plugins/plugin_info.rb +2 -2
- data/fastlane/lib/fastlane/plugins/template/%gem_name%.gemspec.erb +7 -6
- data/fastlane/lib/fastlane/plugins/template/.rubocop.yml +30 -35
- data/fastlane/lib/fastlane/plugins/template/spec/spec_helper.rb.erb +1 -1
- data/fastlane/lib/fastlane/setup/setup.rb +23 -10
- data/fastlane/lib/fastlane/swift_fastlane_function.rb +35 -14
- data/fastlane/lib/fastlane/swift_runner_upgrader.rb +2 -0
- data/fastlane/lib/fastlane/version.rb +2 -2
- data/fastlane/swift/Deliverfile.swift +1 -1
- data/fastlane/swift/DeliverfileProtocol.swift +1 -1
- data/fastlane/swift/Fastlane.swift +6672 -3787
- data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +4 -0
- data/fastlane/swift/Gymfile.swift +1 -1
- data/fastlane/swift/GymfileProtocol.swift +1 -1
- data/fastlane/swift/LaneFileProtocol.swift +9 -3
- data/fastlane/swift/Matchfile.swift +1 -1
- data/fastlane/swift/MatchfileProtocol.swift +1 -1
- data/fastlane/swift/OptionalConfigValue.swift +131 -0
- data/fastlane/swift/Precheckfile.swift +1 -1
- data/fastlane/swift/PrecheckfileProtocol.swift +1 -1
- data/fastlane/swift/RubyCommand.swift +1 -1
- data/fastlane/swift/Scanfile.swift +1 -1
- data/fastlane/swift/ScanfileProtocol.swift +5 -1
- data/fastlane/swift/Screengrabfile.swift +1 -1
- data/fastlane/swift/ScreengrabfileProtocol.swift +1 -1
- data/fastlane/swift/Snapshotfile.swift +1 -1
- data/fastlane/swift/SnapshotfileProtocol.swift +5 -1
- data/fastlane/swift/SocketClient.swift +2 -1
- data/fastlane/swift/SocketResponse.swift +4 -2
- data/fastlane/swift/formatting/Brewfile.lock.json +18 -16
- data/fastlane/swift/upgrade_manifest.json +1 -1
- data/fastlane_core/lib/fastlane_core.rb +22 -21
- data/fastlane_core/lib/fastlane_core/build_watcher.rb +65 -11
- data/fastlane_core/lib/fastlane_core/clipboard.rb +20 -0
- data/fastlane_core/lib/fastlane_core/device_manager.rb +1 -1
- data/fastlane_core/lib/fastlane_core/helper.rb +4 -4
- data/fastlane_core/lib/fastlane_core/languages.rb +2 -2
- data/fastlane_core/lib/fastlane_core/queue_worker.rb +2 -2
- data/fastlane_core/lib/fastlane_core/swag.rb +1 -1
- data/fastlane_core/lib/fastlane_core/ui/help.erb +35 -0
- data/fastlane_core/lib/fastlane_core/ui/help_formatter.rb +16 -0
- data/fastlane_core/lib/fastlane_core/ui/implementations/shell.rb +16 -2
- data/frameit/lib/frameit/commands_generator.rb +2 -1
- data/frameit/lib/frameit/config_parser.rb +2 -2
- data/frameit/lib/frameit/frame_downloader.rb +2 -1
- data/gym/lib/gym/code_signing_mapping.rb +2 -2
- data/gym/lib/gym/commands_generator.rb +2 -1
- data/gym/lib/gym/generators/package_command_generator_xcode7.rb +6 -5
- data/gym/lib/gym/runner.rb +5 -1
- data/match/lib/match/change_password.rb +1 -1
- data/match/lib/match/commands_generator.rb +2 -1
- data/pem/lib/pem/commands_generator.rb +2 -1
- data/pilot/lib/pilot/build_manager.rb +3 -3
- data/pilot/lib/pilot/commands_generator.rb +2 -1
- data/pilot/lib/pilot/options.rb +2 -2
- data/pilot/lib/pilot/tester_exporter.rb +0 -1
- data/pilot/lib/pilot/tester_manager.rb +0 -1
- data/precheck/lib/precheck/commands_generator.rb +2 -1
- data/produce/lib/produce/commands_generator.rb +2 -1
- data/scan/lib/scan/commands_generator.rb +2 -1
- data/scan/lib/scan/options.rb +10 -5
- data/scan/lib/scan/runner.rb +54 -1
- data/scan/lib/scan/test_command_generator.rb +10 -8
- data/screengrab/lib/screengrab/commands_generator.rb +2 -1
- data/sigh/lib/sigh/commands_generator.rb +2 -1
- data/snapshot/lib/assets/SnapfileTemplate +1 -1
- data/snapshot/lib/assets/SnapshotHelper.swift +1 -1
- data/snapshot/lib/snapshot/commands_generator.rb +3 -1
- data/snapshot/lib/snapshot/options.rb +5 -0
- data/snapshot/lib/snapshot/reports_generator.rb +4 -0
- data/snapshot/lib/snapshot/simulator_launchers/launcher_configuration.rb +2 -0
- data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher.rb +1 -1
- data/snapshot/lib/snapshot/simulator_launchers/simulator_launcher_base.rb +8 -4
- data/spaceship/README.md +2 -12
- data/spaceship/lib/spaceship/base.rb +2 -2
- data/spaceship/lib/spaceship/commands_generator.rb +4 -2
- data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
- data/{gym/lib/gym/.runner.rb.swp → spaceship/lib/spaceship/connect_api/models/.app.rb.swp} +0 -0
- data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +1 -1
- data/spaceship/lib/spaceship/connect_api/models/profile.rb +6 -0
- data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +6 -2
- data/spaceship/lib/spaceship/connect_api/token.rb +7 -1
- data/spaceship/lib/spaceship/spaceauth_runner.rb +19 -9
- data/spaceship/lib/spaceship/tunes/members.rb +1 -1
- data/spaceship/lib/spaceship/ui.rb +2 -2
- data/supply/lib/supply/client.rb +3 -1
- data/supply/lib/supply/commands_generator.rb +2 -1
- data/supply/lib/supply/options.rb +2 -2
- data/supply/lib/supply/uploader.rb +1 -0
- metadata +75 -86
- data/pilot/lib/pilot/tester_util.rb +0 -0
@@ -7,10 +7,7 @@ module Fastlane
|
|
7
7
|
truncated_value = value[0..800].gsub(/\s\w+\s*$/, '...')
|
8
8
|
UI.message("Storing '#{truncated_value}' in the clipboard 🎨")
|
9
9
|
|
10
|
-
|
11
|
-
require 'open3'
|
12
|
-
Open3.popen3('pbcopy') { |input, _, _| input << value }
|
13
|
-
end
|
10
|
+
FastlaneCore::Clipboard.copy(content: value)
|
14
11
|
end
|
15
12
|
|
16
13
|
#####################################################
|
@@ -30,11 +27,11 @@ module Fastlane
|
|
30
27
|
end
|
31
28
|
|
32
29
|
def self.authors
|
33
|
-
["KrauseFx", "joshdholtz"]
|
30
|
+
["KrauseFx", "joshdholtz", "rogerluan"]
|
34
31
|
end
|
35
32
|
|
36
33
|
def self.is_supported?(platform)
|
37
|
-
|
34
|
+
FastlaneCore::Clipboard.is_supported?
|
38
35
|
end
|
39
36
|
|
40
37
|
def self.example_code
|
@@ -17,6 +17,7 @@ module Fastlane
|
|
17
17
|
cmd << "--danger_id=#{danger_id}" if danger_id
|
18
18
|
cmd << "--dangerfile=#{dangerfile}" if dangerfile
|
19
19
|
cmd << "--fail-on-errors=true" if params[:fail_on_errors]
|
20
|
+
cmd << "--fail-if-no-pr=true" if params[:fail_if_no_pr]
|
20
21
|
cmd << "--new-comment" if params[:new_comment]
|
21
22
|
cmd << "--remove-previous-comments" if params[:remove_previous_comments]
|
22
23
|
cmd << "--base=#{base}" if base
|
@@ -99,7 +100,12 @@ module Fastlane
|
|
99
100
|
env_name: "FL_DANGER_PR",
|
100
101
|
description: "Run danger on a specific pull request. e.g. \"https://github.com/danger/danger/pull/518\"",
|
101
102
|
is_string: true,
|
102
|
-
optional: true)
|
103
|
+
optional: true),
|
104
|
+
FastlaneCore::ConfigItem.new(key: :fail_if_no_pr,
|
105
|
+
env_name: "FL_DANGER_FAIL_IF_NO_PR",
|
106
|
+
description: "Fail Danger execution if no PR is found",
|
107
|
+
type: Boolean,
|
108
|
+
default_value: false)
|
103
109
|
]
|
104
110
|
end
|
105
111
|
|
@@ -332,7 +332,7 @@ To get more information about language and locale codes please read [Internation
|
|
332
332
|
|
333
333
|
## Use a clean status bar
|
334
334
|
|
335
|
-
You can set `override_status_bar` to `true` to set the status bar to Tuesday January 9th at 9:41AM with full battery and reception.
|
335
|
+
You can set `override_status_bar` to `true` to set the status bar to Tuesday January 9th at 9:41AM with full battery and reception. If you need more granular customization, to set a Carrier name for example, also set `override_status_bar_arguments` to the specific arguments to be passed to the `xcrun simctl status_bar override` command. Run `xcrun simctl status_bar --help` to see the options available.
|
336
336
|
|
337
337
|
## Editing the `Snapfile`
|
338
338
|
|
@@ -332,7 +332,24 @@ Use [_deliver_](https://docs.fastlane.tools/actions/deliver/) to upload iOS scre
|
|
332
332
|
|
333
333
|
## Use a clean status bar
|
334
334
|
|
335
|
-
You can set `override_status_bar` to `true` in snapshot to set the status bar to Tuesday January 9th at 9:41AM with full battery and reception.
|
335
|
+
You can set `override_status_bar` to `true` in snapshot to set the status bar to Tuesday January 9th at 9:41AM with full battery and reception. If you need more granular customization, to set a Carrier name for example, also set `override_status_bar_arguments` to the specific arguments to be passed to the `xcrun simctl status_bar override` command. Run `xcrun simctl status_bar --help` to see the options available.
|
336
|
+
|
337
|
+
### Examples
|
338
|
+
|
339
|
+
```ruby
|
340
|
+
# Sets the time to 9:41AM with full battery and reception, with the default carrier name: Carrier
|
341
|
+
capture_ios_screenshots(
|
342
|
+
override_status_bar: true
|
343
|
+
)
|
344
|
+
```
|
345
|
+
|
346
|
+
```ruby
|
347
|
+
# Set the time to 9:41AM, battery at 75% and charging, on the TELUS LTE network
|
348
|
+
capture_ios_screenshots(
|
349
|
+
override_status_bar: true,
|
350
|
+
override_status_bar_arguments: "--time 9:41 --dataNetwork lte --cellularMode active --cellularBars 4 --batteryState charging --batteryLevel 75 --operatorName TELUS"
|
351
|
+
)
|
352
|
+
```
|
336
353
|
|
337
354
|
## Gray artifacts around text
|
338
355
|
|
@@ -3,15 +3,11 @@ module Fastlane
|
|
3
3
|
class EnsureEnvVarsAction < Action
|
4
4
|
def self.run(params)
|
5
5
|
variables = params[:env_vars]
|
6
|
+
missing_variables = variables.select { |variable| ENV[variable].to_s.strip.empty? }
|
6
7
|
|
7
|
-
|
8
|
-
next unless ENV[variable].to_s.strip.empty?
|
9
|
-
|
10
|
-
UI.user_error!("Missing environment variable '#{variable}'")
|
11
|
-
end
|
8
|
+
UI.user_error!("Missing environment variable(s) '#{missing_variables.join('\', \'')}'") unless missing_variables.empty?
|
12
9
|
|
13
10
|
is_one = variables.length == 1
|
14
|
-
|
15
11
|
UI.success("Environment variable#{is_one ? '' : 's'} '#{variables.join('\', \'')}' #{is_one ? 'is' : 'are'} set!")
|
16
12
|
end
|
17
13
|
|
@@ -26,7 +26,9 @@ module Fastlane
|
|
26
26
|
# Login
|
27
27
|
credentials = JSON.parse(json_key_data)
|
28
28
|
callback_uri = 'https://fastlane.github.io/managed_google_play-callback/callback.html'
|
29
|
-
|
29
|
+
require 'addressable/uri'
|
30
|
+
continueUrl = Addressable::URI.encode(callback_uri)
|
31
|
+
uri = "https://play.google.com/apps/publish/delegatePrivateApp?service_account=#{credentials['client_email']}&continueUrl=#{continueUrl}"
|
30
32
|
|
31
33
|
UI.message("To obtain publishing rights for custom apps on Managed Play Store, open the following URL and log in:")
|
32
34
|
UI.message("")
|
@@ -2,7 +2,7 @@ module Fastlane
|
|
2
2
|
module Actions
|
3
3
|
class GitBranchAction < Action
|
4
4
|
def self.run(params)
|
5
|
-
branch = Actions.git_branch
|
5
|
+
branch = Actions.git_branch || ""
|
6
6
|
return "" if branch == "HEAD" # Backwards compatibility with the original (and documented) implementation
|
7
7
|
branch
|
8
8
|
end
|
@@ -42,11 +42,13 @@ module Fastlane
|
|
42
42
|
FastlaneCore::ConfigItem.new(key: :message,
|
43
43
|
description: "The commit message that should be used"),
|
44
44
|
FastlaneCore::ConfigItem.new(key: :skip_git_hooks,
|
45
|
-
description: "Set to true to pass
|
45
|
+
description: "Set to true to pass `--no-verify` to git",
|
46
|
+
default_value: false,
|
46
47
|
type: Boolean,
|
47
48
|
optional: true),
|
48
49
|
FastlaneCore::ConfigItem.new(key: :allow_nothing_to_commit,
|
49
50
|
description: "Set to true to allow commit without any git changes in the files you want to commit",
|
51
|
+
default_value: false,
|
50
52
|
type: Boolean,
|
51
53
|
optional: true)
|
52
54
|
]
|
@@ -23,20 +23,14 @@ module Fastlane
|
|
23
23
|
[
|
24
24
|
FastlaneCore::ConfigItem.new(key: :only_tags,
|
25
25
|
description: "Simply pull the tags, and not bring new commits to the current branch from the remote",
|
26
|
-
|
26
|
+
type: Boolean,
|
27
27
|
optional: true,
|
28
|
-
default_value: false,
|
29
|
-
verify_block: proc do |value|
|
30
|
-
UI.user_error!("Please pass a valid value for only_tags. Use one of the following: true, false") unless value.kind_of?(TrueClass) || value.kind_of?(FalseClass)
|
31
|
-
end),
|
28
|
+
default_value: false),
|
32
29
|
FastlaneCore::ConfigItem.new(key: :rebase,
|
33
30
|
description: "Rebase on top of the remote branch instead of merge",
|
34
|
-
|
31
|
+
type: Boolean,
|
35
32
|
optional: true,
|
36
|
-
default_value: false
|
37
|
-
verify_block: proc do |value|
|
38
|
-
UI.user_error!("Please pass a valid value for rebase. Use one of the following: true, false") unless value.kind_of?(TrueClass) || value.kind_of?(FalseClass)
|
39
|
-
end)
|
33
|
+
default_value: false)
|
40
34
|
]
|
41
35
|
end
|
42
36
|
|
@@ -13,20 +13,19 @@ module Fastlane
|
|
13
13
|
#####################################################
|
14
14
|
|
15
15
|
def self.description
|
16
|
-
"Executes a git submodule command"
|
16
|
+
"Executes a git submodule update command"
|
17
17
|
end
|
18
18
|
|
19
19
|
def self.available_options
|
20
20
|
[
|
21
21
|
FastlaneCore::ConfigItem.new(key: :recursive,
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
description: "Should the submodules be updated recursively?",
|
23
|
+
type: Boolean,
|
24
|
+
default_value: false),
|
25
25
|
FastlaneCore::ConfigItem.new(key: :init,
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
default_value: false)
|
26
|
+
description: "Should the submodules be initiated before update?",
|
27
|
+
type: Boolean,
|
28
|
+
default_value: false)
|
30
29
|
]
|
31
30
|
end
|
32
31
|
|
@@ -44,6 +43,15 @@ module Fastlane
|
|
44
43
|
return true
|
45
44
|
end
|
46
45
|
|
46
|
+
def self.example_code
|
47
|
+
[
|
48
|
+
'git_submodule_update',
|
49
|
+
'git_submodule_update(recursive: true)',
|
50
|
+
'git_submodule_update(init: true)',
|
51
|
+
'git_submodule_update(recursive: true, init: true)'
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
47
55
|
def self.category
|
48
56
|
:source_control
|
49
57
|
end
|
@@ -49,7 +49,8 @@ module Fastlane
|
|
49
49
|
# Escape channel's name to guarantee it is a valid URL resource.
|
50
50
|
# First of all we verify that the value is not already escaped,
|
51
51
|
# escaping an escaped value will produce a wrong channel name.
|
52
|
-
|
52
|
+
require 'addressable/uri'
|
53
|
+
escaped_channel = Addressable::URI.encode(channel) == channel ? Addressable::URI.encode(channel) : channel
|
53
54
|
if user?(channel)
|
54
55
|
params = { 'message' => message, 'message_format' => message_format }
|
55
56
|
json_headers = { 'Content-Type' => 'application/json',
|
@@ -43,7 +43,7 @@ module Fastlane
|
|
43
43
|
is_string: false,
|
44
44
|
optional: true),
|
45
45
|
FastlaneCore::ConfigItem.new(key: :cache_path,
|
46
|
-
description: "The path to a directory where the repository should be cloned into.
|
46
|
+
description: "The path to a directory where the repository should be cloned into. Defaults to `nil`, which causes the repository to be cloned on every call, to a temporary directory",
|
47
47
|
default_value: nil,
|
48
48
|
optional: true)
|
49
49
|
]
|
@@ -61,14 +61,14 @@ module Fastlane
|
|
61
61
|
[
|
62
62
|
'import_from_git(
|
63
63
|
url: "git@github.com:fastlane/fastlane.git", # The URL of the repository to import the Fastfile from.
|
64
|
-
branch: "HEAD", # The branch to checkout on the repository
|
65
|
-
path: "fastlane/Fastfile", # The path of the Fastfile in the repository
|
64
|
+
branch: "HEAD", # The branch to checkout on the repository.
|
65
|
+
path: "fastlane/Fastfile", # The path of the Fastfile in the repository.
|
66
66
|
version: "~> 1.0.0" # The version to checkout on the repository. Optimistic match operator can be used to select the latest version within constraints.
|
67
67
|
)',
|
68
68
|
'import_from_git(
|
69
69
|
url: "git@github.com:fastlane/fastlane.git", # The URL of the repository to import the Fastfile from.
|
70
|
-
branch: "HEAD", # The branch to checkout on the repository
|
71
|
-
path: "fastlane/Fastfile", # The path of the Fastfile in the repository
|
70
|
+
branch: "HEAD", # The branch to checkout on the repository.
|
71
|
+
path: "fastlane/Fastfile", # The path of the Fastfile in the repository.
|
72
72
|
version: [">= 1.1.0", "< 2.0.0"], # The version to checkout on the repository. Multiple conditions can be used to select the latest version within constraints.
|
73
73
|
cache_path: "~/.cache/fastlane/imported" # A directory in which the repository will be added, which means that it will not be cloned again on subsequent calls.
|
74
74
|
)'
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module Fastlane
|
2
2
|
module Actions
|
3
|
+
module SharedValues
|
4
|
+
JIRA_JSON = :JIRA_JSON
|
5
|
+
end
|
6
|
+
|
3
7
|
class JiraAction < Action
|
4
8
|
def self.run(params)
|
5
9
|
Actions.verify_gem!('jira-ruby')
|
@@ -21,10 +25,28 @@ module Fastlane
|
|
21
25
|
password: password
|
22
26
|
}
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
begin
|
29
|
+
client = JIRA::Client.new(options)
|
30
|
+
issue = client.Issue.find(ticket_id)
|
31
|
+
comment = issue.comments.build
|
32
|
+
comment.save({ 'body' => comment_text })
|
33
|
+
|
34
|
+
# An exact representation of the JSON returned from the JIRA API
|
35
|
+
# https://github.com/sumoheavy/jira-ruby/blob/master/lib/jira/base.rb#L67
|
36
|
+
json_response = comment.attrs
|
37
|
+
raise 'Failed to add a comment on Jira ticket' if json_response.nil?
|
38
|
+
|
39
|
+
Actions.lane_context[SharedValues::JIRA_JSON] = json_response
|
40
|
+
UI.success('Successfully added a comment on Jira ticket')
|
41
|
+
return json_response
|
42
|
+
rescue => exception
|
43
|
+
message = "Received exception when adding a Jira comment: #{exception}"
|
44
|
+
if params[:fail_on_error]
|
45
|
+
UI.user_error!(message)
|
46
|
+
else
|
47
|
+
UI.error(message)
|
48
|
+
end
|
49
|
+
end
|
28
50
|
end
|
29
51
|
|
30
52
|
#####################################################
|
@@ -32,7 +54,7 @@ module Fastlane
|
|
32
54
|
#####################################################
|
33
55
|
|
34
56
|
def self.description
|
35
|
-
"Leave a comment on
|
57
|
+
"Leave a comment on a Jira ticket"
|
36
58
|
end
|
37
59
|
|
38
60
|
def self.available_options
|
@@ -50,13 +72,13 @@ module Fastlane
|
|
50
72
|
default_value: ""),
|
51
73
|
FastlaneCore::ConfigItem.new(key: :username,
|
52
74
|
env_name: "FL_JIRA_USERNAME",
|
53
|
-
description: "Username for
|
75
|
+
description: "Username for Jira instance",
|
54
76
|
verify_block: proc do |value|
|
55
77
|
UI.user_error!("No username") if value.to_s.length == 0
|
56
78
|
end),
|
57
79
|
FastlaneCore::ConfigItem.new(key: :password,
|
58
80
|
env_name: "FL_JIRA_PASSWORD",
|
59
|
-
description: "Password for Jira",
|
81
|
+
description: "Password or API token for Jira",
|
60
82
|
sensitive: true,
|
61
83
|
verify_block: proc do |value|
|
62
84
|
UI.user_error!("No password") if value.to_s.length == 0
|
@@ -72,15 +94,35 @@ module Fastlane
|
|
72
94
|
description: "Text to add to the ticket as a comment",
|
73
95
|
verify_block: proc do |value|
|
74
96
|
UI.user_error!("No comment specified") if value.to_s.length == 0
|
75
|
-
end)
|
97
|
+
end),
|
98
|
+
FastlaneCore::ConfigItem.new(key: :fail_on_error,
|
99
|
+
env_name: "FL_JIRA_FAIL_ON_ERROR",
|
100
|
+
description: "Should an error adding the Jira comment cause a failure?",
|
101
|
+
type: Boolean,
|
102
|
+
optional: true,
|
103
|
+
default_value: true) # Default value is true for 'Backward compatibility'
|
104
|
+
]
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.output
|
108
|
+
[
|
109
|
+
['JIRA_JSON', 'The whole Jira API JSON object']
|
76
110
|
]
|
77
111
|
end
|
78
112
|
|
79
113
|
def self.return_value
|
114
|
+
[
|
115
|
+
"A hash containing all relevant information of the Jira comment",
|
116
|
+
"Access Jira comment 'id', 'author', 'body', and more"
|
117
|
+
].join("\n")
|
118
|
+
end
|
119
|
+
|
120
|
+
def self.return_type
|
121
|
+
:hash
|
80
122
|
end
|
81
123
|
|
82
124
|
def self.authors
|
83
|
-
["iAmChrisTruman"]
|
125
|
+
["iAmChrisTruman", "crazymanish"]
|
84
126
|
end
|
85
127
|
|
86
128
|
def self.is_supported?(platform)
|
@@ -92,17 +134,22 @@ module Fastlane
|
|
92
134
|
'jira(
|
93
135
|
url: "https://bugs.yourdomain.com",
|
94
136
|
username: "Your username",
|
95
|
-
password: "Your password",
|
96
|
-
ticket_id: "
|
137
|
+
password: "Your password or API token",
|
138
|
+
ticket_id: "IOS-123",
|
97
139
|
comment_text: "Text to post as a comment"
|
98
|
-
)',
|
140
|
+
)', # How to get API token: https://developer.atlassian.com/cloud/jira/platform/basic-auth-for-rest-apis/#get-an-api-token
|
99
141
|
'jira(
|
100
142
|
url: "https://yourserverdomain.com",
|
101
143
|
context_path: "/jira",
|
102
144
|
username: "Your username",
|
103
|
-
password: "Your password",
|
104
|
-
ticket_id: "
|
145
|
+
password: "Your password or API token",
|
146
|
+
ticket_id: "IOS-123",
|
105
147
|
comment_text: "Text to post as a comment"
|
148
|
+
)',
|
149
|
+
'jira(
|
150
|
+
ticket_id: "IOS-123",
|
151
|
+
comment_text: "Text to post as a comment",
|
152
|
+
fail_on_error: false
|
106
153
|
)'
|
107
154
|
]
|
108
155
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
module Fastlane
|
2
2
|
module Actions
|
3
3
|
class NotarizeAction < Action
|
4
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
4
5
|
def self.run(params)
|
5
6
|
package_path = params[:package]
|
6
7
|
bundle_id = params[:bundle_id]
|
7
8
|
try_early_stapling = params[:try_early_stapling]
|
8
9
|
print_log = params[:print_log]
|
9
10
|
verbose = params[:verbose]
|
11
|
+
api_key_path = params[:api_key_path]
|
10
12
|
|
11
13
|
# Compress and read bundle identifier only for .app bundle.
|
12
14
|
compressed_package_path = nil
|
@@ -28,68 +30,73 @@ module Fastlane
|
|
28
30
|
|
29
31
|
UI.user_error!('Could not read bundle identifier, provide as a parameter') unless bundle_id
|
30
32
|
|
31
|
-
apple_id_account = CredentialsManager::AccountManager.new(user: params[:username])
|
32
|
-
|
33
|
-
# Add password as a temporary environment variable for altool.
|
34
|
-
# Use app specific password if specified.
|
35
|
-
ENV['FL_NOTARIZE_PASSWORD'] = ENV['FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD'] || apple_id_account.password
|
36
|
-
|
37
33
|
UI.message('Uploading package to notarization service, might take a while')
|
38
34
|
|
39
|
-
notarization_upload_command = "xcrun altool --notarize-app -t osx -f \"#{compressed_package_path || package_path}\" --primary-bundle-id #{bundle_id}
|
40
|
-
notarization_upload_command << " --asc-provider \"#{params[:asc_provider]}\"" if params[:asc_provider]
|
35
|
+
notarization_upload_command = "xcrun altool --notarize-app -t osx -f \"#{compressed_package_path || package_path}\" --primary-bundle-id #{bundle_id} --output-format xml"
|
41
36
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
)
|
37
|
+
notarization_info = {}
|
38
|
+
with_notarize_authenticator(params, api_key_path) do |notarize_authenticator|
|
39
|
+
notarization_upload_command << " --asc-provider \"#{params[:asc_provider]}\"" if params[:asc_provider] && api_key_path.nil?
|
46
40
|
|
47
|
-
|
41
|
+
notarization_upload_response = Actions.sh(
|
42
|
+
notarize_authenticator.call(notarization_upload_command),
|
43
|
+
log: verbose
|
44
|
+
)
|
48
45
|
|
49
|
-
|
50
|
-
notarization_request_id = notarization_upload_plist['notarization-upload']['RequestUUID']
|
46
|
+
FileUtils.rm_rf(compressed_package_path) if compressed_package_path
|
51
47
|
|
52
|
-
|
48
|
+
notarization_upload_plist = Plist.parse_xml(notarization_upload_response)
|
53
49
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
UI.
|
58
|
-
elsif try_early_stapling
|
59
|
-
UI.message('Request in progress, trying early staple')
|
60
|
-
|
61
|
-
begin
|
62
|
-
self.staple(package_path, verbose)
|
63
|
-
UI.message('Successfully notarized and early stapled package.')
|
64
|
-
|
65
|
-
return
|
66
|
-
rescue
|
67
|
-
UI.message('Early staple failed, waiting to query again')
|
68
|
-
end
|
50
|
+
if notarization_upload_plist.key?('product-errors') && notarization_upload_plist['product-errors'].any?
|
51
|
+
UI.important("🚫 Could not upload package to notarization service! Here are the reasons:")
|
52
|
+
notarization_upload_plist['product-errors'].each { |product_error| UI.error("#{product_error['message']} (#{product_error['code']})") }
|
53
|
+
UI.user_error!("Package upload to notarization service cancelled. Please check the error messages above.")
|
69
54
|
end
|
70
55
|
|
71
|
-
|
72
|
-
|
73
|
-
UI.
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
56
|
+
notarization_request_id = notarization_upload_plist['notarization-upload']['RequestUUID']
|
57
|
+
|
58
|
+
UI.success("Successfully uploaded package to notarization service with request identifier #{notarization_request_id}")
|
59
|
+
|
60
|
+
while notarization_info.empty? || (notarization_info['Status'] == 'in progress')
|
61
|
+
if notarization_info.empty?
|
62
|
+
UI.message('Waiting to query request status')
|
63
|
+
elsif try_early_stapling
|
64
|
+
UI.message('Request in progress, trying early staple')
|
65
|
+
|
66
|
+
begin
|
67
|
+
self.staple(package_path, verbose)
|
68
|
+
UI.message('Successfully notarized and early stapled package.')
|
69
|
+
|
70
|
+
return
|
71
|
+
rescue
|
72
|
+
UI.message('Early staple failed, waiting to query again')
|
73
|
+
end
|
74
|
+
end
|
87
75
|
|
88
|
-
|
89
|
-
|
90
|
-
|
76
|
+
sleep(30)
|
77
|
+
|
78
|
+
UI.message('Querying request status')
|
79
|
+
|
80
|
+
# As of July 2020, the request UUID might not be available for polling yet which returns an error code
|
81
|
+
# This is now handled with the error_callback (which prevents an error from being raised)
|
82
|
+
# Catching this error allows for polling to continue until the notarization is complete
|
83
|
+
error = false
|
84
|
+
notarization_info_response = Actions.sh(
|
85
|
+
notarize_authenticator.call("xcrun altool --notarization-info #{notarization_request_id} --output-format xml"),
|
86
|
+
log: verbose,
|
87
|
+
error_callback: lambda { |msg|
|
88
|
+
error = true
|
89
|
+
UI.error("Error polling for notarization info: #{msg}")
|
90
|
+
}
|
91
|
+
)
|
92
|
+
|
93
|
+
unless error
|
94
|
+
notarization_info_plist = Plist.parse_xml(notarization_info_response)
|
95
|
+
notarization_info = notarization_info_plist['notarization-info']
|
96
|
+
end
|
91
97
|
end
|
92
98
|
end
|
99
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
93
100
|
|
94
101
|
log_url = notarization_info['LogFileURL']
|
95
102
|
ENV['FL_NOTARIZE_LOG_FILE_URL'] = log_url
|
@@ -123,6 +130,35 @@ module Fastlane
|
|
123
130
|
)
|
124
131
|
end
|
125
132
|
|
133
|
+
def self.with_notarize_authenticator(params, api_key_path)
|
134
|
+
if api_key_path
|
135
|
+
# From xcrun altool for --apiKey:
|
136
|
+
# This option will search the following directories in sequence for a private key file with the name of 'AuthKey_<api_key>.p8': './private_keys', '~/private_keys', '~/.private_keys', and '~/.appstoreconnect/private_keys'.
|
137
|
+
api_key = Spaceship::ConnectAPI::Token.from_json_file(api_key_path)
|
138
|
+
api_key_folder_path = File.expand_path('~/.appstoreconnect/private_keys')
|
139
|
+
api_key_file_path = File.join(api_key_folder_path, "AuthKey_#{api_key.key_id}.p8")
|
140
|
+
directory_exists = File.directory?(api_key_folder_path)
|
141
|
+
file_exists = File.exist?(api_key_file_path)
|
142
|
+
begin
|
143
|
+
FileUtils.mkdir_p(api_key_folder_path) unless directory_exists
|
144
|
+
api_key.write_key_to_file(api_key_file_path) unless file_exists
|
145
|
+
|
146
|
+
yield(proc { |command| "#{command} --apiKey #{api_key.key_id} --apiIssuer #{api_key.issuer_id}" })
|
147
|
+
ensure
|
148
|
+
FileUtils.rm(api_key_file_path) unless file_exists
|
149
|
+
FileUtils.rm_r(api_key_folder_path) unless directory_exists
|
150
|
+
end
|
151
|
+
else
|
152
|
+
apple_id_account = CredentialsManager::AccountManager.new(user: params[:username])
|
153
|
+
|
154
|
+
# Add password as a temporary environment variable for altool.
|
155
|
+
# Use app specific password if specified.
|
156
|
+
ENV['FL_NOTARIZE_PASSWORD'] = ENV['FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD'] || apple_id_account.password
|
157
|
+
|
158
|
+
yield(proc { |command| "#{command} -u #{apple_id_account.user} -p @env:FL_NOTARIZE_PASSWORD" })
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
126
162
|
def self.description
|
127
163
|
'Notarizes a macOS app'
|
128
164
|
end
|
@@ -160,6 +196,8 @@ module Fastlane
|
|
160
196
|
env_name: 'FL_NOTARIZE_USERNAME',
|
161
197
|
description: 'Apple ID username',
|
162
198
|
default_value: username,
|
199
|
+
optional: true,
|
200
|
+
conflicting_options: [:api_key_path],
|
163
201
|
default_value_dynamic: true),
|
164
202
|
FastlaneCore::ConfigItem.new(key: :asc_provider,
|
165
203
|
env_name: 'FL_NOTARIZE_ASC_PROVIDER',
|
@@ -177,7 +215,16 @@ module Fastlane
|
|
177
215
|
description: 'Whether to log requests',
|
178
216
|
optional: true,
|
179
217
|
default_value: false,
|
180
|
-
type: Boolean)
|
218
|
+
type: Boolean),
|
219
|
+
FastlaneCore::ConfigItem.new(key: :api_key_path,
|
220
|
+
env_name: 'FL_NOTARIZE_API_KEY_PATH',
|
221
|
+
description: 'Path to AppStore Connect API key',
|
222
|
+
optional: true,
|
223
|
+
conflicting_options: [:username],
|
224
|
+
is_string: true,
|
225
|
+
verify_block: proc do |value|
|
226
|
+
UI.user_error!("API Key not found at '#{value}'") unless File.exist?(value)
|
227
|
+
end)
|
181
228
|
]
|
182
229
|
end
|
183
230
|
|