2023-04-03 15:28:16 +00:00
|
|
|
library 'status-jenkins-lib@v1.7.0'
|
2022-12-06 18:00:59 +00:00
|
|
|
|
|
|
|
pipeline {
|
|
|
|
agent {
|
2023-04-03 15:28:16 +00:00
|
|
|
label 'linux && nix-2.11 && x86_64'
|
2022-12-06 18:00:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
options {
|
|
|
|
timestamps()
|
|
|
|
disableConcurrentBuilds()
|
|
|
|
/* Prevent Jenkins jobs from running forever */
|
|
|
|
timeout(time: 30, unit: 'MINUTES')
|
|
|
|
/* Go requires a certain directory structure */
|
|
|
|
checkoutToSubdirectory('src/github.com/waku-org/go-waku')
|
|
|
|
/* Limit builds retained */
|
|
|
|
buildDiscarder(logRotator(
|
|
|
|
numToKeepStr: '10',
|
|
|
|
daysToKeepStr: '20',
|
|
|
|
artifactNumToKeepStr: '10',
|
|
|
|
))
|
|
|
|
/* Allows combined build to copy */
|
|
|
|
copyArtifactPermission('/go-waku/*')
|
|
|
|
}
|
|
|
|
|
|
|
|
environment {
|
2023-04-14 13:45:01 +00:00
|
|
|
TARGET = 'linux'
|
|
|
|
REPO = "${env.WORKSPACE}/src/github.com/waku-org/go-waku"
|
|
|
|
GOCACHE = "${env.WORKSPACE_TMP}/go-build"
|
|
|
|
GOPATH = "${env.WORKSPACE}"
|
|
|
|
PATH = "${env.PATH}:${env.GOPATH}/bin"
|
2022-12-06 18:00:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
stages {
|
|
|
|
|
2023-04-03 15:28:16 +00:00
|
|
|
stage('Prep') {
|
|
|
|
steps { script { dir(env.REPO) {
|
|
|
|
env.DEB_ARTIFACT = "${env.REPO}/pkg/" + utils.pkgFilename(
|
|
|
|
name: "go-waku",
|
|
|
|
type: "x86_64",
|
|
|
|
ext: "deb"
|
|
|
|
)
|
|
|
|
} } }
|
|
|
|
}
|
2022-12-06 18:00:59 +00:00
|
|
|
|
2023-04-03 15:28:16 +00:00
|
|
|
stage('Build') {
|
|
|
|
steps { script { dir(env.REPO) {
|
|
|
|
nix.develop('make build')
|
|
|
|
} } }
|
|
|
|
}
|
|
|
|
|
|
|
|
stage('Package') {
|
|
|
|
steps { script { dir(env.REPO) {
|
|
|
|
dir('./scripts/linux') {
|
|
|
|
nix.develop('./fpm-build.sh', attr: 'fpm')
|
|
|
|
}
|
|
|
|
dir('build') {
|
|
|
|
sh "cp gowaku*.deb ${env.DEB_ARTIFACT}"
|
|
|
|
}
|
|
|
|
} } }
|
|
|
|
}
|
2022-12-06 18:00:59 +00:00
|
|
|
|
|
|
|
stage('Parallel Upload') {
|
|
|
|
parallel {
|
|
|
|
stage('Archive') {
|
|
|
|
steps { script {
|
|
|
|
archiveArtifacts(env.DEB_ARTIFACT.minus("${env.WORKSPACE}/"))
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
stage('Upload') {
|
|
|
|
steps { script {
|
|
|
|
env.PKG_URL = s3.uploadArtifact(env.DEB_ARTIFACT)
|
|
|
|
jenkins.setBuildDesc(x86_64_deb: env.PKG_URL)
|
|
|
|
} }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
post {
|
|
|
|
success { script { github.notifyPR(true) } }
|
|
|
|
failure { script { github.notifyPR(false) } }
|
|
|
|
always { cleanWs() }
|
|
|
|
}
|
2023-04-03 15:28:16 +00:00
|
|
|
}
|