fastlane-plugin-dynatrace 2.0.1 → 2.1.0

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: 58ed6912adbea0ca9a55066716a2aa6dbc22affdac8ad25c4bc93fc0da852682
4
- data.tar.gz: 3b0b6706d78c1243b2454b432532823a0043e6405aff4501ec15e16bc400d054
3
+ metadata.gz: 8f9d82532307fde8ca1288b6bb467088f63e0a45da5933d1646e8dada2f57cd6
4
+ data.tar.gz: ccd706648e2f0ca713ad9f2210cf7693889f34c176c9eae18ea27358002244db
5
5
  SHA512:
6
- metadata.gz: 147aa55c0aef9dc4632fbe355a2a7ed38c864e3830e3e69be6627b0c9a21221f17504dfc7ed31b3734a33f5f75de3b0e358befadfe4acceee09c13fcbcf48c20
7
- data.tar.gz: 7a683def56df76f503569f417a9691c1042642c3c0a6d588227d7d31379aba11f16f1876f5860dbb3c84a2cea6816aad6dd44544c79dbac022116ef7f793be95
6
+ metadata.gz: 5743294ccc42bb2c63a47fd41b48bf320d49c2f9fe72907c35a23cc634fc4f85b5ea7d0630faad35db8ea334f075777ae5b284d027d0251512ab9834ba2fb40f
7
+ data.tar.gz: 04ec5397a2153f52e307b91539fa2295bec158da91d8db07fdbf067bac1479e778a8add0e8ac5c56310bcfe70f600bcf92e04bb1596d9f78477ada069fe2be86
data/README.md CHANGED
@@ -37,22 +37,24 @@ Now, when you run fastlane, the Dynatrace plugin will manage the symbol files of
37
37
 
38
38
 
39
39
  ## List of all Parameters
