From 9b15cc31cb6ebcc31cf1ba35f4f831f0c16ab91f Mon Sep 17 00:00:00 2001 From: Patrick de Ruiter Date: Sun, 28 Dec 2025 01:12:13 +0100 Subject: [PATCH] feat: trigger CD pipeline after image push Add stage 7 to trigger terraform-docker-openldap pipeline via Gitea API after successfully pushing a new image to the registry. This enables automatic deployment of new container versions. Requires GITEA_TOKEN secret and GITEA_URL variable to be configured. --- .gitea/workflows/build.yaml | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index e30cc2b..61c43e3 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -273,23 +273,36 @@ jobs: if: always() run: docker logout ${{ env.REGISTRY }} || true - # Stage 7: Update CD pipeline (trigger deployment) + # Stage 7: Trigger CD pipeline for terraform-docker-openldap update-cd: runs-on: ubuntu-latest needs: push if: needs.push.result == 'success' steps: - - name: Trigger CD pipeline + - name: Trigger terraform-docker-openldap pipeline run: | echo "==============================================" - echo " Ready to update CD pipeline" + echo " Triggering CD pipeline" echo "==============================================" echo "New version: ${{ needs.push.outputs.version }}" echo "Full image: ${{ needs.push.outputs.full_image }}" echo "" - echo "TODO: Add step to update version in CD repository" - echo "This could be:" - echo " - Update docker-compose.yml in infra repo" - echo " - Update Helm values" - echo " - Trigger ArgoCD sync" + + # Trigger the Gitea Actions workflow via repository dispatch + curl -X POST \ + -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ + -H "Content-Type: application/json" \ + "${{ vars.GITEA_URL }}/api/v1/repos/wbyc/terraform-docker-openldap/actions/workflows/pipeline.yaml/dispatches" \ + -d '{ + "ref": "main", + "inputs": { + "image_tag": "${{ needs.push.outputs.version }}" + } + }' || { + echo "::warning::Failed to trigger CD pipeline" + exit 1 + } + + echo "==============================================" + echo " CD pipeline triggered successfully" echo "=============================================="