Skip to content

Create google.yml#1

Merged
Dargon789 merged 1 commit intomasterfrom
Dargon789-patch-1
Sep 20, 2025
Merged

Create google.yml#1
Dargon789 merged 1 commit intomasterfrom
Dargon789-patch-1

Conversation

@Dargon789
Copy link
Owner

@Dargon789 Dargon789 commented Sep 20, 2025

Summary by Sourcery

Add a new GitHub Actions workflow that builds a Docker image, pushes it to Google Artifact Registry, and deploys it to a GKE cluster on pushes to master/main branches

New Features:

  • Authenticate to Google Cloud via Workload Identity Federation
  • Build and push Docker container to Artifact Registry
  • Retrieve GKE credentials and deploy application using kustomize and kubectl

CI:

  • Introduce .github/workflows/google.yml triggered on pushes to master, main, and circleci-project-setup

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
@gemini-code-assist
Copy link

Note

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

@sourcery-ai
Copy link

sourcery-ai bot commented Sep 20, 2025

Reviewer's Guide

Introduces a new GitHub Actions workflow to automate building and publishing a Docker image to Google Artifact Registry and deploying it to a GKE cluster using Workload Identity Federation and Kustomize.

File-Level Changes

Change Details Files
Define workflow triggers, environment variables, and job scaffold
  • Set workflow name and trigger on push to master, main, and a setup branch
  • Declare PROJECT_ID, GAR_LOCATION, GKE_CLUSTER, GKE_ZONE, DEPLOYMENT_NAME, REPOSITORY, IMAGE, WORKLOAD_IDENTITY_PROVIDER in env
  • Configure a single job on ubuntu-latest with production environment and minimal permissions
.github/workflows/google.yml
Authenticate to Google Cloud and Docker registry
  • Use google-github-actions/auth@v2 with workload identity provider for OIDC authentication
  • Log in to Artifact Registry via docker/login-action using OAuth2 access token
.github/workflows/google.yml
Fetch GKE credentials
  • Invoke google-github-actions/get-gke-credentials@v2 with cluster name and zone
.github/workflows/google.yml
Build and publish Docker image
  • Compute DOCKER_TAG using GAR_LOCATION, PROJECT_ID, REPOSITORY, IMAGE, and GITHUB_SHA
  • Build image with build-args for GITHUB_SHA and GITHUB_REF
  • Push the tagged image to Artifact Registry
.github/workflows/google.yml
Deploy to GKE with Kustomize
  • Download and set executable permission on Kustomize binary
  • Update kustomize image tag to the newly built image
  • Apply manifests via kubectl, wait for deployment rollout, and list services
.github/workflows/google.yml

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

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 they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `.github/workflows/google.yml:106-108` </location>
<code_context>
+          docker push "${DOCKER_TAG}"
+
+      # 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 command fetches a tar.gz file but saves it as an executable.

You need to extract the kustomize binary from the tar.gz archive before setting executable permissions.
</issue_to_address>

### Comment 2
<location> `.github/workflows/google.yml:112-115` </location>
<code_context>
+          chmod u+x ./kustomize
+
+      # Deploy the Docker image to the GKE cluster
+      - name: 'Deploy to GKE'
+        run: |-
+          # replacing the image name in the k8s template
+          ./kustomize edit set image LOCATION-docker.pkg.dev/PROJECT_ID/REPOSITORY/IMAGE:TAG=$GAR_LOCATION-docker.pkg.dev/$PROJECT_ID/$REPOSITORY/$IMAGE:$GITHUB_SHA
+          ./kustomize build . | kubectl apply -f -
+          kubectl rollout status deployment/$DEPLOYMENT_NAME
</code_context>

<issue_to_address>
**issue:** The kustomize image replacement command uses literal placeholders instead of environment variables.

Literal strings like LOCATION and PROJECT_ID will not be replaced with actual values. Use shell variable interpolation (e.g., $GAR_LOCATION, $PROJECT_ID) to ensure the correct image reference is set.
</issue_to_address>

