11 Commits

Author SHA1 Message Date
zhipeng.hu f165b7444b drone1sssss 1 year ago
zhipeng.hu 156bbf7b59 drone1ss 1 year ago
zhipeng.hu 6896fe034d drone1ss 1 year ago
zhipeng.hu 42f75fc8c2 drone1 1 year ago
zhipeng.hu d3c79f1c2b drone1 1 year ago
zhipeng.hu aeab31d82a drone1 1 year ago
zhipeng.hu b8f9b7fe74 drone 1 year ago
zhipeng.hu 738afef916 drone 1 year ago
zhipeng.hu 859a5b395d drone 1 year ago
zhipeng.hu 8d4b0284d5 drone 1 year ago
zhipeng.hu b43cbd9e5c drone 1 year ago
  1. 40
      .drone.yml
  2. 3
      main.go

40
.drone.yml

@ -2,12 +2,10 @@
kind: pipeline kind: pipeline
type: docker type: docker
name: default name: default
volumes: volumes:
- name: gopath - name: gopath
host: host:
path: /usr/local/path/gopath path: /usr/local/path/gopath
steps: steps:
- name: golang-build - name: golang-build
image: golang:1.17-alpine3.15 image: golang:1.17-alpine3.15
@ -18,41 +16,3 @@ steps:
- echo "hello world" - echo "hello world"
when: when:
target: [ "test","pre" ] target: [ "test","pre" ]
- name: prod-deploy
image: alpine:3.10
when:
condition: ${DRONE_DEPLOY_ENABLED}
target: [ "test","pre" ]
environment:
ENVIRONMENT: "hi"
- name: tar-prod-push
privileged: true
image: registry.cn-hangzhou.aliyuncs.com/hvp/dpr:75
settings:
tar: ops-api-${DRONE_BUILD_NUMBER}.tar
commands:
- suffix=$(echo "${IMAGE}" | awk -F '/' '{split($NF, a, ":"); print a[2]}')
- echo ${suffix}
- docker images | grep "ops-api" | grep ${suffix} | awk '{print $3}' | xargs docker rmi
when:
target: [ "hi","prod" ]
- name: deployment-replace-prod
image: repository.241210.com/repository/base/kubectl:4
commands:
- cd web/
- sed -i 's!IMAGE_PATH:IMAGE_TAG!'${IMAGE}'!g' deployment.yaml
when:
target: [ "exp","prod" ]
- name: deploy-prod
image: repository.241210.com/repository/base/kubectl:4
commands:
- cd web/
- kubectl --kubeconfig /kube/${CI_BUILD_TARGET} apply -f deployment.yaml
when:
target: [ "exp","prod" ]

3
main.go

@ -5,5 +5,6 @@ import "fmt"
// 入口函数 // 入口函数
func main() { func main() {
// 初始化一个http服务对象 // 初始化一个http服务对象
fmt.Println("ssss1")
fmt.Println("ssss")
//01s
} }
Loading…
Cancel
Save