|
|
@ -2,7 +2,7 @@ pipeline { |
|
|
|
agent any |
|
|
|
agent any |
|
|
|
|
|
|
|
|
|
|
|
environment { |
|
|
|
environment { |
|
|
|
DOCKER_IMAGE = "my-web-app:latest" |
|
|
|
docker_image = "my-web-app:latest" |
|
|
|
K8S_DEPLOYMENT_NAME = "my-web-app-deployment" |
|
|
|
K8S_DEPLOYMENT_NAME = "my-web-app-deployment" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -10,7 +10,7 @@ pipeline { |
|
|
|
stage('构建镜像') { |
|
|
|
stage('构建镜像') { |
|
|
|
steps { |
|
|
|
steps { |
|
|
|
script { |
|
|
|
script { |
|
|
|
docker.build("${DOCKER_IMAGE}") |
|
|
|
docker.build("${docker_image}") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -19,7 +19,7 @@ pipeline { |
|
|
|
script { |
|
|
|
script { |
|
|
|
// 假设已经配置了 Docker 认证 |
|
|
|
// 假设已经配置了 Docker 认证 |
|
|
|
docker.withRegistry('http://core.harbor.cn', 'registry-credentials') { |
|
|
|
docker.withRegistry('http://core.harbor.cn', 'registry-credentials') { |
|
|
|
docker.image("${DOCKER_IMAGE}").push() |
|
|
|
docker.image("${docker_image}").push() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|