Added support for self-hosted Sentry (#7230)
This commit is contained in:
parent
a8ee3a1b5a
commit
d3a9b35d42
5 changed files with 32 additions and 44 deletions
|
|
@ -187,6 +187,32 @@ lane :configure do
|
||||||
configured = true
|
configured = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Set Sentry upload properties'
|
||||||
|
lane :link_sentry do |options|
|
||||||
|
if ENV['SENTRY_ENABLED'] == 'true'
|
||||||
|
os_type = options[:os_type].downcase
|
||||||
|
if os_type == 'ios'
|
||||||
|
project_dir = 'ios/'
|
||||||
|
sentry_project = ENV['SENTRY_PROJECT_IOS']
|
||||||
|
elsif os_type == 'android'
|
||||||
|
project_dir = 'android/'
|
||||||
|
sentry_project = ENV['SENTRY_PROJECT_ANDROID']
|
||||||
|
end
|
||||||
|
url = ENV['SENTRY_URL'] || 'https://sentry.io'
|
||||||
|
File.open("../#{project_dir}sentry.properties", 'w+') do |f|
|
||||||
|
UI.message('Creating sentry.properties from environment')
|
||||||
|
f.write(
|
||||||
|
"defaults.url=#{url}\n"\
|
||||||
|
"defaults.org=#{ENV['SENTRY_ORG']}\n"\
|
||||||
|
"defaults.project=#{sentry_project}\n"\
|
||||||
|
"auth.token=#{ENV['SENTRY_AUTH_TOKEN']}\n"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
UI.message('Not creating sentry.properties because Sentry is disabled')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
desc 'Upload file to s3'
|
desc 'Upload file to s3'
|
||||||
lane :upload_file_to_s3 do |options|
|
lane :upload_file_to_s3 do |options|
|
||||||
os_type = options[:os_type].downcase
|
os_type = options[:os_type].downcase
|
||||||
|
|
@ -347,6 +373,7 @@ platform :ios do
|
||||||
end
|
end
|
||||||
update_identifiers
|
update_identifiers
|
||||||
replace_assets
|
replace_assets
|
||||||
|
link_sentry({:os_type => "ios"})
|
||||||
build_ios
|
build_ios
|
||||||
upload_file_to_s3({:os_type => "ios"})
|
upload_file_to_s3({:os_type => "ios"})
|
||||||
end
|
end
|
||||||
|
|
@ -586,7 +613,7 @@ platform :ios do
|
||||||
config_mode = ENV['BUILD_FOR_RELEASE'] == 'true' ? 'Release' : 'Debug'
|
config_mode = ENV['BUILD_FOR_RELEASE'] == 'true' ? 'Release' : 'Debug'
|
||||||
method = ENV['IOS_BUILD_EXPORT_METHOD'].nil? || ENV['IOS_BUILD_EXPORT_METHOD'].empty? ? 'ad-hoc' : ENV['IOS_BUILD_EXPORT_METHOD']
|
method = ENV['IOS_BUILD_EXPORT_METHOD'].nil? || ENV['IOS_BUILD_EXPORT_METHOD'].empty? ? 'ad-hoc' : ENV['IOS_BUILD_EXPORT_METHOD']
|
||||||
|
|
||||||
# Need to add xcargs to only notification and
|
# Need to add xcargs to only notification and share extensions
|
||||||
xcargs = ENV['SENTRY_ENABLED'] == 'true' ? "SENTRY_DSN_IOS='#{ENV['SENTRY_DSN_IOS']}' SENTRY_ENABLED='#{ENV['SENTRY_ENABLED']}'" : ''
|
xcargs = ENV['SENTRY_ENABLED'] == 'true' ? "SENTRY_DSN_IOS='#{ENV['SENTRY_DSN_IOS']}' SENTRY_ENABLED='#{ENV['SENTRY_ENABLED']}'" : ''
|
||||||
|
|
||||||
setup_code_signing
|
setup_code_signing
|
||||||
|
|
@ -604,7 +631,7 @@ platform :ios do
|
||||||
signingStyle: 'manual',
|
signingStyle: 'manual',
|
||||||
iCloudContainerEnvironment: 'Production'
|
iCloudContainerEnvironment: 'Production'
|
||||||
},
|
},
|
||||||
xcargs:xcargs
|
xcargs: xcargs
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -636,7 +663,7 @@ platform :android do
|
||||||
end
|
end
|
||||||
update_identifiers
|
update_identifiers
|
||||||
replace_assets
|
replace_assets
|
||||||
link_sentry_android
|
link_sentry({:os_type => "android"})
|
||||||
build_android
|
build_android
|
||||||
move_android_to_root
|
move_android_to_root
|
||||||
upload_file_to_s3({:os_type => "android"})
|
upload_file_to_s3({:os_type => "android"})
|
||||||
|
|
@ -849,23 +876,6 @@ platform :android do
|
||||||
UI.message("AAB PATH \"#{new_aab_path}\"")
|
UI.message("AAB PATH \"#{new_aab_path}\"")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def link_sentry_android
|
|
||||||
if ENV['SENTRY_ENABLED'] == 'true'
|
|
||||||
url = 'https://sentry.io'
|
|
||||||
File.open('../android/sentry.properties', 'w+') do |f|
|
|
||||||
UI.message('Creating sentry.properties from environment')
|
|
||||||
f.write(
|
|
||||||
"defaults.url=#{url}\n"\
|
|
||||||
"defaults.org=#{ENV['SENTRY_ORG']}\n"\
|
|
||||||
"defaults.project=#{ENV['SENTRY_PROJECT_ANDROID']}\n"\
|
|
||||||
"auth.token=#{ENV['SENTRY_AUTH_TOKEN']}\n"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
UI.message('Not creating sentry.properties because Sentry is disabled')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def load_config_json(json_path)
|
def load_config_json(json_path)
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ export SUBMIT_ANDROID_TO_GOOGLE_PLAY=false
|
||||||
|
|
||||||
############ OPTIONAL ############
|
############ OPTIONAL ############
|
||||||
#export SENTRY_ENABLED=<set to true if you want to use sentry http://sentry.io/ to track crash and error reports>
|
#export SENTRY_ENABLED=<set to true if you want to use sentry http://sentry.io/ to track crash and error reports>
|
||||||
|
#export SENTRY_URL=<set your sentry host URL, if you use self-hosted sentry>
|
||||||
#export SENTRY_ORG=<your sentry org>
|
#export SENTRY_ORG=<your sentry org>
|
||||||
#export SENTRY_PROJECT_IOS=<your sentry ios project>
|
#export SENTRY_PROJECT_IOS=<your sentry ios project>
|
||||||
#export SENTRY_DSN_IOS=<your sentry DSN for the ios project>
|
#export SENTRY_DSN_IOS=<your sentry DSN for the ios project>
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@ export ENTRY_FILE="index.ts"
|
||||||
if [[ "${SENTRY_ENABLED}" = "true" ]]; then
|
if [[ "${SENTRY_ENABLED}" = "true" ]]; then
|
||||||
echo "Sentry native integration is enabled"
|
echo "Sentry native integration is enabled"
|
||||||
|
|
||||||
./makeSentryProperties.sh
|
|
||||||
|
|
||||||
export SENTRY_PROPERTIES=sentry.properties
|
export SENTRY_PROPERTIES=sentry.properties
|
||||||
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode \
|
../node_modules/@sentry/cli/bin/sentry-cli react-native xcode \
|
||||||
../node_modules/react-native/scripts/react-native-xcode.sh
|
../node_modules/react-native/scripts/react-native-xcode.sh
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
sentry_properties="defaults.url=https://sentry.io
|
|
||||||
defaults.org=${SENTRY_ORG}
|
|
||||||
defaults.project=${SENTRY_PROJECT_IOS}
|
|
||||||
auth.token=${SENTRY_AUTH_TOKEN}
|
|
||||||
cli.executable=../node_modules/@sentry/cli/bin/sentry-cli"
|
|
||||||
|
|
||||||
if [[ "${SENTRY_ENABLED}" = "true" ]]; then
|
|
||||||
if [[ ! -f "sentry.properties" ]]; then
|
|
||||||
echo "Creating sentry.properties from environment"
|
|
||||||
|
|
||||||
echo "${sentry_properties}" > sentry.properties
|
|
||||||
else
|
|
||||||
echo "sentry.properties already exists"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Not creating sentry.properties because Sentry is disabled"
|
|
||||||
fi
|
|
||||||
|
|
@ -3,10 +3,8 @@
|
||||||
if [[ "${SENTRY_ENABLED}" = "true" ]]; then
|
if [[ "${SENTRY_ENABLED}" = "true" ]]; then
|
||||||
echo "Uploading debugging symbols to Sentry"
|
echo "Uploading debugging symbols to Sentry"
|
||||||
|
|
||||||
./makeSentryProperties.sh
|
|
||||||
|
|
||||||
export SENTRY_PROPERTIES=sentry.properties
|
export SENTRY_PROPERTIES=sentry.properties
|
||||||
../node_modules/@sentry/cli/bin/sentry-cli upload-dif "$DWARF_DSYM_FOLDER_PATH"
|
../node_modules/@sentry/cli/bin/sentry-cli upload-dif "$DWARF_DSYM_FOLDER_PATH"
|
||||||
|
|
||||||
else
|
else
|
||||||
echo "Not uploading debugging symbols to Sentry because Sentry is disabled"
|
echo "Not uploading debugging symbols to Sentry because Sentry is disabled"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue