Feature/gitops #37

Merged
niko merged 23 commits from feature/gitops into main 2026-06-22 10:37:15 +03:00
Showing only changes of commit e84e37c9f8 - Show all commits
+45 -3
View File
@@ -1,5 +1,5 @@
name: POC GitOps Dispatch
run-name: "POC (${{ inputs.dispatch_id }})"
run-name: "POC (${{ inputs.dispatch_id || 'orchestrator' }})"
on:
push:
branches:
@@ -14,7 +14,49 @@ on:
type: string
jobs:
echo:
orchestrator:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- run: echo "POC dispatch_id=${{ inputs.dispatch_id }} type=${{ inputs.type }}"
- name: Generate dispatch_id
id: gen
run: |
ID=$(date +%s | md5sum | head -c 8)
echo "dispatch_id=$ID" >> "$GITHUB_OUTPUT"
- name: Dispatch test run with dispatch_id
run: |
INPUTS=$(jq -nc \
--arg dispatch_id "${{ steps.gen.outputs.dispatch_id }}" \
--arg type "auto" \
'{dispatch_id: $dispatch_id, type: $type}')
curl -s -X POST \
"${{ gitea.server_url }}/api/v1/repos/${{ github.repository }}/actions/workflows/poc-dispatch.yml/dispatches" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$(jq -nc --arg ref "${{ github.ref_name }}" --argjson inputs "$INPUTS" '{ref: $ref, inputs: $inputs}')"
- name: Poll for dispatched run
run: |
ID=${{ steps.gen.outputs.dispatch_id }}
for i in $(seq 1 12); do
RUNS=$(curl -s "${{ gitea.server_url }}/api/v1/repos/${{ github.repository }}/actions/runs?event=workflow_dispatch&limit=10" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}")
FOUND=$(echo "$RUNS" | jq -r --arg id "$ID" \
'[.workflow_runs[] | select(.display_title | contains($id))] | .[0].id // empty')
if [ -n "$FOUND" ]; then
echo "POC PASS: found run id=$FOUND with display_title containing '$ID'"
exit 0
fi
sleep 5
done
echo "POC FAIL: no run found with display_title containing '$ID'"
echo "$RUNS"
exit 1
test:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- run: |
echo "POC dispatch_id=${{ inputs.dispatch_id }} type=${{ inputs.type }}"