Repository navigation
fix(functions): skip Eventarc roles for a deleted default compute service account - #11534
Open
IzaakGough wants to merge 10 commits into
Open
IzaakGough wants to merge 10 commits into
IzaakGough wants to merge 10 commits into
Conversation
…vice account When the default compute service account no longer exists and every v2 event function sets its own service account, skip granting it roles and print the gcloud commands for the functions' accounts instead.
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces logic to handle scenarios where the default compute service account is missing during function deployment. It adds a new helper function, obtainEventarcServiceAccountBindings, to src/deploy/functions/checkIam.ts and updates ensureServiceAgentRoles to incorporate this check, along with comprehensive unit tests in src/deploy/functions/checkIam.spec.ts. The reviewer identified an issue where IAM member strings were missing the required serviceAccount: prefix and provided a code suggestion to resolve it.
…es warning Declarative security accounts get these roles at release, so printing commands for them is noise.
A function that names the deleted default account now gets the early error instead of grant commands for an account that does not exist. The error no longer suggests Node-only syntax.
… guidance requiredRoles only grants the roles the user declares, so managed accounts need run.invoker and eventarc.eventReceiver too when the default compute account is deleted.
These accounts are created during release and only get the roles their codebase declares, so printed gcloud commands fail on a first deploy. Skip the suggestion when both roles are already declared.
IzaakGough
marked this pull request as ready for review
November 17, 2026 16:25
This was referenced Nov 19, 2026
…ult-compute-sa # Conflicts: # CHANGELOG.md
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #10536
Fixes #10507.
Deploying 2nd gen event functions failed when the project's default compute service account had been deleted, even if every function set its own
serviceAccount.If that account is missing or disabled and no v2 event function runs as it, the deploy now skips its role grants and prints the
gcloudcommands to grant those roles to the functions' own accounts.requiresRolesuggestion instead ofgcloudcommands, since the CLI creates them during the deploy.Tested with unit tests and a live deploy with the default account deleted. The disabled case has unit tests only. A full deploy there still needs #9598.