poc
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 23s
unit-tests Bats test report
CI Feature / Bats tests (push) Failing after 1m34s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Failing after 1m35s
CI Feature / Report Summary (push) Successful in 5s
POC GitOps E2E / e2e (push) Failing after 35s

This commit is contained in:
moilanik
2026-06-22 04:55:09 +03:00
parent e84e37c9f8
commit 47df5a8017
4 changed files with 86 additions and 78 deletions
+35 -31
View File
@@ -1,5 +1,5 @@
name: POC GitOps Dispatch
run-name: "POC (${{ inputs.dispatch_id || 'orchestrator' }})"
name: POC GitOps E2E
run-name: "POC E2E (${{ inputs.dispatch_id || 'orchestrator' }})"
on:
push:
branches:
@@ -7,14 +7,11 @@ on:
workflow_dispatch:
inputs:
dispatch_id:
required: true
type: string
type:
required: true
required: false
type: string
jobs:
orchestrator:
e2e:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
@@ -24,39 +21,46 @@ jobs:
ID=$(date +%s | md5sum | head -c 8)
echo "dispatch_id=$ID" >> "$GITHUB_OUTPUT"
- name: Dispatch test run with dispatch_id
- name: Dispatch to gitea-ci-gitops-tests
run: |
INPUTS=$(jq -nc \
--arg dispatch_id "${{ steps.gen.outputs.dispatch_id }}" \
--arg type "auto" \
'{dispatch_id: $dispatch_id, type: $type}')
--arg file "dev/Chart.yaml" \
--arg yq_tpl '.version = "{{VERSION}}"' \
--arg version "0.2.0" \
--arg source_repo "${{ github.repository }}" \
--arg source_commit "${{ github.sha }}" \
'{dispatch_id: $dispatch_id, file: $file, yq_tpl: $yq_tpl, version: $version, source_repo: $source_repo, source_commit: $source_commit}')
curl -s -X POST \
"${{ gitea.server_url }}/api/v1/repos/${{ github.repository }}/actions/workflows/poc-dispatch.yml/dispatches" \
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
"https://gitea.app.keskikuja.site/api/v1/repos/niko/gitea-ci-gitops-tests/actions/workflows/gitops-service.yaml/dispatches" \
-H "Authorization: token ${{ secrets.GITOPS_DISPATCH_TOKEN }}" \
-H "Content-Type: application/json" \
-d "$(jq -nc --arg ref "${{ github.ref_name }}" --argjson inputs "$INPUTS" '{ref: $ref, inputs: $inputs}')"
-d "$(jq -nc --arg ref "main" --argjson inputs "$INPUTS" '{ref: "main", inputs: $inputs}')"
- name: Poll for dispatched run
- name: Poll for completion
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 }}")
for i in $(seq 1 60); do
RUNS=$(curl -s "https://gitea.app.keskikuja.site/api/v1/repos/niko/gitea-ci-gitops-tests/actions/runs?event=workflow_dispatch&limit=10" \
-H "Authorization: token ${{ secrets.GITOPS_DISPATCH_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
'[.workflow_runs[] | select(.display_title | contains($id))] | .[0]')
if [ -n "$FOUND" ] && [ "$FOUND" != "null" ]; then
STATUS=$(echo "$FOUND" | jq -r '.status')
CONCLUSION=$(echo "$FOUND" | jq -r '.conclusion // ""')
RUN_NUM=$(echo "$FOUND" | jq -r '.run_number')
echo "run found: id=$(echo $FOUND | jq -r '.id') number=$RUN_NUM display_title=$(echo $FOUND | jq -r '.display_title') status=$STATUS"
if [ "$STATUS" = "completed" ]; then
if [ "$CONCLUSION" = "success" ]; then
echo "POC PASS: gitops workflow completed successfully"
exit 0
else
echo "POC FAIL: gitops workflow completed with conclusion=$CONCLUSION"
exit 1
fi
fi
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 }}"
echo "POC FAIL: timeout waiting for gitops workflow"
exit 124