Skip to content

Commit 31c69c7

Browse files
committed
CC-36444: added early return when cache folder is empty
1 parent 1aeacb0 commit 31c69c7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

bin/sdk/images/prepopulate-composer-cache.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ fi
1313

1414
COMPOSER_CACHE_DIR=$(composer config cache-dir)
1515

16-
echo "Pre-populating Docker BuildKit cache from ${COMPOSER_CACHE_DIR}"
17-
18-
if [ ! -d "${COMPOSER_CACHE_DIR}" ]; then
19-
echo "Warning: Composer cache directory ${COMPOSER_CACHE_DIR} does not exist. Skipping pre-population."
16+
if [ -z "$(ls -A "${COMPOSER_CACHE_DIR}" 2>/dev/null | grep -v '^\.htaccess$')" ]; then
17+
echo "Warning: Composer cache directory ${COMPOSER_CACHE_DIR} is empty (excluding .htaccess). Skipping pre-population."
2018
exit 0
2119
fi
2220

21+
echo "Pre-populating Docker BuildKit cache from ${COMPOSER_CACHE_DIR}"
22+
2323
# Create a temporary directory for the build context
2424
TEMP_CONTEXT=$(mktemp -d)
2525
trap "rm -rf ${TEMP_CONTEXT}" EXIT

0 commit comments

Comments
 (0)