From 5aaf1a8bcae53ae2c25e4e820b0498f2b01e8959 Mon Sep 17 00:00:00 2001 From: Ashwin Bharambe Date: Mon, 20 Oct 2025 22:08:15 -0700 Subject: [PATCH] fix(ci): improve workflow logging and bot notifications (#3872) ## Summary - Link pre-commit bot comment to workflow run instead of PR for better debugging - Dump docker container logs before removal to ensure logs are actually captured ## Changes 1. **Pre-commit bot**: Changed the initial bot comment to link "pre-commit hooks" text to the actual workflow run URL instead of just having the PR number auto-link 2. **Docker logs**: Moved docker container log dumping from GitHub Actions to the integration-tests.sh script's stop_container() function, ensuring logs are captured before container removal ## Test plan - Pre-commit bot comment will now have a clickable link to the workflow run - Docker container logs will be successfully captured in CI runs --- .github/actions/run-and-record-tests/action.yml | 7 +++---- .github/workflows/precommit-trigger.yml | 2 +- scripts/integration-tests.sh | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/actions/run-and-record-tests/action.yml b/.github/actions/run-and-record-tests/action.yml index 3929df09c..ac600d570 100644 --- a/.github/actions/run-and-record-tests/action.yml +++ b/.github/actions/run-and-record-tests/action.yml @@ -86,10 +86,9 @@ runs: if: ${{ always() }} shell: bash run: | - sudo docker logs ollama > ollama-${{ inputs.inference-mode }}.log || true - distro_name=$(echo "${{ inputs.stack-config }}" | sed 's/^docker://' | sed 's/^server://') - stack_container_name="llama-stack-test-$distro_name" - sudo docker logs $stack_container_name > docker-${distro_name}-${{ inputs.inference-mode }}.log || true + # Ollama logs (if ollama container exists) + sudo docker logs ollama > ollama-${{ inputs.inference-mode }}.log 2>&1 || true + # Note: distro container logs are now dumped in integration-tests.sh before container is removed - name: Upload logs if: ${{ always() }} diff --git a/.github/workflows/precommit-trigger.yml b/.github/workflows/precommit-trigger.yml index a78b2c3ac..b05898d29 100644 --- a/.github/workflows/precommit-trigger.yml +++ b/.github/workflows/precommit-trigger.yml @@ -99,7 +99,7 @@ jobs: owner: context.repo.owner, repo: context.repo.repo, issue_number: ${{ steps.check_author.outputs.pr_number }}, - body: `⏳ Running pre-commit hooks on PR #${{ steps.check_author.outputs.pr_number }}...` + body: `⏳ Running [pre-commit hooks](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) on PR #${{ steps.check_author.outputs.pr_number }}...` }); - name: Checkout PR branch (same-repo) diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh index daf6ccd1b..99db89742 100755 --- a/scripts/integration-tests.sh +++ b/scripts/integration-tests.sh @@ -238,6 +238,8 @@ if [[ "$STACK_CONFIG" == *"docker:"* && "$COLLECT_ONLY" == false ]]; then echo "Stopping Docker container..." container_name="llama-stack-test-$DISTRO" if docker ps -a --format '{{.Names}}' | grep -q "^${container_name}$"; then + echo "Dumping container logs before stopping..." + docker logs "$container_name" > "docker-${DISTRO}-${INFERENCE_MODE}.log" 2>&1 || true echo "Stopping and removing container: $container_name" docker stop "$container_name" 2>/dev/null || true docker rm "$container_name" 2>/dev/null || true