Test setting pipefail #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 runner" | |
uses: ./.github/workflows/manage-runner-pre | |
- 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") | |
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") | |
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 }} |