40
- | Key | Description | default value |
41
- |------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
42
- | action | *(iOS/tvOS only)* Action to be performed by DTXDssClient (`upload` or `decode`). | `upload` |
43
- | username | *(iOS/tvOS only)* The username/AppleID to use to download the dSYMs. Alternatively you can specify this in your AppFile as `apple_id`. | |
44
- | os | The type of the symbol files, either `ios`, `tvOS` or `android`. | |
45
- | apitoken | Dynatrace API token with mobile symbolication permissions. | |
46
- | appID | The application ID you get from your Dynatrace environment. | |
47
- | bundleId | The CFBundlebundleId (iOS, tvOS) / package (Android) of the application. Alternatively you can specify this in your AppFile as `app_identifier`. | |
48
- | versionStr | The CFBundleShortVersionString (iOS, tvOS) / versionName (Android) | |
49
- | version | The CFBundleVersion (iOS, tvOS) / versionCode (Android). Is also used for the dSYM download. | |
50
- | symbolsfile | Path to the dSYM or Android mapping file to be processed. *(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. | |
51
- | symbolsfileAutoZip | *(Android only)* Automatically zip symbolsfile if it exceeds 10MiB and doesn't already end with `*.zip`. | `true` |
52
- | server | The API endpoint for the Dynatrace environment (e.g. `https://environmentID.live.dynatrace.com` or `https://dynatrace-managed.com/e/environmentID`). | |
53
- | cleanBuildArtifacts | Clean build artifacts after processing. | `false` |
54
- | tempdir | (OPTIONAL) Custom temporary directory for the DTXDssClient. **The plugin does not take care of cleaning this directory.** | |
55
- | debugMode | Enable debug logging. | false |
40
+ | Key | Description | default value |
41
+ |-------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------|
42
+ | action | *(iOS/tvOS only)* Action to be performed by DTXDssClient (`upload` or `decode`). | `upload` |
43
+ | username | *(iOS/tvOS only)* The username/AppleID to use to download the dSYMs. Alternatively you can specify this in your AppFile as `apple_id`. | |
44
+ | os | The type of the symbol files, either `ios`, `tvOS` or `android`. | |
45
+ | apitoken | Dynatrace API token with mobile symbolication permissions. | |
46
+ | appID | The application ID you get from your Dynatrace environment. | |
47
+ | bundleId | The CFBundlebundleId (iOS, tvOS) / package (Android) of the application. Alternatively you can specify this in your AppFile as `app_identifier`. | |
48
+ | versionStr | The CFBundleShortVersionString (iOS, tvOS) / versionName (Android) | |
49
+ | version | The CFBundleVersion (iOS, tvOS) / versionCode (Android). Is also used for the dSYM download. | |
50
+ | symbolsfile | Path to the dSYM or Android mapping file to be processed. *(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. | |
51
+ | symbolsfileAutoZip | *(Android only)* Automatically zip symbolsfile if it exceeds 10MiB and doesn't already end with `*.zip`. | `true` |
52
+ | server | The API endpoint for the Dynatrace environment (e.g. `https://environmentID.live.dynatrace.com` or `https://dynatrace-managed.com/e/environmentID`). | |
53
+ | cleanBuildArtifacts | Clean build artifacts after processing. | `false` |
54
+ | tempdir | (OPTIONAL) Custom temporary directory for the DTXDssClient. **The plugin does not take care of cleaning this directory.** | |
55
+ | debugMode | Enable debug logging. | `false` |
56
+ | customLLDBFrameworkPath | (OPTIONAL) Custom path to the LLDB framework used as runtime dependency by DTXDssClient (e.g. `/Users/test/Documents/LLDB.framework`). | |
57
+ | autoSymlinkLLDB | (OPTIONAL) Automatically find and create a symlink to the LLDB framework into the DTXDssClient's temporary folder. | `true` |
56
58
 
57
59
  ## Example
58
60
  Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
@@ -32,36 +32,54 @@ module Fastlane
32
32
  if params[:os] == "android"
33
33
  symbols_path = Helper::DynatraceHelper.zip_if_required(params)
34
34
  response, request = Helper::DynatraceHelper.put_android_symbols(params, bundleId, symbols_path)
35
- case response.code
36
- when '204'
37
- UI.success "Success. The file has been uploaded and stored."
38
- when '400'
39
- UI.user_error! "Failed. The input is invalid."
40
- when '401'
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/"
42
- when '413'
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."
35
+
36
+ # https://www.dynatrace.com/support/help/dynatrace-api/configuration-api/mobile-symbolication-api/put-files-app-version
37
+ if response.code == '204'
38
+ UI.success "API response: Success."
39
+ else
40
+ message = nil
41
+ if response.class.body_permitted? and not response.body.nil?
42
+ message = JSON.parse(response.body)["error"]["message"]
43
+ end
44
+
45
+ if message.nil?
46
+ UI.user_error! "API response: #{response.code}. Please try again in a few minutes or contact Dynatrace support (https://support.dynatrace.com)."
44
47
  else
45
- message = nil
46
- unless response.body.nil?
47
- message = JSON.parse(response.body)["error"]["message"]
48
- end
49
- if message.nil?
50
- UI.user_error! "Symbol upload error (Response Code: #{response.code}). Please try again in a few minutes or contact the Dynatrace support (https://www.dynatrace.com/services-support/)."
51
- else
52
- UI.user_error! "Symbol upload error (Response Code: #{response.code}). #{message}"
53
- end
48
+ UI.user_error! "API response: #{message} (Response code: #{response.code})"
49
+ end
54
50
  end
55
51
  return
56
- elsif params[:os] != "ios" && params[:os] != "tvos"
52
+ end
53
+
54
+ if params[:os] != "ios" && params[:os] != "tvos"
57
55
  UI.user_error! "Unsopported value os=#{params[:os]}"
58
56
  end
59
57
 
60
58
  # iOS/tvOS workflow
61
- dtxDssClientPath = Helper::DynatraceHelper.get_dss_client(params)
59
+ unless OS.mac?
60
+ UI.user_error! "A macOS machine is required to process iOS or tvOS symbols."
61
+ end
62
62
 
63
- if !OS.mac?
64
- UI.user_error! "A macOS machine is required to process iOS symbols."
63
+ dtxDssClientPath = Helper::DynatraceHelper.get_dss_client(params)
64
+ dtxDssClientDir = File.dirname(dtxDssClientPath)
65
+ Helper::DynatraceSymlinkHelper.delete_existing_lldb_symlinks(dtxDssClientDir)
66
+
67
+ customLLDBFrameworkPath = params[:customLLDBFrameworkPath]
68
+ if customLLDBFrameworkPath.nil?
69
+ UI.message "No custom LLDB framework path provided"
70
+ if params[:autoSymlinkLLDB]
71
+ UI.message "Automatic LLDB symlink creation enabled"
72
+ Helper::DynatraceSymlinkHelper.auto_symlink_lldb(dtxDssClientDir)
73
+ elsif
74
+ UI.message "Automatic LLDB symlink creation disabled"
75
+ end
76
+ else
77
+ if Helper::DynatraceSymlinkHelper.path_exists?(customLLDBFrameworkPath)
78
+ UI.message "Custom LLDB framework path `#{customLLDBFrameworkPath}` exists."
79
+ Helper::DynatraceSymlinkHelper.symlink_custom_lldb(customLLDBFrameworkPath, dtxDssClientDir)
80
+ else
81
+ UI.user_error! "Custom LLDB framework path `#{customLLDBFrameworkPath}` does not exist!"
82
+ end
65
83
  end
66
84
 
67
85
  # start constructing the command that will trigger the DTXDssClient
@@ -177,7 +195,7 @@ module Fastlane
177
195
  description: "Path to the dSYM or Android mapping file to be processed. 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",
178
196
  verify_block: proc do |value|
179
197
  UI.user_error!("Please provide a value for the symbol files. Pass using `symbolsfile: 'symbolsfile'`") unless (value and not value.empty?)
180
- end),
198
+ end),
181
199
 
