Skip to content
This repository was archived by the owner on Nov 23, 2025. It is now read-only.

Dev ops#6

Merged
RandithaK merged 4 commits intomainfrom
devOps
Nov 7, 2025
Merged

Dev ops#6
RandithaK merged 4 commits intomainfrom
devOps

Conversation

@RandithaK
Copy link
Copy Markdown
Member

@RandithaK RandithaK commented Nov 7, 2025

Summary by CodeRabbit

  • Chores

    • Enhanced CI/CD pipelines with automated build, test, and Docker packaging workflows.
    • Removed legacy build workflow in favor of streamlined testing process.
    • Implemented automated Kubernetes deployment workflow triggered after successful builds.
  • New Features

    • Added two new services: appointments-availability and notifications.
    • Standardized API route prefixes to /api/v1/<service> format.
    • Improved service configuration with environment variable support for flexible URL management.

@RandithaK RandithaK merged commit 88ac3f8 into main Nov 7, 2025
4 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 7, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The changes introduce a complete CI/CD pipeline for a Go API Gateway, replacing an older workflow with new build/test/package and Kubernetes deployment workflows. The gateway code is updated to support environment variable-based service URL configuration, and config.yaml is restructured to standardize API routes and add environment variable wiring for service discovery.

Changes

Cohort / File(s) Summary
GitHub Actions Workflows
.github/workflows/build.yaml, .github/workflows/deploy.yaml
New workflows added: build.yaml implements a two-job pipeline for building, testing, and pushing Docker images to GHCR; deploy.yaml triggers post-build to update Kubernetes deployment with new commit SHA and wait for rollout completion.
Removed Workflow
.github/workflows/buildtest.yaml
Previous CI workflow entirely removed; functionality consolidated into new build.yaml.
Gateway Configuration
config.yaml
API route prefixes standardized to /api/v1/<service> format; environment variable wiring added via env_var fields for service discovery; new services appointments-availability and notifications added; strip_prefix values adjusted to align with updated routes.
Gateway Code
cmd/gateway/main.go
ServiceConfig struct extended with optional EnvVar field; logic added to override service TargetURL from environment variables (either explicitly named or auto-generated as UPPERCASE_SERVICE_NAME_SERVICE_URL).
Build Artifacts
.gitignore
New "Build Artefacts" section added with bin/ entry.

Sequence Diagram(s)

sequenceDiagram
    participant GH as GitHub Actions
    participant Build as build.yaml
    participant Docker as GHCR Registry
    participant K8s as Kubernetes Cluster
    participant Deploy as deploy.yaml

    GH->>Build: Trigger on push to main/devOps/dev
    Build->>Build: Checkout, setup Go 1.22
    Build->>Build: Build & test gateway
    Build->>Docker: Generate metadata & login
    Build->>Docker: Build & push Docker image
    
    Build-->>Deploy: Job completes successfully
    Deploy->>Deploy: Trigger on main/devOps/dev
    Deploy->>Deploy: Derive short commit SHA
    Deploy->>Deploy: Install kubectl & yq
    Deploy->>K8s: Authenticate via kubeconfig
    Deploy->>K8s: Update gateway-deployment.yaml image tag
    Deploy->>K8s: Apply manifest
    Deploy->>K8s: Wait for rollout completion
Loading
sequenceDiagram
    participant Config as config.yaml
    participant Gateway as gateway (main.go)
    participant Env as Environment Variables
    participant Service as Target Service

    Gateway->>Config: Load service configuration
    Gateway->>Gateway: For each service, check EnvVar field
    
    alt EnvVar explicitly set
        Gateway->>Env: Lookup service's EnvVar name
        Env-->>Gateway: Return env value (if set)
        Gateway->>Gateway: Override TargetURL, log override
    else EnvVar not set
        Gateway->>Gateway: Auto-generate env name (UPPERCASE_SERVICE_NAME_SERVICE_URL)
        Gateway->>Env: Lookup auto-generated name
        Env-->>Gateway: Return env value (if set)
        Gateway->>Gateway: Override TargetURL if found, log override
    end
    
    Gateway->>Service: Route requests to resolved TargetURL
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

  • GitHub Actions workflows: Verify job dependencies, branch conditions, and GHCR authentication setup
  • Environment variable override logic: Carefully review the precedence and fallback behavior (explicit EnvVar vs. auto-generated names) in cmd/gateway/main.go
  • config.yaml restructuring: Validate all service routes are correctly standardized and environment variable names match expectations
  • Kubernetes deployment workflow: Ensure kubeconfig secret handling and manifest update logic for gateway-deployment.yaml are secure
  • Workflow removal: Confirm that removing buildtest.yaml doesn't break any existing CI dependencies or external references

Poem

🐰 A gateway once built with old tests now complete,
Docker and Kubernetes make the CI sweet!
Env vars guide services to their rightful place,
With /api/v1 routes and a brand new face! 🚀

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devOps

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1746c22 and 172c805.

📒 Files selected for processing (6)
  • .github/workflows/build.yaml (1 hunks)
  • .github/workflows/buildtest.yaml (0 hunks)
  • .github/workflows/deploy.yaml (1 hunks)
  • .gitignore (1 hunks)
  • cmd/gateway/main.go (2 hunks)
  • config.yaml (1 hunks)

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.

This was referenced Nov 15, 2025
Merged
Merged
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant