2727 with :
2828 fetch-depth : 0
2929
30- - name : Detect existing images on quay.io
30+ - name : Decide whether we should build
3131 id : detect-existing
3232 run : |
3333
@@ -37,17 +37,25 @@ jobs:
3737 # Display the current environment variables used throughout building
3838 # -- useful for debugging
3939 env_var_inventory
40+ set -x
41+
42+ if [[ "$(git log -1 --pretty=%B | head -n 1)" == *"[image skip]"* ]]; then
43+
44+ if tag_exists $BASE_BUSYBOX_IMAGE_NAME latest \
45+ && tag_exists $BASE_DEBIAN_IMAGE_NAME latest \
46+ && tag_exists $BUILD_ENV_IMAGE_NAME latest \
47+ && tag_exists $BOT_IMAGE_NAME latest \
48+ && tag_exists $ISSUE_RESPONDER_IMAGE_NAME latest \
49+ && tag_exists $CREATE_ENV_IMAGE_NAME latest; then
50+ echo "DO_BUILD=false" >> $GITHUB_OUTPUT
51+ else
52+ echo "Although '[image skip]' was used in the commit message, no images exist on quay.io to use. So images will be built."
53+ echo "DO_BUILD=true" >> $GITHUB_OUTPUT
54+ fi
4055
41- if tag_exists $BASE_BUSYBOX_IMAGE_NAME $BASE_TAG \
42- && tag_exists $BASE_DEBIAN_IMAGE_NAME $BASE_TAG \
43- && tag_exists $BUILD_ENV_IMAGE_NAME $BIOCONDA_IMAGE_TAG \
44- && tag_exists $BOT_IMAGE_NAME $BIOCONDA_IMAGE_TAG \
45- && tag_exists $ISSUE_RESPONDER_IMAGE_NAME $BIOCONDA_IMAGE_TAG \
46- && tag_exists $CREATE_ENV_IMAGE_NAME $BIOCONDA_IMAGE_TAG;
47- then
48- echo "DO_BUILD=false" >> $GITHUB_OUTPUT
4956 else
5057 echo "DO_BUILD=true" >> $GITHUB_OUTPUT
58+
5159 fi
5260
5361 build-images :
@@ -156,18 +164,21 @@ jobs:
156164 # Download tarballs created in the previous job
157165 - name : Download images as artifacts
158166 uses : actions/download-artifact@v4
167+ if : ${{ needs.detect-existing.outputs.DO_BUILD == 'true' }}
159168 with :
160169 name : image-artifacts
161170 path : image-artifacts
162171
163172 # Load those tarballs as images into podman.
164173 - name : Load image artifacts into podman
174+ if : ${{ needs.detect-existing.outputs.DO_BUILD == 'true' }}
165175 run : |
166176 for image in image-artifacts/*.tar; do
167177 podman load -i $image
168178 done
169179
170180 - name : Build & push manifests to local docker registry
181+ if : ${{ needs.detect-existing.outputs.DO_BUILD == 'true' }}
171182 run : |
172183
173184 # Source env vars and functions to be used throughout building.
@@ -221,10 +232,23 @@ jobs:
221232 # registry running on localhost (which simulates eventually using
222233 # manifests from quay.io)
223234 source images/image_config.sh
224- export DEFAULT_BASE_IMAGE="localhost:5000/${BASE_BUSYBOX_IMAGE_NAME}:${BASE_TAG}"
225- export DEFAULT_EXTENDED_BASE_IMAGE="localhost:5000/${BASE_DEBIAN_IMAGE_NAME}:${BASE_TAG}"
226- export BUILD_ENV_IMAGE="localhost:5000/${BUILD_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG}"
227- export CREATE_ENV_IMAGE="localhost:5000/${CREATE_ENV_IMAGE_NAME}:${BIOCONDA_IMAGE_TAG}"
235+
236+ # If we built images in this CI run, then use them -- otherwise use the
237+ # latest on quay.io
238+ if [ "${{ needs.detect-existing.outputs.DO_BUILD }}" == "true" ]; then
239+ registry="localhost:5000"
240+ base_tag="${BASE_TAG}"
241+ bioconda_image_tag="${BIOCONDA_IMAGE_TAG}"
242+ else
243+ registry="quay.io/bioconda/"
244+ base_tag="latest"
245+ bioconda_image_tag="latest"
246+ fi
247+
248+ export DEFAULT_BASE_IMAGE="${registry}/${BASE_BUSYBOX_IMAGE_NAME}:${base_tag}"
249+ export DEFAULT_EXTENDED_BASE_IMAGE="${registry}/${BASE_DEBIAN_IMAGE_NAME}:${base_tag}"
250+ export BUILD_ENV_IMAGE="${registry}/${BUILD_ENV_IMAGE_NAME}:${bioconda_image_tag}"
251+ export CREATE_ENV_IMAGE="${registry}/${CREATE_ENV_IMAGE_NAME}:${bioconda_image_tag}"
228252
229253 # Now that everything is set up, run the actual tests -- but only those
230254 # related to docker. The other tests are run in a different GitHub
0 commit comments