Less magic for fastlane parameters.

1. Don't require all the nodes to be provisioned manually to upload to Google play.

2. Don't require all the nodes to be provisioned manually to send to Slack channel.

Pass it as a credential from Jenkins instead.

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Igor Mandrigin 2018-08-14 11:31:11 +02:00
parent 06bb8c6348
commit 329c360a40
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
4 changed files with 62 additions and 29 deletions

View File

@ -93,20 +93,28 @@ timeout(90) {
def buildInfo = server.upload(uploadSpec) def buildInfo = server.upload(uploadSpec)
apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename
sh ('bundle exec fastlane android nightly')
sh ('echo ARTIFACT Android: ' + apkUrl) sh ('echo ARTIFACT Android: ' + apkUrl)
withCredentials([
string(
credentialsId: "SUPPLY_JSON_KEY_DATA",
variable: 'GOOGLE_PLAY_JSON_KEY'
),
string(
credentialsId: "SLACK_URL",
variable: 'SLACK_URL'
)
]) {
sh ('bundle exec fastlane android nightly')
}
} }
stage('Build & TestFlight (iOS)') { stage('Build & TestFlight (iOS)') {
withCredentials([ withCredentials([
string( string(credentialsId: "slave-pass-${env.NODE_NAME}", variable: 'KEYCHAIN_PASSWORD'),
credentialsId: "slave-pass-${env.NODE_NAME}", string(credentialsId: "SLACK_URL", variable: 'SLACK_URL'),
variable: 'KEYCHAIN_PASSWORD' string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'),
), string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID'),
string( string(credentialsId: 'fastlane-match-password', variable:'MATCH_PASSWORD')]) {
credentialsId: 'fastlane-match-password',
variable:'MATCH_PASSWORD'
)]) {
sh "plutil -replace CFBundleShortVersionString -string ${version} ios/StatusIm/Info.plist" sh "plutil -replace CFBundleShortVersionString -string ${version} ios/StatusIm/Info.plist"
sh "plutil -replace CFBundleVersion -string ${build_no} ios/StatusIm/Info.plist" sh "plutil -replace CFBundleVersion -string ${build_no} ios/StatusIm/Info.plist"

View File

@ -80,8 +80,19 @@ timeout(90) {
} }
stage('Deploy (Android)') { stage('Deploy (Android)') {
withCredentials([
string(
credentialsId: "SUPPLY_JSON_KEY_DATA",
variable: 'GOOGLE_PLAY_JSON_KEY'
),
string(
credentialsId: "SLACK_URL",
variable: 'SLACK_URL'
)
]) {
sh ('bundle exec fastlane android release') sh ('bundle exec fastlane android release')
} }
}
} catch (e) { } catch (e) {
slackSend color: 'bad', message: 'Release build failed uploading to the Play Market. ' + env.BUILD_URL slackSend color: 'bad', message: 'Release build failed uploading to the Play Market. ' + env.BUILD_URL
throw e throw e

View File

@ -76,16 +76,11 @@ timeout(90) {
stage('Build & TestFlight (iOS)') { stage('Build & TestFlight (iOS)') {
withCredentials([ withCredentials([
string( string(credentialsId: "slave-pass-${env.NODE_NAME}", variable: 'KEYCHAIN_PASSWORD'),
credentialsId: "slave-pass-${env.NODE_NAME}", string(credentialsId: "SLACK_URL", variable: 'SLACK_URL'),
variable: 'KEYCHAIN_PASSWORD' string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'),
), string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID'),
string( string(credentialsId: 'fastlane-match-password', variable:'MATCH_PASSWORD')]) {
credentialsId: 'fastlane-match-password',
variable:'MATCH_PASSWORD'
)]) {
sh "plutil -replace CFBundleShortVersionString -string ${version} ios/StatusIm/Info.plist" sh "plutil -replace CFBundleShortVersionString -string ${version} ios/StatusIm/Info.plist"
sh "plutil -replace CFBundleVersion -string ${build_no} ios/StatusIm/Info.plist" sh "plutil -replace CFBundleVersion -string ${build_no} ios/StatusIm/Info.plist"
sh 'fastlane ios release' sh 'fastlane ios release'

View File

@ -16,7 +16,7 @@ def unlock_keychain_if_needed
if ENV["KEYCHAIN_PASSWORD"] if ENV["KEYCHAIN_PASSWORD"]
unlock_keychain( unlock_keychain(
path:"login.keychain", path:"login.keychain",
password:ENV["password"], password:ENV["KEYCHAIN_PASSWORD"],
set_default: true) set_default: true)
end end
end end
@ -75,7 +75,11 @@ platform :ios do
upload_to_testflight( upload_to_testflight(
ipa: "status_appstore/StatusIm.ipa" ipa: "status_appstore/StatusIm.ipa"
) )
slack(message: "New nightly build uploaded to TestFlight")
slack(
message: "New nightly build uploaded to TestFlight",
slack_url: ENV["SLACK_URL"]
)
# additional .ipa is for diawi # additional .ipa is for diawi
# we have to re-build it because it uses different config # we have to re-build it because it uses different config
@ -106,7 +110,10 @@ platform :ios do
upload_to_testflight( upload_to_testflight(
ipa: "status_appstore/StatusIm.ipa" ipa: "status_appstore/StatusIm.ipa"
) )
slack(message: "New release build uploaded to TestFlight") slack(
message: "New release build uploaded to TestFlight",
slack_url: ENV["SLACK_URL"]
)
end end
desc "`fastlane ios clean` - remove inactive TestFlight users" desc "`fastlane ios clean` - remove inactive TestFlight users"
@ -120,18 +127,30 @@ end
platform :android do platform :android do
desc "Deploy a new internal build to Google Play" desc "Deploy a new internal build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
lane :nightly do lane :nightly do
upload_to_play_store( upload_to_play_store(
track: "internal", track: "internal",
apk: "android/app/build/outputs/apk/release/app-release.apk" apk: "android/app/build/outputs/apk/release/app-release.apk",
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
)
slack(
message: "New nightly build uploaded to Google Play",
slack_url: ENV["SLACK_URL"]
) )
slack(message: "New nightly build uploaded to Google Play")
end end
lane :release do lane :release do
desc "Deploy a new alpha (public) build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
upload_to_play_store( upload_to_play_store(
track: "alpha", track: "alpha",
apk: "android/app/build/outputs/apk/release/app-release.apk" apk: "android/app/build/outputs/apk/release/app-release.apk",
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
)
slack(
message: "New release build uploaded to Google Play",
slack_url: ENV["SLACK_URL"]
) )
slack(message: "New release build uploaded to Google Play")
end end
end end