-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeai-test-verification.yaml
More file actions
56 lines (52 loc) · 1.88 KB
/
Copy pathcodeai-test-verification.yaml
File metadata and controls
56 lines (52 loc) · 1.88 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
apiVersion: argoproj.io/v1alpha1
kind: AnalysisTemplate
metadata:
name: codeai-test-verification
namespace: kargo-project-codeai
spec:
args:
- name: gitCommit
- name: namespace
- name: deploymentName
metrics:
- name: drone-and-rollout-gate
provider:
job:
spec:
backoffLimit: 0
template:
spec:
restartPolicy: Never
containers:
- name: verify
image: alpine:3.20
command:
- sh
- -ceu
args:
- |
apk add --no-cache curl kubectl >/dev/null
attempts=30
while [ "$attempts" -gt 0 ]; do
state="$(
curl -fsSL "https://api.github.com/repos/code-dot-org/code-dot-org/commits/{{ args.gitCommit }}/status" |
grep -m1 -o '"state":"[^"]*"' |
cut -d'"' -f4
)"
case "$state" in
success)
break
;;
failure|error)
echo "Commit status failed: $state" >&2
exit 1
;;
esac
attempts=$((attempts - 1))
if [ "$attempts" -eq 0 ]; then
echo "Timed out waiting for commit status success" >&2
exit 1
fi
sleep 60
done
kubectl -n "{{ args.namespace }}" rollout status "deployment/{{ args.deploymentName }}" --timeout=10m