darling/ci/Jenkinsfile

129 lines
2.8 KiB
Plaintext
Raw Permalink Normal View History

2021-07-06 18:04:05 +00:00
pipeline {
agent {
docker {
image 'registry.git.facekapow.dev/darling-build-image-top:latest'
registryUrl 'https://registry.git.facekapow.dev'
alwaysPull true
args '-u ci:ci -v /var/run/docker.sock:/var/run/docker.sock --group-add docker'
label 'darling'
}
}
2021-07-06 18:04:05 +00:00
parameters {
booleanParam(name: 'DEB', defaultValue: true, description: 'If true, build Debian packages.')
booleanParam(name: 'RPM', defaultValue: true, description: 'If true, build RPM packages.')
}
2021-07-06 18:04:05 +00:00
triggers {
githubPush()
}
environment {
ESCAPED_JOB_NAME = sh(script: 'echo "${JOB_NAME}" | sed \'s/\\//-/g\'', returnStdout: true).trim()
CCACHE_DIR = credentials('darling-ccache-dir')
2021-07-06 18:04:05 +00:00
}
options {
skipDefaultCheckout()
disableConcurrentBuilds abortPrevious: true
2021-07-06 18:04:05 +00:00
}
stages {
stage('Start Job') {
steps {
scmSkip(deleteBuild: true, skipPattern:'.*\\[ci skip\\].*')
2021-07-06 18:04:05 +00:00
dir('source') {
checkout scm
2021-07-06 18:04:05 +00:00
}
}
}
stage('Prepare') {
2021-07-06 18:04:05 +00:00
steps {
dir('source') {
sh 'git submodule update --init --recursive'
sh 'cd src/external/swift && git lfs install && git lfs pull'
touch '../.submodules-cloned'
}
}
}
2021-07-06 18:04:05 +00:00
stage('Build Debian') {
when { expression { params.DEB } }
agent {
docker {
image 'registry.git.facekapow.dev/darling-build-image:latest'
registryUrl 'https://registry.git.facekapow.dev'
alwaysPull true
args '-u ci:ci -v ${WORKSPACE}/source:/src/mnt:rw -v ${CCACHE_DIR}:/ccache:rw'
label 'darling'
reuseNode true
2021-07-06 18:04:05 +00:00
}
}
environment {
DEB_DISTRO = sh(script: 'lsb_release -cs', returnStdout: true).trim()
CCACHE_DIR = '/ccache'
CCACHE_BASEDIR = '/src/mnt'
}
steps {
//sh 'tools/debian/make-deb --dsc'
sh '''#!/bin/bash
pushd /src/mnt
tools/debian/make-deb
popd
'''
sh 'rm -rf out-deb'
sh 'mkdir out-deb'
dir('out-deb') {
sh 'mv /src/*.deb ./'
}
archiveArtifacts artifacts: 'out-deb/**/*', fingerprint: true
}
}
stage('Build RPM') {
when { expression { params.RPM } }
agent {
docker {
image 'registry.git.facekapow.dev/darling-build-image-fedora:latest'
registryUrl 'https://registry.git.facekapow.dev'
alwaysPull true
args '-v ${WORKSPACE}/source:/src:ro -v ${CCACHE_DIR}:/ccache:rw'
label 'darling'
reuseNode true
}
}
environment {
CCACHE_DIR = '/ccache'
CCACHE_BASEDIR = '/home/ci/rpmbuild/BUILD/darling'
}
steps {
sh 'bash -xv /src/rpm/build.bsh'
2021-07-06 18:04:05 +00:00
sh 'rm -rf out-rpm'
sh 'mkdir out-rpm'
2021-07-06 18:04:05 +00:00
dir('out-rpm') {
sh 'mv ${HOME}/rpmbuild/RPMS/x86_64/*.rpm ./'
2021-07-06 18:04:05 +00:00
}
archiveArtifacts artifacts: 'out-rpm/**/*', fingerprint: true
2021-07-06 18:04:05 +00:00
}
}
}
post {
cleanup {
script {
if (!fileExists('.submodules-cloned')) {
sh 'rm -rf source'
2021-07-06 18:04:05 +00:00
}
}
}
}
}