diff --git a/Jenkinsfile b/Jenkinsfile index aabc43f..98dd134 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,11 +1,16 @@ pipeline { agent { kubernetes { + // Keep build I/O off the node's runtime USB drive. + workspaceVolume dynamicPVC(accessModes: 'ReadWriteOnce', requestsSize: '40Gi', storageClassName: 'ci-scratch') defaultContainer 'tester' yaml """ apiVersion: v1 kind: Pod spec: + securityContext: + fsGroup: 1000 + fsGroupChangePolicy: OnRootMismatch nodeSelector: kubernetes.io/arch: arm64 node-role.kubernetes.io/worker: "true" @@ -49,8 +54,9 @@ spec: - "--host=tcp://0.0.0.0:2375" - "--tls=false" volumeMounts: - - name: dind-storage + - name: workspace-volume mountPath: /var/lib/docker + subPath: .cache/docker - name: workspace-volume mountPath: /home/jenkins/agent - name: builder @@ -89,20 +95,20 @@ spec: volumes: - name: docker-config-writable emptyDir: {} - - name: dind-storage - emptyDir: {} - name: harbor-config secret: secretName: harbor-robot-pipeline items: - key: .dockerconfigjson path: config.json - - name: workspace-volume - emptyDir: {} """ } } environment { + PIP_CACHE_DIR = '/home/jenkins/agent/.cache/pip' + NPM_CONFIG_CACHE = '/home/jenkins/agent/.cache/npm' + SONAR_USER_HOME = '/home/jenkins/agent/.cache/sonar' + TMPDIR = '/home/jenkins/agent/.cache/tmp' PIP_DISABLE_PIP_VERSION_CHECK = '1' PYTHONUNBUFFERED = '1' SUITE_NAME = 'atlasbot' @@ -118,6 +124,11 @@ spec: buildDiscarder(logRotator(daysToKeepStr: '30', numToKeepStr: '200', artifactDaysToKeepStr: '30', artifactNumToKeepStr: '120')) } stages { + stage('Prepare build scratch') { + steps { + sh 'mkdir -p /home/jenkins/agent/.cache/tmp /home/jenkins/agent/.cache/go-tmp' + } + } stage('Checkout') { steps { checkout scm