ci: fix dind toolchain and docker config

This commit is contained in:
bstein 2025-12-17 02:51:34 -03:00
parent 1dfee091fe
commit b6eb17b62f

26
Jenkinsfile vendored
View File

@ -10,6 +10,9 @@ pipeline {
apiVersion: v1 apiVersion: v1
kind: Pod kind: Pod
spec: spec:
nodeSelector:
kubernetes.io/arch: arm64
hardware: rpi5
containers: containers:
- name: dind - name: dind
image: docker:27-dind image: docker:27-dind
@ -35,17 +38,19 @@ spec:
volumeMounts: volumeMounts:
- name: workspace-volume - name: workspace-volume
mountPath: /home/jenkins/agent mountPath: /home/jenkins/agent
- name: dind-storage - name: docker-config-writable
mountPath: /var/lib/docker
- name: docker-config
mountPath: /root/.docker mountPath: /root/.docker
- name: docker-config-secret
mountPath: /docker-config
volumes: volumes:
- name: docker-config - name: docker-config-secret
secret: secret:
secretName: harbor-robot-pipeline secretName: harbor-robot-pipeline
items: items:
- key: .dockerconfigjson - key: .dockerconfigjson
path: config.json path: config.json
- name: docker-config-writable
emptyDir: {}
- name: workspace-volume - name: workspace-volume
emptyDir: {} emptyDir: {}
- name: dind-storage - name: dind-storage
@ -74,7 +79,7 @@ spec:
container('builder') { container('builder') {
sh ''' sh '''
set -euo pipefail set -euo pipefail
apk add --no-cache bash curl make tar gzip git coreutils apk add --no-cache bash curl make tar gzip git coreutils go ncurses
''' '''
} }
} }
@ -101,11 +106,18 @@ spec:
container('builder') { container('builder') {
sh ''' sh '''
set -euo pipefail set -euo pipefail
mkdir -p /root/.docker
cp /docker-config/config.json /root/.docker/config.json
# Harbor's build uses git metadata; Jenkins workspace ownership can trigger
# Git's safe.directory protection in containerized builds.
git config --global --add safe.directory '*'
# `harbor-src/` itself matches `harbor-*`, so exclude it. # `harbor-src/` itself matches `harbor-*`, so exclude it.
SRC_DIR=$(find harbor-src -mindepth 1 -maxdepth 1 -type d -name "harbor-*" | head -n1) SRC_DIR=$(find harbor-src -mindepth 1 -maxdepth 1 -type d -name "harbor-*" | head -n1)
cd "${SRC_DIR}" cd "${SRC_DIR}"
export DOCKER_BUILDKIT=1
export VERSIONTAG="${VERSIONTAG}" export VERSIONTAG="${VERSIONTAG}"
export BASEIMAGETAG="${VERSIONTAG}" export BASEIMAGETAG="${VERSIONTAG}"
export IMAGENAMESPACE="${REGISTRY}" export IMAGENAMESPACE="${REGISTRY}"
@ -139,8 +151,6 @@ spec:
} }
} }
post { post {
always { always { echo 'done' }
deleteDir()
}
} }
} }