fastlane-plugin-dynatrace 1.0.6 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f695a0a113199724b6440168cc2a62ffbd531cde63a5aaf5ac721614831010b8
4
- data.tar.gz: d84839f594a4bbc69b73fcdcab2e8883ca6fd059999ac20097ae485f86fec6b7
3
+ metadata.gz: 1bdb472eb2918d5953d9fdddcce1ae84a4ecd27b71519237f26de179a741841b
4
+ data.tar.gz: 2fe8fab3e1187ab2b2b1ce32c629a8f7a4b55452a418605749c5c083d306e62b
5
5
  SHA512:
6
- metadata.gz: ec8631c08720d264f90067ec7c4008d4748e4bbffa6ad3db6507f05afdbbb6f627fb8e808228721d03ae494391c74490d60a58b2aeac89dd6536ffea916dda96
7
- data.tar.gz: c38a6198cb709b0869392cf2b7179e83fcbdc0c81ab7dd68306bfb0c972a3a051ad47d5ec3aaf2c82b5043bd0f49c580ec401b64dd39eb5cac5baf5d38b99f8c
6
+ metadata.gz: 32d4130da7d003f7a1a2a75c7947f4e844f5bbe9a17cd642a4af238635b8d7c0dcbc92cbe22e8eedb13a21ee53a14c73d99d918c8a07deec7b25706488875a3d
7
+ data.tar.gz: 8715c0bb53db8021da3707aac6775f4b64bbd1bfd57a9c2fbbf0b73ae4ec634aa8fd2ed4a9ac678192fae696465e0dbc9e8375d2ac2ed3fca8a459be58b2e713
data/README.md CHANGED
@@ -10,8 +10,6 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
10
10
  fastlane add_plugin dynatrace
11
11
  ```
12
12
 
13
- ⚠️ The way Apple introduced the two-factor authentication interferes with a fully automated workflow. The workaround requires manual interaction. For more information, see **App Store Connect Two-Factor-Authentication** section below for details.
14
-
15
13
  ## About the Dynatrace fastlane plugin
16
14
  The Dynatrace fastlane plugin manages uploading symbol files (iOS, tvOS) or obfuscation mapping files (Android) to the Dynatrace cluster. Symbol and mapping files are used to make reported stack traces human-readable. The plugin also allows to download the latest dSYM files from App Store Connect, which enables full automation of the mobile app deployment, and the pre-processing of dSYM files, a step that is necessary for the Dynatrace cluster to be able to symbolicate.
17
15
 
@@ -38,22 +36,13 @@ Background: If your app is Bitcode-enabled, then the dSYMs that are generated du
38
36
 
39
37
  ### Automatically downloading dSYMs
40
38
 
41
- To fully automate the following five-step workflow, add the snippets below to the respective files and fill in the placeholders. Uploading the app the App Store Connect is a necessary prerequisite and either handled manually or by fastlane directly:
39
+ To fully automate the following five-step workflow, add the snippets below to the respective files and fill in the placeholders. Uploading the app to App Store Connect is a necessary prerequisite and either handled manually or by fastlane directly:
42
40
 
43
41
  1. Wait until the build is processed
44
42
  2. Download the resulting dSYM files
45
43
  3. Process dSYM files into the format that Dynatrace requires
46
44
  4. Upload processed dSYM files to Dynatrace
47
45
 
48
-
49
- #### AppFile
50
- Make sure the following information is present in `AppFile` to authenticate with App Store Connect.
51
-
52
- ```ruby
53
- app_identifier("com.yourcompany.yourappID") # bundle identifier of your app
54
- apple_id("user@email.com")
55
- ```
56
-
57
46
  #### Fastfile
58
47
  ```ruby
