Change method of deploying cloud funcs - #63
Conversation
✅ Deploy Preview for molevolvr ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Leaving this here for posterity. This is John Finigan's Terraform for the Google Cloud project, which basically describes the permissions/roles he needed to give to each service account within the project to make everything work as expected. This goes hand-in-hand with the content of the |
|
We ended up going with option 2 above, creating the Configuring it with the right permissions was a little trickier than expected, see this comment. In summary:
|
Changes the method of deploying cloud funcs to align with CU OIT's preferred permissions setup for GCP, which forces us to do the deployment through a script with the GCP CLI instead of through the web console UI (where it is currently impossible to specify separate service accounts for the build and runtime). As I mention in this comment on PR #62, we're still not doing automatic deployment of this script (yet) since it's very small and unlikely to change.
@jananiravi You'll see in this diff that a
GITHUB_TOKENis required so that an issue can be created on this repo. It also determines what account the issues will be created by. There are basically three methods we can choose from:@jananiraviusername, generate a fine-grain personal access token (PAT) that only has permissions to create issues, and only on this repo. The feedback form would then create issues as if you had created them.@molevolvr-bot, keep track of its login info, and generate a PAT with that. The feedback form would then create issues as the bot account, which we could give a little 🤖 avatar so people know it was automated.1 isn't ideal because your username will get much more notifications (which maybe you want), and it's unclear at first glance (other than the
feedbacklabel that will be auto-added to the created issue) that it was an automated thing.3 is imo overkill for what we are trying to do. It involves more set up, more secrets, and a more involved auth handshake than what we currently have in the
/feedback/index.jsscript. Apps allow more complex things like allowing multiple repos to install it, multiple users to authenticate with it, and acting on behalf of users, when all we really need is issue write permissions for a single repo.Therefore, I recommend option 2. If you're agreeable to that, I can create it, add its username/password to the software team's vault, share it with you so you have ownership access, and do the deploy with its PAT.
Gemini's summary of the benefits of making a GitHub app, with my own commentary
Fine-grained personal access token's alleviate this. They allow, for example, only the ability to write issues to a specific repo.
PATs can be leaked. However we have the
.env.localfile where ours is supposed to be added in.gitignore, and we have GitHub's built-in push secret protection enabled, and if a PAT happens to be committed, we can revoke it immediately.We don't need this.
Option 2 allows us to have a "bot" identity for these cloud functions.