ci: Use a dynamic PVC for the workspace volume
dustin/metricspi/pipeline/head Something is wrong with the build of this commit Details

Using an actual persistent volume for the workspace ultimately doesn't
work with multibranch pipelines.  When a branch/PR goes away and the
corresponding Jenkins job is deleted, the workspace cannot be cleaned up
because it is not mounted anywhere.  As such, we will just use a dynamic
PVC to ensure that the workspace is always cleaned up and nothing gets
left behind.  This of course obviates the need for the `Clean`
parameter.
master
Dustin 2022-12-21 09:53:15 -06:00
parent 06b04abf47
commit 332e36a388
1 changed files with 1 additions and 14 deletions

15
ci/Jenkinsfile vendored
View File

@ -5,9 +5,7 @@ pipeline {
kubernetes { kubernetes {
yamlFile 'ci/podTemplate.yaml' yamlFile 'ci/podTemplate.yaml'
defaultContainer 'buildroot' defaultContainer 'buildroot'
workspaceVolume persistentVolumeClaimWorkspaceVolume( workspaceVolume dynamicPVC()
claimName: 'jenkins-ws-metricspi'
)
} }
} }
@ -16,12 +14,6 @@ pipeline {
disableConcurrentBuilds() disableConcurrentBuilds()
} }
parameters {
booleanParam \
name: 'Clean',
description: 'Clean the workspace and perform a full rebuild'
}
environment { environment {
BUILDROOT_SRC = "${env.WORKSPACE}/buildroot" BUILDROOT_SRC = "${env.WORKSPACE}/buildroot"
TMPDIR = "${env.WORKSPACE_TMP}" TMPDIR = "${env.WORKSPACE_TMP}"
@ -32,11 +24,6 @@ pipeline {
stages { stages {
stage('Prepare') { stage('Prepare') {
steps { steps {
script {
if (params.Clean) {
sh 'rm -rf _build'
}
}
checkout poll: false, scm: [ checkout poll: false, scm: [
$class: 'GitSCM', $class: 'GitSCM',
branches: [[name: '2022.05.x']], branches: [[name: '2022.05.x']],