From ecfea845c2be440ca143fd5d9ea97c2ddc1de969 Mon Sep 17 00:00:00 2001 From: zhangwenjian Date: Sun, 23 Aug 2026 14:11:49 +0800 Subject: [PATCH] =?UTF-8?q?ci=F0=9F=94=A7:=20run=20one=20deploy=20at=20a?= =?UTF-8?q?=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two merges seconds apart raced. Both runs do docker rm -f then docker run; the second removed the container the first had just created, and the first's docker run failed on the name conflict: Conflict. The container name "/go-admin-api" is already in use The deploy went red and the demo stayed on the older image, which is the worse half: a failure that leaves the wrong version running. Grouping by ref serialises pushes to master while leaving pull request runs independent, since those carry their own ref. --- .github/workflows/build.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfaad7ca..e6a69879 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,14 @@ on: pull_request: branches: [ master ] +# One deploy at a time. Two merges seconds apart raced here: both runs did +# docker rm -f then docker run, the second removed the container the first had +# just created, and the first's docker run then failed on a name conflict - +# leaving the demo on the older image with a red deploy. +concurrency: + group: deploy-${{ github.ref }} + cancel-in-progress: false + env: IMAGE_NAME: registry.ap-northeast-1.aliyuncs.com/go-admin/go-admin-api # 镜像名称 TAG: ${{ github.sha }}