Add a function to the Jenkinsfile and archive artifacts in each cmake-build directory

This commit is contained in:
Username404 2021-08-15 16:13:24 +02:00
parent 7016eb18c4
commit 28fcc49572
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
1 changed files with 10 additions and 7 deletions

17
Jenkinsfile vendored
View File

@ -1,6 +1,13 @@
pipeline { // Multi-branch pipeline script for Yerbacon.
agent any
def buildTarget(String path, String rpmArch, String debArch) {
cmakeBuild buildDir: 'cmake-build-${debArch}', buildType: 'release', cleanBuild: true, installation: 'Main'
cmake arguments: '--build ./cmake-build-${debArch} --target ybcon', installation: 'Main',
cmakeArgs: '-DCMAKE_C_COMPILER=/usr/bin/${path}-gcc -DCMAKE_CXX_COMPILER=/usr/bin/${path}-g++ -DCMAKE_LINKER=/usr/bin/${path}-ld.gold -DCMAKE_AR=/usr/bin/${path}-ar -DCPACK_RPM_PACKAGE_ARCHITECTURE=${rpmArch} -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=${debArch}'
cpack installation: 'Main', workingDir: 'cmake-build-{debArch}'
}
options {
buildDiscarder(logRotator(numToKeepStr: '48', artifactNumToKeepStr: '96'))
timeout(time: 8, unit: 'MINUTES')
@ -16,11 +23,10 @@ pipeline { // Multi-branch pipeline script for Yerbacon.
steps {
echo "Building the ${env.BRANCH_NAME} branch.."
cmakeBuild buildDir: 'cmake-build-release', buildType: 'release', cleanBuild: true, installation: 'Main'
cmakeBuild buildDir: 'cmake-build-release-arm', buildType: 'release', cleanBuild: true, installation: 'Main',
cmakeArgs: '-DCMAKE_C_COMPILER=/usr/bin/arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=/usr/bin/arm-linux-gnueabi-g++ -DCMAKE_LINKER=/usr/bin/arm-linux-gnueabi-ld.gold -DCMAKE_AR=/usr/bin/arm-linux-gnueabi-ar -DCPACK_RPM_PACKAGE_ARCHITECTURE=armv4l -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armel'
cmake arguments: '--build ./cmake-build-release --target ybcon', installation: 'Main'
sh 'strip ./cmake-build-release/ybcon'
cmake arguments: '--build ./cmake-build-release-arm --target ybcon', installation: 'Main'
cpack installation: 'Main', workingDir: 'cmake-build-release'
buildTarget('arm-linux-gnueabi', 'armv4l', 'armel')
}
}
stage('Build for other platforms') {
@ -36,10 +42,7 @@ pipeline { // Multi-branch pipeline script for Yerbacon.
stage('Deploy') {
steps {
echo 'Deploying....'
cpack installation: 'Main', workingDir: 'cmake-build-release'
dir('cmake-build-release') { archiveArtifacts artifacts:'*.deb, *.rpm, *.tar.gz, *.sh', fingerprint: false }
cpack installation: 'Main', workingDir: 'cmake-build-release-arm'
dir('cmake-build-release-arm') { zip zipFile: './Yerbacon-ARM_lpkg.zip', archive: true, glob: "*.tar.gz, *.sh, *.rpm, *.deb" }
archiveArtifacts artifacts: 'cmake-build-*/*.deb, cmake-build-*/*.rpm, cmake-build-*/*.tar.gz, cmake-build-*/*.sh', fingerprint: false
}
}
}