merge nix-cache build Jenkinsfiles

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-04-18 14:39:40 +02:00
parent 6f16ccf416
commit a4b5f69e5b
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
2 changed files with 1 additions and 54 deletions

View File

@ -1,7 +1,5 @@
pipeline { pipeline {
agent { agent { label params.AGENT_LABEL }
label 'macos'
}
environment { environment {
CI_ENVIRONMENT = 'jenkins' CI_ENVIRONMENT = 'jenkins'

View File

@ -1,51 +0,0 @@
pipeline {
agent { label 'linux' }
environment {
CI_ENVIRONMENT = 'jenkins'
/* we source .bash_profile to be able to use nix-store */
NIX_SSHOPTS = "-o StrictHostKeyChecking=no source .bash_profile;"
/* where our /nix/store is hosted */
NIX_CACHE_USER = 'nix-cache'
NIX_CACHE_HOST = 'master-01.do-ams3.ci.misc.statusim.net'
NIX_CONF_DIR = "${env.WORKSPACE}/nix"
}
options {
timestamps()
disableConcurrentBuilds()
/* Prevent Jenkins jobs from running forever */
timeout(time: 20, unit: 'MINUTES')
/* Limit builds retained */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
stages {
stage('Setup') {
steps {
sh 'nix-env -i openssh'
}
}
stage('Build') {
steps {
sh """
nix build -v --no-link &&
nix-shell --pure --run echo
"""
}
}
stage('Upload') {
steps {
sshagent(credentials: ['nix-cache-ssh']) {
sh """
find /nix/store/ -mindepth 1 -maxdepth 1 -not -name '.links' -and -not -name '*.lock' | \
xargs nix-copy-closure -v --to ${NIX_CACHE_USER}@${NIX_CACHE_HOST}
"""
}
}
}
}
}