feat(2): lasuite-drive setup creates MinIO bucket via createbuckets one-shot

In-flight Q3.2 iteration (NOT yet live-verified — needs a lasuite-drive deploy
once the warm keycloak from Phase 2w is available). Phase 2 paused here per
operator interjection of Phase 2w; state preserved.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-28 23:08:11 +01:00
parent 534cd7066c
commit 66e065dff5

View File

@ -31,6 +31,27 @@ KC_SECRET=$(jq -r '.keycloak.client_secret' "$CCCI_DEPS_FILE")
echo " lasuite-drive setup_custom_tests: wiring OIDC against keycloak dep ${KC_DOMAIN}"
# 0) Recipe post-deploy setup (lasuite-drive README): the deploy alone does NOT create the MinIO
# bucket — `minio-createbuckets` is a `replicas:0` one-shot that must be triggered. The MinIO
# storage test asserts the bucket exists, so create it here. We scale the one-shot to 1 directly
# (deterministic) rather than the README's finicky `abra app restart` (which it notes "will appear
# to fail"). (DB `backend migrate` is the README's other documented step; not run here because
# neither current test needs a migrated DB — add it when an upload-via-app test does.)
STACK=$(printf '%s' "$CCCI_APP_DOMAIN" | tr '.' '_')
echo " setup: creating MinIO bucket via the minio-createbuckets one-shot (scale 0->1)"
docker service scale "${STACK}_minio-createbuckets=1" >/dev/null 2>&1 || true
# Wait up to 90s for the one-shot to create the bucket (mc mb drive/drive-media-storage; exit 0).
# Poll by checking the bucket directly from the running minio replica container.
for i in $(seq 1 30); do
MC_CID=$(docker ps -q -f "name=${STACK}_minio.1" | head -1)
if [ -n "$MC_CID" ] && docker exec "$MC_CID" sh -c \
'mc alias set _c http://localhost:9000 "$(cat /run/secrets/minio_ru)" "$(cat /run/secrets/minio_rp)" >/dev/null 2>&1 && mc ls _c/drive-media-storage >/dev/null 2>&1'; then
echo " setup: bucket drive-media-storage present after ${i} poll(s)"
break
fi
sleep 3
done
# 1) Insert the OIDC client secret at a bumped version (the recipe-maintainer pattern; abra already
# generated oidc_rpcs:v1 randomly and swarm forbids overwriting a secret at the same version).
ENV_PATH="$HOME/.abra/servers/default/${CCCI_APP_DOMAIN}.env"