182
200
  FastlaneCore::ConfigItem.new(key: :symbolsfileAutoZip,
183
201
  env_name: "FL_UPLOAD_TO_DYNATRACE_SYM_FILE_AUTO_ZIP",
@@ -208,6 +226,18 @@ module Fastlane
208
226
  description: "Enable debug logging",
209
227
  default_value: false,
210
228
  is_string: false,
229
+ optional: true),
230
+
231
+ FastlaneCore::ConfigItem.new(key: :customLLDBFrameworkPath,
232
+ env_name: "FL_UPLOAD_TO_DYNATRACE_LLDB_PATH",
233
+ description: "Custom path to the LLDB framework used as runtime dependency by DTXDssClient",
234
+ optional: true),
235
+
236
+ FastlaneCore::ConfigItem.new(key: :autoSymlinkLLDB,
237
+ env_name: "FL_UPLOAD_TO_DYNATRACE_AUTO_LINK_LLDB",
238
+ description: "Automatically find and create a symlink to the LLDB framework into the DTXDssClient's temporary folder",
239
+ type: Boolean,
240
+ default_value: true,
211
241
  optional: true)
212
242
  ]
213
243
  end
@@ -0,0 +1,83 @@
1
+ module Fastlane
2
+ UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
3
+
4
+ module Helper
5
+ class DynatraceSymlinkHelper
6
+ def self.path_exists?(path)
7
+ unless path.nil?
8
+ return Dir.exist?(path) || File.exist?(path)
9
+ end
10
+ return false
11
+ end
12
+
13
+ def self.symlink_custom_lldb(lldb_path, destination_path)
14
+ require_path(destination_path)
15
+ require_path(lldb_path)
16
+ UI.message "Preparing to symlink custom LLDB framework path to: #{destination_path}"
17
+ symlink(lldb_path, destination_path)
18
+ end
19
+
20
+ def self.auto_symlink_lldb(destination_path)
21
+ require_path(destination_path)
22
+ UI.message "Preparing to automatically symlink LLDB framework path to: #{destination_path}"
23
+ current_xcode_path = %x(xcrun xcode-select --print-path).chomp
24
+ active_lldb_path = active_lldb_path(current_xcode_path)
25
+ if active_lldb_path.nil?
26
+ UI.important "Could not find active LLDB framework path!"
27
+ else
28
+ UI.message "LLDB framework found at: #{active_lldb_path}"
29
+ symlink(active_lldb_path, destination_path)
30
+ end
31
+ end
32
+
33
+ def self.delete_existing_lldb_symlinks(destination_path)
34
+ symlink_path = make_symlink_path_name(destination_path)
35
+ if File.symlink?(symlink_path)
36
+ UI.message "Deleting existing LLDB symlink: #{symlink_path}"
37
+ FileUtils.rm(symlink_path)
38
+ else
39
+ UI.message "No existing LLDB symlink at destination: #{symlink_path}"
40
+ end
41
+ end
42
+
43
+ def self.require_path(path)
44
+ if path.nil?
45
+ raise "Path should not be nil."
46
+ end
47
+
48
+ unless path.instance_of?(String)
49
+ raise "Path should be a string."
50
+ end
51
+
52
+ unless path_exists?(path)
53
+ raise "Path: #{path} does not exist."
54
+ end
55
+ end
56
+
57
+ def self.symlink(source, destination)
58
+ destination_absolute = File.expand_path(make_symlink_path_name(destination))
59
+ source_absolute = File.expand_path(source)
60
+ UI.message "Creating a symlink of #{source_absolute} at #{destination_absolute}"
61
+ FileUtils.symlink(source_absolute, destination_absolute)
62
+ end
63
+
64
+ def self.active_lldb_path(xcode_path)
65
+ unless xcode_path.end_with? "/Developer"
66
+ UI.important "Could not find proper Xcode path!"
67
+ UI.important "Output of `xcode-select --print-path` command is `#{xcode_path}`"
68
+ UI.important "Please make sure your developer path ends with `/Developer`"
69
+ return nil
70
+ end
71
+
72
+ parent_dir = File.dirname(xcode_path)
73
+ return File.join(parent_dir, "SharedFrameworks", "LLDB.framework")
74
+ end
75
+
76
+ def self.make_symlink_path_name(destination_path)
77
+ File.join(destination_path, "LLDB.framework")
78
+ end
79
+
80
+ private_class_method :require_path, :symlink, :make_symlink_path_name
81
+ end
82
+ end
83
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module Dynatrace
3
- VERSION = "2.0.1"
3
+ VERSION = "2.1.0"
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: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dynatrace LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-15 00:00:00.000000000 Z
11
+ date: 2024-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -245,6 +245,7 @@ files:
245
245
  - lib/fastlane/plugin/dynatrace.rb
246
246
  - lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb
247
247
  - lib/fastlane/plugin/dynatrace/helper/dynatrace_helper.rb
248
+ - lib/fastlane/plugin/dynatrace/helper/dynatrace_symlink_helper.rb
248
249
  - lib/fastlane/plugin/dynatrace/version.rb
249
250
  homepage: https://github.com/Dynatrace/fastlane-plugin-dynatrace
250
251
  licenses:
@@ -265,7 +266,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
266
  - !ruby/object:Gem::Version
266
267
  version: '0'
267
268
  requirements: []
268
- rubygems_version: 3.3.11
269
+ rubygems_version: 3.4.10
269
270
  signing_key:
270
271
  specification_version: 4
271
272
  summary: This action processes and uploads your symbol files to Dynatrace