You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

3 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. ---
  2. kind: pipeline
  3. type: docker
  4. name: default
  5. volumes:
  6. - name: gopath
  7. host:
  8. path: /usr/local/path/gopath
  9. steps:
  10. ## 使用参数推送稳定镜像
  11. - name: tar-prod-push
  12. privileged: true
  13. image: repository.241210.com/repository/base/docker-push:2
  14. settings:
  15. tar: ops-api-${DRONE_BUILD_NUMBER}.tar
  16. commands:
  17. - docker pull ${IMAGE}
  18. - docker save ${IMAGE} >ops-api-${DRONE_BUILD_NUMBER}.tar
  19. - dpr
  20. - suffix=$(echo "$IMAGE" | awk -F '/' '{split($NF, a, ":"); print a[2]}')
  21. - docker images | grep "ops-api" | grep ${suffix} | awk '{print $3}' | xargs docker rmi
  22. when:
  23. target: [ "hi","prod" ]
  24. - name: deployment-replace-prod
  25. image: repository.241210.com/repository/base/kubectl:4
  26. commands:
  27. - cd web/
  28. - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  29. when:
  30. target: [ "exp","prod" ]
  31. - name: deploy-prod
  32. image: repository.241210.com/repository/base/kubectl:4
  33. commands:
  34. - cd web/
  35. - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  36. when:
  37. target: [ "exp","prod" ]