Created
November 10, 2021 13:23
-
-
Save buranmert/835ae8daf2171379ea8a7e0b827dbad7 to your computer and use it in GitHub Desktop.
Upload symbols to Datadog fastlane action
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Fastlane | |
module Actions | |
class UploadSymbolsToDatadogAction < Action | |
def self.run(params) | |
UI.message("Datadog API Key: #{params[:api_key]}") | |
UI.message("dSYM Path: #{params[:dsym_path]}") | |
ENV['DATADOG_API_KEY'] = params[:api_key] | |
cmd = 'npx @datadog/datadog-ci dsyms upload ' | |
cmd += params[:dsym_path] | |
if params[:dry_run] | |
cmd += ' --dry-run' | |
end | |
sh(cmd) | |
end | |
##################################################### | |
# @!group Documentation | |
##################################################### | |
def self.description | |
"Uploads dSYM files to Datadog in order to symbolicate crash reports" | |
end | |
def self.details | |
"If you are sending your crashes to Datadog, they will appear without symbol names. You also need to provide dSYM files to symbolicate your crash reports. This action is a wrapper around datadog-ci npm package, for more info: https://github.com/DataDog/datadog-ci/blob/master/src/commands/dsyms/README.md" | |
end | |
def self.available_options | |
[ | |
FastlaneCore::ConfigItem.new(key: :api_key, | |
env_name: 'FL_DATADOG_API_KEY', | |
default_value: ENV['DATADOG_API_KEY'], | |
description: "Datadog API Key for UploadSymbolsToDatadogAction", | |
verify_block: proc do |value| | |
UI.user_error!("No API key for UploadSymbolsToDatadogAction given, pass using `datadog_api_key: 'api_key'`") unless value && (!value.empty?) | |
end), | |
FastlaneCore::ConfigItem.new(key: :dsym_path, | |
env_name: "FL_DSYM_PATH", | |
description: "Either the folder or the zip file which contains the dSYM files"), | |
FastlaneCore::ConfigItem.new(key: :dry_run, | |
env_name: "FL_DRY_RUN", | |
description: "No upload to Datadog", | |
default_value: false) | |
] | |
end | |
def self.authors | |
["buranmert", "ncreated", "maxep"] | |
end | |
def self.is_supported?(platform) | |
platform == :ios | |
end | |
def self.example_code | |
[ | |
'upload_symbols_to_datadog(api_key: "my-api-key", dsym_path: "~/Downloads/appdSYMs.zip")', | |
'upload_symbols_to_datadog(api_key: "my-api-key", dsym_path: "~/Library/Developer/Xcode/DerivedData/")' | |
] | |
end | |
def self.category | |
:misc | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
UI.message("Datadog API Key: #{params[:api_key]}")
- is there a way to redact this secret in log? I'm not sure if we should print it directly, better to hide it with***
or sth. MaybeUI.password
can be used somehow (ref)?