Skip to content

fix(functions): use endpoint service accounts for Eventarc IAM#10536

Open
IzaakGough wants to merge 4 commits into
mainfrom
@invertase/fix-set-global-options-iam
Open

fix(functions): use endpoint service accounts for Eventarc IAM#10536
IzaakGough wants to merge 4 commits into
mainfrom
@invertase/fix-set-global-options-iam

Conversation

@IzaakGough
Copy link
Copy Markdown

@IzaakGough IzaakGough commented May 20, 2026

Summary

Fixes #10507.

ensureServiceAgentRoles now grants roles/run.invoker and roles/eventarc.eventReceiver to runtime service accounts from the deploy backend (including setGlobalOptions({ serviceAccount })), instead of always using gce.getDefaultServiceAccount().

Complements #9598 (#8841) for GCF v2 create/update.

Test plan

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the IAM binding logic to support custom service accounts for Cloud Functions (v2). It introduces resolveRuntimeServiceAccounts to handle service account resolution and obtainComputeServiceAgentBindings to generate bindings for multiple accounts. Feedback indicates a logic issue where Eventarc roles are only granted during the initial deployment, potentially missing custom accounts added later. Additionally, a more idiomatic approach using a Set was suggested for deduplicating service accounts to avoid issues when the default account is explicitly specified.

Comment thread src/deploy/functions/checkIam.ts
Comment thread src/deploy/functions/checkIam.ts Outdated
@IzaakGough IzaakGough marked this pull request as ready for review May 20, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

functions/v2/setGlobalOptions serviceAccount option cannot change the firebase-tools IAM checker default behavior

2 participants