-
Notifications
You must be signed in to change notification settings - Fork 6
96 lines (86 loc) · 2.99 KB
/
multiservice-discovery-diff.yaml
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
name: multiservice-discovery diff
on:
push:
branches:
- add-multiservice-discovery-diff
# on:
# pull_request:
# paths:
# - 'rs/ic-observability/multiservice-discovery/src/*'
# types:
# - opened
# - synchronize
jobs:
compute-targets-diff:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: branch-run
id: branch-run
run: |
set -exuo pipefail
mkdir -p registry
bazel run //rs/ic-observability/multiservice-discovery -- --targets-dir /home/runner/work/dre/dre/registry &
pid=$!
url="http://localhost:8000/prom/targets"
max_retries=100
retry_interval=5
retry_count=0
while true; do
http_status=$(curl -s -o /dev/null -w "%{http_code}" "$url" || true)
if [ "$http_status" -eq 200 ]; then
break
else
retry_count=$((retry_count + 1))
sleep $retry_interval
if [ $retry_count -eq $max_retries ]; then
break
fi
fi
done
result=$(curl -sL http://localhost:8000/prom/targets)
kill $pid
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "result<<$EOF" >> $GITHUB_OUTPUT
echo "$result" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: main
- name: main run
id: main-run
run: |
mkdir -p registry
bazel run //rs/ic-observability/multiservice-discovery -- --targets-dir /home/runner/work/dre/dre/registry &
pid=$!
url="http://localhost:8000/prom/targets"
max_retries=100
retry_interval=5
retry_count=0
while true; do
http_status=$(curl -s -o /dev/null -w "%{http_code}" "$url" || true)
if [ "$http_status" -eq 200 ]; then
echo "Status 200 received. Exiting loop."
break
else
retry_count=$((retry_count + 1))
echo "Retry $retry_count: Status $http_status. Retrying in $retry_interval seconds..."
sleep $retry_interval
if [ $retry_count -eq $max_retries ]; then
echo "Max retries reached. Exiting."
break
fi
fi
done
result=$(curl -sL http://localhost:8000/prom/targets)
kill $pid
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "result<<$EOF" >> $GITHUB_OUTPUT
echo "$result" >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
- uses: int128/diff-action@v1
with:
base: ${{ steps.main-run.outputs.result }}
head: ${{ steps.branch-run.outputs.result }}