From fc565753ece0b1032aa77b5e5f6a89df048c5b04 Mon Sep 17 00:00:00 2001 From: Bakery Admin Date: Fri, 23 Jan 2026 05:38:43 +0100 Subject: [PATCH] Fix resources isues 30 --- PRODUCTION_DEPLOYMENT_GUIDE.md | 134 ++++++++++++++++++ infrastructure/cicd/gitea/values-prod.yaml | 27 ++++ infrastructure/cicd/gitea/values.yaml | 2 + .../templates/task-kaniko-build.yaml | 3 +- .../templates/trigger-template.yaml | 3 + infrastructure/cicd/tekton-helm/values.yaml | 14 ++ 6 files changed, 182 insertions(+), 1 deletion(-) diff --git a/PRODUCTION_DEPLOYMENT_GUIDE.md b/PRODUCTION_DEPLOYMENT_GUIDE.md index f262201e..a970d5fc 100644 --- a/PRODUCTION_DEPLOYMENT_GUIDE.md +++ b/PRODUCTION_DEPLOYMENT_GUIDE.md @@ -20,6 +20,8 @@ 5. [Phase 2: Domain & DNS Configuration](#phase-2-domain--dns-configuration) 6. [Phase 3: Deploy Foundation Layer](#phase-3-deploy-foundation-layer) 7. [Phase 4: Deploy CI/CD Infrastructure](#phase-4-deploy-cicd-infrastructure) + - [Step 4.6: Configure Gitea Webhook](#step-46-configure-gitea-webhook-for-cicd-pipeline) + - [Step 4.7: Configure PipelineRun Cleanup](#step-47-configure-pipelinerun-cleanup-optional-but-recommended) 8. [Phase 5: Pre-Pull and Push Base Images to Gitea Registry](#phase-5-pre-pull-and-push-base-images-to-gitea-registry) - [Step 5.1: Pre-Pull Base Images](#step-51-pre-pull-base-images-and-push-to-registry) - [Step 5.2: Verify Images in Registry](#step-52-verify-images-in-gitea-registry) @@ -654,6 +656,138 @@ flux get sources git -n flux-system flux get kustomizations -n flux-system ``` +### Step 4.6: Configure Gitea Webhook for CI/CD Pipeline + +> **Important:** The Tekton EventListener is exposed via an internal Kubernetes service. For Gitea (running in the same cluster) to trigger pipelines, you need to configure a webhook pointing to the EventListener service. + +```bash +# Get the EventListener service details +kubectl get svc -n tekton-pipelines | grep el-bakery-ia + +# Expected output: +# el-bakery-ia-event-listener ClusterIP 10.x.x.x 8080/TCP,9000/TCP +``` + +**Configure Webhook in Gitea UI:** + +1. Navigate to: `https://gitea.bakewise.ai/bakery-admin/bakery-ia/settings/hooks` +2. Click **"Add Webhook"** → **"Gitea"** +3. Configure the webhook: + +| Setting | Value | +|---------|-------| +| **Target URL** | `http://el-bakery-ia-event-listener.tekton-pipelines.svc.cluster.local:8080` | +| **HTTP Method** | POST | +| **Content Type** | application/json | +| **Secret** | (leave empty or use `$TEKTON_WEBHOOK_TOKEN` from Step 4.4) | +| **Trigger On** | Push Events | +| **Branch Filter** | `main` | +| **Active** | ✅ Checked | + +4. Click **"Add Webhook"** +5. Click **"Test Delivery"** to verify connectivity + +**Verify Webhook Works:** + +```bash +# Watch for new PipelineRuns after pushing a commit +kubectl get pipelineruns -n tekton-pipelines --watch + +# Or make a test push +cd /root/bakery-ia +git commit --allow-empty -m "Test CI/CD trigger" +git push origin main + +# Check if pipeline was triggered +kubectl get pipelineruns -n tekton-pipelines +``` + +**Alternative: External Webhook URL (if DNS issues)** + +If Gitea cannot resolve the internal service DNS, an ingress was created for external access: + +```bash +# Verify EventListener ingress exists +kubectl get ingress -n tekton-pipelines + +# Use external URL instead: +# Target URL: https://tekton-webhook.bakewise.ai +``` + +> **DNS Note:** The internal URL (`http://el-bakery-ia-event-listener.tekton-pipelines.svc.cluster.local:8080`) should work for Gitea pods in the same cluster. If you encounter DNS resolution errors, use the external ingress URL. + +### Step 4.7: Configure PipelineRun Cleanup (Optional but Recommended) + +> **Purpose:** Completed PipelineRuns and TaskRuns accumulate over time and consume etcd storage. Configure automatic pruning to keep only recent runs. + +**Option A: Configure Tekton Pruner (Recommended)** + +```bash +# Create a CronJob to prune old PipelineRuns and TaskRuns +cat <= v0.52.0) + # Set to 0 to disable automatic cleanup + pipelineRuns: + # Keep last N successful PipelineRuns per Pipeline + keepSuccessful: 3 + # Keep last N failed PipelineRuns per Pipeline + keepFailed: 5 + # TaskRun retention + taskRuns: + keepSuccessful: 3 + keepFailed: 5 + # Labels to apply to resources labels: app: