Create google.yml - #266
Merged
Merged
Conversation
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
|
Note Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported. |
Reviewer's GuideAdds a GitHub Actions workflow to build a Docker image, push it to Google Artifact Registry, and deploy it to a GKE cluster on pushes to the main/master branches using Workload Identity Federation for authentication. Flow diagram for CI pipeline steps in google.ymlflowchart TD
A["Push to main or master branch"] --> B["Trigger Build and Deploy to GKE workflow"]
B --> C["Start job setup-build-publish-deploy on ubuntu-latest"]
C --> D["Checkout repository (actions/checkout)"]
D --> E["Authenticate to Google Cloud (google-github-actions/auth) using Workload Identity Provider"]
E --> F["Docker login to Artifact Registry (docker/login-action) with auth token"]
F --> G["Get GKE credentials (google-github-actions/get-gke-credentials)"]
G --> H["Build Docker image with build args and tag using GITHUB_SHA"]
H --> I["Push Docker image to Artifact Registry"]
I --> J["Download and make kustomize executable"]
J --> K["Update kustomize image to new Artifact Registry image tag"]
K --> L["kustomize build and kubectl apply to GKE cluster"]
L --> M["kubectl rollout status for deployment"]
M --> N["kubectl get services -o wide"]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Hey there - I've reviewed your changes and found some issues that need to be addressed.
- The
on.push.branchesentries are quoted twice (- '"main"'and- '"master"'), which will prevent the workflow from triggering as expected; use plain- main/- masterinstead. - The kustomize installation step downloads a
.tar.gzfile straight tokustomizeand marks it executable, but never extracts the archive, so./kustomizewill fail; update this to download and extract the tarball correctly or use the official kustomize install script.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `on.push.branches` entries are quoted twice (`- '"main"'` and `- '"master"'`), which will prevent the workflow from triggering as expected; use plain `- main` / `- master` instead.
- The kustomize installation step downloads a `.tar.gz` file straight to `kustomize` and marks it executable, but never extracts the archive, so `./kustomize` will fail; update this to download and extract the tarball correctly or use the official kustomize install script.
## Individual Comments
### Comment 1
<location> `.github/workflows/google.yml:38-40` </location>
<code_context>
+
+on:
+ push:
+ branches:
+ - '"main"'
+ - '"master"'
+
+env:
</code_context>
<issue_to_address>
**issue (bug_risk):** Branch names are double-quoted as string literals including quotes, so the workflow likely won’t trigger on pushes to main/master.
Update these to plain branch names (e.g. `- main` / `- master` or `- 'main'` / `- 'master'`) so the filters match the actual branch names and the workflow triggers correctly.
</issue_to_address>
### Comment 2
<location> `.github/workflows/google.yml:81` </location>
<code_context>
+ uses: 'docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567' # docker/login-action@v3
+ with:
+ username: 'oauth2accesstoken'
+ password: '${{ steps.auth.outputs.auth_token }}'
+ registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev'
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The Docker login is using `auth_token`, but the auth action v2 exposes `access_token`, so this will likely fail authentication.
`google-github-actions/auth@v2` exposes the token as `steps.auth.outputs.access_token`, not `auth_token`, so this will pass an empty password to `docker/login-action` and cause login to fail. Please update this to use `password: '${{ steps.auth.outputs.access_token }}'`.
</issue_to_address>
### Comment 3
<location> `.github/workflows/google.yml:73-74` </location>
<code_context>
+ - id: 'auth'
+ name: 'Authenticate to Google Cloud'
+ uses: 'google-github-actions/auth@f112390a2df9932162083945e46d439060d66ec2' # google-github-actions/auth@v2
+ with:
+ workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
+
+ # Authenticate Docker to Google Cloud Artifact Registry
</code_context>
<issue_to_address>
**question (bug_risk):** The Workload Identity Federation config is missing a `service_account` binding, which is typically required.
This action typically requires both `workload_identity_provider` and `service_account` to correctly impersonate a Google service account. Without `service_account`, it may fail to resolve which account to use and cause intermittent auth failures. Please add `service_account: 'SERVICE_ACCOUNT_EMAIL'` to make the authentication explicit and reliable.
</issue_to_address>
### Comment 4
<location> `.github/workflows/google.yml:107` </location>
<code_context>
+ # Set up kustomize
+ - name: 'Set up Kustomize'
+ run: |-
+ curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.4.3/kustomize_v5.4.3_linux_amd64.tar.gz
+ chmod u+x ./kustomize
+
</code_context>
<issue_to_address>
**issue (bug_risk):** The kustomize download URL points to a `.tar.gz`, but the script treats it as a binary directly.
The script saves the `.tar.gz` as `kustomize` and makes it executable without extracting, so `./kustomize` will fail because it’s a tarball, not a binary. Use a direct binary URL or extract the archive (e.g., `tar -xzf …` and invoke the extracted binary).
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Motivation
Solution
PR Checklist
Summary by Sourcery
CI: