main: push: - services: # 流水线中启用 docker 服务 - docker stages: # 云原生构建自动构建Docker镜像并将它发布到制品库 - name: docker login script: - docker login -u ${CNB_TOKEN_USER_NAME} -p "${CNB_TOKEN}" ${CNB_DOCKER_REGISTRY} - name: docker build script: - docker build -t ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:${CNB_COMMIT} . - name: docker push script: - docker push ${CNB_DOCKER_REGISTRY}/${CNB_REPO_SLUG_LOWERCASE}:${CNB_COMMIT} # - name: 使用kubectl操作腾讯TKE更新指定pod的镜像版本 # # 导入环境变量,【环境变量】https://docs.cnb.cool/zh/env.html # imports: https://cnb.cool/examples/secrets/-/blob/main/go-gin-kubernetes-kubeconfig.yml # image: bitnami/kubectl # commands: | # echo "$KUBECF" > ~/.kube/config # kubectl set image $POD_TYPE/$POD $CONTAINER=$IMAGE:$IMAGE_TAG -n $NS