File tree Expand file tree Collapse file tree 1 file changed +13
-7
lines changed
Expand file tree Collapse file tree 1 file changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -122,14 +122,20 @@ jobs:
122122
123123 - name : Lock Check and Creation
124124 run : |
125- echo "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${GIT_SHA}.txt
126- if gcloud storage cp ${GIT_SHA}.txt gs://${GCP_DOCKER_BUILD_LOCK_BUCKET}/${GIT_SHA}.txt --if-not-exists; then
127- echo "Lock created successfully"
128- else
129- echo "Lock already exists"
130- echo "Checkback when the following workflow is finished building images: "
131- gcloud storage cat gs://${GCP_DOCKER_BUILD_LOCK_BUCKET}/${GIT_SHA}.txt
125+ set +e
126+ gcloud storage ls gs://${{ env.GCP_DOCKER_BUILD_LOCK_BUCKET }}/${{ env.GIT_SHA }}.txt
127+ result=$?
128+ set -e
129+ if [ $result -eq 0 ]; then
130+ echo "Lock file exists: Current workflow building: "
131+ gcloud storage cat gs://${{ env.GCP_DOCKER_BUILD_LOCK_BUCKET }}/${{ env.GIT_SHA }}.txt
132+ echo "Rerun again when the image is finished building"
132133 exit 1
134+ else
135+ echo "Lock file does not exist"
136+ echo "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" > ${GIT_SHA}.txt
137+ gcloud storage cp ${GIT_SHA}.txt gs://${GCP_DOCKER_BUILD_LOCK_BUCKET}/${GIT_SHA}.txt
138+ echo "Docker Build locked"
133139 fi
134140
135141 - name : Build and Push Rust images
You can’t perform that action at this time.
0 commit comments