fastlane-plugin-appcenter 1.9.0 → 2.0.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 +34 -2
- data/lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb +156 -0
- data/lib/fastlane/plugin/appcenter/actions/appcenter_fetch_devices_action.rb +1 -1
- data/lib/fastlane/plugin/appcenter/actions/appcenter_fetch_version_number.rb +35 -16
- data/lib/fastlane/plugin/appcenter/actions/appcenter_upload_action.rb +9 -2
- data/lib/fastlane/plugin/appcenter/helper/appcenter_helper.rb +336 -151
- data/lib/fastlane/plugin/appcenter/version.rb +1 -1
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d5bec07c7933960b0bfdb0bba55430e4d72a248266b5f9c6b19f2ff9faae1b8
|
4
|
+
data.tar.gz: c6419bab9a2cd682f16cfe08beba4c34d65e994b07b4daca7e8db685c3d9160b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14c273eb0477916f7c67a00ddd07b89c4422deed716eb5b84c767df206eae11e1e51b727981ec1b7b0106ec4daba2dcf5983cd37ce011fff2f7fb2eebcaa60d2
|
7
|
+
data.tar.gz: 4771c6ef66b34209e9b61986d685cc3f82cd0fa30de705e8164e85f81f13a33c2645795f139abd6e6616de46eb6ebd953353b24f662f12dd094bcd7b2d699e32
|
data/README.md
CHANGED
@@ -23,6 +23,8 @@ With [App Center](https://appcenter.ms) you can continuously build, test, releas
|
|
23
23
|
|
24
24
|
`appcenter_fetch_version_number` allows you to obtain the latest version number (short or full) for an app. This is useful for tasks such as getting the latest version of an app so that an increment action can take place on CI, or checking that an upload has been successful.
|
25
25
|
|
26
|
+
`appcenter_codepush_release_react` allows you to deploy app updates via CodePush.
|
27
|
+
|
26
28
|
## Usage
|
27
29
|
|
28
30
|
To get started, first, [obtain an API token](https://appcenter.ms/settings/apitokens) in App Center. The API Token is used to authenticate with the App Center API in each call.
|
@@ -52,7 +54,8 @@ appcenter_upload(
|
|
52
54
|
appcenter_fetch_version_number(
|
53
55
|
api_token: "<appcenter token>",
|
54
56
|
owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
|
55
|
-
app_name: "<appcenter app name (as seen in app URL)>"
|
57
|
+
app_name: "<appcenter app name (as seen in app URL)>",
|
58
|
+
version: "a specific version to get the last release for" # optional, don't set this value to get the last upload of all versions
|
56
59
|
)
|
57
60
|
```
|
58
61
|
|
@@ -62,6 +65,15 @@ The `appcenter_fetch_version_number` returns a hash that contains the id, the ve
|
|
62
65
|
{"id"=>588, "version"=>"1.2.0", "build_number"=>"1615"}
|
63
66
|
```
|
64
67
|
|
68
|
+
```ruby
|
69
|
+
appcenter_codepush_release_react(
|
70
|
+
api_token: "<appcenter token>",
|
71
|
+
owner_name: "<appcenter account name of the owner of the app (username or organization URL name)>",
|
72
|
+
app_name: "<appcenter app name (as seen in app URL)>",
|
73
|
+
deployment: "Staging"
|
74
|
+
)
|
75
|
+
```
|
76
|
+
|
65
77
|
### Help
|
66
78
|
|
67
79
|
Once installed, information and help for an action can be printed out with this command:
|
@@ -121,6 +133,7 @@ Here is the list of all existing parameters:
|
|
121
133
|
| `version` <br/> `APPCENTER_DISTRIBUTE_VERSION` | The build version, required for .pkg, .dmg, .zip and .msi builds, as well as Android ProGuard `mapping.txt` when using `upload_mapping_only` |
|
122
134
|
| `timeout` <br/> `APPCENTER_DISTRIBUTE_TIMEOUT` | Request timeout in seconds applied to individual HTTP requests. Some commands use multiple HTTP requests, large file uploads are also split in multiple HTTP requests |
|
123
135
|
| `dsa_signature` <br/> `APPCENTER_DISTRIBUTE_DSA_SIGNATURE` | DSA signature of the macOS or Windows release for Sparkle update feed |
|
136
|
+
| `ed_signature` <br/> `APPCENTER_DISTRIBUTE_ED_SIGNATURE` | EdDSA signature of the macOS or Windows release for Sparkle update feed |
|
124
137
|
| `strict` <br/> `APPCENTER_STRICT_MODE` | Strict mode, set to 'true' to fail early in case a potential error was detected |
|
125
138
|
|
126
139
|
#### `appcenter_fetch_version_number`
|
@@ -130,6 +143,25 @@ Here is the list of all existing parameters:
|
|
130
143
|
| `api_token` <br/> `APPCENTER_API_TOKEN` | API Token for App Center |
|
131
144
|
| `owner_name` <br/> `APPCENTER_OWNER_NAME` | Owner name, as found in the App's URL in App Center |
|
132
145
|
| `app_name` <br/> `APPCENTER_APP_NAME` | App name as found in the App's URL in App Center. If there is no app with such name, you will be prompted to create one |
|
146
|
+
| `version` <br/> `APPCENTER_APP_VERSION` | App version to get the last release for instead of the last release of all versions |
|
147
|
+
|
148
|
+
#### `appcenter_codepush_release_react`
|
149
|
+
| Key & Env Var | Description |
|
150
|
+
|-----------------|--------------------|
|
151
|
+
| `api_token` <br/> `APPCENTER_API_TOKEN` | API Token for App Center |
|
152
|
+
| `owner_name` <br/> `APPCENTER_OWNER_NAME` | Owner name, as found in the App's URL in App Center |
|
153
|
+
| `app_name` <br/> `APPCENTER_APP_NAME` | App name as found in the App's URL in App Center. If there is no app with such name, you will be prompted to create one |
|
154
|
+
| `deployment` <br/> `APPCENTER_CODEPUSH_DEPLOYMENT` | Name of deployment track (default: `Staging`) |
|
155
|
+
| `target_version` <br/> `APPCENTER_CODEPUSH_TARGET_VERSION` | Target binary app version |
|
156
|
+
| `mandatory` <br/> `APPCENTER_CODEPUSH_MANDATORY` | Specifies whether the update should be mandatory (default: `true`) |
|
157
|
+
| `description` <br/> `APPCENTER_CODEPUSH_DESCRIPTION` | Description of CodePush release |
|
158
|
+
| `dry_run` <br/> `APPCENTER_CODEPUSH_DRY_RUN` | Print command that would be run, don't run it (default: `false`) |
|
159
|
+
| `disabled` <br/> `APPCENTER_CODEPUSH_DISABLED` | Specifies whether this release should not be immediately available for download (default: `false`) |
|
160
|
+
| `no_duplicate_release_error` <br/> `APPCENTER_CODEPUSH_NO_DUPLICATE_ERROR` | Specifies whether to ignore errors if bundle is identical to the latest codepush release (default: `false`) |
|
161
|
+
| `bundle_name` <br/> `APPCENTER_CODEPUSH_BUNDLE_NAME` | Specifies the name of the bundle file |
|
162
|
+
| `output_dir` <br/> `APPCENTER_CODEPUSH_OUTPUT` | Specifies path to where the bundle and sourcemap should be written |
|
163
|
+
| `sourcemap_output` <br/> `APPCENTER_CODEPUSH_SOURCEMAP_OUTPUT` | Specifies path to write sourcemaps to |
|
164
|
+
| `development` <br/> `APPCENTER_CODEPUH_DEVELOPMENT` | Specifies whether to generate dev or release build (default: `false`) |
|
133
165
|
|
134
166
|
## Example
|
135
167
|
|
@@ -183,4 +215,4 @@ Check out [SECURITY.md](SECURITY.md) for any security concern with this project.
|
|
183
215
|
|
184
216
|
## Contact
|
185
217
|
|
186
|
-
We're on Twitter as [@vsappcenter](https://www.twitter.com/vsappcenter). Additionally you can reach out to us on the [App Center](https://appcenter.ms/apps) portal. Open the "?" menu on the top right corner of screen, then use "Contact support" to file a support ticket. Our support team is there to answer your questions and help you solve your problems.
|
218
|
+
We're on Twitter as [@vsappcenter](https://www.twitter.com/vsappcenter). Additionally you can reach out to us on the [App Center](https://appcenter.ms/apps) portal. Open the "?" menu on the top right corner of screen, then use "Contact support" to file a support ticket. Our support team is there to answer your questions and help you solve your problems.
|
@@ -0,0 +1,156 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
5
|
+
|
6
|
+
module Actions
|
7
|
+
class AppcenterCodepushReleaseReactAction < Action
|
8
|
+
def self.description
|
9
|
+
"CodePush release react action"
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.authors
|
13
|
+
["Ivan Sokolovskii"]
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.run(params)
|
17
|
+
app = params[:app_name]
|
18
|
+
owner = params[:owner_name]
|
19
|
+
token = params[:api_token]
|
20
|
+
deployment = params[:deployment]
|
21
|
+
dev = params[:development]
|
22
|
+
description = params[:description]
|
23
|
+
mandatory = params[:mandatory]
|
24
|
+
version = params[:target_version]
|
25
|
+
disabled = params[:disabled]
|
26
|
+
no_errors = params[:no_duplicate_release_error]
|
27
|
+
bundle = params[:bundle_name]
|
28
|
+
output = params[:output_dir]
|
29
|
+
sourcemap_output = params[:sourcemap_output]
|
30
|
+
dry_run = params[:dry_run]
|
31
|
+
|
32
|
+
command = "appcenter codepush release-react --token #{token} --app #{owner}/#{app} --deployment-name #{deployment} --development #{dev} "
|
33
|
+
if description
|
34
|
+
command += "--description \"#{description}\" "
|
35
|
+
end
|
36
|
+
if mandatory
|
37
|
+
command += "--mandatory "
|
38
|
+
end
|
39
|
+
if version
|
40
|
+
command += "--target-binary-version #{version} "
|
41
|
+
end
|
42
|
+
if disabled
|
43
|
+
command += "--disabled "
|
44
|
+
end
|
45
|
+
if no_errors
|
46
|
+
command += "--disable-duplicate-release-error "
|
47
|
+
end
|
48
|
+
if bundle
|
49
|
+
command += "--bundle-name #{bundle} "
|
50
|
+
end
|
51
|
+
if output
|
52
|
+
command += "--output-dir #{output} "
|
53
|
+
end
|
54
|
+
if sourcemap_output
|
55
|
+
command += "--sourcemap-output #{sourcemap_output} "
|
56
|
+
end
|
57
|
+
if dry_run
|
58
|
+
UI.message("Dry run!".red + " Would have run: " + command + "\n")
|
59
|
+
else
|
60
|
+
sh(command.to_s)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.available_options
|
65
|
+
[
|
66
|
+
FastlaneCore::ConfigItem.new(key: :api_token,
|
67
|
+
type: String,
|
68
|
+
env_name: "APPCENTER_API_TOKEN",
|
69
|
+
description: "API Token for App Center Access",
|
70
|
+
verify_block: proc do |value|
|
71
|
+
UI.user_error!("No API token for App Center given, pass using `api_token: 'token'`") unless value && !value.empty?
|
72
|
+
end),
|
73
|
+
FastlaneCore::ConfigItem.new(key: :owner_name,
|
74
|
+
type: String,
|
75
|
+
env_name: "APPCENTER_OWNER_NAME",
|
76
|
+
description: "Name of the owner of the application on App Center",
|
77
|
+
verify_block: proc do |value|
|
78
|
+
UI.user_error!("No owner name for App Center given, pass using `owner_name: 'owner name'`") unless value && !value.empty?
|
79
|
+
end),
|
80
|
+
FastlaneCore::ConfigItem.new(key: :app_name,
|
81
|
+
type: String,
|
82
|
+
env_name: "APPCENTER_APP_NAME",
|
83
|
+
description: "Name of the application on App Center",
|
84
|
+
verify_block: proc do |value|
|
85
|
+
UI.user_error!("No app name for App Center given, pass using `app_name: 'app name'`") unless value && !value.empty?
|
86
|
+
end),
|
87
|
+
FastlaneCore::ConfigItem.new(key: :deployment,
|
88
|
+
type: String,
|
89
|
+
env_name: "APPCENTER_CODEPUSH_DEPLOYMENT",
|
90
|
+
optional: true,
|
91
|
+
default_value: "Staging",
|
92
|
+
description: "Deployment name for releasing to"),
|
93
|
+
FastlaneCore::ConfigItem.new(key: :target_version,
|
94
|
+
type: String,
|
95
|
+
env_name: "APPCENTER_CODEPUSH_TARGET_VERSION",
|
96
|
+
optional: true,
|
97
|
+
description: "Target binary version for example 1.0.1"),
|
98
|
+
FastlaneCore::ConfigItem.new(key: :mandatory,
|
99
|
+
type: Boolean,
|
100
|
+
env_name: "APPCENTER_CODEPUSH_MANDATORY",
|
101
|
+
default_value: true,
|
102
|
+
optional: true,
|
103
|
+
description: "mandatory update or not"),
|
104
|
+
FastlaneCore::ConfigItem.new(key: :description,
|
105
|
+
type: String,
|
106
|
+
env_name: "APPCENTER_CODEPUSH_DESCRIPTION",
|
107
|
+
optional: true,
|
108
|
+
description: "Release description for CodePush"),
|
109
|
+
FastlaneCore::ConfigItem.new(key: :dry_run,
|
110
|
+
type: Boolean,
|
111
|
+
env_name: "APPCENTER_CODEPUSH_DRY_RUN",
|
112
|
+
default_value: false,
|
113
|
+
optional: true,
|
114
|
+
description: "Print the command that would be run, and don't run it"),
|
115
|
+
FastlaneCore::ConfigItem.new(key: :disabled,
|
116
|
+
type: Boolean,
|
117
|
+
env_name: "APPCENTER_CODEPUSH_DISABLED",
|
118
|
+
default_value: false,
|
119
|
+
optional: true,
|
120
|
+
description: "Specifies whether this release should be immediately downloadable"),
|
121
|
+
FastlaneCore::ConfigItem.new(key: :no_duplicate_release_error,
|
122
|
+
type: Boolean,
|
123
|
+
env_name: "APPCENTER_CODEPUSH_NO_DUPLICATE_ERROR",
|
124
|
+
default_value: false,
|
125
|
+
optional: true,
|
126
|
+
description: "Specifies whether to return an error if the main bundle is identical to the latest codepush release"),
|
127
|
+
FastlaneCore::ConfigItem.new(key: :bundle_name,
|
128
|
+
type: String,
|
129
|
+
env_name: "APPCENTER_CODEPUSH_BUNDLE_NAME",
|
130
|
+
optional: true,
|
131
|
+
description: "Specifies the name of the bundle file"),
|
132
|
+
FastlaneCore::ConfigItem.new(key: :output_dir,
|
133
|
+
type: String,
|
134
|
+
env_name: "APPCENTER_CODEPUSH_OUTPUT",
|
135
|
+
optional: true,
|
136
|
+
description: "Specifies path to where the bundle and sourcemap should be written"),
|
137
|
+
FastlaneCore::ConfigItem.new(key: :sourcemap_output,
|
138
|
+
type: String,
|
139
|
+
env_name: "APPCENTER_CODEPUSH_SOURCEMAP_OUTPUT",
|
140
|
+
optional: true,
|
141
|
+
description: "Specifies path to write sourcemap to"),
|
142
|
+
FastlaneCore::ConfigItem.new(key: :development,
|
143
|
+
type: Boolean,
|
144
|
+
env_name: "APPCENTER_CODEPUSH_DEVELOPMENT",
|
145
|
+
optional: true,
|
146
|
+
default_value: false,
|
147
|
+
description: "Specifies whether to generate a dev build")
|
148
|
+
]
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.is_supported?(platform)
|
152
|
+
[:ios, :android].include?(platform)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "json"
|
2
|
+
require "net/http"
|
3
|
+
require "fastlane_core/ui/ui"
|
4
4
|
|
5
5
|
module Fastlane
|
6
6
|
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
@@ -8,38 +8,51 @@ module Fastlane
|
|
8
8
|
module Actions
|
9
9
|
class AppcenterFetchVersionNumberAction < Action
|
10
10
|
def self.description
|
11
|
-
"Fetches the latest version number of an app from App Center"
|
11
|
+
"Fetches the latest version number of an app or the last build number of a version from App Center"
|
12
12
|
end
|
13
13
|
|
14
14
|
def self.authors
|
15
|
-
["jspargo", "ShopKeep"]
|
15
|
+
["jspargo", "ShopKeep", "Qutaibah"]
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.run(params)
|
19
19
|
api_token = params[:api_token]
|
20
20
|
app_name = params[:app_name]
|
21
21
|
owner_name = params[:owner_name]
|
22
|
+
version = params[:version]
|
22
23
|
|
23
24
|
releases = Helper::AppcenterHelper.fetch_releases(
|
24
25
|
api_token: api_token,
|
25
26
|
owner_name: owner_name,
|
26
|
-
app_name: app_name
|
27
|
+
app_name: app_name,
|
27
28
|
)
|
28
29
|
|
29
30
|
UI.abort_with_message!("No versions found for '#{app_name}' owned by #{owner_name}") unless releases
|
30
|
-
|
31
|
-
|
31
|
+
|
32
|
+
sorted_releases = releases
|
33
|
+
|
34
|
+
if version.nil?
|
35
|
+
sorted_releases = releases.sort_by { |release| release["id"] }
|
36
|
+
else
|
37
|
+
sorted_releases = releases.select { |release| release["short_version"] == version }.sort_by { |release| release["id"] }
|
38
|
+
end
|
39
|
+
|
40
|
+
latest_release = sorted_releases.last
|
32
41
|
|
33
42
|
if latest_release.nil?
|
34
|
-
|
43
|
+
if version.nil?
|
44
|
+
UI.user_error!("This app has no releases yet")
|
45
|
+
return nil
|
46
|
+
end
|
47
|
+
UI.user_error!("The provided version (#{version}) has no releases yet")
|
35
48
|
return nil
|
36
49
|
end
|
37
50
|
|
38
51
|
return {
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
52
|
+
"id" => latest_release["id"],
|
53
|
+
"version" => latest_release["short_version"],
|
54
|
+
"build_number" => latest_release["version"],
|
55
|
+
}
|
43
56
|
end
|
44
57
|
|
45
58
|
def self.available_options
|
@@ -61,7 +74,13 @@ module Fastlane
|
|
61
74
|
description: "Name of the application on App Center",
|
62
75
|
verify_block: proc do |value|
|
63
76
|
UI.user_error!("No app name for App Center given, pass using `app_name: 'app name'`") unless value && !value.empty?
|
64
|
-
end)
|
77
|
+
end),
|
78
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
79
|
+
env_name: "APPCENTER_APP_VERSION",
|
80
|
+
description: "The version to get the latest release for",
|
81
|
+
optional: true,
|
82
|
+
type: String),
|
83
|
+
|
65
84
|
]
|
66
85
|
end
|
67
86
|
|
@@ -70,11 +89,11 @@ module Fastlane
|
|
70
89
|
end
|
71
90
|
|
72
91
|
def self.get_apps(api_token)
|
73
|
-
host_uri = URI.parse(
|
92
|
+
host_uri = URI.parse("https://api.appcenter.ms")
|
74
93
|
http = Net::HTTP.new(host_uri.host, host_uri.port)
|
75
94
|
http.use_ssl = true
|
76
95
|
apps_request = Net::HTTP::Get.new("/v0.1/apps")
|
77
|
-
apps_request[
|
96
|
+
apps_request["X-API-Token"] = api_token
|
78
97
|
apps_response = http.request(apps_request)
|
79
98
|
return [] unless apps_response.kind_of?(Net::HTTPOK)
|
80
99
|
return JSON.parse(apps_response.body)
|
@@ -143,6 +143,7 @@ module Fastlane
|
|
143
143
|
build_number = params[:build_number]
|
144
144
|
version = params[:version]
|
145
145
|
dsa_signature = params[:dsa_signature]
|
146
|
+
ed_signature = params[:ed_signature]
|
146
147
|
|
147
148
|
if release_notes.length >= Constants::MAX_RELEASE_NOTES_LENGTH
|
148
149
|
unless should_clip
|
@@ -230,7 +231,7 @@ module Fastlane
|
|
230
231
|
UI.message("Release '#{release_id}' committed: #{release_url}")
|
231
232
|
|
232
233
|
release = Helper::AppcenterHelper.update_release(api_token, owner_name, app_name, release_id, release_notes)
|
233
|
-
Helper::AppcenterHelper.update_release_metadata(api_token, owner_name, app_name, release_id, dsa_signature)
|
234
|
+
Helper::AppcenterHelper.update_release_metadata(api_token, owner_name, app_name, release_id, dsa_signature, ed_signature)
|
234
235
|
|
235
236
|
destinations_array = []
|
236
237
|
if destinations == '*'
|
@@ -643,7 +644,13 @@ module Fastlane
|
|
643
644
|
description: "DSA signature of the macOS or Windows release for Sparkle update feed",
|
644
645
|
optional: true,
|
645
646
|
type: String),
|
646
|
-
|
647
|
+
|
648
|
+
FastlaneCore::ConfigItem.new(key: :ed_signature,
|
649
|
+
env_name: "APPCENTER_DISTRIBUTE_ED_SIGNATURE",
|
650
|
+
description: "EdDSA signature of the macOS or Windows release for Sparkle update feed",
|
651
|
+
optional: true,
|
652
|
+
type: String),
|
653
|
+
|
647
654
|
FastlaneCore::ConfigItem.new(key: :strict,
|
648
655
|
env_name: "APPCENTER_STRICT_MODE",
|
649
656
|
description: "Strict mode, set to 'true' to fail early in case a potential error was detected",
|
@@ -67,14 +67,23 @@ module Fastlane
|
|
67
67
|
|
68
68
|
UI.message("DEBUG: POST #{url}") if ENV['DEBUG']
|
69
69
|
UI.message("DEBUG: POST body: #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
70
|
+
|
71
|
+
status, message, response = retry_429_and_error do
|
72
|
+
response = connection.post(url) do |req|
|
73
|
+
req.headers['X-API-Token'] = api_token
|
74
|
+
req.headers['internal-request-source'] = "fastlane"
|
75
|
+
req.body = body
|
76
|
+
end
|
74
77
|
end
|
75
78
|
|
76
|
-
|
77
|
-
|
79
|
+
case status
|
80
|
+
when 0, 429
|
81
|
+
if status == 0
|
82
|
+
UI.error("Faraday http exception creating release upload: #{message}")
|
83
|
+
else
|
84
|
+
UI.error("Retryable error creating release upload #{status}: #{message}")
|
85
|
+
end
|
86
|
+
false
|
78
87
|
when 200...300
|
79
88
|
response.body
|
80
89
|
when 401
|
@@ -110,15 +119,22 @@ module Fastlane
|
|
110
119
|
UI.message("DEBUG: POST #{url}") if ENV['DEBUG']
|
111
120
|
UI.message("DEBUG: POST body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
112
121
|
|
113
|
-
response =
|
114
|
-
|
115
|
-
|
116
|
-
|
122
|
+
status, message, response = retry_429_and_error do
|
123
|
+
response = connection.post(url) do |req|
|
124
|
+
req.headers['X-API-Token'] = api_token
|
125
|
+
req.headers['internal-request-source'] = "fastlane"
|
126
|
+
req.body = body
|
127
|
+
end
|
117
128
|
end
|
118
129
|
|
119
|
-
|
120
|
-
|
121
|
-
|
130
|
+
case status
|
131
|
+
when 0, 429
|
132
|
+
if status == 0
|
133
|
+
UI.error("Faraday http exception creating mapping upload: #{message}")
|
134
|
+
else
|
135
|
+
UI.error("Retryable error creating mapping upload #{status}: #{message}")
|
136
|
+
end
|
137
|
+
false
|
122
138
|
when 200...300
|
123
139
|
response.body
|
124
140
|
when 401
|
@@ -149,15 +165,22 @@ module Fastlane
|
|
149
165
|
UI.message("DEBUG: POST #{url}") if ENV['DEBUG']
|
150
166
|
UI.message("DEBUG: POST body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
151
167
|
|
152
|
-
response =
|
153
|
-
|
154
|
-
|
155
|
-
|
168
|
+
status, message, response = retry_429_and_error do
|
169
|
+
response = connection.post(url) do |req|
|
170
|
+
req.headers['X-API-Token'] = api_token
|
171
|
+
req.headers['internal-request-source'] = "fastlane"
|
172
|
+
req.body = body
|
173
|
+
end
|
156
174
|
end
|
157
175
|
|
158
|
-
|
159
|
-
|
160
|
-
|
176
|
+
case status
|
177
|
+
when 0, 429
|
178
|
+
if status == 0
|
179
|
+
UI.error("Faraday http exception creating dsym upload: #{message}")
|
180
|
+
else
|
181
|
+
UI.error("Retryable error creating dsym upload #{status}: #{message}")
|
182
|
+
end
|
183
|
+
false
|
161
184
|
when 200...300
|
162
185
|
response.body
|
163
186
|
when 401
|
@@ -184,15 +207,22 @@ module Fastlane
|
|
184
207
|
UI.message("DEBUG: PATCH #{url}") if ENV['DEBUG']
|
185
208
|
UI.message("DEBUG: PATCH body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
186
209
|
|
187
|
-
response =
|
188
|
-
|
189
|
-
|
190
|
-
|
210
|
+
status, message, response = retry_429_and_error do
|
211
|
+
response = connection.patch(url) do |req|
|
212
|
+
req.headers['X-API-Token'] = api_token
|
213
|
+
req.headers['internal-request-source'] = "fastlane"
|
214
|
+
req.body = body
|
215
|
+
end
|
191
216
|
end
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
217
|
+
|
218
|
+
case status
|
219
|
+
when 0, 429
|
220
|
+
if status == 0
|
221
|
+
UI.error("Faraday http exception updating symbol upload: #{message}")
|
222
|
+
else
|
223
|
+
UI.error("Retryable error updating symbol upload #{status}: #{message}")
|
224
|
+
end
|
225
|
+
false
|
196
226
|
when 200...300
|
197
227
|
response.body
|
198
228
|
when 401
|
@@ -213,19 +243,26 @@ module Fastlane
|
|
213
243
|
UI.message("DEBUG: PUT #{upload_url}") if ENV['DEBUG']
|
214
244
|
UI.message("DEBUG: PUT body <data>\n") if ENV['DEBUG']
|
215
245
|
|
216
|
-
response = connection.put do |req|
|
217
|
-
req.headers['x-ms-blob-type'] = "BlockBlob"
|
218
|
-
req.headers['Content-Length'] = File.size(symbol).to_s
|
219
|
-
req.headers['internal-request-source'] = "fastlane"
|
220
|
-
req.body = Faraday::UploadIO.new(symbol, 'application/octet-stream') if symbol && File.exist?(symbol)
|
221
|
-
end
|
222
|
-
|
223
|
-
UI.message("DEBUG: #{response.status} #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
|
224
|
-
|
225
246
|
log_type = "dSYM" if symbol_type == "Apple"
|
226
247
|
log_type = "mapping" if symbol_type == "Android"
|
227
248
|
|
228
|
-
|
249
|
+
status, message, response = retry_429_and_error do
|
250
|
+
response = connection.put do |req|
|
251
|
+
req.headers['x-ms-blob-type'] = "BlockBlob"
|
252
|
+
req.headers['Content-Length'] = File.size(symbol).to_s
|
253
|
+
req.headers['internal-request-source'] = "fastlane"
|
254
|
+
req.body = Faraday::UploadIO.new(symbol, 'application/octet-stream') if symbol && File.exist?(symbol)
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
case status
|
259
|
+
when 0, 429
|
260
|
+
if status == 0
|
261
|
+
UI.error("Faraday http exception updating symbol upload: #{message}")
|
262
|
+
else
|
263
|
+
UI.error("Retryable error updating symbol upload #{status}: #{message}")
|
264
|
+
end
|
265
|
+
false
|
229
266
|
when 200...300
|
230
267
|
self.update_symbol_upload(api_token, owner_name, app_name, symbol_upload_id, 'committed')
|
231
268
|
UI.success("#{log_type} uploaded")
|
@@ -248,13 +285,22 @@ module Fastlane
|
|
248
285
|
|
249
286
|
UI.message("DEBUG: POST #{set_metadata_url}") if ENV['DEBUG']
|
250
287
|
UI.message("DEBUG: POST body <data>\n") if ENV['DEBUG']
|
251
|
-
|
252
|
-
|
253
|
-
|
288
|
+
|
289
|
+
status, message, response = retry_429_and_error do
|
290
|
+
response = connection.post do |req|
|
291
|
+
req.options.timeout = timeout
|
292
|
+
req.headers['internal-request-source'] = "fastlane"
|
293
|
+
end
|
254
294
|
end
|
255
|
-
UI.message("DEBUG: #{response.status} #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
|
256
295
|
|
257
|
-
case
|
296
|
+
case status
|
297
|
+
when 0, 429
|
298
|
+
if status == 0
|
299
|
+
UI.error("Faraday http exception releasing upload metadata: #{message}")
|
300
|
+
else
|
301
|
+
UI.error("Retryable error releasing upload metadata #{status}: #{message}")
|
302
|
+
end
|
303
|
+
false
|
258
304
|
when 200...300
|
259
305
|
chunk_size = response.body['chunk_size']
|
260
306
|
unless chunk_size.is_a? Integer
|
@@ -280,13 +326,22 @@ module Fastlane
|
|
280
326
|
connection = self.connection(finish_url)
|
281
327
|
|
282
328
|
UI.message("DEBUG: POST #{finish_url}") if ENV['DEBUG']
|
283
|
-
|
284
|
-
|
285
|
-
|
329
|
+
|
330
|
+
status, message, response = retry_429_and_error do
|
331
|
+
response = connection.post do |req|
|
332
|
+
req.options.timeout = timeout
|
333
|
+
req.headers['internal-request-source'] = "fastlane"
|
334
|
+
end
|
286
335
|
end
|
287
|
-
UI.message("DEBUG: #{response.status} #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
|
288
336
|
|
289
|
-
case
|
337
|
+
case status
|
338
|
+
when 0, 429
|
339
|
+
if status == 0
|
340
|
+
UI.error("Faraday http exception finishing release upload: #{message}")
|
341
|
+
else
|
342
|
+
UI.error("Retryable error finishing release upload #{status}: #{message}")
|
343
|
+
end
|
344
|
+
false
|
290
345
|
when 200...300
|
291
346
|
if response.body['error'] == false
|
292
347
|
UI.message("Upload finished")
|
@@ -324,6 +379,7 @@ module Fastlane
|
|
324
379
|
req.options.timeout = timeout
|
325
380
|
req.headers['internal-request-source'] = "fastlane"
|
326
381
|
req.headers['Content-Length'] = chunk.length.to_s
|
382
|
+
req.headers['Content-Type'] = 'application/octet-stream'
|
327
383
|
req.body = chunk
|
328
384
|
end
|
329
385
|
UI.message("DEBUG: #{response.status} #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
|
@@ -380,15 +436,22 @@ module Fastlane
|
|
380
436
|
UI.message("DEBUG: PATCH #{url}") if ENV['DEBUG']
|
381
437
|
UI.message("DEBUG: PATCH body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
382
438
|
|
383
|
-
response =
|
384
|
-
|
385
|
-
|
386
|
-
|
439
|
+
status, message, response = retry_429_and_error do
|
440
|
+
response = connection.patch(url) do |req|
|
441
|
+
req.headers['X-API-Token'] = api_token
|
442
|
+
req.headers['internal-request-source'] = "fastlane"
|
443
|
+
req.body = body
|
444
|
+
end
|
387
445
|
end
|
388
446
|
|
389
|
-
|
390
|
-
|
391
|
-
|
447
|
+
case status
|
448
|
+
when 0, 429
|
449
|
+
if status == 0
|
450
|
+
UI.error("Faraday http exception updating release upload: #{message}")
|
451
|
+
else
|
452
|
+
UI.error("Retryable error updating release upload #{status}: #{message}")
|
453
|
+
end
|
454
|
+
false
|
392
455
|
when 200...300
|
393
456
|
response.body
|
394
457
|
when 401
|
@@ -410,14 +473,21 @@ module Fastlane
|
|
410
473
|
|
411
474
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
412
475
|
|
413
|
-
response =
|
414
|
-
|
415
|
-
|
476
|
+
status, message, response = retry_429_and_error do
|
477
|
+
response = connection.get(url) do |req|
|
478
|
+
req.headers['X-API-Token'] = api_token
|
479
|
+
req.headers['internal-request-source'] = "fastlane"
|
480
|
+
end
|
416
481
|
end
|
417
482
|
|
418
|
-
|
419
|
-
|
420
|
-
|
483
|
+
case status
|
484
|
+
when 0, 429
|
485
|
+
if status == 0
|
486
|
+
UI.error("Faraday http exception getting release: #{message}")
|
487
|
+
else
|
488
|
+
UI.error("Retryable error getting release: #{status}: #{message}")
|
489
|
+
end
|
490
|
+
false
|
421
491
|
when 200...300
|
422
492
|
release = response.body
|
423
493
|
release
|
@@ -442,14 +512,22 @@ module Fastlane
|
|
442
512
|
|
443
513
|
while true
|
444
514
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
445
|
-
response = connection.get(url) do |req|
|
446
|
-
req.headers['X-API-Token'] = api_token
|
447
|
-
req.headers['internal-request-source'] = "fastlane"
|
448
|
-
end
|
449
515
|
|
450
|
-
|
516
|
+
status, message, response = retry_429_and_error do
|
517
|
+
response = connection.get(url) do |req|
|
518
|
+
req.headers['X-API-Token'] = api_token
|
519
|
+
req.headers['internal-request-source'] = "fastlane"
|
520
|
+
end
|
521
|
+
end
|
451
522
|
|
452
|
-
case
|
523
|
+
case status
|
524
|
+
when 0, 429
|
525
|
+
if status == 0
|
526
|
+
UI.error("Faraday http exception polling for release id: #{message}")
|
527
|
+
else
|
528
|
+
UI.error("Retryable error polling for release id: #{status}: #{message}")
|
529
|
+
end
|
530
|
+
return false
|
453
531
|
when 200...300
|
454
532
|
case response.body['upload_status']
|
455
533
|
when "readyToBePublished"
|
@@ -475,14 +553,21 @@ module Fastlane
|
|
475
553
|
|
476
554
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
477
555
|
|
478
|
-
response =
|
479
|
-
|
480
|
-
|
556
|
+
status, message, response = retry_429_and_error do
|
557
|
+
response = connection.get(url) do |req|
|
558
|
+
req.headers['X-API-Token'] = api_token
|
559
|
+
req.headers['internal-request-source'] = "fastlane"
|
560
|
+
end
|
481
561
|
end
|
482
562
|
|
483
|
-
|
484
|
-
|
485
|
-
|
563
|
+
case status
|
564
|
+
when 0, 429
|
565
|
+
if status == 0
|
566
|
+
UI.error("Faraday http exception getting destination: #{message}")
|
567
|
+
else
|
568
|
+
UI.error("Retryable error getting destination: #{status}: #{message}")
|
569
|
+
end
|
570
|
+
false
|
486
571
|
when 200...300
|
487
572
|
destination = response.body
|
488
573
|
destination
|
@@ -510,15 +595,22 @@ module Fastlane
|
|
510
595
|
UI.message("DEBUG: PUT #{url}") if ENV['DEBUG']
|
511
596
|
UI.message("DEBUG: PUT body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
512
597
|
|
513
|
-
response =
|
514
|
-
|
515
|
-
|
516
|
-
|
598
|
+
status, message, response = retry_429_and_error do
|
599
|
+
response = connection.put(url) do |req|
|
600
|
+
req.headers['X-API-Token'] = api_token
|
601
|
+
req.headers['internal-request-source'] = "fastlane"
|
602
|
+
req.body = body
|
603
|
+
end
|
517
604
|
end
|
518
605
|
|
519
|
-
|
520
|
-
|
521
|
-
|
606
|
+
case status
|
607
|
+
when 0, 429
|
608
|
+
if status == 0
|
609
|
+
UI.error("Faraday http exception updating release: #{message}")
|
610
|
+
else
|
611
|
+
UI.error("Retryable error updating release: #{status}: #{message}")
|
612
|
+
end
|
613
|
+
false
|
522
614
|
when 200...300
|
523
615
|
# get full release info
|
524
616
|
release = self.get_release(api_token, owner_name, app_name, release_id)
|
@@ -545,29 +637,42 @@ module Fastlane
|
|
545
637
|
end
|
546
638
|
|
547
639
|
# updates release metadata
|
548
|
-
def self.update_release_metadata(api_token, owner_name, app_name, release_id, dsa_signature)
|
549
|
-
return if dsa_signature.to_s == ''
|
640
|
+
def self.update_release_metadata(api_token, owner_name, app_name, release_id, dsa_signature = '', ed_signature = '')
|
641
|
+
return if dsa_signature.to_s == '' && ed_signature.to_s == ''
|
550
642
|
|
551
643
|
url = "v0.1/apps/#{owner_name}/#{app_name}/releases/#{release_id}"
|
552
644
|
body = {
|
553
|
-
metadata: {
|
554
|
-
dsa_signature: dsa_signature
|
555
|
-
}
|
645
|
+
metadata: {}
|
556
646
|
}
|
647
|
+
|
648
|
+
if dsa_signature.to_s != ''
|
649
|
+
body[:metadata]["dsa_signature"] = dsa_signature
|
650
|
+
end
|
651
|
+
if ed_signature.to_s != ''
|
652
|
+
body[:metadata]["ed_signature"] = ed_signature
|
653
|
+
end
|
557
654
|
|
558
655
|
UI.message("DEBUG: PATCH #{url}") if ENV['DEBUG']
|
559
656
|
UI.message("DEBUG: PATCH body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
560
657
|
|
561
658
|
connection = self.connection
|
562
|
-
response = connection.patch(url) do |req|
|
563
|
-
req.headers['X-API-Token'] = api_token
|
564
|
-
req.headers['internal-request-source'] = "fastlane"
|
565
|
-
req.body = body
|
566
|
-
end
|
567
659
|
|
568
|
-
|
660
|
+
status, message, response = retry_429_and_error do
|
661
|
+
response = connection.patch(url) do |req|
|
662
|
+
req.headers['X-API-Token'] = api_token
|
663
|
+
req.headers['internal-request-source'] = "fastlane"
|
664
|
+
req.body = body
|
665
|
+
end
|
666
|
+
end
|
569
667
|
|
570
|
-
case
|
668
|
+
case status
|
669
|
+
when 0, 429
|
670
|
+
if status == 0
|
671
|
+
UI.error("Faraday http exception updating release metadata: #{message}")
|
672
|
+
else
|
673
|
+
UI.error("Retryable error updating release metadata: #{status}: #{message}")
|
674
|
+
end
|
675
|
+
false
|
571
676
|
when 200...300
|
572
677
|
UI.message("Release Metadata was successfully updated for release '#{release_id}'")
|
573
678
|
when 404
|
@@ -599,15 +704,22 @@ module Fastlane
|
|
599
704
|
UI.message("DEBUG: POST #{url}") if ENV['DEBUG']
|
600
705
|
UI.message("DEBUG: POST body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
601
706
|
|
602
|
-
response =
|
603
|
-
|
604
|
-
|
605
|
-
|
707
|
+
status, message, response = retry_429_and_error do
|
708
|
+
response = connection.post(url) do |req|
|
709
|
+
req.headers['X-API-Token'] = api_token
|
710
|
+
req.headers['internal-request-source'] = "fastlane"
|
711
|
+
req.body = body
|
712
|
+
end
|
606
713
|
end
|
607
714
|
|
608
|
-
|
609
|
-
|
610
|
-
|
715
|
+
case status
|
716
|
+
when 0, 429
|
717
|
+
if status == 0
|
718
|
+
UI.error("Faraday http exception adding to destination: #{message}")
|
719
|
+
else
|
720
|
+
UI.error("Retryable error adding to destination: #{status}: #{message}")
|
721
|
+
end
|
722
|
+
false
|
611
723
|
when 200...300
|
612
724
|
# get full release info
|
613
725
|
release = self.get_release(api_token, owner_name, app_name, release_id)
|
@@ -641,14 +753,21 @@ module Fastlane
|
|
641
753
|
|
642
754
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
643
755
|
|
644
|
-
response =
|
645
|
-
|
646
|
-
|
756
|
+
status, message, response = retry_429_and_error do
|
757
|
+
response = connection.get(url) do |req|
|
758
|
+
req.headers['X-API-Token'] = api_token
|
759
|
+
req.headers['internal-request-source'] = "fastlane"
|
760
|
+
end
|
647
761
|
end
|
648
762
|
|
649
|
-
|
650
|
-
|
651
|
-
|
763
|
+
case status
|
764
|
+
when 0, 429
|
765
|
+
if status == 0
|
766
|
+
UI.error("Faraday http exception getting app: #{message}")
|
767
|
+
else
|
768
|
+
UI.error("Retryable error getting app: #{status}: #{message}")
|
769
|
+
end
|
770
|
+
false
|
652
771
|
when 200...300
|
653
772
|
UI.message("DEBUG: #{JSON.pretty_generate(response.body)}\n") if ENV['DEBUG']
|
654
773
|
true
|
@@ -679,15 +798,22 @@ module Fastlane
|
|
679
798
|
UI.message("DEBUG: POST #{url}") if ENV['DEBUG']
|
680
799
|
UI.message("DEBUG: POST body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
681
800
|
|
682
|
-
response =
|
683
|
-
|
684
|
-
|
685
|
-
|
801
|
+
status, message, response = retry_429_and_error do
|
802
|
+
response = connection.post(url) do |req|
|
803
|
+
req.headers['X-API-Token'] = api_token
|
804
|
+
req.headers['internal-request-source'] = "fastlane"
|
805
|
+
req.body = body
|
806
|
+
end
|
686
807
|
end
|
687
808
|
|
688
|
-
|
689
|
-
|
690
|
-
|
809
|
+
case status
|
810
|
+
when 0, 429
|
811
|
+
if status == 0
|
812
|
+
UI.error("Faraday http exception creating app: #{message}")
|
813
|
+
else
|
814
|
+
UI.error("Retryable error creating app: #{status}: #{message}")
|
815
|
+
end
|
816
|
+
false
|
691
817
|
when 200...300
|
692
818
|
created = response.body
|
693
819
|
UI.success("Created #{os}/#{platform} app with name \"#{created['name']}\" and display name \"#{created['display_name']}\" for #{owner_type} \"#{owner_name}\"")
|
@@ -708,14 +834,21 @@ module Fastlane
|
|
708
834
|
|
709
835
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
710
836
|
|
711
|
-
response =
|
712
|
-
|
713
|
-
|
837
|
+
status, message, response = retry_429_and_error do
|
838
|
+
response = connection.get(url) do |req|
|
839
|
+
req.headers['X-API-Token'] = api_token
|
840
|
+
req.headers['internal-request-source'] = "fastlane"
|
841
|
+
end
|
714
842
|
end
|
715
843
|
|
716
|
-
|
717
|
-
|
718
|
-
|
844
|
+
case status
|
845
|
+
when 0, 429
|
846
|
+
if status == 0
|
847
|
+
UI.error("Faraday http fetching destribution groups: #{message}")
|
848
|
+
else
|
849
|
+
UI.error("Retryable error fetching destribution groups: #{status}: #{message}")
|
850
|
+
end
|
851
|
+
false
|
719
852
|
when 200...300
|
720
853
|
response.body
|
721
854
|
when 401
|
@@ -737,14 +870,21 @@ module Fastlane
|
|
737
870
|
|
738
871
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
739
872
|
|
740
|
-
response =
|
741
|
-
|
742
|
-
|
873
|
+
status, message, response = retry_429_and_error do
|
874
|
+
response = connection.get(url) do |req|
|
875
|
+
req.headers['X-API-Token'] = api_token
|
876
|
+
req.headers['internal-request-source'] = "fastlane"
|
877
|
+
end
|
743
878
|
end
|
744
879
|
|
745
|
-
|
746
|
-
|
747
|
-
|
880
|
+
case status
|
881
|
+
when 0, 429
|
882
|
+
if status == 0
|
883
|
+
UI.error("Faraday http fetching devices: #{message}")
|
884
|
+
else
|
885
|
+
UI.error("Retryable error fetching devices: #{status}: #{message}")
|
886
|
+
end
|
887
|
+
false
|
748
888
|
when 200...300
|
749
889
|
response.body
|
750
890
|
when 401
|
@@ -766,26 +906,33 @@ module Fastlane
|
|
766
906
|
|
767
907
|
UI.message("DEBUG: GET #{url}") if ENV['DEBUG']
|
768
908
|
|
769
|
-
response =
|
770
|
-
|
771
|
-
|
909
|
+
status, message, response = retry_429_and_error do
|
910
|
+
response = connection.get(url) do |req|
|
911
|
+
req.headers['X-API-Token'] = api_token
|
912
|
+
req.headers['internal-request-source'] = "fastlane"
|
913
|
+
end
|
772
914
|
end
|
773
915
|
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
916
|
+
case status
|
917
|
+
when 0, 429
|
918
|
+
if status == 0
|
919
|
+
UI.error("Faraday http fetching releases: #{message}")
|
920
|
+
else
|
921
|
+
UI.error("Retryable error fetching releases: #{status}: #{message}")
|
922
|
+
end
|
923
|
+
false
|
924
|
+
when 200...300
|
925
|
+
JSON.parse(response.body)
|
926
|
+
when 401
|
927
|
+
UI.user_error!("Auth Error, provided invalid token")
|
928
|
+
false
|
929
|
+
when 404
|
930
|
+
UI.error("Not found, invalid owner or application name")
|
931
|
+
false
|
932
|
+
else
|
933
|
+
UI.error("Error #{response.status}: #{response.body}")
|
934
|
+
false
|
935
|
+
end
|
789
936
|
end
|
790
937
|
|
791
938
|
def self.get_release_url(owner_type, owner_name, app_name, release_id)
|
@@ -808,7 +955,7 @@ module Fastlane
|
|
808
955
|
|
809
956
|
# add new created app to existing distribution group
|
810
957
|
def self.add_new_app_to_distribution_group(api_token:, owner_name:, app_name:, destination_name:)
|
811
|
-
url = URI.escape("/v0.1/orgs/#{owner_name}/distribution_groups/#{destination_name}/apps")
|
958
|
+
url = URI::Parser.new.escape("/v0.1/orgs/#{owner_name}/distribution_groups/#{destination_name}/apps")
|
812
959
|
body = {
|
813
960
|
apps: [
|
814
961
|
{ name: app_name }
|
@@ -818,17 +965,23 @@ module Fastlane
|
|
818
965
|
UI.message("DEBUG: POST #{url}") if ENV['DEBUG']
|
819
966
|
UI.message("DEBUG: POST body #{JSON.pretty_generate(body)}\n") if ENV['DEBUG']
|
820
967
|
|
821
|
-
response =
|
822
|
-
|
823
|
-
|
824
|
-
|
968
|
+
status, message, response = retry_429_and_error do
|
969
|
+
response = connection.post(url) do |req|
|
970
|
+
req.headers['X-API-Token'] = api_token
|
971
|
+
req.headers['internal-request-source'] = "fastlane"
|
972
|
+
req.body = body
|
973
|
+
end
|
825
974
|
end
|
826
975
|
|
827
|
-
|
828
|
-
|
829
|
-
|
976
|
+
case status
|
977
|
+
when 0, 429
|
978
|
+
if status == 0
|
979
|
+
UI.error("Faraday http adding to distribution group: #{message}")
|
980
|
+
else
|
981
|
+
UI.error("Retryable error adding to distribution group: #{status}: #{message}")
|
982
|
+
end
|
830
983
|
when 200...300
|
831
|
-
|
984
|
+
response.body
|
832
985
|
UI.success("Added new app #{app_name} to distribution group #{destination_name}")
|
833
986
|
when 401
|
834
987
|
UI.user_error!("Auth Error, provided invalid token")
|
@@ -840,6 +993,38 @@ module Fastlane
|
|
840
993
|
UI.error("Error adding app to distribution group #{response.status}: #{response.body}")
|
841
994
|
end
|
842
995
|
end
|
996
|
+
|
997
|
+
def self.retry_429_and_error(&block)
|
998
|
+
retries = 0
|
999
|
+
status = 0
|
1000
|
+
|
1001
|
+
# status == 0 - Faraday error
|
1002
|
+
# status == 429 - retryable error code from server
|
1003
|
+
while ((status == 0) || (status == 429)) && (retries <= MAX_REQUEST_RETRIES)
|
1004
|
+
begin
|
1005
|
+
# calling request sending logic
|
1006
|
+
response = block.call
|
1007
|
+
|
1008
|
+
# checking reponse
|
1009
|
+
status = response.status
|
1010
|
+
message = response.body
|
1011
|
+
UI.message("DEBUG: #{status} #{JSON.pretty_generate(message)}\n") if ENV['DEBUG']
|
1012
|
+
rescue Faraday::Error => e
|
1013
|
+
status = 0
|
1014
|
+
message = e.message
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
# Pause before retrying
|
1018
|
+
if (status == 0) || (status == 429)
|
1019
|
+
sleep(REQUEST_RETRY_INTERVAL)
|
1020
|
+
end
|
1021
|
+
|
1022
|
+
retries += 1
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
return status, message, response
|
1026
|
+
end
|
1027
|
+
|
843
1028
|
end
|
844
1029
|
end
|
845
1030
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-appcenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -122,8 +122,8 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
description:
|
126
|
-
email:
|
125
|
+
description:
|
126
|
+
email:
|
127
127
|
executables: []
|
128
128
|
extensions: []
|
129
129
|
extra_rdoc_files: []
|
@@ -131,6 +131,7 @@ files:
|
|
131
131
|
- LICENSE
|
132
132
|
- README.md
|
133
133
|
- lib/fastlane/plugin/appcenter.rb
|
134
|
+
- lib/fastlane/plugin/appcenter/actions/appcenter_codepush_release_react.rb
|
134
135
|
- lib/fastlane/plugin/appcenter/actions/appcenter_fetch_devices_action.rb
|
135
136
|
- lib/fastlane/plugin/appcenter/actions/appcenter_fetch_version_number.rb
|
136
137
|
- lib/fastlane/plugin/appcenter/actions/appcenter_upload_action.rb
|
@@ -140,7 +141,7 @@ homepage: https://github.com/microsoft/fastlane-plugin-appcenter
|
|
140
141
|
licenses:
|
141
142
|
- MIT
|
142
143
|
metadata: {}
|
143
|
-
post_install_message:
|
144
|
+
post_install_message:
|
144
145
|
rdoc_options: []
|
145
146
|
require_paths:
|
146
147
|
- lib
|
@@ -155,8 +156,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
156
|
- !ruby/object:Gem::Version
|
156
157
|
version: '0'
|
157
158
|
requirements: []
|
158
|
-
rubygems_version: 3.
|
159
|
-
signing_key:
|
159
|
+
rubygems_version: 3.1.2
|
160
|
+
signing_key:
|
160
161
|
specification_version: 4
|
161
162
|
summary: Fastlane plugin for App Center
|
162
163
|
test_files: []
|