Class: Fastlane::Actions::DynatraceProcessSymbolsAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::DynatraceProcessSymbolsAction
- Defined in:
- lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
250 251 252 |
# File 'lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb', line 250 def self. ["MANassar/@MohamedANassar", "cynicer"] end |
.available_options ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb', line 145 def self. [ FastlaneCore::ConfigItem.new(key: :action, env_name: "FL_UPLOAD_TO_DYNATRACE_ACTION", description: "(iOS only) Action to be performed by DTXDssClient (\"upload\" or \"decode\")", default_value: "upload", is_string: true, verify_block: proc do |value| UI.user_error!("Action needs to either be \"upload\" or \"decode\"") unless (value and value == "upload" or value == "decode") end), FastlaneCore::ConfigItem.new(key: :downloadDsyms, env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS", default_value: false, is_string: false, description: "(iOS only) Download the dSYMs from App Store Connect"), FastlaneCore::ConfigItem.new(key: :waitForDsymProcessing, env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_WAIT_PROCESSING", default_value: true, is_string: false, description: "(iOS only) Wait for dSYM processing to be finished"), FastlaneCore::ConfigItem.new(key: :waitForDsymProcessingTimeout, env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_WAIT_TIMEOUT", default_value: 1800, is_string: false, description: "(iOS only) Timeout in seconds to wait for the dSYMs be downloadable"), FastlaneCore::ConfigItem.new(key: :username, env_name: "FL_UPLOAD_TO_DYNATRACE_DOWNLOAD_DSYMS_USERNAME", description: "(iOS only) The username/AppleID to use to download the dSYMs"), FastlaneCore::ConfigItem.new(key: :os, env_name: "FL_UPLOAD_TO_DYNATRACE_OS", description: "The type of the symbol files, either \"ios\" or \"android\"", sensitive: false, optional: false, verify_block: proc do |value| 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")) end), FastlaneCore::ConfigItem.new(key: :apitoken, env_name: "FL_UPLOAD_TO_DYNATRACE_apitoken", description: "Dynatrace API token with mobile symbolication permissions", verify_block: proc do |value| UI.user_error!("No Dynatrade API token for specified, pass using `apitoken: 'token'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :dtxDssClientPath, env_name: "FL_UPLOAD_TO_DYNATRACE_DTXDssClientPath", description: "(DEPRECATED) The path to your DTXDssClient. The DTXDssClient is downloaded and updated automatically, unless this key is set", optional: true), FastlaneCore::ConfigItem.new(key: :appId, env_name: "FL_UPLOAD_TO_DYNATRACE_APP_ID", description: "The app ID you get from your Dynatrace environment", verify_block: proc do |value| UI.user_error!("Please provide the appID for your application. Pass using `appId: 'appId'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :bundleId, env_name: "FL_UPLOAD_TO_DYNATRACE_BUNDLE_ID", description: "The CFBundlebundleId (iOS) / package (Android) of the application", verify_block: proc do |value| UI.user_error!("Please provide the BundleID for your app. Pass using `bundleId: 'bundleId'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :versionStr, env_name: "FL_UPLOAD_TO_DYNATRACE_VERSION_STRING", description: "The CFBundleShortVersionString (iOS) / versionName (Android)", verify_block: proc do |value| UI.user_error!("Please provide the CFBundleShortVersionString for your app. Pass using `versionStr: 'versionStr'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :version, env_name: "FL_UPLOAD_TO_DYNATRACE_VERSION", description: "The CFBundleVersion (iOS) / versionCode (Android). Is also used for the dSYM download", verify_block: proc do |value| UI.user_error!("Please provide the version for your app. Pass using `version: 'version'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :symbolsfile, env_name: "FL_UPLOAD_TO_DYNATRACE_SYM_FILE_PATH", description: "Path to the dSYM file to be processed. Is only used when downloadDsyms is not set", verify_block: proc do |value| UI.user_error!("Please provide a value for the symbol files. Pass using `symbolsfile: 'symbolsfile'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :server, env_name: "FL_UPLOAD_TO_DYNATRACE_SERVER_URL", description: "The API endpoint for the Dynatrace environment (e.g. https://environmentID.live.dynatrace.com or https://dynatrace-managed.com/e/environmentID)", verify_block: proc do |value| UI.user_error!("Please provide your environment API endpoint. Pass using `server: 'server'`") unless (value and not value.empty?) end), FastlaneCore::ConfigItem.new(key: :debugMode, env_name: "FL_UPLOAD_TO_DYNATRACE_DEBUG_MODE", description: "Enable debug logging", default_value: false, is_string: false, optional: true) ] end |
.description ⇒ Object
137 138 139 |
# File 'lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb', line 137 def self.description "This action processes and uploads your symbol files to Dynatrace." end |
.details ⇒ Object
141 142 143 |
# File 'lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb', line 141 def self.details "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." end |
.is_supported?(platform) ⇒ Boolean
254 255 256 |
# File 'lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb', line 254 def self.is_supported?(platform) [:ios, :android].include?(platform) end |
.run(params) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/fastlane/plugin/dynatrace/actions/dynatrace_action.rb', line 12 def self.run(params) UI. "DTXDssClientPath: #{params[:dtxDssClientPath]}" UI. "Parameter API Token: #{params[:apitoken]}" UI. "OS: #{params[:os]}" UI. "Version string: #{params[:versionStr]}" UI. "Version: #{params[:version]}" UI. "Server URL: #{params[:server]}" UI. "Checking AppFile for possible AppID" bundleId = CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier) if bundleId UI. "Using #{bundleId} from your AppFile" else bundleId = params[:bundleId] UI. "BundleID: #{bundleId}" end UI. "Checking AppFile for possible username/AppleID" username = CredentialsManager::AppfileConfig.try_fetch_value(:apple_id) if username UI. "Using #{username} from your AppFile" else username = params[:username] UI. "Didn't find a username in AppFile, using passed username parameter: #{params[:username]}" end dtxDssClientPath = Helper::DynatraceHelper.get_dss_client(params) dsym_paths = [] symbolFilesKey = "symbolsfile" # default to iOS if params[:os] == "ios" if params[:downloadDsyms] == true UI. "Downloading dSYMs from App Store Connect" startTime = Time.now # it takes a couple of minutes until the new build is available through the API # -> retry until available while params[:waitForDsymProcessing] and # wait is active !lane_context[SharedValues::DSYM_PATHS] and # has dsym path (Time.now - startTime) < params[:waitForDsymProcessingTimeout] # is in time Actions::DownloadDsymsAction.run(wait_for_dsym_processing: params[:waitForDsymProcessing], wait_timeout: (params[:waitForDsymProcessingTimeout] - (Time.now - startTime)).round(0), # remaining timeout app_identifier: bundleId, username: username, version: params[:version], build_number: params[:versionStr], platform: :ios) # should be optional (Hint: it's not) if !lane_context[SharedValues::DSYM_PATHS] and (Time.now - startTime) < params[:waitForDsymProcessingTimeout] UI. "Version #{params[:version]} (Build #{params[:versionStr]}) isn't listed yet, retrying in 60 seconds (timeout in #{(params[:waitForDsymProcessingTimeout] - (Time.now - startTime)).round(0)} seconds)." sleep(60) end end if (Time.now - startTime) > params[:waitForDsymProcessingTimeout] UI.user_error!("Timeout during dSYM download. Try increasing :waitForDsymProcessingTimeout.") end dsym_paths += Actions.lane_context[SharedValues::DSYM_PATHS] if Actions.lane_context[SharedValues::DSYM_PATHS] if dsym_paths.count > 0 UI. "Downloaded the dSYMs from App Store Connect. Paths: #{dsym_paths}" else raise 'No dSYM paths found!' end else UI.error "dSYM download disabled, using local path (#{params[:symbolsfile]})" dsym_paths << params[:symbolsfile] if params[:symbolsfile] end else # android dsym_paths << params[:symbolsfile] if params[:symbolsfile] symbolFilesKey = "file" end # check if we have dSYMs to proceed with if dsym_paths.count == 0 UI. "Symbol file path: #{params[:symbolsfile]}" dsym_paths = params[:symbolsfile] symbolFilesCommandSnippet = "#{symbolFilesKey}=\"#{dsym_paths}\"" else symbolFilesCommandSnippet = "#{symbolFilesKey}=\"#{dsym_paths[0]}\"" end # start constructing the command that will trigger the DTXDssClient command = [] command << "#{dtxDssClientPath}" command << "-#{params[:action]}" #"-upload" command << "appid=\"#{params[:appId]}\"" command << "apitoken=\"#{params[:apitoken]}\"" command << "os=#{params[:os]}" command << "bundleId=\"#{bundleId}\"" command << "versionStr=\"#{params[:versionStr]}\"" command << "version=\"#{params[:version]}\"" command << symbolFilesCommandSnippet command << "server=\"#{Helper::DynatraceHelper.get_server_base_url(params)}\"" command << "DTXLogLevel=ALL -verbose" if params[:debugMode] == true command << "forced=1" # if the file already exists # Create the full shell command to trigger the DTXDssClient shell_command = command.join(' ') UI. "dSYM path: #{dsym_paths[0]}" UI. "#{shell_command}" sh("#{shell_command}", error_callback: ->(result) { # ShAction doesn't return any reference to the return value -> parse it from the output result_groups = result.match /(?:ERROR: Execution failed, rc=)(-?\d*)(?:\sreason=)(.*)/ if result_groups and result_groups.length() >= 2 if result_groups[1] == "413" 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.") else UI.user_error!("DTXDssClient: #{result_groups[2]}") end else UI.user_error!("DTXDssClient finished with errors.") end }) UI. "Cleaning build artifacts" Fastlane::Actions::CleanBuildArtifactsAction.run(exclude_pattern: nil) end |