Repository navigation
106 lines (97 loc) · 4.34 KB
/
Copy pathe2e-replicated.yml
File metadata and controls
106 lines (97 loc) · 4.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: E2E Replicated
# Dispatches the E2E suite for one Replicated instance and returns. It does not
# wait for the suite: this job going green means "the run started", not "the
# tests passed".
on:
workflow_call:
inputs:
instance:
type: string
required: true
permissions: {}
jobs:
trigger-e2e:
environment: e2e-replicated
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Trigger Replicated E2E
id: trigger
shell: bash
env:
ARGO_TOKEN: ${{ secrets.ARGO_WORKFLOWS_E2E_TOKEN }}
INSTANCE: ${{ inputs.instance }}
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
# Argo answers an event that matches no binding with 200 {}, the same
# as a dispatched one, so a caller typo would otherwise pass silently.
case "$INSTANCE" in
unstable|beta|stable) ;;
*) echo "::error::unknown instance \"$INSTANCE\"" ; exit 1 ;;
esac
# Argo names the submitted workflow from these same two values, so the
# confirmation below can read back one exact object.
workflow="openhands-e2e-${INSTANCE}-gh-${RUN_ID}-${RUN_ATTEMPT}"
echo "workflow=${workflow}" >> "$GITHUB_OUTPUT"
payload=$(jq -n \
--arg instance "$INSTANCE" \
--argjson run_id "$RUN_ID" \
--argjson run_attempt "$RUN_ATTEMPT" \
'{
instance: $instance,
run_id: $run_id,
run_attempt: $run_attempt
}')
# Deliberately not retried: a second attempt whose first already landed
# starts a duplicate suite.
curl --fail-with-body --silent --show-error --max-time 20 \
--request POST \
--header "Authorization: Bearer ${ARGO_TOKEN}" \
--header "Content-Type: application/json" \
--data "$payload" \
https://workflows.dev.all-hands.dev/api/v1/events/openhands-e2e/replicated-deploy
# The POST returns 200 whether or not a binding matched, so reading the
# named Workflow back is the only evidence the run exists.
#
# Never fatal. This job sits inside release-replicated-unstable.yml, whose
# run conclusion drives both the deploy badge and the `last-deploy`
# required check - failing here would let a dev-core blip block every open
# PR under a message telling people to go fix a deploy that is fine.
- name: Confirm the run was created
shell: bash
env:
ARGO_TOKEN: ${{ secrets.ARGO_WORKFLOWS_E2E_TOKEN }}
WORKFLOW: ${{ steps.trigger.outputs.workflow }}
INSTANCE: ${{ inputs.instance }}
run: |
ui="https://workflows.dev.all-hands.dev/workflows/openhands-e2e/${WORKFLOW}"
url="https://workflows.dev.all-hands.dev/api/v1/workflows/openhands-e2e/${WORKFLOW}"
# Wall-clock bounded, not attempt-bounded, so a hanging API cannot run
# past the job timeout and fail the release run.
deadline=$(( $(date +%s) + 120 ))
code=000
while [ "$(date +%s)" -lt "$deadline" ]; do
code=$(curl --silent --output /dev/null --write-out '%{http_code}' \
--max-time 10 --header "Authorization: Bearer ${ARGO_TOKEN}" "$url") || code=000
[ "$code" = 200 ] && break
sleep 6
done
{
echo "### E2E dispatched"
echo ""
echo "| Instance | Workflow | Confirmed |"
echo "| --- | --- | --- |"
if [ "$code" = 200 ]; then
echo "| \`${INSTANCE}\` | [\`${WORKFLOW}\`](${ui}) | yes |"
echo ""
echo "This job does not wait for the suite. Follow the link for the result."
else
echo "| \`${INSTANCE}\` | \`${WORKFLOW}\` | **no** (HTTP ${code}) |"
echo ""
echo "The event matched no binding, or the Argo API is unreachable. No suite is running for this deploy."
fi
} >> "$GITHUB_STEP_SUMMARY"
if [ "$code" != 200 ]; then
echo "::warning::${WORKFLOW} never appeared in Argo (last HTTP ${code}) - the event matched no binding, or the API is unreachable. Not failing this job: it would redden the deploy badge for an E2E-side problem."
fi