pipeline-dev nerdctl新增address

This commit is contained in:
tianfeng 2026-03-24 16:02:33 +08:00
parent 22b9679bca
commit 379cd49646

View File

@ -17,6 +17,7 @@ pipeline {
JAR_NAME = "rc-auth-*.jar" JAR_NAME = "rc-auth-*.jar"
ALIYUN_REGISTRY = "registry.cn-hangzhou.aliyuncs.com/public_mirror_images" ALIYUN_REGISTRY = "registry.cn-hangzhou.aliyuncs.com/public_mirror_images"
IMAGE_REP_TAG = "" IMAGE_REP_TAG = ""
NERDCTL = "nerdctl --address /run/containerd/containerd.sock"
DOCKER_FILE = "rc-auth/Dockerfile-dev" DOCKER_FILE = "rc-auth/Dockerfile-dev"
DOCKER_DIR = "rc-auth" DOCKER_DIR = "rc-auth"
K8S_NAMESPACE = "azizi" K8S_NAMESPACE = "azizi"
@ -49,15 +50,15 @@ pipeline {
usernameVariable: 'ALIYUN_USER', usernameVariable: 'ALIYUN_USER',
passwordVariable: 'ALIYUN_PASS' passwordVariable: 'ALIYUN_PASS'
)]) { )]) {
sh 'echo $ALIYUN_PASS | nerdctl login --username $ALIYUN_USER --password-stdin registry.cn-hangzhou.aliyuncs.com' sh 'echo $ALIYUN_PASS | $NERDCTL login --username $ALIYUN_USER --password-stdin registry.cn-hangzhou.aliyuncs.com'
} }
sh "nerdctl build --build-arg SERVICE_VERSION=${BUILD_IMAGE} -f ${DOCKER_FILE} -t ${IMAGE_REP_TAG} ${DOCKER_DIR}" sh "${NERDCTL} build --build-arg SERVICE_VERSION=${BUILD_IMAGE} -f ${DOCKER_FILE} -t ${IMAGE_REP_TAG} ${DOCKER_DIR}"
} }
} }
stage('Upload image') { stage('Upload image') {
steps { steps {
sh "nerdctl push ${IMAGE_REP_TAG}" sh "${NERDCTL} push ${IMAGE_REP_TAG}"
sh "nerdctl rmi -f ${IMAGE_REP_TAG}" sh "${NERDCTL} rmi -f ${IMAGE_REP_TAG}"
} }
} }
stage('Apply') { stage('Apply') {