diff --git a/.github/workflows/dev2.0.yaml b/.github/workflows/dev2.0.yaml new file mode 100644 index 000000000..213fec300 --- /dev/null +++ b/.github/workflows/dev2.0.yaml @@ -0,0 +1,99 @@ +name: arkid v2 cicd + +on: + workflow_dispatch: + push: + branches: + - v2-dev + paths-ignore: + - 'docs/**' + - 'kustomize/**' + - 'README.md' + - '.github/**' +jobs: + dev2test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + - name: Login harbor + uses: docker/login-action@v1 + with: + registry: harbor.longguikeji.com + username: ${{ secrets.HARBORUSER }} + password: ${{ secrets.HARBORPWD }} + - name: Login to Docker Hub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUBUSERNAME }} + password: ${{ secrets.DOCKERHUBPWD }} + - id: get-short-id + run: | + id=$(echo ${{github.sha}}) + echo "::set-output name=id::${id: 0 :8}" + - run: echo "${{steps.get-short-id.outputs.id}}" + - id: set-pip + run: | + sed -i "s@https://mirrors.aliyun.com/pypi/simple@https://pypi.python.org/simple@g" requirements.txt; + sed -i "s@https://mirrors.aliyun.com/pypi/simple@https://pypi.python.org/simple@g" requirements-dev.txt; + - name: Build and push dockerhub + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64 + build-args: | + DEBIAN=http://deb.debian.org/debian + DEBIANSRT=http://security.debian.org/debian-security + PIP="-i https://pypi.python.org/simple" + push: true + tags: | + longguikeji/arkid:v2dev-${{ github.run_number }}-${{steps.get-short-id.outputs.id}} + longguikeji/arkid:v2dev-${{ github.run_number }} + longguikeji/arkid:v2dev + - name: deploy to cluster dockerhub + uses: steebchen/kubectl@v2.0.0 + with: # defaults to latest kubectl binary version + config: ${{ secrets.KUBE_CONFIG_HW }} + command: -n demo-arkidv2 --insecure-skip-tls-verify=true set image --record deployment/demo-arkidv2-be cpextensionroot=longguikeji/arkid:v2dev-${{ github.run_number }} arkid-be=longguikeji/arkid:v2dev-${{ github.run_number }} + - name: Build and push harbor + uses: docker/build-push-action@v2 + with: + context: . + platforms: linux/amd64 + build-args: | + DEBIAN=http://deb.debian.org/debian + DEBIANSRT=http://security.debian.org/debian-security + PIP="-i https://pypi.python.org/simple" + push: true + tags: | + ${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }}-${{steps.get-short-id.outputs.id}} + ${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }} + ${{ secrets.ARK_DEV }}/arkid:v2dev + longguikeji/arkid + - name: deploy to cluster harbor + uses: steebchen/kubectl@v2.0.0 + with: # defaults to latest kubectl binary version + config: ${{ secrets.KUBE_CONFIG_HW }} + command: -n demo-arkidv2 --insecure-skip-tls-verify=true set image --record deployment/demo-arkidv2-be cpextensionroot=${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }} arkid-be=${{ secrets.ARK_DEV }}/arkid:v2dev-${{ github.run_number }} + - name: Feishu 报忧 + if: ${{ failure() }} + uses: wangsijie/feishu-bot@v1 + with: + uuid: ${{ secrets.FEISHU_UUID }} + data: | + {"msg_type":"post","content":{"post":{"zh_cn":{"title":"${{ github.event.repository.name }}流水线状态通知", + "content":[[{"tag":"text","text":"${{ github.event.repository.name }} 项目流水线有更新: "}, + {"tag":"a","text":"${{ github.event.ref }}分支构建失败,点击查看具体日志","href":"https://github.com/${{ github.repository }}/actions/workflows/dev.yml"}]]}}}} + - name: Feishu 报喜 + if: ${{ success() }} + uses: wangsijie/feishu-bot@v1 + with: + uuid: ${{ secrets.FEISHU_UUID }} + data: | + {"msg_type":"post","content":{"post":{"zh_cn":{"title": "${{ github.event.repository.name }}流水线状态通知", + "content":[[{"tag":"text","text":"${{ github.event.repository.name }} 项目流水线有更新: "}, + {"tag":"a","text":"${{ github.event.ref }}分支构建并部署成功,点击查看部署后的效果","href":"${{ secrets.ENV_DEV }}"}]]}}}}