23 lines
771 B
Bash
23 lines
771 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
RUSTFS_ENDPOINT=${RUSTFS_ENDPOINT:-http://localhost:8080}
|
|
BUCKET=${BUCKET:-export-ci}
|
|
TMP=$(mktemp)
|
|
cleanup(){ rm -f "$TMP"; }
|
|
trap cleanup EXIT
|
|
|
|
cat > "$TMP" <<'DATA'
|
|
{"id":"exp-001","object":"s3://export-ci/sample-export.ndjson","status":"ready"}
|
|
DATA
|
|
|
|
# RustFS uses S3-compatible API
|
|
export AWS_ACCESS_KEY_ID="${AWS_ACCESS_KEY_ID:-exportci}"
|
|
export AWS_SECRET_ACCESS_KEY="${AWS_SECRET_ACCESS_KEY:-exportci123}"
|
|
export AWS_EC2_METADATA_DISABLED=true
|
|
|
|
if ! aws --endpoint-url "$RUSTFS_ENDPOINT" s3 ls "s3://$BUCKET" >/dev/null 2>&1; then
|
|
aws --endpoint-url "$RUSTFS_ENDPOINT" s3 mb "s3://$BUCKET"
|
|
fi
|
|
aws --endpoint-url "$RUSTFS_ENDPOINT" s3 cp "$TMP" "s3://$BUCKET/sample-export.ndjson"
|
|
echo "Seeded $BUCKET/sample-export.ndjson"
|