Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(build): add support for custom build service account in Cloud Build submissions

fudjiaaa4161e1c441
diff --git a/deploy/world/apply-hardening.sh b/deploy/world/apply-hardening.sh
index eff60e1d6..27caa0a1b 100755
--- a/deploy/world/apply-hardening.sh
+++ b/deploy/world/apply-hardening.sh
@@ -20,6 +20,13 @@ REGION=us-central1
SERVICE=hyperfy-world
RUNTIME_SA=hyperfy-world-sa@${PROJECT}.iam.gserviceaccount.com
SECRET=hyperfy-admin-code
+# Build identity for `gcloud builds submit`. This project has no legacy Cloud
+# Build service account (newer GCP projects don't auto-create
+# <projectNumber>@cloudbuild.gserviceaccount.com), so an unqualified submit fails
+# with "Unknown service account". Build as the dedicated build SA the other
+# images use; override with BUILD_SERVICE_ACCOUNT if it's renamed. The
+# cloudbuild.yaml sets logging: CLOUD_LOGGING_ONLY, which a user-specified SA needs.
+BUILD_SA=${BUILD_SERVICE_ACCOUNT:-three-ws-build@${PROJECT}.iam.gserviceaccount.com}
gcloud config set project "$PROJECT" >/dev/null
@@ -39,7 +46,9 @@ echo "Granted secretAccessor to $RUNTIME_SA."
# Rebuild the image: picks up the pinned upstream ref and the server-side
# upload-size patch in patches/.
-gcloud builds submit --config deploy/world/cloudbuild.yaml deploy/world/
+gcloud builds submit --config deploy/world/cloudbuild.yaml \
+ --service-account="projects/${PROJECT}/serviceAccounts/${BUILD_SA}" \
+ deploy/world/
# Apply the service config: ADMIN_CODE + PUBLIC_MAX_UPLOAD_SIZE=16.
gcloud run services replace deploy/world/cloudrun.yaml --region="$REGION"
diff --git a/scripts/deploy-sniper.mjs b/scripts/deploy-sniper.mjs
index 5e9ef1cfb..a17583743 100644
--- a/scripts/deploy-sniper.mjs
+++ b/scripts/deploy-sniper.mjs
@@ -44,6 +44,14 @@ const REGION = process.env.GCP_REGION || 'us-central1';
const REPO = 'workers'; // Artifact Registry repo (shared by the worker images)
const SERVICE = 'agent-sniper';
const RUNTIME_SA = `agent-sniper-sa@${PROJECT}.iam.gserviceaccount.com`;
+// Build identity for `gcloud builds submit`. This project has no legacy Cloud
+// Build service account (newer GCP projects don't auto-create
+// <projectNumber>@cloudbuild.gserviceaccount.com), so an unqualified submit fails
+// with "Unknown service account". Run the build as the dedicated build SA the
+// other images already use; override with BUILD_SERVICE_ACCOUNT if it's renamed.
+// The cloudbuild.yaml sets `logging: CLOUD_LOGGING_ONLY`, which a user-specified
+// build SA requires (no default logs bucket).
+const BUILD_SA = process.env.BUILD_SERVICE_ACCOUNT || `three-ws-build@${PROJECT}.iam.gserviceaccount.com`;
const CLOUDBUILD = 'deploy/sniper/cloudbuild.yaml';
const CLOUDRUN = 'deploy/sniper/cloudrun.yaml';
@@ -155,7 +163,12 @@ function checkSecrets() {
function build() {
if (SKIP_BUILD) { warn('--skip-build: reusing the current :latest image'); return; }
log('building + pushing image via Cloud Build (this can take several minutes)…');
- const r = gcloud(['builds', 'submit', `--config=${CLOUDBUILD}`, '.']);
+ const r = gcloud([
+ 'builds', 'submit',
+ `--config=${CLOUDBUILD}`,
+ `--service-account=projects/${PROJECT}/serviceAccounts/${BUILD_SA}`,
+ '.',
+ ]);
if (r.status !== 0) die('Cloud Build failed — see the build logs above');
ok('image built + pushed');
}