From d28c8d74531be75ea0c8a91eaa073e1ec9dd9b35 Mon Sep 17 00:00:00 2001 From: WaylonWalker Date: Mon, 27 Jul 2020 08:18:03 -0500 Subject: [PATCH] move wait for agent to a script --- .github/ci/wait_for_agent.sh | 14 ++++++++++++++ .github/workflows/test-waylonwalker-com.yml | 16 +--------------- 2 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 .github/ci/wait_for_agent.sh diff --git a/.github/ci/wait_for_agent.sh b/.github/ci/wait_for_agent.sh new file mode 100644 index 0000000..1479cb3 --- /dev/null +++ b/.github/ci/wait_for_agent.sh @@ -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 diff --git a/.github/workflows/test-waylonwalker-com.yml b/.github/workflows/test-waylonwalker-com.yml index 59b77f4..6e94226 100644 --- a/.github/workflows/test-waylonwalker-com.yml +++ b/.github/workflows/test-waylonwalker-com.yml @@ -32,21 +32,7 @@ jobs: cat docker-compose.yml docker-compose -f docker-compose.yml up -d - name: Wait for Agent to Register - run: | - 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: bash .github/ci/wait_for_agent.sh - run: pytest env: TP_DEV_TOKEN: ${{ secrets.TP_DEV_TOKEN }}