fastlane-plugin-dynatrace 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 303492b26907fe0832d98d1216348562355deba9f8dd27172036c28647e82585
4
- data.tar.gz: 7a1405e4547ca3780d113818969b23f469b67f635361bed1cbaf14aedeacc581
3
+ metadata.gz: 1bdb472eb2918d5953d9fdddcce1ae84a4ecd27b71519237f26de179a741841b
4
+ data.tar.gz: 2fe8fab3e1187ab2b2b1ce32c629a8f7a4b55452a418605749c5c083d306e62b
5
5
  SHA512:
6
- metadata.gz: 05a90824664bed687a50b8cf9c1bf8f737375a7160b2454788964cf483d81a1c2263ef0404da43824b9f614550405cd7227818b7a235850d58af515716008212
7
- data.tar.gz: 226ea656e025793f328e840b65846c953f85194d96f22dbbfefd4bb76b94848e2a420917bbe342e98b5d4f5a31a7df2ef56eb3f4388f4ca346183e6c01fc4f19
6
+ metadata.gz: 32d4130da7d003f7a1a2a75c7947f4e844f5bbe9a17cd642a4af238635b8d7c0dcbc92cbe22e8eedb13a21ee53a14c73d99d918c8a07deec7b25706488875a3d
7
+ data.tar.gz: 8715c0bb53db8021da3707aac6775f4b64bbd1bfd57a9c2fbbf0b73ae4ec634aa8fd2ed4a9ac678192fae696465e0dbc9e8375d2ac2ed3fca8a459be58b2e713
data/README.md CHANGED
@@ -102,6 +102,7 @@ dynatrace_process_symbols(
102
102
  | versionStr | The CFBundleShortVersionString (iOS, tvOS) / versionName (Android) | |
103
103
  | version | The CFBundleVersion (iOS, tvOS) / versionCode (Android). Is also used for the dSYM download. | |
104
104
  | symbolsfile | Path to the dSYM file to be processed. If downloadDsyms is set, this is only a fallback. | |
105
+ | symbolsfileAutoZip | *(Android only)* Automatically zip symbolsfile if it exceeds 10MiB and doesn't already end with `*.zip`. | `true` |
105
106
  | server | The API endpoint for the Dynatrace environment (e.g. `https://environmentID.live.dynatrace.com` or `https://dynatrace-managed.com/e/environmentID`). | |
106
107
  | cleanBuildArtifacts | Clean build artifacts after processing. | `true` |
107
108
  | tempdir | (OPTIONAL) Custom temporary directory for the DTXDssClient. **The plugin does not take care of cleaning this directory.** | |
@@ -30,16 +30,17 @@ module Fastlane
30
30
  end
31
31
 
32
32
  if params[:os] == "android"
33
- response = Helper::DynatraceHelper.put_android_symbols(params, bundleId)
33
+ symbols_path = Helper::DynatraceHelper.zip_if_required(params)
34
+ response, request = Helper::DynatraceHelper.put_android_symbols(params, bundleId, symbols_path)
34
35
  case response.code
35
36
  when '204'
36
- UI.success "Successfully uploaded the mapping file (#{params[:symbolsfile]}) to Dynatrace."
37
+ UI.success "Success. The file has been uploaded and stored."
37
38
  when '400'
38
- UI.user_error! "Failed to upload. The input is invalid."
39
+ UI.user_error! "Failed. The input is invalid."
39
40
  when '401'
40
41
  UI.user_error! "Invalid Dynatrace API token. See https://www.dynatrace.com/support/help/dynatrace-api/basics/dynatrace-api-authentication/#token-permissions and https://www.dynatrace.com/support/help/dynatrace-api/configuration-api/mobile-symbolication-api/"
41
42
  when '413'
42
- UI.user_error! "Failed to upload. The symbol file storage quota is exhausted. See https://www.dynatrace.com/support/help/shortlink/mobile-symbolication#manage-the-uploaded-symbol-files for more information."
43
+ UI.user_error! "Failed. The symbol file storage quota is exhausted. See https://www.dynatrace.com/support/help/shortlink/mobile-symbolication#manage-the-uploaded-symbol-files for more information."
43
44
  else
44
45
  message = nil
45
46
  unless response.body.nil?
@@ -258,11 +259,17 @@ module Fastlane
258
259
 
259
260
  FastlaneCore::ConfigItem.new(key: :symbolsfile,
260
261
  env_name: "FL_UPLOAD_TO_DYNATRACE_SYM_FILE_PATH",
261
- description: "Path to the dSYM file to be processed. Is only used when downloadDsyms is not set",
262
+ description: "Path to the dSYM file to be processed. Is only used when downloadDsyms is not set. Android only: If the file exceeds 10MiB and doesn't end with *.zip it's zipped before uploading. This can be disabled by setting `symbolsfileAutoZip` to false",
262
263
  verify_block: proc do |value|
263
264
  UI.user_error!("Please provide a value for the symbol files. Pass using `symbolsfile: 'symbolsfile'`") unless (value and not value.empty?)
264
265
  end),
265
266
 
267
+ FastlaneCore::ConfigItem.new(key: :symbolsfileAutoZip,
268
+ env_name: "FL_UPLOAD_TO_DYNATRACE_SYM_FILE_AUTO_ZIP",
269
+ default_value: true,
270
+ is_string: false,
271
+ description: "(Android only) Automatically zip symbolsfile if it exceeds 10MiB and doesn't already end with *.zip"),
272
+
266
273
  FastlaneCore::ConfigItem.new(key: :server,
267
274
  env_name: "FL_UPLOAD_TO_DYNATRACE_SERVER_URL",
268
275
  description: "The API endpoint for the Dynatrace environment (e.g. https://environmentID.live.dynatrace.com or https://dynatrace-managed.com/e/environmentID)",
@@ -3,6 +3,7 @@ require 'digest'
3
3
  require 'net/http'
4
4
  require 'tempfile'
5
5
  require 'open-uri'
6
+ require 'zip'
6
7
 
7
8
  module Fastlane
8
9
  UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
@@ -136,7 +137,7 @@ module Fastlane
136
137
  end
137
138
  end
138
139
 
139
- def self.put_android_symbols(params, bundleId)
140
+ def self.put_android_symbols(params, bundleId, symbolspath)
140
141
  path = "/api/config/v1/symfiles/#{params[:appId]}/#{bundleId}/ANDROID/#{params[:version]}/#{params[:versionStr]}"
141
142
 
142
143
  # if path points to dynatrace managed, we need to prepend the path component from the server (/e/{your-environment-id})
@@ -148,14 +149,46 @@ module Fastlane
148
149
  path = self.without_trailing_slash(uri[5]) + path
149
150
  end
150
151
 
152
+ is_symbolsfile_zip = symbolspath.end_with?(".zip")
151
153
 
152
- req = Net::HTTP::Put.new(path, initheader = { 'Content-Type' => 'text/plain',
154
+ request = Net::HTTP::Put.new(path, initheader = { 'Content-Type' => is_symbolsfile_zip ? 'application/zip' : 'text/plain',
153
155
  'Authorization' => "Api-Token #{params[:apitoken]}"} )
154
156
 
155
- req.body = IO.read(params[:symbolsfile])
157
+ request.body = IO.read(symbolspath)
156
158
  http = Net::HTTP.new(self.get_host_name(params), 443)
157
159
  http.use_ssl = true
158
- http.request(req)
160
+ response = http.request(request)
161
+
162
+ return [response, request]
163
+ end
164
+
165
+ def self.zip_if_required(params)
166
+ symbolsfile_path = params[:symbolsfile]
167
+
168
+ if !params[:symbolsfileAutoZip]
169
+ UI.message "Symbolsfile auto-zipping is disbled."
170
+ return symbolsfile_path
171
+ end
172
+
173
+ if symbolsfile_path.end_with?(".zip")
174
+ UI.message "Symbolsfile is already a zip."
175
+ return symbolsfile_path
176
+ end
177
+
178
+ if File.size(symbolsfile_path) > 10 * 1024 * 1024 # 10MiB
179
+ symbolsfile_path_zip = symbolsfile_path + ".zip"
180
+ UI.message "Symbolsfile exceeds 10MiB -> zipping to " + symbolsfile_path_zip
181
+
182
+ # replace any old file
183
+ FileUtils.rm_f(symbolsfile_path_zip)
184
+
185
+ Zip::File.open(symbolsfile_path_zip, create: true) do |zipfile|
186
+ zipfile.add(File.basename(symbolsfile_path), symbolsfile_path)
187
+ end
188
+ symbolsfile_path = symbolsfile_path_zip
189
+ end
190
+
191
+ return symbolsfile_path
159
192
  end
160
193
 
161
194
  private
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Dynatrace
3
- VERSION = "1.0.7"
3
+ VERSION = "1.0.8"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-dynatrace
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dynatrace LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-31 00:00:00.000000000 Z
11
+ date: 2023-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -136,6 +136,104 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: 2.142.0
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubyzip
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :runtime
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: digest
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :runtime
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: net-http
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: tempfile
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :runtime
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: open-uri
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :runtime
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: os
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :runtime
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: json
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :runtime
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
139
237
  description:
140
238
  email: mobile.agent@dynatrace.com
141
239
  executables: []
@@ -167,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
265
  - !ruby/object:Gem::Version
168
266
  version: '0'
169
267
  requirements: []
170
- rubygems_version: 3.3.3
268
+ rubygems_version: 3.3.11
171
269
  signing_key:
172
270
  specification_version: 4
173
271
  summary: This action processes and uploads your symbol files to Dynatrace