Skip to content

Commit 885a5b7

Browse files
committed
Avoid running build-and-push-image.yml parallel for same commit
* If a second workflow would be triggered while the first one still runs, it would build another image. Setting the concurrency avoids that
1 parent 48a233d commit 885a5b7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

.github/workflows/build-and-push-image.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ on:
44
workflow_dispatch:
55
workflow_call:
66

7+
concurrency:
8+
group: build-and-push-image-${{ github.sha }}
9+
710
jobs:
811
check-image-presence:
912
name: Check if images already exist
@@ -24,8 +27,6 @@ jobs:
2427
echo "Dev image with given tag already exists"
2528
else
2629
echo "Dev image does not exist. Build needed"
27-
echo "$(aws ecr describe-images --repository-name mavis/webapp --image-ids imageTag=${{ github.sha }})"
28-
2930
echo "BUILD_NEEDED=true" >> $GITHUB_ENV
3031
fi
3132
- name: Configure AWS Prod credentials
@@ -40,8 +41,6 @@ jobs:
4041
echo "Prod and dev images with given tag already exist. No build needed"
4142
else
4243
echo "At least one image does not exist. Build needed"
43-
echo "$(aws ecr describe-images --repository-name mavis/webapp --image-ids imageTag=${{ github.sha }})"
44-
4544
echo "BUILD_NEEDED=true" >> $GITHUB_OUTPUT
4645
fi
4746

0 commit comments

Comments
 (0)