2022-09-29 10:29:28 +00:00
|
|
|
library 'status-jenkins-lib@v1.5.7'
|
2020-03-06 15:43:04 +00:00
|
|
|
|
2019-02-28 10:56:58 +00:00
|
|
|
pipeline {
|
2019-04-18 12:39:40 +00:00
|
|
|
agent { label params.AGENT_LABEL }
|
2019-02-28 10:56:58 +00:00
|
|
|
|
2021-06-24 12:02:20 +00:00
|
|
|
parameters {
|
|
|
|
string(
|
|
|
|
name: 'NIX_CACHE_HOST',
|
|
|
|
description: 'FQDN of Nix binary cache host.',
|
|
|
|
defaultValue: params.NIX_CACHE_HOST ?: 'cache-01.do-ams3.nix.ci.statusim.net'
|
|
|
|
)
|
|
|
|
string(
|
|
|
|
name: 'NIX_CACHE_USER',
|
|
|
|
description: 'Username for Nix binary cache host.',
|
|
|
|
defaultValue: params.NIX_CACHE_USER ?: 'nix-cache'
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2019-02-28 10:56:58 +00:00
|
|
|
environment {
|
2019-11-26 13:21:10 +00:00
|
|
|
/* See nix/README.md */
|
|
|
|
NIX_IGNORE_SYMLINK_STORE = 1
|
2019-02-28 10:56:58 +00:00
|
|
|
/* we source .bash_profile to be able to use nix-store */
|
2021-06-24 12:02:20 +00:00
|
|
|
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .profile;"
|
2019-04-03 11:06:42 +00:00
|
|
|
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
2019-04-02 20:27:01 +00:00
|
|
|
timeout(time: 300, unit: 'MINUTES')
|
2019-02-28 10:56:58 +00:00
|
|
|
/* Limit builds retained */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '20',
|
|
|
|
daysToKeepStr: '30',
|
|
|
|
))
|
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
stage('Setup') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
2021-04-12 14:07:55 +00:00
|
|
|
nix.shell('nix-env -i openssh', sandbox: false, pure: false)
|
2019-11-29 10:20:08 +00:00
|
|
|
/* some build targets don't build on MacOS */
|
|
|
|
uname = sh(script: 'uname', returnStdout: true)
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
2019-07-22 03:31:47 +00:00
|
|
|
stage('Build status-go') {
|
|
|
|
steps { script {
|
2020-07-01 19:45:39 +00:00
|
|
|
def platforms = ['mobile.android', 'mobile.ios']
|
2019-11-29 10:20:08 +00:00
|
|
|
if (uname != "Darwin") {
|
|
|
|
platforms.removeAll { it == "ios" }
|
|
|
|
}
|
|
|
|
platforms.each { os ->
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.build(
|
|
|
|
attr: "targets.status-go.${os}.buildInputs",
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
link: false
|
|
|
|
)
|
2019-07-22 03:31:47 +00:00
|
|
|
}
|
|
|
|
} }
|
|
|
|
}
|
2019-07-26 14:51:06 +00:00
|
|
|
stage('Build android jsbundle') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
|
|
|
/* build/fetch things required to produce a js-bundle for android
|
|
|
|
* (e.g. maven and node repos) */
|
|
|
|
nix.build(
|
2019-11-29 10:20:08 +00:00
|
|
|
attr: 'targets.mobile.android.jsbundle',
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
pure: false,
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Build android deps') {
|
|
|
|
steps { script {
|
|
|
|
/* build/fetch things required to build jsbundle and android */
|
|
|
|
nix.build(
|
2020-05-16 13:02:28 +00:00
|
|
|
attr: 'targets.mobile.android.release.buildInputs',
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
pure: false,
|
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
2019-06-04 16:50:29 +00:00
|
|
|
}
|
|
|
|
stage('Build nix shell deps') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
2019-11-29 10:20:08 +00:00
|
|
|
/* build/fetch things required to instantiate shell.nix for TARGET=all */
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.build(
|
2019-11-29 10:20:08 +00:00
|
|
|
attr: 'shells.default.buildInputs',
|
2020-02-29 10:40:11 +00:00
|
|
|
sandbox: false,
|
2019-07-15 16:34:33 +00:00
|
|
|
link: false
|
|
|
|
)
|
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
stage('Upload') {
|
2019-07-15 16:34:33 +00:00
|
|
|
steps { script {
|
2019-02-28 10:56:58 +00:00
|
|
|
sshagent(credentials: ['nix-cache-ssh']) {
|
2019-07-15 16:34:33 +00:00
|
|
|
nix.shell("""
|
2019-07-26 14:51:06 +00:00
|
|
|
find /nix/store/ -mindepth 1 -maxdepth 1 -type d \
|
2022-07-17 12:37:46 +00:00
|
|
|
-not -name '*.links' -and -not -name '*-status-mobile-*' \
|
2022-05-07 09:16:20 +00:00
|
|
|
| xargs nix copy \
|
|
|
|
--to ssh-ng://${params.NIX_CACHE_USER}@${params.NIX_CACHE_HOST}
|
2019-07-15 16:34:33 +00:00
|
|
|
""",
|
|
|
|
pure: false
|
|
|
|
)
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|
|
|
|
}
|
2019-06-04 16:50:29 +00:00
|
|
|
post {
|
2019-07-15 16:34:33 +00:00
|
|
|
always { script {
|
|
|
|
nix.shell('nix-store --optimize', pure: false)
|
2019-11-29 10:20:08 +00:00
|
|
|
nix.shell('nix/scripts/clean.sh', pure: false)
|
2019-07-15 16:34:33 +00:00
|
|
|
} }
|
2019-06-04 16:50:29 +00:00
|
|
|
}
|
2019-02-28 10:56:58 +00:00
|
|
|
}
|