Skip to content

add: added service account to cloud build config #7843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

OladapoAjala
Copy link
Contributor

Fixes: #7787
Related: Relevant tracking issues, for context
Merge before/after: Dependent or prerequisite PRs

Description

This PR adds a Service Account field to Google Cloud Build configurations.
It allow users set which service account (different from the default) is used by
cloud build.

User facing changes (remove if N/A)

Follow-up Work (remove if N/A)

@codecov
Copy link

codecov bot commented Sep 5, 2022

Codecov Report

Merging #7843 (a11bfaa) into main (290280e) will decrease coverage by 3.83%.
The diff coverage is 54.09%.

@@            Coverage Diff             @@
##             main    #7843      +/-   ##
==========================================
- Coverage   70.48%   66.64%   -3.84%     
==========================================
  Files         515      593      +78     
  Lines       23150    28716    +5566     
==========================================
+ Hits        16317    19138    +2821     
- Misses       5776     8172    +2396     
- Partials     1057     1406     +349     
Impacted Files Coverage Δ
cmd/skaffold/app/cmd/credits/export.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/deploy.go 40.90% <0.00%> (-12.94%) ⬇️
cmd/skaffold/app/cmd/test.go 44.44% <0.00%> (ø)
cmd/skaffold/skaffold.go 0.00% <0.00%> (ø)
cmd/skaffold/app/cmd/inspect_tests.go 62.50% <14.28%> (-1.14%) ⬇️
cmd/skaffold/app/cmd/render.go 35.48% <18.18%> (-5.90%) ⬇️
cmd/skaffold/app/cmd/lsp.go 28.12% <28.12%> (ø)
cmd/skaffold/app/cmd/run.go 64.28% <33.33%> (-9.63%) ⬇️
cmd/skaffold/app/cmd/fix.go 56.41% <37.50%> (-20.07%) ⬇️
cmd/skaffold/app/cmd/verify.go 41.17% <41.17%> (ø)
... and 367 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@aaron-prindle aaron-prindle self-requested a review September 6, 2022 02:55
@aaron-prindle
Copy link
Contributor

aaron-prindle commented Sep 6, 2022

Thanks for the PR @OladapoAjala! Currently while this PR adds serviceAccount to the schema, it does not plumb the value through our GoogleCloudBuild inputs to the gcloud sdk (which calls the CloudBuild API). If you could also plumb this value through the buildSpec here:
https://github.com/GoogleContainerTools/skaffold/blob/main/pkg/skaffold/build/gcb/spec.go#L39

Something like plumbin the serviceAccount through the necessary gcb code (buildSpec function, etc.) and adding
buildSpec.ServiceAccount = serviceAccount
to the end of the function buildSpecthen the serviceAccount will actually get propogated to the CloudBuild call

@OladapoAjala
Copy link
Contributor Author

Thanks @aaron-prindle I just pushed an updated code.

@aaron-prindle aaron-prindle marked this pull request as ready for review September 14, 2022 04:38
Copy link
Contributor

@aaron-prindle aaron-prindle left a comment

Choose a reason for hiding this comment

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

LGTM, seeing one test error that I believe is a flake (not related to the changes you have made). I am restarting the test that failed and hope it passes. Once all the tests are green we can merge

@aaron-prindle aaron-prindle merged commit d86d7ff into GoogleContainerTools:main Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow specification of serviceAccount in Cloud Build
2 participants