ec22d49039
CI Feature / Load example-gitea-env.conf to pipeline env (push) Successful in 22s
POC GitOps E2E / e2e (push) Successful in 52s
unit-tests Bats test report
CI Feature / Bats tests (push) Failing after 1m29s
acc-tests Cucumber test report
CI Feature / Cucumber tests (push) Failing after 1m40s
CI Feature / Report Summary (push) Successful in 6s
68 lines
2.9 KiB
YAML
68 lines
2.9 KiB
YAML
name: POC GitOps E2E
|
|
run-name: "POC E2E (${{ inputs.dispatch_id || 'orchestrator' }})"
|
|
on:
|
|
push:
|
|
branches:
|
|
- feature/gitops
|
|
workflow_dispatch:
|
|
inputs:
|
|
dispatch_id:
|
|
required: false
|
|
type: string
|
|
|
|
jobs:
|
|
e2e:
|
|
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 to gitea-ci-gitops-tests
|
|
run: |
|
|
INPUTS=$(jq -nc \
|
|
--arg dispatch_id "${{ steps.gen.outputs.dispatch_id }}" \
|
|
--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 }}" \
|
|
--arg git_tag_prefix "poc-test" \
|
|
'{dispatch_id: $dispatch_id, file: $file, yq_tpl: $yq_tpl, version: $version, source_repo: $source_repo, source_commit: $source_commit, git_tag_prefix: $git_tag_prefix}')
|
|
curl -s -X POST \
|
|
"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 "main" --argjson inputs "$INPUTS" '{ref: "main", inputs: $inputs}')"
|
|
|
|
- name: Poll for completion
|
|
run: |
|
|
ID=${{ steps.gen.outputs.dispatch_id }}
|
|
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]')
|
|
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: timeout waiting for gitops workflow"
|
|
exit 124
|