Skip to content

ci: upload integration logs on failure#933

Open
dkropachev wants to merge 1 commit into
scylladb:masterfrom
dkropachev:ci-upload-integration-logs
Open

ci: upload integration logs on failure#933
dkropachev wants to merge 1 commit into
scylladb:masterfrom
dkropachev:ci-upload-integration-logs

Conversation

@dkropachev

@dkropachev dkropachev commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Preserve CCM/Scylla logs for failed integration tests before pytest cleanup clears or removes CCM cluster directories, then upload them as a GitHub Actions artifact.

Changes

  • tests/integration/conftest.py: records failed pytest reports through the shared integration helper.
  • tests/integration/__init__.py: before cluster cleanup clears/removes clusters, copies CCM logs/config from tests/integration/ccm into integration-test-logs/.
  • tests/integration/__init__.py: writes integration-test-logs/failed-tests.txt so the artifact identifies which test phase/nodeid failed.
  • .github/workflows/integration-tests.yml: sets INTEGRATION_LOG_ARTIFACT_DIR=integration-test-logs for pytest.
  • .github/workflows/integration-tests.yml: uploads integration-test-logs, any remaining tests/integration/ccm log/config files, and matching /home/runner/.ccm log/config files when a matrix job fails.
  • .github/workflows/integration-tests.yml: warns if no matching files are found and keeps artifacts for 14 days.

Commit Structure

  • test: preserve failed integration logs
  • ci: upload integration logs on failure

Driver Surface

CI/test infrastructure only. No driver runtime, protocol, or compatibility behavior changes.

Verification

  • git diff --check origin/master...HEAD
  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/integration-tests.yml")'
  • uv run python -m py_compile tests/integration/__init__.py tests/integration/conftest.py
  • manually exercised preserve_ccm_logs_on_failure() against a temp fake CCM tree with SCYLLA_VERSION=release:2026.1

actionlint is not installed in the local environment.

Fixes: #932

Pre-review checklist

  • I have split my patch into logically separate commits.
  • All commit messages clearly explain what they change and why.
  • I added relevant tests for new features and bug fixes.
  • All commits compile, pass static checks and pass test.
  • PR description sums up the changes and reasons why they should be introduced.
  • I have provided docstrings for the public items that I want to introduce.
  • I have adjusted the documentation in ./docs/source/.
  • I added appropriate Fixes: annotations to PR description.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a441cde7-b351-4bb1-b83c-4c7783f68690

📥 Commits

Reviewing files that changed from the base of the PR and between 64b4521 and 525feeb.

📒 Files selected for processing (3)
  • .github/workflows/integration-tests.yml
  • tests/integration/__init__.py
  • tests/integration/conftest.py
🚧 Files skipped from review as they are similar to previous changes (3)
  • tests/integration/conftest.py
  • .github/workflows/integration-tests.yml
  • tests/integration/init.py

📝 Walkthrough

Walkthrough

Integration tests record failed reports and preserve selected CCM logs and configuration before cluster cleanup. The CI workflow configures the artifact directory and uploads collected files after pytest failures, using matrix-specific names and 14-day retention.

Sequence Diagram(s)

sequenceDiagram
  participant Pytest
  participant Teardown
  participant CCM
  participant GitHubActions
  participant ArtifactStorage
  Pytest->>Teardown: report failure
  Teardown->>CCM: preserve logs and configuration
  Teardown->>CCM: clean up clusters
  GitHubActions->>ArtifactStorage: upload preserved artifacts
Loading

Possibly related PRs

Suggested reviewers: sylwiaszunejko

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and matches the main CI log-upload change.
Description check ✅ Passed The PR description includes summary, change list, verification, and issue reference, matching the repository template well.
Linked Issues check ✅ Passed The workflow and test changes satisfy #932 by preserving CCM logs on failure and uploading matrix-named artifacts.
Out of Scope Changes check ✅ Passed The changes stay within CI and integration-test teardown/log-preservation scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/integration-tests.yml (1)

108-114: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Ensure the glob covers future pytest output.

