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)
apkUrl = 'http://artifacts.status.im:8081/artifactory/nightlies-local/' + filename
sh ('bundle exec fastlane android nightly')
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)') {
withCredentials([
string(
credentialsId: "slave-pass-${env.NODE_NAME}",
variable: 'KEYCHAIN_PASSWORD'
),
string(
credentialsId: 'fastlane-match-password',
variable:'MATCH_PASSWORD'
)]) {
string(credentialsId: "slave-pass-${env.NODE_NAME}", variable: 'KEYCHAIN_PASSWORD'),
string(credentialsId: "SLACK_URL", variable: 'SLACK_URL'),
string(credentialsId: 'FASTLANE_PASSWORD', variable: 'FASTLANE_PASSWORD'),
string(credentialsId: 'APPLE_ID', variable: 'APPLE_ID'),
string(credentialsId: 'fastlane-match-password', variable:'MATCH_PASSWORD')]) {
sh "plutil -replace CFBundleShortVersionString -string ${version} ios/StatusIm/Info.plist"
sh "plutil -replace CFBundleVersion -string ${build_no} ios/StatusIm/Info.plist"

View File

@ -80,7 +80,18 @@ timeout(90) {
}
stage('Deploy (Android)') {
sh ('bundle exec fastlane android release')
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')
}
}
} catch (e) {
slackSend color: 'bad', message: 'Release build failed uploading to the Play Market. ' + env.BUILD_URL

View File

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

View File

@ -16,7 +16,7 @@ def unlock_keychain_if_needed
if ENV["KEYCHAIN_PASSWORD"]
unlock_keychain(
path:"login.keychain",
password:ENV["password"],
password:ENV["KEYCHAIN_PASSWORD"],
set_default: true)
end
end
@ -73,9 +73,13 @@ platform :ios do
output_directory: "status_appstore"
)
upload_to_testflight(
ipa: "status_appstore/StatusIm.ipa"
ipa: "status_appstore/StatusIm.ipa"
)
slack(
message: "New nightly build uploaded to TestFlight",
slack_url: ENV["SLACK_URL"]
)
slack(message: "New nightly build uploaded to TestFlight")
# additional .ipa is for diawi
# we have to re-build it because it uses different config
@ -104,9 +108,12 @@ platform :ios do
}
)
upload_to_testflight(
ipa: "status_appstore/StatusIm.ipa"
ipa: "status_appstore/StatusIm.ipa"
)
slack(
message: "New release build uploaded to TestFlight",
slack_url: ENV["SLACK_URL"]
)
slack(message: "New release build uploaded to TestFlight")
end
desc "`fastlane ios clean` - remove inactive TestFlight users"
@ -120,18 +127,30 @@ end
platform :android do
desc "Deploy a new internal build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
lane :nightly do
upload_to_play_store(
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
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(
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