ci: fix on demand condition

This commit is contained in:
Zijian Zhang 2025-07-09 21:19:15 +08:00
parent 8e201ef3e2
commit a70cd28f8f
1 changed files with 3 additions and 3 deletions

View File

@ -6,6 +6,9 @@ GIT_COMMIT_SHA=${GIT_COMMIT_SHA:?"GIT_COMMIT_SHA is not set"}
echo "GIT_COMMIT_SHA: $GIT_COMMIT_SHA"
RUN_ID="areal-$GIT_COMMIT_SHA"
cd "/tmp/$RUN_ID"
# If there is already an image for the current environment, skip the build.
ENV_SHA=$(sha256sum pyproject.toml | awk '{print $1}')
if docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "areal-env:$ENV_SHA"; then
@ -13,9 +16,6 @@ if docker images --format '{{.Repository}}:{{.Tag}}' | grep -q "areal-env:$ENV_S
exit 0
fi
RUN_ID="areal-$GIT_COMMIT_SHA"
cd "/tmp/$RUN_ID"
if docker ps -a --format '{{.Names}}' | grep -q "$RUN_ID"; then
docker rm -f $RUN_ID
fi