Skip to content

Commit ad141e2

Browse files
committed
chore(ci): azurite for azure store test
1 parent 8a864b8 commit ad141e2

1 file changed

Lines changed: 38 additions & 21 deletions

File tree

.github/workflows/_build.yaml

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -147,25 +147,11 @@ jobs:
147147
BUILD_STAMP: ${{ inputs.build_stamp }}
148148
run: ${{ matrix.builder_cmd }} build --verbose --autoinstall --version="$FULL_VERSION" --hash="$BUILD_HASH" --stamp="$BUILD_STAMP" ${{ inputs.nodownload && '--nodownload' || '' }}
149149

150-
# -----------------------------------------------------------------------
151-
# MinIO for the S3Store integration tests (Linux only).
152-
#
153-
# packages/ai/tests/ai/account/test_store.py gates the live-S3 cases on
154-
# `pytest.importorskip('boto3')` + ROCKETRIDE_TEST_S3_ACCESS_KEY_ID, so
155-
# they skip unless a real S3 endpoint is wired up. We give them a local
156-
# MinIO. Service containers / docker aren't available on the win/macOS
157-
# runners, so this is Ubuntu-only; the tests skip cleanly elsewhere.
158-
#
159-
# continue-on-error + writing the test vars to $GITHUB_ENV ONLY after
160-
# MinIO is confirmed healthy and the bucket exists: if anything here
161-
# fails the vars stay unset → the S3 tests skip → a MinIO hiccup can
162-
# never block a CI or release build.
163-
# (minio:latest is intentional — a stale pinned RELEASE tag would 404
164-
# and silently skip the suite; revisit pinning once we mirror the image.)
165-
# -----------------------------------------------------------------------
166-
- name: Start MinIO for S3Store tests (Linux)
150+
# MinIO for S3Store integration tests (Linux only). Env vars are exported
151+
# to $GITHUB_ENV only after MinIO is healthy; S3 tests gate on those vars
152+
# so they skip on win/macOS.
153+
- name: Start MinIO for tests / Linux
167154
if: matrix.platform == 'ubuntu' && inputs.codeql == false
168-
continue-on-error: true
169155
env:
170156
AWS_ACCESS_KEY_ID: minioadmin
171157
AWS_SECRET_ACCESS_KEY: minioadmin
@@ -180,13 +166,12 @@ jobs:
180166
sleep 2
181167
done
182168
[ "${ready:-}" = "1" ] || { echo "MinIO did not become ready"; docker logs minio || true; exit 1; }
183-
# Create the bucket + smoke a put/get so the backend is proven even
184-
# before the S3Store tests land on develop (they live on feat/deploy-v2).
169+
# Create bucket and smoke put/get.
185170
aws --endpoint-url http://localhost:9000 s3 mb s3://rocketride-test
186171
printf 'minio smoke\n' > /tmp/minio-smoke.txt
187172
aws --endpoint-url http://localhost:9000 s3 cp /tmp/minio-smoke.txt s3://rocketride-test/smoke.txt
188173
aws --endpoint-url http://localhost:9000 s3 ls s3://rocketride-test/
189-
# Expose the test vars (read by test_store.py) only now that S3 is live.
174+
# Export test vars only once S3 is live.
190175
{
191176
echo "ROCKETRIDE_TEST_S3_ENDPOINT=http://localhost:9000"
192177
echo "ROCKETRIDE_TEST_S3_REGION=us-east-1"
@@ -195,6 +180,38 @@ jobs:
195180
echo "ROCKETRIDE_TEST_S3_BUCKET=rocketride-test"
196181
} >> "$GITHUB_ENV"
197182
183+
# Azurite for AzureBlobStore integration tests (Linux only). Health check
184+
# via nc (no dedicated endpoint). Account key is Azurite's public dev
185+
# credential — not a secret. Env vars exported to $GITHUB_ENV only after
186+
# Azurite is live; Azure tests gate on those vars, so they skip on win/macOS.
187+
- name: Start Azurite for tests / Linux
188+
if: matrix.platform == 'ubuntu' && inputs.codeql == false
189+
run: |
190+
set -euo pipefail
191+
docker run -d --name azurite -p 10000:10000 \
192+
mcr.microsoft.com/azure-storage/azurite \
193+
azurite-blob --blobHost 0.0.0.0 --skipApiVersionCheck
194+
for i in $(seq 1 30); do
195+
if nc -z localhost 10000 2>/dev/null; then ready=1; break; fi
196+
sleep 2
197+
done
198+
[ "${ready:-}" = "1" ] || { echo "Azurite did not become ready"; docker logs azurite || true; exit 1; }
199+
# Smoke-test Azure Blob.
200+
AZURITE_ACCOUNT_KEY="Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==" # gitleaks:allow — Azurite's public dev key, documented at learn.microsoft.com/azure/storage/common/storage-use-azurite
201+
AZURITE_CONN_STR="DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=${AZURITE_ACCOUNT_KEY};BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;"
202+
az storage container create --name azurite-smoke --connection-string "$AZURITE_CONN_STR"
203+
printf 'azurite smoke\n' > /tmp/azurite-smoke.txt
204+
az storage blob upload --container-name azurite-smoke --name smoke.txt --file /tmp/azurite-smoke.txt --connection-string "$AZURITE_CONN_STR"
205+
az storage blob list --container-name azurite-smoke --connection-string "$AZURITE_CONN_STR" --output table
206+
# Export test vars only once Azurite is live.
207+
{
208+
echo "ROCKETRIDE_TEST_AZURE_DEFAULT_PROTOCOL=http"
209+
echo "ROCKETRIDE_TEST_AZURE_ACCOUNT_NAME=devstoreaccount1"
210+
echo "ROCKETRIDE_TEST_AZURE_ACCOUNT_KEY=${AZURITE_ACCOUNT_KEY}"
211+
echo "ROCKETRIDE_TEST_AZURE_BLOB_ENDPOINT=http://127.0.0.1:10000/devstoreaccount1"
212+
echo "ROCKETRIDE_TEST_AZURE_CONTAINER=rocketride-test"
213+
} >> "$GITHUB_ENV"
214+
198215
- name: Test
199216
if: inputs.codeql == false
200217
# Integration tests boot a local server on :5565 and connect a test

0 commit comments

Comments
 (0)