poc
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
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
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
name: POC GitOps Dispatch
|
name: POC GitOps Dispatch
|
||||||
run-name: "POC (${{ inputs.dispatch_id }})"
|
run-name: "POC (${{ inputs.dispatch_id || 'orchestrator' }})"
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
@@ -14,7 +14,49 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
echo:
|
orchestrator:
|
||||||
|
if: github.event_name == 'push'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
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 }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user