diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..51fb99a --- /dev/null +++ b/.drone.yml @@ -0,0 +1,53 @@ +kind: pipeline +type: ssh # 使用SSH +name: baidu + + +server: + host: + from_secret: ssh_host + user: + from_secret: ssh_user + password: + from_secret: ssh_password + +clone: + disable: true + +steps: + - name: build + commands: + - echo build start + - date + - export PATH=$PATH:/usr/local/go/bin + - cd /root + - rm -rf WechatGateWay + - git clone https://git.sre.ink/go/WechatGateWay.git + - cd WechatGateWay + - make build-linux-arm64 + - date + - echo build end + - name: package + commands: + - echo package start + - date + - cd /root/WechatGateWay + - /bin/cp -arf /root/wx.yaml application.yaml + - docker build -t sre/wechatgateway:arm64 . + - date + - echo package end + - name: deploy + commands: + - echo deploy start + - date + - export KUBECONFIG=/etc/kubernetes/admin.conf + - kubectl rollout restart deployment -n sre wehcat-gateway + - date + - echo deploy end + - name: alert + commands: + - echo alert start + - date + - /usr/bin/wechat "wehcat-gateway deployed on k8s" + - date + - echo alert end \ No newline at end of file diff --git a/Makefile b/Makefile index 8919945..5f4c38a 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,8 @@ all: build-linux-arm64 build-linux-amd64 build-linux-arm64: - /bin/cp -arf /root/wx.yaml application.yaml CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go mod tidy CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -v -a -o wechat.bin main.go - /bin/cp -arf /usr/bin/kubectl . - /bin/cp -arf /root/.kube/config . - docker build -t sre/wechatgateway:arm64 . - kubectl rollout restart deployment -n sre wehcat-gateway build-linux-amd64: diff --git a/readme.md b/readme.md index 34d9d35..ec2d55d 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,5 @@ +[![Build Status](https://ci.yangqiao.org/api/badges/go/WechatGateWay/status.svg)](https://ci.yangqiao.org/go/WechatGateWay) + ![](https://cnjdmh6kwm1w.compat.objectstorage.ap-seoul-1.oraclecloud.com/s3/2022/07/29d6e88c6061f4d56315cb36f2c66036.png) # 接收消息与事件 https://developer.work.weixin.qq.com/document/10514 @@ -23,3 +25,13 @@ manifests/Service.yaml manifests/ingress.yaml --- ``` +old makefile: +``` + /bin/cp -arf /root/wx.yaml application.yaml + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go mod tidy + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GO111MODULE=on go build -v -a -o wechat.bin main.go + /bin/cp -arf /usr/bin/kubectl . + /bin/cp -arf /root/.kube/config . + docker build -t sre/wechatgateway:arm64 . + kubectl rollout restart deployment -n sre wehcat-gateway +``` \ No newline at end of file