jenkins cleanup

This commit is contained in:
Anton Iakimov 2024-01-17 15:52:52 +01:00
parent 3f2cdf94a5
commit f681afa092
No known key found for this signature in database
GPG Key ID: DEA1FE58DD8BF7FA
3 changed files with 48 additions and 20 deletions

View File

@ -5,7 +5,7 @@ library 'status-jenkins-lib@linux-use-nix'
def isPRBuild = utils.isPRBuild() def isPRBuild = utils.isPRBuild()
pipeline { pipeline {
agent { label 'linux' } agent none
parameters { parameters {
booleanParam( booleanParam(
@ -28,12 +28,17 @@ pipeline {
description: 'Decides whether the mocked status-keycard-go library is built.', description: 'Decides whether the mocked status-keycard-go library is built.',
defaultValue: false defaultValue: false
) )
booleanParam(
name: 'NIX_SHELL',
description: 'Run build in Nix shell',
defaultValue: getDefaultNixShell()
)
} }
options { options {
timestamps() timestamps()
/* Prevent Jenkins jobs from running forever */ /* Prevent Jenkins jobs from running forever */
//timeout(time: 25, unit: 'MINUTES') timeout(time: 25, unit: 'MINUTES')
/* manage how many builds we keep */ /* manage how many builds we keep */
buildDiscarder(logRotator( buildDiscarder(logRotator(
numToKeepStr: '10', numToKeepStr: '10',
@ -51,7 +56,7 @@ pipeline {
environment { environment {
TARGET = "linux/${getArch()}" TARGET = "linux/${getArch()}"
/* Improve make performance */ /* Improve make performance */
MAKEFLAGS = "-j1 V=${params.VERBOSE}" MAKEFLAGS = "-j4 V=${params.VERBOSE}"
/* Avoid weird bugs caused by stale cache. */ /* Avoid weird bugs caused by stale cache. */
QML_DISABLE_DISK_CACHE = "true" QML_DISABLE_DISK_CACHE = "true"
/* Control output the filename */ /* Control output the filename */
@ -60,22 +65,50 @@ pipeline {
} }
stages { stages {
stage('environment setup') {
steps { script {
if (env.NIX_SHELL) {
currentBuild.agent = { label 'linux' }
} else {
currentBuild.agent = {
/* Necessary image with Ubuntu 20.04 for older Glibc. */
docker {
label 'linux'
image 'statusteam/nim-status-client-build:1.3.0-qt5.15.2'
/* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */
args '--entrypoint="" --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse'
}
}
QTDIR = "/opt/qt/5.15.2/gcc_64"
PATH = "${env.QTDIR}/bin:${env.PATH}"
}
} }
}
stage('Deps') { stage('Deps') {
steps { script { steps { script {
nix.shell('make update --debug V=1', pure: true) if (env.NIX_SHELL) {
nix.shell('make deps --debug V=1', pure: true) nix.shell('make update --debug V=1', pure: true)
nix.shell('make deps --debug V=1', pure: true)
} else {
sh 'make update'
sh 'make deps'
}
} } } }
} }
stage('status-go') { stage('status-go') {
steps { script { steps { script {
nix.shell('make status-go --debug V=1', pure: true) if (env.NIX_SHELL) {
nix.shell('make status-go --debug V=1', pure: true)
} else {
sh 'make status-go'
} } } }
} }
stage('Package') { stage('Package') {
steps { script { steps { script {
linux.bundle('--debug=b tgz-linux', 1) linux.bundle('--debug=b tgz-linux', 1, env.NIX_SHELL)
} } } }
} }
@ -119,3 +152,11 @@ def getArch() {
if (tokens.contains(arch)) { return arch } if (tokens.contains(arch)) { return arch }
} }
} }
def getDefaultNixShell() {
if (env.JOB_BASE_NAME == "package_nix") {
return true
} else {
return false
}
}

View File

@ -1,11 +0,0 @@
# NOTE: If you are in Asia you might want to add https://nix-cache-cn.status.im/ to extra-substituters
extra-substituters = https://nix-cache.status.im/
substituters = https://cache.nixos.org/
trusted-public-keys = nix-cache.status.im-1:x/93lOfLU+duPplwMSBR+OlY4+mo+dCN7n0mr4oPwgY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=
# Some downloads are multiple GB, default is 5 minutes
stalled-download-timeout = 3600
connect-timeout = 10
max-jobs = auto
# Helps avoid removing currently used dependencies via garbage collection
keep-derivations = true
keep-outputs = true

View File

@ -107,5 +107,3 @@ in pkgs.mkShell {
xorg.xcbutil xorg.xcbutil
]; ];
} }