2023-06-29 13:40:43 +00:00
|
|
|
#!/usr/bin/env groovy
|
2023-09-28 18:03:15 +00:00
|
|
|
library 'status-jenkins-lib@v1.7.15'
|
2020-03-06 15:43:04 +00:00
|
|
|
|
2022-06-28 18:46:54 +00:00
|
|
|
/* Options section can't access functions in objects. */
|
|
|
|
def isPRBuild = utils.isPRBuild()
|
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
pipeline {
|
2023-06-16 12:05:18 +00:00
|
|
|
agent { label 'linux && x86_64 && nix-2.14' }
|
2018-08-14 18:09:52 +00:00
|
|
|
|
|
|
|
options {
|
2018-11-13 11:58:34 +00:00
|
|
|
timestamps()
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2021-06-17 13:44:34 +00:00
|
|
|
timeout(time: 30, unit: 'MINUTES')
|
2018-10-30 09:38:52 +00:00
|
|
|
/* Limit builds retained */
|
2018-08-14 18:09:52 +00:00
|
|
|
buildDiscarder(logRotator(
|
2018-12-13 09:49:16 +00:00
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '20',
|
|
|
|
artifactNumToKeepStr: '10',
|
2018-08-14 18:09:52 +00:00
|
|
|
))
|
2020-05-11 09:04:11 +00:00
|
|
|
/* Allows combined build to copy */
|
2022-07-17 12:37:46 +00:00
|
|
|
copyArtifactPermission('/status-mobile/*')
|
2022-06-28 18:46:54 +00:00
|
|
|
/* Abort old PR builds. */
|
|
|
|
disableConcurrentBuilds(
|
|
|
|
abortPrevious: isPRBuild
|
|
|
|
)
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2018-09-25 17:01:48 +00:00
|
|
|
|
2018-12-11 11:00:22 +00:00
|
|
|
parameters {
|
2018-12-11 14:27:21 +00:00
|
|
|
string(
|
2018-12-11 11:00:22 +00:00
|
|
|
name: 'BUILD_TYPE',
|
2018-12-11 14:27:21 +00:00
|
|
|
description: 'Specify build type. Values: pr / e2e / nightly / release',
|
2018-12-11 11:00:22 +00:00
|
|
|
defaultValue: 'pr',
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
environment {
|
2019-05-10 15:33:54 +00:00
|
|
|
LANG = "en_US.UTF-8"
|
|
|
|
LC_ALL = "en_US.UTF-8"
|
|
|
|
LANGUAGE = "en_US.UTF-8"
|
2022-11-24 08:26:28 +00:00
|
|
|
TARGET = "android${utils.isE2EBuild() ? "-e2e" : ""}"
|
2019-07-15 16:34:33 +00:00
|
|
|
BUILD_ENV = 'prod'
|
2019-05-10 15:33:54 +00:00
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
2018-08-14 18:09:52 +00:00
|
|
|
FASTLANE_DISABLE_COLORS = 1
|
|
|
|
}
|
2018-09-25 17:01:48 +00:00
|
|
|
|
2018-08-14 18:09:52 +00:00
|
|
|
stages {
|
|
|
|
stage('Prep') {
|
|
|
|
steps {
|
|
|
|
script {
|
2022-09-14 10:16:55 +00:00
|
|
|
utils.symlinkEnv()
|
|
|
|
println("Build Number: ${utils.genBuildNumber()}")
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-26 13:18:45 +00:00
|
|
|
stage('Bundle') {
|
|
|
|
steps {
|
|
|
|
script { apks = android.bundle() }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('Sign') {
|
|
|
|
steps {
|
|
|
|
script { apks = android.sign(apks) }
|
2019-01-18 00:31:07 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
2019-10-09 15:37:58 +00:00
|
|
|
stage('Parallel Upload') {
|
|
|
|
parallel {
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
|
|
|
apks.each { archiveArtifacts it }
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Upload') {
|
2022-08-26 13:18:45 +00:00
|
|
|
steps { script {
|
|
|
|
def urls = apks.collect { s3.uploadArtifact(it) }
|
2023-02-03 16:09:08 +00:00
|
|
|
if (urls.size() > 1) { /* Return only the universal APK. */
|
2022-08-26 13:18:45 +00:00
|
|
|
env.PKG_URL = urls.find { it.contains('universal') }
|
2023-02-03 16:09:08 +00:00
|
|
|
} else { /* If no universal is available pick first. */
|
2022-08-26 13:18:45 +00:00
|
|
|
env.PKG_URL = urls.first()
|
|
|
|
}
|
|
|
|
jenkins.setBuildDesc(APK: env.PKG_URL)
|
|
|
|
} }
|
2018-08-27 15:32:54 +00:00
|
|
|
}
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|
2018-12-11 14:27:21 +00:00
|
|
|
}
|
|
|
|
post {
|
2020-03-06 15:43:04 +00:00
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
2022-08-26 13:18:45 +00:00
|
|
|
always { sh 'make purge' }
|
2018-08-14 18:09:52 +00:00
|
|
|
}
|
|
|
|
}
|