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.
This commit is contained in:
parent
d5405f3bba
commit
c2fe2ea908
@ -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 "=============================================="
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user