Inject Sentry/Mapbox secrets in Jenkins CI

This commit is contained in:
wpetit 2018-12-27 08:53:37 +01:00
parent a196bb62ee
commit 4d0e9e0d95
3 changed files with 24 additions and 1 deletions

2
.gitignore vendored
View File

@ -57,3 +57,5 @@ buck-out/
.env*
!.env.dist
/android/sentry-*.properties
!/android/sentry.properties.dist

18
Jenkinsfile vendored
View File

@ -36,9 +36,25 @@ pipeline {
script {
withCredentials([
string(credentialsId: 'ANDROID_RELEASE_KEY_STOREPASS', variable: 'ANDROID_RELEASE_KEY_STOREPASS'),
string(credentialsId: 'ANDROID_RELEASE_KEY_KEYPASS', variable: 'ANDROID_RELEASE_KEY_KEYPASS')
string(credentialsId: 'ANDROID_RELEASE_KEY_KEYPASS', variable: 'ANDROID_RELEASE_KEY_KEYPASS'),
string(credentialsId: 'MAPBOX_ACCESS_TOKEN', variable: 'MAPBOX_ACCESS_TOKEN'),
string(credentialsId: 'SENTRY_DSN', variable: 'SENTRY_DSN'),
string(credentialsId: 'SENTRY_AUTH_TOKEN', variable: 'SENTRY_AUTH_TOKEN'),
string(credentialsId: 'SENTRY_PROJECT', variable: 'SENTRY_PROJECT'),
string(credentialsId: 'SENTRY_ORG', variable: 'SENTRY_ORG')
]) {
sh '''
# Create .env file
cp .env.dist .env
sed -i "s|^SENTRY_DSN=.*|SENTRY_DSN=${SENTRY_DSN}|" .env
sed -i "s|^MAPBOX_ACCESS_TOKEN=.*|MAPBOX_ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN}|" .env
# Create Sentry release properties
cp android/sentry.properties.dist android/sentry-release.properties
sed -i "s|^defaults.org=.*|defaults.org=${SENTRY_ORG}|" android/sentry-release.properties
sed -i "s|^defaults.project=.*|defaults.project=${SENTRY_PROJECT}|" android/sentry-release.properties
sed -i "s|^auth.token=.*|auth.token=${SENTRY_AUTH_TOKEN}|" android/sentry-release.properties
# Create new keystore
keytool -genkey -noprompt \
-alias fieldnotes \

View File

@ -0,0 +1,5 @@
defaults.url=https://sentry.io/
defaults.org=
defaults.project=
auth.token=
cli.executable=node_modules/@sentry/cli/bin/sentry-cli