--- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -117,7 +117,7 @@ try-runtime-tests: needs: [prepare-execution-marix, try-runtime-build] # The type of runner that the job will run on - runs-on: [self-hosted-ci] + runs-on: [medium] timeout-minutes: 600 @@ -186,6 +186,62 @@ - name: Build the stack run: docker-compose -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300 + - name: Check if docker logs consist logs related to Runtime Upgrade testing. + if: success() + run: | + counter=300 + counter_life=0 + function check_container_status { + docker inspect -f {{.State.Running}} try-runtime + } + function do_docker_logs { + docker logs --details try-runtime 2>&1 | grep -i 'TryRuntime_on_runtime_upgrade executed without errors. Consumed' + } + function is_started { + if [ "$(check_container_status)" == "true" ]; then + echo "Container: try-runtime RUNNING"; + echo "Check Docker logs" + DOCKER_LOGS=$(do_docker_logs) + if [[ -n ${DOCKER_LOGS} ]]; then + echo "TryRuntime_on_runtime_upgrade executed without errors." + return 0 + else + echo "Message not found in logs output, repeating..." + return 1 + fi + else + DOCKER_LOGS=$(do_docker_logs) + while [ $counter_life -lt 3 ] + do + (( counter_life++ )) + if [[ -n ${DOCKER_LOGS} ]]; then + echo "TryRuntime_on_runtime_upgrade executed without errors" + return 0 + else + echo "Container try-runtime not RUNNING" + return 1 + fi + done + fi + exit 0 + } + + while ! is_started; do + echo "Waiting for special message in log files " + sleep 30s + counter=$(( $counter - 1 )) + echo "Counter: $counter" + if [ "$counter" -gt "0" ]; then + continue + else + echo "Counter reached zero, yet upgrade is not finished" + exit 1 + fi + done + echo "Halting script" + exit 0 + shell: bash + - name: Collect Docker Logs if: success() || failure() uses: jwalton/gh-docker-logs@v2.2.1 @@ -193,6 +249,7 @@ dest: './try-runtime-logs.${{ matrix.network }}' - name: Show docker logs + if: success() || failure() run: cat './try-runtime-logs.${{ matrix.network }}/try-runtime.log' - name: Stop running containers