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.

55 lines
1.3 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 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. - name: test-secrt
  11. image: alpine
  12. commands:
  13. - echo "hello world"
  14. when:
  15. target: [ "test","pre" ]
  16. - name: prod deploy
  17. when:
  18. condition: ${DRONE_DEPLOY_ENABLED}
  19. environment:
  20. ENVIRONMENT: hi
  21. - name: tar-prod-push
  22. privileged: true
  23. image: registry.cn-hangzhou.aliyuncs.com/hvp/dpr:75
  24. settings:
  25. tar: ops-api-${DRONE_BUILD_NUMBER}.tar
  26. commands:
  27. - docker pull ${IMAGE}
  28. - docker save ${IMAGE} >ops-api-${DRONE_BUILD_NUMBER}.tar
  29. - dpr
  30. - suffix=$(echo "$IMAGE" | awk -F '/' '{split($NF, a, ":"); print a[2]}')
  31. - docker images | grep "ops-api" | grep ${suffix} | awk '{print $3}' | xargs docker rmi
  32. when:
  33. target: [ "hi","prod" ]
  34. - name: deployment-replace-prod
  35. image: repository.241210.com/repository/base/kubectl:4
  36. commands:
  37. - cd web/
  38. - sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
  39. when:
  40. target: [ "exp","prod" ]
  41. - name: deploy-prod
  42. image: repository.241210.com/repository/base/kubectl:4
  43. commands:
  44. - cd web/
  45. - kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
  46. when:
  47. target: [ "exp","prod" ]