Skip to content

Create google.yml - #266

Merged
Dargon789 merged 1 commit into
masterfrom
Dargon789-patch-3
Dec 10, 2025
Merged

Create google.yml#266
Dargon789 merged 1 commit into
masterfrom
Dargon789-patch-3

Conversation

@Dargon789

@Dargon789 Dargon789 commented Dec 10, 2025

Copy link
Copy Markdown
Owner

Motivation

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Summary by Sourcery

CI:

  • Introduce a Google Cloud deployment workflow that builds a Docker image, pushes it to Artifact Registry, and deploys it to a GKE cluster on pushes to the main branches.

Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@vercel

vercel Bot commented Dec 10, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
next Ready Ready Preview Comment Dec 10, 2025 3:15am
react Ready Ready Preview Comment Dec 10, 2025 3:15am

@codesandbox

codesandbox Bot commented Dec 10, 2025

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@gemini-code-assist

Copy link
Copy Markdown

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@sourcery-ai

sourcery-ai Bot commented Dec 10, 2025

Copy link
Copy Markdown

Reviewer's Guide

Adds 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.yml

flowchart 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"]
Loading

File-Level Changes

Change Details Files
Introduce a GKE deployment GitHub Actions workflow using Google Cloud auth and Artifact Registry.
  • Add a workflow triggered on pushes to designated branches to build, push, and deploy a Docker image to GKE
  • Configure environment variables for GCP project, Artifact Registry location, GKE cluster/zone, deployment name, repository, image name, and workload identity provider
  • Authenticate to Google Cloud via google-github-actions/auth using Workload Identity Federation and obtain an access token for Docker
  • Log in to Artifact Registry with docker/login-action using the federated access token
  • Fetch GKE cluster credentials with google-github-actions/get-gke-credentials to allow kubectl operations
  • Build and push a Docker image tagged with the current commit SHA to Artifact Registry
  • Download and configure kustomize for Kubernetes manifests manipulation and deployment
  • Update the image reference in kustomize configuration, apply manifests to the cluster, wait for rollout, and list services
.github/workflows/google.yml

Possibly linked issues

  • Create google.yml #87: The PR adds .github/workflows/google.yml, exactly implementing the GKE CI/CD workflow requested in the issue.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@snyk-io

snyk-io Bot commented Dec 10, 2025

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and found some issues that need to be addressed.

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/google.yml
@Dargon789
Dargon789 merged commit bfd383f into master Dec 10, 2025
0 checks passed
@Dargon789
Dargon789 deleted the Dargon789-patch-3 branch December 10, 2025 03:49
@Dargon789 Dargon789 linked an issue Dec 10, 2025 that may be closed by this pull request
@Dargon789 Dargon789 mentioned this pull request May 9, 2026
3 tasks
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.

# Flow diagram for CI pipeline steps in google.yml

1 participant