These patterns only collect selected extensions and files beneath conf/ or logs/. If redirected pytest output is later written as .out, .txt, .xml, or another format under ~/.ccm, it will be omitted. Add the concrete output path/extension or use a narrowly scoped catch-all for the relevant cluster directories.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/integration-tests.yml around lines 108 - 114, Update the
artifact collection paths in the workflow’s `path` block to include future
pytest output under `/home/runner/.ccm`, either by adding the concrete output
extensions/locations or a narrowly scoped catch-all for the relevant cluster
directories while preserving the existing patterns.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/integration-tests.yml:
- Line 115: Update the artifact-upload configuration around if-no-files-found so
missing CCM logs are surfaced instead of silently ignored. Change its value to
warn at minimum, or error if CCM artifacts are required for the integration test
workflow.

---

Nitpick comments:
In @.github/workflows/integration-tests.yml:
- Around line 108-114: Update the artifact collection paths in the workflow’s
`path` block to include future pytest output under `/home/runner/.ccm`, either
by adding the concrete output extensions/locations or a narrowly scoped
catch-all for the relevant cluster directories while preserving the existing
patterns.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: aacc41ba-820b-43df-9e49-844ce5c26b61

📥 Commits

Reviewing files that changed from the base of the PR and between 8f772c8 and 8033d33.

📒 Files selected for processing (1)
  • .github/workflows/integration-tests.yml

Comment thread .github/workflows/integration-tests.yml Outdated
@dkropachev
dkropachev force-pushed the ci-upload-integration-logs branch 2 times, most recently from e90fbd5 to 04829ab Compare July 14, 2026 00:00
Comment thread tests/integration/conftest.py Outdated
Comment thread tests/integration/conftest.py Outdated
@dkropachev
dkropachev force-pushed the ci-upload-integration-logs branch from 04829ab to 6f2d4c2 Compare July 14, 2026 11:06

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/integration/__init__.py`:
- Around line 115-117: Wrap the shutil.copy2 operation in the file-copying loop
around destination_file with a try/except that catches OSError. Handle copy
failures without propagating them so teardown and cluster cleanup continue even
when source logs are deleted or inaccessible.
- Around line 89-113: Scope preserve_ccm_logs_on_failure to one cluster by
adding optional cluster_name=None and appending it to both ccm_root and
ccm_destination when provided. Update the calls at tests/integration/__init__.py
lines 429, 502, and 519 to pass CCM_CLUSTER.name, cluster_name, and cluster_name
respectively.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 936b8f50-cd50-4034-b18a-a5e6ea830780

📥 Commits

Reviewing files that changed from the base of the PR and between 8033d33 and 6f2d4c2.

📒 Files selected for processing (3)
  • .github/workflows/integration-tests.yml
  • tests/integration/__init__.py
  • tests/integration/conftest.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/integration-tests.yml

Comment thread tests/integration/__init__.py Outdated
Comment thread tests/integration/__init__.py Outdated
@dkropachev
dkropachev force-pushed the ci-upload-integration-logs branch from 6f2d4c2 to 64b4521 Compare July 14, 2026 15:03
def preserve_ccm_logs_on_failure(cluster_name=None):
if not _failed_reports:
return

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get the idea here. I checked the docs, pytest_runtest_logreport will be called during each test. That means, after first test failure, _failed_reports will be non-empty. preserve_ccm_logs_on_failure will be called, it will save fail reports and cluster files.

But then, preserve_ccm_logs_on_failure will be called after each test, _failed_reports will still be non-empty, so we will save cluster again and again, and re-save failed-tests.txt.

Am I wrong? What is the idea here?

@dkropachev
dkropachev force-pushed the ci-upload-integration-logs branch from 64b4521 to 525feeb Compare July 16, 2026 18:26
Preserve CCM log and config files before integration cleanup clears cluster directories, then upload them as failure-only artifacts for integration test jobs.
@dkropachev
dkropachev force-pushed the ci-upload-integration-logs branch from 525feeb to 724350d Compare July 16, 2026 18:49
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown

Caution

Review failed

An error occurred during the review process. Please try again later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: upload Scylla/ccm logs for failed integration tests

2 participants