可以将外部的/etc/localtime文件在pod启动的时候挂载到docker内部即可
以下内容仅供参考
pipeline {
agent {
kubernetes {
label "${UUID.randomUUID().toString()}"
yaml """
metadata:
labels:
some-label: some-label-value
class: KubernetesDeclarativeAgentTest
namespace: scm
spec:
nodeSelector:
jenkins-ci: "true"
containers:
- name: build
image: hub.hobot.cc/builder/matrix:arm-cmake-3.13-v7
command:
- cat
tty: true
env:
- name: CONTAINER_ENV_VAR
value: build
volumeMounts:
- name: local-time
mountPath: /etc/localtime
volumes:
- name: local-time
hostPath:
path: /etc/localtime
"""
}
}
stages {
stage('Example') {
steps {
container("build"){
script{
sh 'date'
}
}
}
}
}
}