Skip to content

Test results dir

Test results dir #33

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: Setup upterm session
uses: lhotari/action-upterm@v1
- name: "🔧 Setup runner"
uses: ./.github/workflows/manage-runner-pre
- name: branch-run
id: branch-run
run: |
set -exuo pipefail
RESULT_DIR = /home/runner/work/targets-branch
mkdir -p /home/runner/work/tmp
mkdir -p $RESULT_DIR
bazel run //rs/ic-observability/multiservice-discovery -- --targets-dir /home/runner/work/tmp &
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
curl -sL http://localhost:8000/prom/targets > $RESULT_DIR/targets.json
kill $pid
echo "result_dir=$RESULT_DIR" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
ref: main
- name: main run
id: main-run
run: |
set -exuo pipefail
RESULT_DIR = /home/runner/work/targets-main
mkdir -p $RESULT_DIR
bazel run //rs/ic-observability/multiservice-discovery -- --targets-dir /home/runner/work/tmp &
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
curl -sL http://localhost:8000/prom/targets > $RESULT_DIR/targets.json
kill $pid
echo "result_dir=$RESULT_DIR" >> $GITHUB_OUTPUT
- uses: int128/diff-action@v1
with:
base: ${{ steps.main-run.outputs.result_dir }}
head: ${{ steps.branch-run.outputs.result_dir }}