Skip to content

Test deployment file gen#9

Open
bosesuneha wants to merge 20 commits intogambtho:mainfrom
bosesuneha:main
Open

Test deployment file gen#9
bosesuneha wants to merge 20 commits intogambtho:mainfrom
bosesuneha:main

Conversation

@bosesuneha
Copy link

@bosesuneha bosesuneha commented Feb 12, 2026

Summary by CodeRabbit

  • Chores

    • Removed demo GitHub Actions workflow.
  • New Features

    • Added GitHub Actions workflow for building Docker images and deploying to Azure Kubernetes Service, including container registry integration and automated manifest deployment.
    • Added Kubernetes deployment manifest configuring the go-echo application with image pull policy and port configuration.
    • Added Kubernetes service manifest exposing the application via LoadBalancer type.
    • Added Docker multi-stage build configuration for containerized application packaging.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

This pull request replaces a demo GitHub Actions workflow with infrastructure-as-code for deploying a Go application to Azure Kubernetes Service. It introduces a CI/CD pipeline that builds Docker images, pushes to Azure Container Registry, and deploys Kubernetes manifests to AKS, along with corresponding service and deployment configurations.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/github-actions-demo.yml, .github/workflows/test-aks-deploy.yaml
Removed demo workflow; added new workflow that builds Docker images, pushes to Azure Container Registry, and deploys to Azure Kubernetes Service with kubelogin authentication and manifest application.
Kubernetes Infrastructure
manifests/deployment.yaml, manifests/service.yaml
Added Kubernetes Deployment and LoadBalancer Service manifests for go-echo application, defining container image from ACR, port 1323, and service routing configuration.
Container Build
test.Dockerfile
Added multi-stage Dockerfile with Go builder stage and distroless final stage, building a statically-linked binary running on port 1323.

Sequence Diagram(s)

sequenceDiagram
    participant GHA as GitHub Actions
    participant Azure as Azure Login
    participant ACR as Container Registry
    participant AKS as Kubernetes Cluster
    
    rect rgba(100, 150, 200, 0.5)
    Note over GHA,ACR: Build & Push Phase (buildImage job)
    GHA->>GHA: Checkout code
    GHA->>Azure: Authenticate with Azure
    GHA->>ACR: Login to Container Registry
    GHA->>ACR: Build & push image<br/>(test.Dockerfile)
    end
    
    rect rgba(150, 200, 100, 0.5)
    Note over GHA,AKS: Deploy Phase (deploy job)
    GHA->>GHA: Checkout code
    GHA->>Azure: Authenticate with Azure
    GHA->>AKS: Configure kubelogin<br/>& get kubeconfig
    GHA->>AKS: Deploy manifests<br/>(deployment + service)
    AKS->>ACR: Pull image from registry
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A workflow takes flight, with Docker and might,
To Azure's great cloud, oh what a delight!
From registry to cluster, the manifests dance,
A Kubernetes waltz—give deployment a chance!
hippity-hoppity, containers now bloom! 🚀

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Test deployment file gen' is vague and does not clearly describe the main changes, which involve adding AKS deployment infrastructure, Kubernetes manifests, and a Dockerfile while removing a demo workflow. Clarify the title to specifically reference the primary change, such as 'Add AKS deployment workflow and Kubernetes manifests' or 'Set up test deployment infrastructure'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🤖 Fix all issues with AI agents
In @.github/workflows/test-aks-deploy.yaml:
- Line 29: Replace the deprecated actions/checkout@v3 usages with
actions/checkout@v4; locate both occurrences of the literal string "uses:
actions/checkout@v3" in the workflow and update them to "uses:
actions/checkout@v4" so the job steps at those positions (the checkout steps at
the two uses) run on the supported runtime.
- Line 17: The DOCKER_FILE workflow variable is pointing to ./Dockerfile but the
PR added test.Dockerfile, so the az acr build step will fail; update the
DOCKER_FILE value to reference test.Dockerfile (or rename the Dockerfile to
match DOCKER_FILE) so that the az acr build command uses the correct file name
referenced by DOCKER_FILE in the workflow.

In `@manifests/deployment.yaml`:
- Line 21: The manifest's hardcoded image reference (image:
testACRCA.azurecr.io/goecho:latest) won't be replaced by the CI because the
workflow tags images as sunehatestaksregistry.azurecr.io/go-echo:${{ github.sha
}}; update the image field in the Deployment manifest to match the
workflow-produced name and tag (use sunehatestaksregistry.azurecr.io/go-echo:${{
github.sha }} or the placeholder used by the deploy action) so Azure/k8s-deploy
can correctly substitute the image during CI/CD.