### Comment 3
<location> `.github/workflows/google.yml:83` </location>
<code_context>
+          workload_identity_provider: '${{ env.WORKLOAD_IDENTITY_PROVIDER }}'
+
+      # Authenticate Docker to Google Cloud Artifact Registry
+      - name: 'Docker Auth'
+        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'
+
+      # Get the GKE credentials so we can deploy to the cluster
</code_context>

<issue_to_address>
**suggestion:** The Docker registry URL may not match the expected format for Artifact Registry.

The registry value should include the project ID and repository to match the full Artifact Registry path. Please verify and update as needed.

```suggestion
          registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.REPOSITORY }}'
```
</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.

@github-actions
Copy link

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/checkout 692973e3d937129bcbf40652eb9f2f61becf3332 🟢 6.8
Details
CheckScoreReason
Code-Review🟢 10all changesets reviewed
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Maintained🟢 57 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Binary-Artifacts🟢 10no binaries found in the repo
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
License🟢 10license file detected
Packaging⚠️ -1packaging workflow not detected
Pinned-Dependencies🟢 3dependency not pinned by hash detected -- score normalized to 3
Fuzzing⚠️ 0project is not fuzzed
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ -1internal error: error during GetBranch(releases/v2): error during branchesHandler.query: internal error: githubv4.Query: Resource not accessible by integration
SAST🟢 9SAST tool detected but not run on all commits
Vulnerabilities🟢 100 existing vulnerabilities detected
actions/docker/login-action 9780b0c442fbb1117ed29e0efdff1e18412f7567 🟢 5.6
Details
CheckScoreReason
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Security-Policy🟢 9security policy file detected
Packaging⚠️ -1packaging workflow not detected
Maintained🟢 1016 commit(s) and 3 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 6Found 3/5 approved changesets -- score normalized to 6
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Signed-Releases⚠️ -1no releases found
Branch-Protection🟢 5branch protection is not maximal on development and all release branches
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Vulnerabilities⚠️ 010 existing vulnerabilities detected
SAST🟢 9SAST tool detected but not run on all commits
actions/google-github-actions/auth f112390a2df9932162083945e46d439060d66ec2 🟢 7.6
Details
CheckScoreReason
Maintained🟢 1012 commit(s) and 8 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 7Found 23/29 approved changesets -- score normalized to 7
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Binary-Artifacts🟢 10no binaries found in the repo
License🟢 10license file detected
Packaging⚠️ -1packaging workflow not detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Fuzzing⚠️ 0project is not fuzzed
Token-Permissions🟢 7detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies🟢 6dependency not pinned by hash detected -- score normalized to 6
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 10security policy file detected
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
Vulnerabilities🟢 100 existing vulnerabilities detected
SAST🟢 9SAST tool is not run on all commits -- score normalized to 9
actions/google-github-actions/get-gke-credentials 6051de21ad50fbb1767bc93c11357a49082ad116 🟢 7.2
Details
CheckScoreReason
Maintained🟢 67 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 6
Code-Review🟢 8Found 22/25 approved changesets -- score normalized to 8
Binary-Artifacts🟢 10no binaries found in the repo
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Packaging⚠️ -1packaging workflow not detected
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Token-Permissions🟢 8detected GitHub workflow tokens with excessive permissions
License🟢 10license file detected
Fuzzing⚠️ 0project is not fuzzed
Pinned-Dependencies🟢 5dependency not pinned by hash detected -- score normalized to 5
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 10security policy file detected
Branch-Protection🟢 4branch protection is not maximal on development and all release branches
SAST🟢 7SAST tool is not run on all commits -- score normalized to 7
Vulnerabilities🟢 100 existing vulnerabilities detected

Scanned Files

  • .github/workflows/google.yml

@Dargon789 Dargon789 merged commit f6fa1d8 into master Sep 20, 2025
8 of 9 checks passed
@Dargon789 Dargon789 deleted the Dargon789-patch-1 branch September 20, 2025 08:03
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.

1 participant