59
48
  dynatrace_process_symbols(
@@ -113,14 +102,12 @@ dynatrace_process_symbols(
113
102
  | versionStr | The CFBundleShortVersionString (iOS, tvOS) / versionName (Android) | |
114
103
  | version | The CFBundleVersion (iOS, tvOS) / versionCode (Android). Is also used for the dSYM download. | |
115
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` |
116
106
  | server | The API endpoint for the Dynatrace environment (e.g. `https://environmentID.live.dynatrace.com` or `https://dynatrace-managed.com/e/environmentID`). | |
117
- | cleanBuildArtifacts | Clean build artifacts after processing. | `true` |
107
+ | cleanBuildArtifacts | Clean build artifacts after processing. | `true` |
108
+ | tempdir | (OPTIONAL) Custom temporary directory for the DTXDssClient. **The plugin does not take care of cleaning this directory.** | |
118
109
  | debugMode | Enable debug logging. | false |
119
110
 
120
- ## App Store Connect Two-Factor-Authentication
121
- When the plugin is used to download symbols from *App Store Connect* automatically (`downloadDsyms: true`), valid App Store Connect credentials with access to the dSYM files are required. The preferred method of doing so is by setting the `FASTLANE_USER` and `FASTLANE_PASSWORD` environment variables to their respective values.
122
-
123
- Apple started enforcing 2-Factor-Authentication for the *App Store Connect* API in February 2021. This [limits the ability to automate the symbol processing](https://github.com/fastlane/fastlane/discussions/17655), because it will most likely involve manual interaction, which is not suitable for CI automation. The only workaround at this point in time is to pre-generate a session and cache it in CI.
124
111
 
125
112
  ### Fastlane Session
126
113
  The full documentation for this can be found on the [fastlane docs](https://docs.fastlane.tools/best-practices/continuous-integration/#two-step-or-two-factor-auth
@@ -18,6 +18,7 @@ module Fastlane
18
18
  UI.message "Version string: #{params[:versionStr]}"
19
19
  UI.message "Version: #{params[:version]}"
20
20
  UI.message "Server URL: #{params[:server]}"
21
+ UI.message "Tempdir: #{params[:tempdir]}"
21
22
 
22
23
  UI.message "Checking AppFile for possible AppID"
23
24
  bundleId = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
@@ -29,16 +30,17 @@ module Fastlane
29
30
  end
30
31
 
31
32
  if params[:os] == "android"
32
- 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)
33
35
  case response.code
34
36
  when '204'
35
- UI.success "Successfully uploaded the mapping file (#{params[:symbolsfile]}) to Dynatrace."
37
+ UI.success "Success. The file has been uploaded and stored."
36
38
  when '400'
37
- UI.user_error! "Failed to upload. The input is invalid."
39
+ UI.user_error! "Failed. The input is invalid."
38
40
  when '401'
39
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/"
40
42
  when '413'
41
- 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."
42
44
  else
43
45
  message = nil
44
46
  unless response.body.nil?
@@ -137,6 +139,7 @@ module Fastlane
137
139
  command << "server=\"#{Helper::DynatraceHelper.without_trailing_slash(params[:server])}\""
138
140
  command << "DTXLogLevel=ALL -verbose" if params[:debugMode] == true
139
141
  command << "forced=1" # if the file already exists
142
+ command << "tempdir=\"#{params[:tempdir]}\"" if params[:tempdir]
140
143
 
141
144
  # Create the full shell command to trigger the DTXDssClient
142
145
  shell_command = command.join(' ')
@@ -256,11 +259,17 @@ module Fastlane
256
259
 
257
260
  FastlaneCore::ConfigItem.new(key: :symbolsfile,
258
261
  env_name: "FL_UPLOAD_TO_DYNATRACE_SYM_FILE_PATH",
259
- 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",
260
263
  verify_block: proc do |value|
261
264
  UI.user_error!("Please provide a value for the symbol files. Pass using `symbolsfile: 'symbolsfile'`") unless (value and not value.empty?)
262
265
  end),
263
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
+
264
273
  FastlaneCore::ConfigItem.new(key: :server,
265
274
  env_name: "FL_UPLOAD_TO_DYNATRACE_SERVER_URL",
266
275
  description: "The API endpoint for the Dynatrace environment (e.g. https://environmentID.live.dynatrace.com or https://dynatrace-managed.com/e/environmentID)",
@@ -274,6 +283,11 @@ module Fastlane
274
283
  is_string: false,
275
284
  description: "Clean build artifacts after processing"),
276
285
 
286
+ FastlaneCore::ConfigItem.new(key: :tempdir,
287
+ env_name: "FL_UPLOAD_TO_DYNATRACE_TEMP_DIR",
288
+ description: "(OPTIONAL) Custom temporary directory for the DTXDssClient. The plugin does not take care of cleaning this directory",
289
+ optional: true),
290
+
277
291
  FastlaneCore::ConfigItem.new(key: :debugMode,
278
292
  env_name: "FL_UPLOAD_TO_DYNATRACE_DEBUG_MODE",
279
293
  description: "Enable debug logging",
@@ -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.6"
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.6
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-02-08 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.1.4
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