In `@test.Dockerfile`:
- Around line 1-16: The workflow uses the variable DOCKER_FILE: ./Dockerfile but
the image build file is named test.Dockerfile, causing the build to miss the
intended file; fix by either renaming test.Dockerfile to Dockerfile or updating
the workflow's DOCKER_FILE variable in test-aks-deploy.yaml to ./test.Dockerfile
so the build step references the correct Dockerfile.
- Line 1: Update the builder base image reference from the EOL golang:1.18 to
the current stable golang:1.26 by changing the FROM line (the symbol to edit is
the Dockerfile FROM instruction currently set to "golang:1.18 AS builder"); also
adjust the final image stage to avoid running as root by switching its base to a
distroless nonroot runtime (e.g., use a distroless/static:nonroot or appropriate
nonroot runtime image) and ensure any user creation/ownership steps in the
Dockerfile set a non-root user before switching to that final image.
🧹 Nitpick comments (3)
manifests/deployment.yaml (1)

18-24: Add a security context and resource constraints.

Static analysis (Trivy KSV-0014, KSV-0118; Checkov CKV_K8S_20, CKV_K8S_23) correctly flags that the container runs with default (root) privileges and no filesystem restrictions. Even for a test deployment, hardening the pod spec is good practice and prevents accidentally promoting an insecure config.

Suggested addition
     spec:
+      securityContext:
+        runAsNonRoot: true
+        runAsUser: 65534
       containers:
         - name: go-echo
           image: testACRCA.azurecr.io/goecho:latest
           imagePullPolicy: Always
           ports:
             - containerPort: 1323
+          securityContext:
+            allowPrivilegeEscalation: false
+            readOnlyRootFilesystem: true
+          resources:
+            requests:
+              cpu: 100m
+              memory: 128Mi
+            limits:
+              cpu: 250m
+              memory: 256Mi
.github/workflows/test-aks-deploy.yaml (2)

7-19: Environment variables contain hardcoded personal/test resource names.

Resource names like suneha-test-rg and suneha-test-aks are hardcoded. If this workflow is intended as a reusable template, consider parameterizing these via repository variables or workflow inputs. Fine if this is strictly a personal test.


68-71: Update kubelogin to v0.2.14 or later for CVE fixes.

The current version v0.0.25 is significantly outdated. The latest release is v0.2.14 (January 2026), a maintenance release that addresses CVEs and includes updated dependencies.

DEPLOYMENT_MANIFEST_PATH: |
manifests/deployment.yaml
manifests/service.yaml
DOCKER_FILE: ./Dockerfile
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Dockerfile path mismatch — build will fail.

DOCKER_FILE is set to ./Dockerfile, but the Dockerfile added in this PR is test.Dockerfile. This will cause az acr build to fail (or use a wrong/missing file).

-  DOCKER_FILE: ./Dockerfile
+  DOCKER_FILE: ./test.Dockerfile
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
DOCKER_FILE: ./Dockerfile
DOCKER_FILE: ./test.Dockerfile
🤖 Prompt for AI Agents
In @.github/workflows/test-aks-deploy.yaml at line 17, The DOCKER_FILE workflow
variable is pointing to ./Dockerfile but the PR added test.Dockerfile, so the az
acr build step will fail; update the DOCKER_FILE value to reference
test.Dockerfile (or rename the Dockerfile to match DOCKER_FILE) so that the az
acr build command uses the correct file name referenced by DOCKER_FILE in the
workflow.

runs-on: ubuntu-latest
steps:
# Checks out the repository this file is in
- uses: actions/checkout@v3
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update actions/checkout from v3 to v4.

As flagged by actionlint, actions/checkout@v3 uses a deprecated Node.js runtime. Both usages (lines 29 and 57) should be updated.

Proposed fix
-      - uses: actions/checkout@v3
+      - uses: actions/checkout@v4

Apply the same change at line 57.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v3
- uses: actions/checkout@v4
🧰 Tools
🪛 actionlint (1.7.10)

[error] 29-29: the runner of "actions/checkout@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue

(action)

🤖 Prompt for AI Agents
In @.github/workflows/test-aks-deploy.yaml at line 29, Replace the deprecated
actions/checkout@v3 usages with actions/checkout@v4; locate both occurrences of
the literal string "uses: actions/checkout@v3" in the workflow and update them
to "uses: actions/checkout@v4" so the job steps at those positions (the checkout
steps at the two uses) run on the supported runtime.

spec:
containers:
- name: go-echo
image: testACRCA.azurecr.io/goecho:latest
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Image reference mismatch — deployment will use the wrong image.

The manifest hardcodes testACRCA.azurecr.io/goecho:latest, but the workflow builds and tags the image as sunehatestaksregistry.azurecr.io/go-echo:${{ github.sha }}. The Azure/k8s-deploy action performs image substitution by matching the image name in the manifest against the provided images input — since the registry and repository names differ, the substitution won't match and the deployment will keep pulling the stale testACRCA.azurecr.io/goecho:latest image.

Update the image to match what the workflow produces:

Proposed fix
-          image: testACRCA.azurecr.io/goecho:latest
+          image: sunehatestaksregistry.azurecr.io/go-echo
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
image: testACRCA.azurecr.io/goecho:latest
image: sunehatestaksregistry.azurecr.io/go-echo
🤖 Prompt for AI Agents
In `@manifests/deployment.yaml` at line 21, The manifest's hardcoded image
reference (image: testACRCA.azurecr.io/goecho:latest) won't be replaced by the
CI because the workflow tags images as
sunehatestaksregistry.azurecr.io/go-echo:${{ github.sha }}; update the image
field in the Deployment manifest to match the workflow-produced name and tag
(use sunehatestaksregistry.azurecr.io/go-echo:${{ github.sha }} or the
placeholder used by the deploy action) so Azure/k8s-deploy can correctly
substitute the image during CI/CD.

Comment on lines +1 to +16
FROM golang:1.18 AS builder

WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download && go mod verify
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -v -o app-binary

FROM gcr.io/distroless/static-debian12

ENV PORT=1323
EXPOSE 1323

WORKDIR /app
COPY --from=builder /build/app-binary .
CMD ["/app/app-binary"] No newline at end of file
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

This Dockerfile is not referenced by the workflow.

The workflow sets DOCKER_FILE: ./Dockerfile (line 17 of test-aks-deploy.yaml), but this file is named test.Dockerfile. Either rename this file to Dockerfile or update the workflow variable to ./test.Dockerfile, otherwise the build step will fail or use a different file.

🧰 Tools
🪛 Trivy (0.69.1)

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)


[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)

🤖 Prompt for AI Agents
In `@test.Dockerfile` around lines 1 - 16, The workflow uses the variable
DOCKER_FILE: ./Dockerfile but the image build file is named test.Dockerfile,
causing the build to miss the intended file; fix by either renaming
test.Dockerfile to Dockerfile or updating the workflow's DOCKER_FILE variable in
test-aks-deploy.yaml to ./test.Dockerfile so the build step references the
correct Dockerfile.

@@ -0,0 +1,16 @@
FROM golang:1.18 AS builder
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Go programming language latest stable version 2026

💡 Result:

As of February 12, 2026, the latest stable Go release is Go 1.26.0, released on February 10, 2026. [1], [2]

Where to verify/download: the official downloads page lists go1.26.0 as the current stable version. [2]

Sources:
[1] Go blog announcement (“Go 1.26 is released”, Feb 10, 2026) (go.dev)
[2] Official Go downloads page (stable versions shows go1.26.0) (go.dev)

Citations:


🏁 Script executed:

find . -name "*.Dockerfile" -o -name "Dockerfile" | head -20

Repository: gambtho/go_echo

Length of output: 89


🏁 Script executed:

rg "DOCKER_FILE|distroless/static-debian12" --type yaml --type yml

Repository: gambtho/go_echo

Length of output: 86


🏁 Script executed:

find .github/workflows -type f 2>/dev/null | xargs cat 2>/dev/null | grep -i "dockerfile\|distroless"

Repository: gambtho/go_echo

Length of output: 86


🏁 Script executed:

rg "distroless" --type yaml

Repository: gambtho/go_echo

Length of output: 41


🌐 Web query:

distroless static-debian12 nonroot variant availability

💡 Result:

gcr.io/distroless/static-debian12 does have a nonroot variant: it’s published as the :nonroot tag (and also :debug-nonroot). The Distroless project lists the available tags for static-debian12 as latest, nonroot, debug, and debug-nonroot. [1][2]

Practically, you can use:

  • gcr.io/distroless/static-debian12:nonroot
  • gcr.io/distroless/static-debian12:debug-nonroot

(And if you use the :nonroot tag, the image default user is the nonroot account, typically UID/GID 65532 with working dir /home/nonroot.) [3]

Sources: [1] [2] [3]


golang:1.18 is end-of-life — upgrade the builder image.

Go 1.18 reached end-of-life in early 2023 and no longer receives security patches. Use the current stable version, golang:1.26.

The Trivy hint about running as root is also valid. The final stage can use the distroless nonroot variant:

Proposed fix
-FROM golang:1.18 AS builder
+FROM golang:1.26 AS builder
-FROM gcr.io/distroless/static-debian12
+FROM gcr.io/distroless/static-debian12:nonroot
🧰 Tools
🪛 Trivy (0.69.1)

[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)


[error] 1-1: Image user should not be 'root'

Specify at least 1 USER command in Dockerfile with non-root user as argument

Rule: DS-0002

Learn more

(IaC/Dockerfile)

🤖 Prompt for AI Agents
In `@test.Dockerfile` at line 1, Update the builder base image reference from the
EOL golang:1.18 to the current stable golang:1.26 by changing the FROM line (the
symbol to edit is the Dockerfile FROM instruction currently set to "golang:1.18
AS builder"); also adjust the final image stage to avoid running as root by
switching its base to a distroless nonroot runtime (e.g., use a
distroless/static:nonroot or appropriate nonroot runtime image) and ensure any
user creation/ownership steps in the Dockerfile set a non-root user before
switching to that final image.

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