move wait for agent to a script

This commit is contained in:
WaylonWalker 2020-07-27 08:18:03 -05:00
parent b7df452394
commit d28c8d7453
2 changed files with 15 additions and 15 deletions

14
.github/ci/wait_for_agent.sh vendored Normal file
View file

@ -0,0 +1,14 @@
trap 'kill $(jobs -p)' EXIT
attempt_counter=0
max_attempts=100
mkdir -p build/reports/agent
docker-compose -f docker-compose.yml logs -f | tee build/reports/agent/log.txt&
until curl -s http://localhost:8585/api/status | jq '.registered' | grep true; do
if [ ${attempt_counter} -eq ${max_attempts} ]; then
echo "Agent failed to register. Terminating..."
exit 1
fi
attempt_counter=$(($attempt_counter+1))
echo
sleep 1
done

View file

@ -32,21 +32,7 @@ jobs:
cat docker-compose.yml cat docker-compose.yml
docker-compose -f docker-compose.yml up -d docker-compose -f docker-compose.yml up -d
- name: Wait for Agent to Register - name: Wait for Agent to Register
run: | run: bash .github/ci/wait_for_agent.sh
trap 'kill $(jobs -p)' EXIT
attempt_counter=0
max_attempts=100
mkdir -p build/reports/agent
docker-compose -f docker-compose.yml logs -f | tee build/reports/agent/log.txt&
until curl -s http://localhost:8585/api/status | jq '.registered' | grep true; do
if [ ${attempt_counter} -eq ${max_attempts} ]; then
echo "Agent failed to register. Terminating..."
exit 1
fi
attempt_counter=$(($attempt_counter+1))
echo
sleep 1
done
- run: pytest - run: pytest
env: env:
TP_DEV_TOKEN: ${{ secrets.TP_DEV_TOKEN }} TP_DEV_TOKEN: ${{ secrets.TP_DEV_TOKEN }}