e84e37c9f8
POC GitOps Dispatch / orchestrator (push) Successful in 10s
POC GitOps Dispatch / test (push) Has been skipped
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 31s
unit-tests Bats test report
acc-tests Cucumber test report
CI Feature / Bats tests (push) Successful in 1m33s
CI Feature / Cucumber tests (push) Successful in 1m35s
CI Feature / Report Summary (push) Successful in 4s
63 lines
2.1 KiB
YAML
63 lines
2.1 KiB
YAML
name: POC GitOps Dispatch
|
|
run-name: "POC (${{ inputs.dispatch_id || 'orchestrator' }})"
|
|
on:
|
|
push:
|
|
branches:
|
|
- feature/gitops
|
|
workflow_dispatch:
|
|
inputs:
|
|
dispatch_id:
|
|
required: true
|
|
type: string
|
|
type:
|
|
required: true
|
|
type: string
|
|
|
|
jobs:
|
|
orchestrator:
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- 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 }}"
|