12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- pipeline {
- agent {
- kubernetes {
- yamlFile 'deploy/KubernetesPod.yaml'
- retries 2
- }
- }
- environment {
- IMAGE_REPO = "registry.cn-hangzhou.aliyuncs.com/sxtest"
- TAB = "\n \n "
- BUILD_TASKS = "\n \n "
- }
- stages{
- stage('构建镜像') {
- steps {
- container('docker') {
- echo "构建 Docker 镜像阶段"
- sh 'echo "nameserver 114.114.114.114" >> /etc/resolv.conf'
- sh 'docker build --target image-idcprod -t ${IMAGE_REPO}/aihub-backend:sxtest --output type=docker .'
- echo "build success"
- }
- script {
- env.BUILD_TASKS += env.STAGE_NAME + "✅" + env.TAB
- }
- }
- }
- stage('镜像推送') {
- steps {
- container('docker') {
- echo "Push Docker 镜像阶段"
- sh'docker images'
- sh 'docker push ${IMAGE_REPO}/aihub-backend:sxtest '
- echo "Push image success"
- }
- script {
- env.BUILD_TASKS += env.STAGE_NAME + "✅" + env.TAB
- }
- }
- }
- stage('重启服务') {
- steps {
- container('kubectl') {
- sh 'kubectl version'
- }
- script {
- env.BUILD_TASKS += env.STAGE_NAME + "✅" + env.TAB
- }
- sh 'printenv'
- }
- }
- }
- }
|