fastlane-plugin-dynatrace 0.1.3 → 1.0.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d33abfce5cb589461d864dbb9dd94561b35d4c70079456144c2b15a71b23493
|
4
|
+
data.tar.gz: 41e48c8dc20f1258efd8ec0e0fa24768eba1b2ab344c103ec85abc4192c4f151
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335db4d66fedc928e82ed2aa3e1394ef0c6cea0010cd8d601417bbf4b55980e6ba654c9392edfd67aca67d67eceb98d09cc6092212af8ecf79e6039f904f0a0c
|
7
|
+
data.tar.gz: c4f8d63463b4edf3c5c50724784372f403d2d2ea35d7da7f3af4278631d0010a14a904bec8a0ceefcbdd4ddf41e1bf709557ca902a3f1e3cb4fa03070610719a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Dynatrace Fastlane plugin
|
2
2
|
|
3
3
|
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-dynatrace)
|
4
4
|
|
@@ -10,129 +10,112 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
|
|
10
10
|
fastlane add_plugin dynatrace
|
11
11
|
```
|
12
12
|
|
13
|
-
|
13
|
+
### Dynatrace Managed
|
14
|
+
If the installation is on version 1.195 or earlier the Symbolication Client has to be manually download and specified (`dtxDssClientPath`), else it's fetched and updated automatically. A matching version can be downloaded manually with this link [https://api.mobileagent.downloads.dynatrace.com/sprint-latest-dss-client/xyz](https://api.mobileagent.downloads.dynatrace.com/sprint-latest-dss-client/xyz) by replacing `xyz` with the 3-digit sprint version of your Dynatrace Managed installation.
|
14
15
|
|
15
|
-
## About
|
16
|
-
|
17
|
-
This plugin allows you to decode and upload symbolication files to Dynatrace. You can also use it to first download your latest dSym files from AppStore Connect if you use Bitcode.
|
16
|
+
## About the Dynatrace fastlane plugin
|
17
|
+
This plugin allows you to decode and upload symbol files (iOS) or just upload obfuscation mapping files (Android) to Dynatrace. You can also use it to first download your latest dSYM files from App Store Connect if you use Bitcode.
|
18
18
|
|
19
19
|
## Action: `dynatrace_process_symbols`
|
20
20
|
|
21
21
|
| Supported Platforms | ios, android |
|
22
22
|
|---------------------|--------------|
|
23
|
-
| Author | @MANassar |
|
24
|
-
|
25
|
-
|
26
|
-
## Parameters
|
27
|
-
|
28
|
-
| Key | Description | default value |
|
29
|
-
|------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
|
30
|
-
| downloadDsyms | Boolean variable that enables downloading the Dsyms from AppStore Connect (iOS only) | false |
|
31
|
-
| username | The username or the AppleID to use to download the Dsyms. You can also store this in your AppFile as "apple_id and it will be automatically retrieved." | |
|
32
|
-
| dtxDssClientPath | The full path to your DTXDssClient. For example, it could be `./ios/agent/DTXDssClient` | `./DTXDssClient` |
|
33
|
-
| action | The action to perform. upload/decode | `upload` |
|
34
|
-
| appID | The app ID you get from your Dynatrace WebUI | |
|
35
|
-
| os | The OperatingSystem of the symbol files. Either "ios" or "android" | |
|
36
|
-
| apitoken | The Dynatrace API token. It should have the correct permissions. | |
|
37
|
-
| bundleId | The CFBundlebundleId (iOS) / package (Android) of the Application. Usually in reverse com notation. Ex. com.your_company.your_app. This can also be stored in the AppFile as "app_identifier" and it will be automatically retrieved. | |
|
38
|
-
| bundleName | The CFBundleName of the Application (iOS only) | |
|
39
|
-
| versionStr | The CFBundleShortVersionString (iOS) / versionName (Android | |
|
40
|
-
| version | The CFBundleVersion (iOS) / versionCode (Android). This will also be used for dsym download. | |
|
41
|
-
| symbolsfile | The path to a local symbol files to be processed and uploaded. You do not need to specify that if you use downloadDsyms. | |
|
42
|
-
| server | The API endpoint for the Dynatrace environment. For example https://environmentID.live.dynatrace.com or https://dynatrace-managed.com/e/environmentID | |
|
43
|
-
| debugMode | Debug logging enabled | false |
|
44
23
|
|
45
|
-
##
|
24
|
+
## Is your app Bitcode enabled?
|
25
|
+
> Only applies for apps distributed via the AppStore or TestFlight.
|
46
26
|
|
47
|
-
|
27
|
+
If your app is bitcode enabled, then the dSYMs that are generated during the Xcode build are **_not_** the dSYMs you want to upload to Dynatrace. This is because Apple recompiles the application on their servers, generating new dSYM files in the process. These newly generated dSYM files need to be downloaded from *App Store Connect*, then processed and uploaded to Dynatrace.
|
48
28
|
|
49
|
-
|
29
|
+
### Important
|
30
|
+
There is a time gap between the application being uploaded to App Store Connect and the dSYM files to be ready. So **_we have to introduce some "wait" time in the CI to accomodate for this_**. You can do this by setting the `waitForDsymProcessing` to true. Unfortunately, Apple does not specify how long this time is. We recommend 1800 seconds (30 mins) as this is usually enough for the symbols are ready for download. You can increase this timeout if needed (`waitForDsymProcessingTimeout`).
|
50
31
|
|
51
|
-
|
32
|
+
> Notice that this timeout is only the **maximum** waiting time. If the symbol files are ready sooner, it will continue processing and will not wait for the whole duration of the timeout.
|
52
33
|
|
53
|
-
###
|
54
|
-
|
55
|
-
```ruby
|
56
|
-
dynatrace_process_symbols(
|
57
|
-
dtxDssClientPath:"<path>/DTXDssClient",
|
58
|
-
appId: "your DT appID",
|
59
|
-
apitoken: "your DT API token",
|
60
|
-
os: "<ios> or <android>",
|
61
|
-
bundleId: "com.yourcompany.yourApp",
|
62
|
-
bundleName: "MyApp",
|
63
|
-
versionStr: "1.0",
|
64
|
-
version: "1",
|
65
|
-
symbolsfile: "<path to my app>.app.dSYM",
|
66
|
-
server: "https://<environmentID.live.dynatrace.com",
|
67
|
-
debugMode: true)
|
68
|
-
|
69
|
-
```
|
70
|
-
|
71
|
-
### Downloading dsyms and using AppFile
|
34
|
+
### Automatically downloading dSYMs and using AppFile for authentication
|
72
35
|
|
73
36
|
#### AppFile
|
74
|
-
|
75
37
|
```ruby
|
76
|
-
app_identifier("com.yourcompany.yourappID") #
|
77
|
-
apple_id("user@email.com")
|
38
|
+
app_identifier("com.yourcompany.yourappID") # bundle identifier of your app
|
39
|
+
apple_id("user@email.com")
|
78
40
|
```
|
79
41
|
|
80
42
|
#### Fastfile
|
81
|
-
|
82
43
|
```ruby
|
83
44
|
dynatrace_process_symbols(
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
debugMode: true)
|
94
|
-
|
45
|
+
appId: "<Dynatrace application ID>",
|
46
|
+
apitoken: "<Dynatrace API token>",
|
47
|
+
os: "ios",
|
48
|
+
bundleId: "<CFBundlebundleId (iOS) / package (Android)>",
|
49
|
+
versionStr: "<Build Number (CFBundleVersion)>",
|
50
|
+
version: "<App Version (CFBundleShortVersionString)>",
|
51
|
+
server: "<Dynatrace Environment URL>",
|
52
|
+
downloadDsyms: true
|
53
|
+
)
|
95
54
|
```
|
96
55
|
|
97
|
-
### Downloading dsyms, using AppFile - Only decoding them
|
98
56
|
|
99
|
-
|
57
|
+
## If you are NOT using Bitcode, or if you have already downloaded your new symbols from App Store Connect manually.
|
100
58
|
|
59
|
+
### Supply all parameters locally
|
101
60
|
```ruby
|
102
|
-
|
103
|
-
|
61
|
+
dynatrace_process_symbols(
|
62
|
+
appId: "<Dynatrace application ID>",
|
63
|
+
apitoken: "<Dynatrace API Token>",
|
64
|
+
os: "<ios> or <android>",
|
65
|
+
bundleId: "<CFBundlebundleId (iOS) / package (Android)>",
|
66
|
+
versionStr: "<CFBundleShortVersionString (iOS) / versionName (Android)>",
|
67
|
+
version: "<CFBundleVersion (iOS) / versionCode (Android)>",
|
68
|
+
server: "<Dynatrace Environment URL>",
|
69
|
+
symbolsfile: "<Symbols File Path>"
|
70
|
+
)
|
104
71
|
```
|
105
72
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
73
|
+
## List of all Parameters
|
74
|
+
| Key | Description | default value |
|
75
|
+
|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------|
|
76
|
+
| action | *(iOS only)* Action to be performed by DTXDssClient (`upload` or `decode`). | `upload` |
|
77
|
+
| downloadDsyms | *(iOS only)* Download the dSYMs from App Store Connect. | `false` |
|
78
|
+
| waitForDsymProcessing | *(iOS only)* Wait for dSYM processing to be finished. | `true` |
|
79
|
+
| waitForDsymProcessingTimeout | *(iOS only)* Timeout in seconds to wait for the dSYMs be downloadable. | `1800` |
|
80
|
+
| username | *(iOS only)* The username/AppleID to use to download the dSYMs. Alternatively you can specify this in your AppFile as `apple_id`. | |
|
81
|
+
| os | The type of the symbol files, either `ios` or `android`. | |
|
82
|
+
| apitoken | Dynatrace API token with mobile symbolication permissions. | |
|
83
|
+
| dtxDssClientPath | **(DEPRECATED)** The path to your DTXDssClient. The DTXDssClient is downloaded and updated automatically, unless this key is set. | |
|
84
|
+
| appID | The application ID you get from your Dynatrace environment. | |
|
85
|
+
| bundleId | The CFBundlebundleId (iOS) / package (Android) of the application. Alternatively you can specify this in your AppFile as `app_identifier`. | |
|
86
|
+
| versionStr | The CFBundleShortVersionString (iOS) / versionName (Android) | |
|
87
|
+
| version | The CFBundleVersion (iOS) / versionCode (Android). Is also used for the dSYM download. | |
|
88
|
+
| symbolsfile | Path to the dSYM file to be processed. If downloadDsyms is set, this is only a fallback. | |
|
89
|
+
| server | The API endpoint for the Dynatrace environment (e.g. `https://environmentID.live.dynatrace.com` or `https://dynatrace-managed.com/e/environmentID`). | |
|
90
|
+
| debugMode | Enable debug logging. | false |
|
91
|
+
|
92
|
+
## AppStore Connect Two-Factor-Authentication
|
93
|
+
When the plugin is used to download symbols from *AppStore Connect* automatically (`downloadDsyms: true`) valid login credentials to an account with permissions to access 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.
|
94
|
+
|
95
|
+
[Apple announced](https://github.com/fastlane/fastlane/discussions/17655) that 2-Factor-Authentication for the *AppStore Connect* API will be enforced starting February 2021. This limits the ability to automate the symbol processing, 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.
|
96
|
+
|
97
|
+
### Fastlane Session
|
98
|
+
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
|
99
|
+
) under **spaceauth**.
|
100
|
+
|
101
|
+
You can generate a session by running `fastlane spaceauth -u user@email.com` on your machine and copy the output into an environment variable `FASTLANE_SESSION` on the target system (e.g. CI).
|
102
|
+
|
103
|
+
###NOTE
|
104
|
+
- Session is only valid in the "region" you create it. If you CI is in a different geographical location the authentication might fail.
|
105
|
+
|
106
|
+
- Generated sessions are valid up to one month. Apple's API doesn't specify details about that, so it will only be visible by a failing build.
|
121
107
|
|
122
|
-
|
108
|
+
## Example
|
109
|
+
Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
|
123
110
|
|
124
111
|
## Issues and Feedback
|
125
|
-
|
126
|
-
For any other issues and feedback about this plugin, please submit it to this repository or contact Dynatrace Support.
|
112
|
+
For any other issues and feedback about this plugin, please submit it to this repository or contact [Dynatrace Support](https://support.dynatrace.com).
|
127
113
|
|
128
114
|
## Troubleshooting
|
129
|
-
|
130
115
|
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
131
116
|
|
132
117
|
## Using _fastlane_ Plugins
|
133
|
-
|
134
118
|
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
135
119
|
|
136
120
|
## About _fastlane_
|
137
|
-
|
138
121
|
_fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
|
@@ -1,4 +1,8 @@
|
|
1
1
|
require 'fastlane/action'
|
2
|
+
require 'net/http'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'zip'
|
5
|
+
require "fileutils"
|
2
6
|
require_relative '../helper/dynatrace_helper'
|
3
7
|
|
4
8
|
module Fastlane
|
@@ -6,7 +10,6 @@ module Fastlane
|
|
6
10
|
class DynatraceProcessSymbolsAction < Action
|
7
11
|
|
8
12
|
def self.run(params)
|
9
|
-
# fastlane will take care of reading in the parameter and fetching the environment variable:
|
10
13
|
UI.message "DTXDssClientPath: #{params[:dtxDssClientPath]}"
|
11
14
|
UI.message "Parameter API Token: #{params[:apitoken]}"
|
12
15
|
UI.message "OS: #{params[:os]}"
|
@@ -14,226 +17,238 @@ module Fastlane
|
|
14
17
|
UI.message "Version: #{params[:version]}"
|
15
18
|
UI.message "Server URL: #{params[:server]}"
|
16
19
|
|
17
|
-
UI.message
|
20
|
+
UI.message "Checking AppFile for possible AppID"
|
18
21
|
bundleId = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier)
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
22
|
+
if bundleId
|
23
|
+
UI.message "Using #{bundleId} from your AppFile"
|
24
|
+
else
|
25
|
+
bundleId = params[:bundleId]
|
26
|
+
UI.message "BundleID: #{bundleId}"
|
23
27
|
end
|
24
28
|
|
29
|
+
dtxDssClientPath = Helper::DynatraceHelper.get_dss_client(params)
|
25
30
|
|
26
31
|
dsym_paths = []
|
32
|
+
symbolFilesKey = "symbolsfile" # default to iOS
|
33
|
+
|
34
|
+
if params[:os] == "ios"
|
35
|
+
if params[:downloadDsyms] == true
|
36
|
+
UI.message "Downloading dSYMs from App Store Connect"
|
37
|
+
startTime = Time.now
|
27
38
|
|
28
|
-
|
29
|
-
|
30
|
-
if
|
31
|
-
|
39
|
+
UI.message "Checking AppFile for possible username/AppleID"
|
40
|
+
username = CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
41
|
+
if username
|
42
|
+
UI.message "Using #{username} from your AppFile"
|
32
43
|
else
|
33
|
-
|
44
|
+
username = params[:username]
|
45
|
+
UI.message "Didn't find a username in AppFile, using passed username parameter: #{params[:username]}"
|
34
46
|
end
|
35
47
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
# it takes a couple of minutes until the new build is available through the API
|
49
|
+
# -> retry until available
|
50
|
+
while params[:waitForDsymProcessing] and # wait is active
|
51
|
+
!lane_context[SharedValues::DSYM_PATHS] and # has dsym path
|
52
|
+
(Time.now - startTime) < params[:waitForDsymProcessingTimeout] # is in time
|
53
|
+
|
54
|
+
Actions::DownloadDsymsAction.run(wait_for_dsym_processing: params[:waitForDsymProcessing],
|
55
|
+
wait_timeout: (params[:waitForDsymProcessingTimeout] - (Time.now - startTime)).round(0), # remaining timeout
|
56
|
+
app_identifier: bundleId,
|
57
|
+
username: username,
|
58
|
+
version: params[:version],
|
59
|
+
build_number: params[:versionStr],
|
60
|
+
platform: :ios) # should be optional (Hint: it's not)
|
61
|
+
|
62
|
+
if !lane_context[SharedValues::DSYM_PATHS] and (Time.now - startTime) < params[:waitForDsymProcessingTimeout]
|
63
|
+
UI.message "Version #{params[:version]} (Build #{params[:versionStr]}) isn't listed yet, retrying in 60 seconds (timeout in #{(params[:waitForDsymProcessingTimeout] - (Time.now - startTime)).round(0)} seconds)."
|
64
|
+
sleep(60)
|
65
|
+
end
|
66
|
+
end
|
50
67
|
|
51
|
-
|
52
|
-
|
68
|
+
if (Time.now - startTime) > params[:waitForDsymProcessingTimeout]
|
69
|
+
UI.user_error!("Timeout during dSYM download. Try increasing :waitForDsymProcessingTimeout.")
|
70
|
+
end
|
53
71
|
|
54
|
-
|
55
|
-
raise 'No dsyms found error'
|
56
|
-
end
|
57
|
-
end
|
72
|
+
dsym_paths += Actions.lane_context[SharedValues::DSYM_PATHS] if Actions.lane_context[SharedValues::DSYM_PATHS]
|
58
73
|
|
59
|
-
|
60
|
-
|
74
|
+
if dsym_paths.count > 0
|
75
|
+
UI.message "Downloaded the dSYMs from App Store Connect. Paths: #{dsym_paths}"
|
76
|
+
else
|
77
|
+
raise 'No dSYM paths found!'
|
78
|
+
end
|
79
|
+
else
|
80
|
+
UI.error "dSYM download disabled, using local path (#{params[:symbolsfile]})"
|
61
81
|
dsym_paths << params[:symbolsfile] if params[:symbolsfile]
|
62
|
-
end
|
82
|
+
end
|
63
83
|
|
64
|
-
|
65
|
-
|
66
|
-
|
84
|
+
else # android
|
85
|
+
dsym_paths << params[:symbolsfile] if params[:symbolsfile]
|
86
|
+
symbolFilesKey = "file"
|
87
|
+
end
|
67
88
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
89
|
+
# check if we have dSYMs to proceed with
|
90
|
+
if dsym_paths.count == 0
|
91
|
+
UI.message "Symbol file path: #{params[:symbolsfile]}"
|
92
|
+
dsym_paths = params[:symbolsfile]
|
93
|
+
symbolFilesCommandSnippet = "#{symbolFilesKey}=\"#{dsym_paths}\""
|
94
|
+
else
|
95
|
+
symbolFilesCommandSnippet = "#{symbolFilesKey}=\"#{dsym_paths[0]}\""
|
96
|
+
end
|
76
97
|
|
77
|
-
#
|
98
|
+
# start constructing the command that will trigger the DTXDssClient
|
78
99
|
command = []
|
79
|
-
command << "#{
|
100
|
+
command << "#{dtxDssClientPath}"
|
80
101
|
command << "-#{params[:action]}" #"-upload"
|
81
102
|
command << "appid=\"#{params[:appId]}\""
|
82
103
|
command << "apitoken=\"#{params[:apitoken]}\""
|
83
104
|
command << "os=#{params[:os]}"
|
84
105
|
command << "bundleId=\"#{bundleId}\""
|
85
|
-
command << "versionStr=\"#{
|
106
|
+
command << "versionStr=\"#{params[:versionStr]}\""
|
86
107
|
command << "version=\"#{params[:version]}\""
|
87
108
|
command << symbolFilesCommandSnippet
|
88
|
-
command << "server=\"#{params
|
109
|
+
command << "server=\"#{Helper::DynatraceHelper.get_server_base_url(params)}\""
|
89
110
|
command << "DTXLogLevel=ALL -verbose" if params[:debugMode] == true
|
90
|
-
command << "forced=1" #
|
111
|
+
command << "forced=1" # if the file already exists
|
91
112
|
|
92
113
|
# Create the full shell command to trigger the DTXDssClient
|
93
114
|
shell_command = command.join(' ')
|
94
115
|
|
116
|
+
UI.message "dSYM path: #{dsym_paths[0]}"
|
117
|
+
UI.message "#{shell_command}"
|
95
118
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
119
|
+
sh("#{shell_command}", error_callback: ->(result) {
|
120
|
+
# ShAction doesn't return any reference to the return value -> parse it from the output
|
121
|
+
result_groups = result.match /(?:ERROR: Execution failed, rc=)(-?\d*)(?:\sreason=)(.*)/
|
122
|
+
if result_groups and result_groups.length() >= 2
|
123
|
+
if result_groups[1] == "413"
|
124
|
+
UI.user_error!("DTXDssClient: #{result_groups[2]} See https://www.dynatrace.com/support/help/shortlink/mobile-symbolication#manage-the-uploaded-symbol-files for more information.")
|
125
|
+
else
|
126
|
+
UI.user_error!("DTXDssClient: #{result_groups[2]}")
|
127
|
+
end
|
128
|
+
else
|
129
|
+
UI.user_error!("DTXDssClient finished with errors.")
|
130
|
+
end
|
131
|
+
})
|
101
132
|
|
102
|
-
UI.message
|
133
|
+
UI.message "Cleaning build artifacts"
|
103
134
|
Fastlane::Actions::CleanBuildArtifactsAction.run(exclude_pattern: nil)
|
104
|
-
|
105
|
-
end #end the run functions
|
135
|
+
end
|
106
136
|
|
107
137
|
def self.description
|
108
|
-
"This action processes and uploads your symbol files to Dynatrace"
|
138
|
+
"This action processes and uploads your symbol files to Dynatrace."
|
109
139
|
end
|
110
140
|
|
111
141
|
def self.details
|
112
|
-
"This action allows you to process and upload symbol files to Dynatrace.
|
142
|
+
"This action allows you to process and upload symbol files to Dynatrace. If you use Bitcode you can also use it to download the latest dSYM files from App Store Connect."
|
113
143
|
end
|
114
144
|
|
115
145
|
def self.available_options
|
116
|
-
# Define all options your action supports.
|
117
146
|
[
|
118
147
|
FastlaneCore::ConfigItem.new(key: :action,
|
119
148
|
env_name: "FL_UPLOAD_TO_DYNATRACE_ACTION",
|
120
|
-
description: "
|
149
|
+
description: "(iOS only) Action to be performed by DTXDssClient (\"upload\" or \"decode\")",
|
121
150
|
default_value: "upload",
|
122
151
|
is_string: true,
|
123
152
|
verify_block: proc do |value|
|
124
|
-
UI.user_error!("Action needs to either be upload or decode") unless (value and value == "upload" or value == "decode")
|
125
|
-
# UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
|
153
|
+
UI.user_error!("Action needs to either be \"upload\" or \"decode\"") unless (value and value == "upload" or value == "decode")
|
126
154
|
end),
|
127
155
|
|
128
156
|
FastlaneCore::ConfigItem.new(key: :downloadDsyms,
|
129
|
-
env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS",
|
157
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS",
|
130
158
|
default_value: false,
|
131
159
|
is_string: false,
|
132
|
-
description: "
|
133
|
-
|
160
|
+
description: "(iOS only) Download the dSYMs from App Store Connect"),
|
161
|
+
|
162
|
+
FastlaneCore::ConfigItem.new(key: :waitForDsymProcessing,
|
163
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_WAIT_PROCESSING",
|
164
|
+
default_value: true,
|
165
|
+
is_string: false,
|
166
|
+
description: "(iOS only) Wait for dSYM processing to be finished"),
|
167
|
+
|
168
|
+
FastlaneCore::ConfigItem.new(key: :waitForDsymProcessingTimeout,
|
169
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_WAIT_TIMEOUT",
|
170
|
+
default_value: 1800,
|
171
|
+
is_string: false,
|
172
|
+
description: "(iOS only) Timeout in seconds to wait for the dSYMs be downloadable"),
|
134
173
|
|
135
174
|
FastlaneCore::ConfigItem.new(key: :username,
|
136
|
-
env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_USERNAME",
|
137
|
-
description: "The username
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
end),
|
175
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_USERNAME",
|
176
|
+
description: "(iOS only) The username/AppleID to use to download the dSYMs"),
|
177
|
+
|
178
|
+
FastlaneCore::ConfigItem.new(key: :os,
|
179
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_OS",
|
180
|
+
description: "The type of the symbol files, either \"ios\" or \"android\"",
|
181
|
+
sensitive: false,
|
182
|
+
optional: false,
|
183
|
+
verify_block: proc do |value|
|
184
|
+
UI.user_error!("Please specify the type of the symbol files. Possible values are \"ios\" or \"android\".") unless (value and not value.empty? and (value == "ios" || value =="android"))
|
185
|
+
end),
|
148
186
|
|
149
187
|
FastlaneCore::ConfigItem.new(key: :apitoken,
|
150
|
-
env_name: "FL_UPLOAD_TO_DYNATRACE_apitoken",
|
151
|
-
description: "
|
188
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_apitoken",
|
189
|
+
description: "Dynatrace API token with mobile symbolication permissions",
|
152
190
|
verify_block: proc do |value|
|
153
|
-
UI.user_error!("No API token for
|
154
|
-
# UI.user_error!("Couldn't find file at path '#{value}'") unless File.exist?(value)
|
191
|
+
UI.user_error!("No Dynatrade API token for specified, pass using `apitoken: 'token'`") unless (value and not value.empty?)
|
155
192
|
end),
|
156
193
|
|
157
194
|
FastlaneCore::ConfigItem.new(key: :dtxDssClientPath,
|
158
195
|
env_name: "FL_UPLOAD_TO_DYNATRACE_DTXDssClientPath",
|
159
|
-
description: "The path to your DTXDssClient",
|
160
|
-
|
196
|
+
description: "(DEPRECATED) The path to your DTXDssClient. The DTXDssClient is downloaded and updated automatically, unless this key is set",
|
197
|
+
optional: true),
|
198
|
+
|
199
|
+
FastlaneCore::ConfigItem.new(key: :appId,
|
200
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_APP_ID",
|
201
|
+
description: "The app ID you get from your Dynatrace environment",
|
161
202
|
verify_block: proc do |value|
|
162
|
-
UI.user_error!("
|
163
|
-
|
164
|
-
# default_value: false) # the default value if the user didn't provide one
|
165
|
-
end),
|
166
|
-
|
167
|
-
FastlaneCore::ConfigItem.new(key: :appId,
|
168
|
-
env_name: "FL_UPLOAD_TO_DYNATRACE_APP_ID",
|
169
|
-
description: "The app ID you get from your Dynatrace WebUI",
|
170
|
-
verify_block: proc do |value|
|
171
|
-
UI.user_error!("Please provide the appID for your app. Pass using `appId: 'appId'`") unless (value and not value.empty?)
|
172
|
-
# is_string: true # true: verifies the input is a string, false: every kind of value
|
173
|
-
# default_value: false) # the default value if the user didn't provide one
|
174
|
-
end),
|
203
|
+
UI.user_error!("Please provide the appID for your application. Pass using `appId: 'appId'`") unless (value and not value.empty?)
|
204
|
+
end),
|
175
205
|
|
176
206
|
FastlaneCore::ConfigItem.new(key: :bundleId,
|
177
207
|
env_name: "FL_UPLOAD_TO_DYNATRACE_BUNDLE_ID",
|
178
|
-
description: "The CFBundlebundleId (iOS) / package (Android) of the
|
208
|
+
description: "The CFBundlebundleId (iOS) / package (Android) of the application",
|
179
209
|
verify_block: proc do |value|
|
180
210
|
UI.user_error!("Please provide the BundleID for your app. Pass using `bundleId: 'bundleId'`") unless (value and not value.empty?)
|
181
|
-
|
182
|
-
# default_value: false) # the default value if the user didn't provide one
|
183
|
-
end),
|
211
|
+
end),
|
184
212
|
|
185
213
|
FastlaneCore::ConfigItem.new(key: :versionStr,
|
186
214
|
env_name: "FL_UPLOAD_TO_DYNATRACE_VERSION_STRING",
|
187
215
|
description: "The CFBundleShortVersionString (iOS) / versionName (Android)",
|
188
216
|
verify_block: proc do |value|
|
189
217
|
UI.user_error!("Please provide the CFBundleShortVersionString for your app. Pass using `versionStr: 'versionStr'`") unless (value and not value.empty?)
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
UI.user_error!("Please provide the version for your app. Pass using `version: 'version'`") unless (value and not value.empty?)
|
199
|
-
# is_string: true # true: verifies the input is a string, false: every kind of value
|
200
|
-
# default_value: false) # the default value if the user didn't provide one
|
201
|
-
end),
|
218
|
+
end),
|
219
|
+
|
220
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
221
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_VERSION",
|
222
|
+
description: "The CFBundleVersion (iOS) / versionCode (Android). Is also used for the dSYM download",
|
223
|
+
verify_block: proc do |value|
|
224
|
+
UI.user_error!("Please provide the version for your app. Pass using `version: 'version'`") unless (value and not value.empty?)
|
225
|
+
end),
|
202
226
|
|
203
227
|
FastlaneCore::ConfigItem.new(key: :symbolsfile,
|
204
228
|
env_name: "FL_UPLOAD_TO_DYNATRACE_SYM_FILE_PATH",
|
205
|
-
description: "
|
229
|
+
description: "Path to the dSYM file to be processed. Is only used when downloadDsyms is not set",
|
206
230
|
verify_block: proc do |value|
|
207
|
-
UI.user_error!("Please provide a value for the
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
UI.user_error!("Please provide your environment API endpoint. Pass using `server: 'server'`") unless (value and not value.empty?)
|
217
|
-
# is_string: true # true: verifies the input is a string, false: every kind of value
|
218
|
-
# default_value: false) # the default value if the user didn't provide one
|
219
|
-
end),
|
231
|
+
UI.user_error!("Please provide a value for the symbol files. Pass using `symbolsfile: 'symbolsfile'`") unless (value and not value.empty?)
|
232
|
+
end),
|
233
|
+
|
234
|
+
FastlaneCore::ConfigItem.new(key: :server,
|
235
|
+
env_name: "FL_UPLOAD_TO_DYNATRACE_SERVER_URL",
|
236
|
+
description: "The API endpoint for the Dynatrace environment (e.g. https://environmentID.live.dynatrace.com or https://dynatrace-managed.com/e/environmentID)",
|
237
|
+
verify_block: proc do |value|
|
238
|
+
UI.user_error!("Please provide your environment API endpoint. Pass using `server: 'server'`") unless (value and not value.empty?)
|
239
|
+
end),
|
220
240
|
|
221
241
|
FastlaneCore::ConfigItem.new(key: :debugMode,
|
222
242
|
env_name: "FL_UPLOAD_TO_DYNATRACE_DEBUG_MODE",
|
223
|
-
description: "
|
243
|
+
description: "Enable debug logging",
|
244
|
+
default_value: false,
|
224
245
|
is_string: false,
|
225
|
-
optional: true
|
226
|
-
)
|
246
|
+
optional: true)
|
227
247
|
]
|
228
248
|
end
|
229
249
|
|
230
|
-
def self.return_value
|
231
|
-
# If your method provides a return value, you can describe here what it does
|
232
|
-
end
|
233
|
-
|
234
250
|
def self.authors
|
235
|
-
|
236
|
-
["MANassar/@MohamedANassar"]
|
251
|
+
["MANassar/@MohamedANassar", "cynicer"]
|
237
252
|
end
|
238
253
|
|
239
254
|
def self.is_supported?(platform)
|
@@ -5,11 +5,70 @@ module Fastlane
|
|
5
5
|
|
6
6
|
module Helper
|
7
7
|
class DynatraceHelper
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
8
|
+
def self.get_dss_client(params)
|
9
|
+
dynatraceDir = "dynatrace"
|
10
|
+
versionFile = "version"
|
11
|
+
dtxDssClientBin = "DTXDssClient"
|
12
|
+
dtxDssClientPath = "#{dynatraceDir}/#{dtxDssClientBin}"
|
13
|
+
|
14
|
+
if (params.all_keys.include? :dtxDssClientPath and not params[:dtxDssClientPath].nil?)
|
15
|
+
UI.message "DEPRECATION WARNING: DTXDssClientPath doesn't need to be specified anymore, the DTXDssClient is downloaded and updated automatically."
|
16
|
+
dtxDssClientPath = params[:dtxDssClientPath]
|
17
|
+
else
|
18
|
+
# get latest version info
|
19
|
+
clientUri = URI("#{self.get_server_base_url(params)}/api/config/v1/symfiles/dtxdss-download?Api-Token=#{params[:apitoken]}")
|
20
|
+
response = Net::HTTP.get_response(clientUri)
|
21
|
+
|
22
|
+
if not response.kind_of? Net::HTTPSuccess
|
23
|
+
base_error = "Couldn't update DTXDssClient (invalid response: #{response.message} (#{response.code})) for URL: #{clientUri})"
|
24
|
+
if File.exists?("#{dynatraceDir}/#{dtxDssClientBin}")
|
25
|
+
UI.important base_error
|
26
|
+
UI.important "Using cached DTXDssClient: #{dynatraceDir}/#{dtxDssClientBin}"
|
27
|
+
return dtxDssClientPath
|
28
|
+
else
|
29
|
+
UI.user_error! base_error
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
remoteClientUrl = JSON.parse(response.body)["dssClientUrl"]
|
34
|
+
UI.message "Remote DSS client: #{remoteClientUrl}"
|
35
|
+
|
36
|
+
# check local state
|
37
|
+
if (!File.directory?(dynatraceDir))
|
38
|
+
Dir.mkdir(dynatraceDir)
|
39
|
+
end
|
40
|
+
|
41
|
+
if (!File.exists?("#{dynatraceDir}/#{versionFile}") or
|
42
|
+
!File.exists?("#{dynatraceDir}/#{dtxDssClientBin}") or
|
43
|
+
File.read("#{dynatraceDir}/#{versionFile}") != remoteClientUrl)
|
44
|
+
# update local state
|
45
|
+
UI.message "Found a different remote DTXDssClient client. Updating local version."
|
46
|
+
File.delete("#{dynatraceDir}/#{versionFile}") if File.exist?("#{dynatraceDir}/#{versionFile}")
|
47
|
+
File.delete("#{dynatraceDir}/#{dtxDssClientBin}") if File.exist?("#{dynatraceDir}/#{dtxDssClientBin}")
|
48
|
+
|
49
|
+
File.write("#{dynatraceDir}/#{versionFile}", remoteClientUrl)
|
50
|
+
|
51
|
+
# get client from served archive
|
52
|
+
open(remoteClientUrl) do |zipped|
|
53
|
+
Zip::InputStream.open(zipped) do |unzipped|
|
54
|
+
entry = unzipped.get_next_entry
|
55
|
+
if (entry.name == dtxDssClientBin)
|
56
|
+
IO.copy_stream(entry.get_input_stream, "#{dynatraceDir}/#{dtxDssClientBin}")
|
57
|
+
FileUtils.chmod("+x", "#{dynatraceDir}/#{dtxDssClientBin}")
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
return dtxDssClientPath
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.get_server_base_url(params)
|
67
|
+
if params[:server][-1] == '/'
|
68
|
+
return params[:server][0..-2]
|
69
|
+
else
|
70
|
+
return params[:server]
|
71
|
+
end
|
13
72
|
end
|
14
73
|
end
|
15
74
|
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: 0.1
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Dynatrace LLC
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -128,16 +128,16 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
131
|
+
version: 2.142.0
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 2.
|
139
|
-
description:
|
140
|
-
email:
|
138
|
+
version: 2.142.0
|
139
|
+
description:
|
140
|
+
email: mobile.agent@dynatrace.com
|
141
141
|
executables: []
|
142
142
|
extensions: []
|
143
143
|
extra_rdoc_files: []
|
@@ -152,7 +152,7 @@ homepage: https://github.com/Dynatrace/fastlane-plugin-dynatrace
|
|
152
152
|
licenses:
|
153
153
|
- MIT
|
154
154
|
metadata: {}
|
155
|
-
post_install_message:
|
155
|
+
post_install_message:
|
156
156
|
rdoc_options: []
|
157
157
|
require_paths:
|
158
158
|
- lib
|
@@ -167,8 +167,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
|
-
rubygems_version: 3.
|
171
|
-
signing_key:
|
170
|
+
rubygems_version: 3.2.3
|
171
|
+
signing_key:
|
172
172
|
specification_version: 4
|
173
173
|
summary: This action processes and uploads your symbol files to Dynatrace
|
174
174
|
test_files: []
|