1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- pipeline {
- agent {
- kubernetes {
- yamlFile 'deploy/KubernetesPod.yaml'
- retries 2
- }
- }
- environment {
- IMAGE_REPO = "zzzx9714"
- 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 -t ${IMAGE_REPO}/helmbe:idcprod --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 login -u zzzx9714 -p zx999714.'
- sh 'docker push ${IMAGE_REPO}/helmbe:idcprod '
- 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'
- }
- }
- }
- }
|