Files
jenkins-pipeline/SCM/lessie_sourcing_agents.groovy

37 lines
1.5 KiB
Groovy
Raw Normal View History

2025-10-18 12:10:08 +08:00
pipeline {
agent any
stages {
stage('拉取镜像') {
steps {
script {
// 从选择的参数中提取标签(如从 "tag→分支:xxx..." 中取前半部分)
def imageTag = params.SELECTED_IMAGE.split(" → ")[0].trim()
def fullImage = "uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:${imageTag}"
// 登录仓库并拉取镜像
withCredentials([usernamePassword(
credentialsId: 'dxin_img_hub_auth',
usernameVariable: 'USERNAME',
passwordVariable: 'PASSWORD'
)]) {
sh """
echo "${PASSWORD}" | docker login uswccr.ccs.tencentyun.com -u ${USERNAME} --password-stdin
docker pull ${fullImage}
"""
}
}
}
}
stage('部署镜像') {
steps {
script {
def imageTag = params.SELECTED_IMAGE.split(" → ")[0].trim()
def fullImage = "uswccr.ccs.tencentyun.com/lessietest/lessie-sourcing-agents:${imageTag}"
echo "正在部署镜像:${fullImage}"
// 添加你的部署命令(如 docker run、kubectl apply 等)
// sh "docker run -d --name my-app ${fullImage}"
}
}
}
}
}