From 332e36a388a362cffb1d9999e1c78c55ba5f0153 Mon Sep 17 00:00:00 2001 From: "Dustin C. Hatch" Date: Wed, 21 Dec 2022 09:53:15 -0600 Subject: [PATCH] ci: Use a dynamic PVC for the workspace volume 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. --- ci/Jenkinsfile | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile index c880226..8f596dc 100644 --- a/ci/Jenkinsfile +++ b/ci/Jenkinsfile @@ -5,9 +5,7 @@ pipeline { kubernetes { yamlFile 'ci/podTemplate.yaml' defaultContainer 'buildroot' - workspaceVolume persistentVolumeClaimWorkspaceVolume( - claimName: 'jenkins-ws-metricspi' - ) + workspaceVolume dynamicPVC() } } @@ -16,12 +14,6 @@ pipeline { disableConcurrentBuilds() } - parameters { - booleanParam \ - name: 'Clean', - description: 'Clean the workspace and perform a full rebuild' - } - environment { BUILDROOT_SRC = "${env.WORKSPACE}/buildroot" TMPDIR = "${env.WORKSPACE_TMP}" @@ -32,11 +24,6 @@ pipeline { stages { stage('Prepare') { steps { - script { - if (params.Clean) { - sh 'rm -rf _build' - } - } checkout poll: false, scm: [ $class: 'GitSCM', branches: [[name: '2022.05.x']],