From 846e8827db4dd6143fc7d5bbc2a35570ef5d9665 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 22:32:16 +0800 Subject: [PATCH 01/10] =?UTF-8?q?:sparkles:=E5=A2=9E=E5=8A=A0=E2=80=98?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E2=80=99=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/apps/base/management/commands/initializedb_open.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/projects/main/apps/base/management/commands/initializedb_open.py b/server/projects/main/apps/base/management/commands/initializedb_open.py index b5113fa89..a57d02fee 100644 --- a/server/projects/main/apps/base/management/commands/initializedb_open.py +++ b/server/projects/main/apps/base/management/commands/initializedb_open.py @@ -42,7 +42,7 @@ def handle(self, *args, **options): ExecTag.objects.get_or_create(name=name) ExecTag.objects.filter(name__in=tag_names).update(public=True) self.stdout.write("新增规则标签...") - label_names = ["基础", "推荐", "通用", "开源", "规范", "安全"] + label_names = ["基础", "推荐", "通用", "开源", "规范", "安全", "增强"] for name in label_names: conf_models.Label.objects.get_or_create(name=name) self.stdout.write("初始化语言...") From f5450e35cc7efb4a80eaa79167ff61d8fb2a5c07 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 22:32:42 +0800 Subject: [PATCH 02/10] =?UTF-8?q?:art:=E5=A2=9E=E5=8A=A0=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=AD=89=E5=BE=85=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/projects/main/bin/wait.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 server/projects/main/bin/wait.sh diff --git a/server/projects/main/bin/wait.sh b/server/projects/main/bin/wait.sh new file mode 100644 index 000000000..5dd650319 --- /dev/null +++ b/server/projects/main/bin/wait.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +function wait_for_service(){ + SERVICE=${1/:/' '} + until nc -vz $SERVICE > /dev/null; do + >&2 echo "$SERVICE is unavailable - sleeping" + sleep 2 + done + >&2 echo "$SERVICE is up" +} + +function wait_for() { + for service in "$@" + do + wait_for_service $service + done +} + +wait_for "$@" \ No newline at end of file From 20f995950d01d46bd2b67139b364406df46f8d65 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 22:45:47 +0800 Subject: [PATCH 03/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index af49a760a..67278e395 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -9,6 +9,34 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - dockerfile: ./projects/server/main/Dockfile + context: ./projects/server/main + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-main + - dockerfile: ./projects/server/analysis/Dockfile + context: ./projects/server/analysis + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-analysis + - dockerfile: ./projects/server/login/Dockfile + context: ./projects/server/login + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-login + - dockerfile: ./projects/server/file/Dockfile + context: ./projects/server/file + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-file + - dockerfile: ./projects/server/scmproxy/Dockfile + context: ./projects/server/scmproxy + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-scmproxy + - dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror + context: ./web/tca-deploy-source + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-web + - dockerfile: ./client/Dockerfile + context: ./client + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-client + - dockerfile: ./Dockerfile + context: . + image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-client steps: # 1. 检出 @@ -34,12 +62,12 @@ jobs: id: docker_build uses: docker/build-push-action@v2 with: - context: ./ - file: ./Dockerfile + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} platforms: linux/amd64, linux/arm64 - push: true + push: false tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/tca:${{ github.event.release.name }} - if: ${{ github.event_name == 'release' }} + if: ${{ github.event_name == 'workflow_dispatch' }} - name: Build and push with beta tag id: docker_build_beta From b7092c73eaa95f69c3489c0c1bdafc48cb05037f Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 22:51:17 +0800 Subject: [PATCH 04/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 67278e395..6dbae3ed5 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -15,28 +15,28 @@ jobs: include: - dockerfile: ./projects/server/main/Dockfile context: ./projects/server/main - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-main + image: tca-main - dockerfile: ./projects/server/analysis/Dockfile context: ./projects/server/analysis - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-analysis + image: tca-analysis - dockerfile: ./projects/server/login/Dockfile context: ./projects/server/login - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-login + image: tca-login - dockerfile: ./projects/server/file/Dockfile context: ./projects/server/file - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-file + image: tca-file - dockerfile: ./projects/server/scmproxy/Dockfile context: ./projects/server/scmproxy - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-scmproxy + image: tca-scmproxy - dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror context: ./web/tca-deploy-source - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-web + image: tca-web - dockerfile: ./client/Dockerfile context: ./client - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-client + image: tca-client - dockerfile: ./Dockerfile context: . - image: ${{ secrets.DOCKER_HUB_USERNAME }}/tca-client + image: tca steps: # 1. 检出 @@ -66,7 +66,7 @@ jobs: file: ${{ matrix.dockerfile }} platforms: linux/amd64, linux/arm64 push: false - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/tca:${{ github.event.release.name }} + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} if: ${{ github.event_name == 'workflow_dispatch' }} - name: Build and push with beta tag From 02c08521f83ec647359cd8135cb77db0ef4523f1 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 22:53:41 +0800 Subject: [PATCH 05/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 6dbae3ed5..286571a5a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -66,7 +66,8 @@ jobs: file: ${{ matrix.dockerfile }} platforms: linux/amd64, linux/arm64 push: false - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest + #tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} if: ${{ github.event_name == 'workflow_dispatch' }} - name: Build and push with beta tag From fc149443c4c44fdac75062a76a158dcaaf1298c4 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 22:59:05 +0800 Subject: [PATCH 06/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 286571a5a..59553749c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -13,20 +13,20 @@ jobs: fail-fast: false matrix: include: - - dockerfile: ./projects/server/main/Dockfile - context: ./projects/server/main + - dockerfile: ./server/projects/main/Dockfile + context: ./server/projects/main image: tca-main - - dockerfile: ./projects/server/analysis/Dockfile - context: ./projects/server/analysis + - dockerfile: ./server/projects/analysis/Dockfile + context: ./server/projects/analysis image: tca-analysis - - dockerfile: ./projects/server/login/Dockfile - context: ./projects/server/login + - dockerfile: ./server/projects/login/Dockfile + context: ./server/projects/login image: tca-login - - dockerfile: ./projects/server/file/Dockfile - context: ./projects/server/file + - dockerfile: ./server/projects/file/Dockfile + context: ./server/projects/file image: tca-file - - dockerfile: ./projects/server/scmproxy/Dockfile - context: ./projects/server/scmproxy + - dockerfile: ./server/projects/scmproxy/Dockfile + context: ./server/projects/scmproxy image: tca-scmproxy - dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror context: ./web/tca-deploy-source @@ -52,10 +52,10 @@ jobs: # 3. 设置 docker 环境 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 # 4. 构建并推送镜像 - name: Build and push with latest tag and release tag From bbacd89eab75b5e6a9e5fd94ed0bf5b4f434f89c Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 23:03:27 +0800 Subject: [PATCH 07/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 59553749c..cc6ce372a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -14,25 +14,25 @@ jobs: matrix: include: - dockerfile: ./server/projects/main/Dockfile - context: ./server/projects/main + context: ./server/projects/main/ image: tca-main - dockerfile: ./server/projects/analysis/Dockfile - context: ./server/projects/analysis + context: ./server/projects/analysis/ image: tca-analysis - dockerfile: ./server/projects/login/Dockfile - context: ./server/projects/login + context: ./server/projects/login/ image: tca-login - dockerfile: ./server/projects/file/Dockfile - context: ./server/projects/file + context: ./server/projects/file/ image: tca-file - dockerfile: ./server/projects/scmproxy/Dockfile - context: ./server/projects/scmproxy + context: ./server/projects/scmproxy/ image: tca-scmproxy - dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror - context: ./web/tca-deploy-source + context: ./web/tca-deploy-source/ image: tca-web - dockerfile: ./client/Dockerfile - context: ./client + context: ./client/ image: tca-client - dockerfile: ./Dockerfile context: . From 1b2092871356a2f7b4106ab8c9bd506fde3660ae Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 23:06:01 +0800 Subject: [PATCH 08/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index cc6ce372a..5ddb1027f 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -13,19 +13,19 @@ jobs: fail-fast: false matrix: include: - - dockerfile: ./server/projects/main/Dockfile + - dockerfile: ./server/projects/main/Dockerfile context: ./server/projects/main/ image: tca-main - - dockerfile: ./server/projects/analysis/Dockfile + - dockerfile: ./server/projects/analysis/Dockerfile context: ./server/projects/analysis/ image: tca-analysis - - dockerfile: ./server/projects/login/Dockfile + - dockerfile: ./server/projects/login/Dockerfile context: ./server/projects/login/ image: tca-login - - dockerfile: ./server/projects/file/Dockfile + - dockerfile: ./server/projects/file/Dockerfile context: ./server/projects/file/ image: tca-file - - dockerfile: ./server/projects/scmproxy/Dockfile + - dockerfile: ./server/projects/scmproxy/Dockerfile context: ./server/projects/scmproxy/ image: tca-scmproxy - dockerfile: ./server/dockerconfs/Dockerfile-nginx-mirror From 80adac8996444c1f580e040790f033b4f8693a99 Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 23:07:03 +0800 Subject: [PATCH 09/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 5ddb1027f..44caed237 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -64,22 +64,22 @@ jobs: with: context: ${{ matrix.context }} file: ${{ matrix.dockerfile }} - platforms: linux/amd64, linux/arm64 + platforms: linux/amd64 push: false tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest #tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} if: ${{ github.event_name == 'workflow_dispatch' }} - - name: Build and push with beta tag - id: docker_build_beta - uses: docker/build-push-action@v2 - with: - context: ./ - file: ./Dockerfile - platforms: linux/amd64, linux/arm64 - push: true - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:beta - if: ${{ github.event_name == 'workflow_dispatch' }} + # - name: Build and push with beta tag + # id: docker_build_beta + # uses: docker/build-push-action@v2 + # with: + # context: ./ + # file: ./Dockerfile + # platforms: linux/amd64, linux/arm64 + # push: true + # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:beta + # if: ${{ github.event_name == 'workflow_dispatch' }} # 5. 打印docker镜像SHA256值 - name: Image digest From e426dc9681bd709766e7ec332e95d5598c9650cd Mon Sep 17 00:00:00 2001 From: Lingghh Date: Thu, 24 Nov 2022 23:12:37 +0800 Subject: [PATCH 10/10] =?UTF-8?q?:art:=E8=B0=83=E6=95=B4github=20=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/push.yml | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 44caed237..abd7421d9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -64,22 +64,21 @@ jobs: with: context: ${{ matrix.context }} file: ${{ matrix.dockerfile }} - platforms: linux/amd64 - push: false - tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest - #tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} - if: ${{ github.event_name == 'workflow_dispatch' }} + platforms: linux/amd64, linux/arm64 + push: true + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:latest, ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:${{ github.event.release.name }} + if: ${{ github.event_name == 'release' }} - # - name: Build and push with beta tag - # id: docker_build_beta - # uses: docker/build-push-action@v2 - # with: - # context: ./ - # file: ./Dockerfile - # platforms: linux/amd64, linux/arm64 - # push: true - # tags: ${{ secrets.DOCKER_HUB_USERNAME }}/tca:beta - # if: ${{ github.event_name == 'workflow_dispatch' }} + - name: Build and push with beta tag + id: docker_build_beta + uses: docker/build-push-action@v2 + with: + context: ${{ matrix.context }} + file: ${{ matrix.dockerfile }} + platforms: linux/amd64, linux/arm64 + push: true + tags: ${{ secrets.DOCKER_HUB_USERNAME }}/${{ matrix.image }}:beta + if: ${{ github.event_name == 'workflow_dispatch' }} # 5. 打印docker镜像SHA256值 - name: Image digest