Skip to content

ci(cassandra): save the server log when a pytest shard fails - #1532

Merged
navareamol merged 3 commits into
mainfrom
ci/cassandra-pytest-server-log
Dec 2, 2026
Merged

navareamol merged 3 commits into
mainfrom
ci/cassandra-pytest-server-log

Conversation

@navareamol

Copy link
Copy Markdown
Collaborator

What

When a cassandra-pytest shard fails or is cancelled, the job saves the server's log as an artifact named server-log-cassandra-pytest-<shard>-<attempt>, kept for 7 days. Each attempt gets its own artifact, so a re-run keeps the first attempt's log.

devtools/run-cassandra-tests starts extenddb serve daemonized. A daemonized server writes its log to syslog (LogTarget::Syslog in crates/app/src/cmd_serve.rs), so the job log holds only the pytest output. The new step reads the journal with journalctl -t extenddb and uploads it. Other workflows print the last 500 journal lines into the job log. This job uploads the whole journal, so a 500 from early in a shard is kept however many lines follow it.

Only lines from the server process are saved. extenddb init prints to the job log and does not write to syslog, so its output is not in the artifact. The artifact relies on the server's log level staying at info, and a comment at the [logging] block in devtools/run-cassandra-tests says so.

The steps also run on a cancelled job. A shard cancelled by a timeout, or by a cancel of the whole run, saves its log too. This matters if merge groups start cancelling the other runs of a group after the first failure, as #1527 proposes.

A separate commit masks the random admin password that devtools/run-cassandra-tests creates. Under GitHub Actions the script registers it with ::add-mask::, so the runner hides it in the job log.

Why

Refs #610, #1204

Both issues report a cassandra-pytest request that answered 500, with no server-side line in the job log. The server logs the storage error behind a 500, so the next failure keeps its cause.

#879 is a time-budget failure. At info the server logs no per-request timing, so this log is unlikely to explain it.

Testing done

Check Result
actionlint 1.7.7 with shellcheck 0.10.0 on integration-cassandra.yml No findings other than the custom runner label, which main reports too
bash -n and shellcheck on devtools/run-cassandra-tests No new findings. The SC2317 notes in cleanup are on main too
YAML parse of the workflow Both new steps have if: failure() || cancelled(), and the artifact name includes the attempt
Dry run of the step with stand-ins for sudo and journalctl: journal has lines, journal empty, journalctl fails File written in all three cases, step exits 0
Dry run with a stand-in journal holding a fake key ID The line reaches the file: the step does not filter, and the server's own redaction keeps secrets out
Mask block with GITHUB_ACTIONS set to true, empty and false Prints the ::add-mask:: line only for true
journalctl with -o short-iso-precise on Ubuntu 24.04 (systemd 255) Format accepted
Server started with the job's [logging] settings (info, pretty) on Cassandra 4.1, 13 pytest files on auth, IAM, console, ABAC, AssumeRole, stream contention and transaction conflicts (277 passed, 10 failed, 34 errors, mostly 30 s read timeouts on a shared node) 32,019 log lines. 0 matches for: the run's random admin password, the string cassandra:cassandra, password= or pass: followed by a value, the config file's key values, Signature=, X-Amz-Security-Token, bcrypt hashes, AKIA or ASIA key IDs, and any base64 string of 30 or more characters. The 64 lines with Authorization are "Authorization denied" lines that name a principal, action and resource. The Cassandra login is the image default cassandra/cassandra, and the startup line prints it as cassandra:***@127.0.0.1:9042/...

That server ran in the foreground with stderr written to a file. A daemonized server uses the same tracing filter and format with a syslog writer instead (serve_inner in crates/server/src/serve.rs), so the same lines would reach syslog.

journald can drop lines from a process that logs fast. Its notice about dropped lines is not tagged extenddb, so the artifact would not show it. A 500-line journal sample from a SQLite job covered about 10 minutes, about 1 line per second, so this is unlikely.

Open question

The artifact is kept for 7 days so a failure can be read before it expires. Is a shorter or longer retention preferred?

Amol Navare added 3 commits November 30, 2026 00:00
devtools/run-cassandra-tests starts the server daemonized, and a
daemonized server writes its log to syslog. The cassandra-pytest job
printed only the pytest output, so a request that answered 500 left no
server-side line in CI.

On failure the job now writes the server's journal entries
(journalctl -t extenddb) to a file and uploads it as an artifact named
server-log-cassandra-pytest-<shard>, kept for 7 days. init output is not
included: init prints to the job log and never to syslog.

Checked with actionlint and shellcheck, a dry run of the step with
stand-ins for sudo and journalctl, and a server started with the job's
configuration on a local Cassandra node whose log was searched for the
passwords and keys the run used.
The server log artifact is now named per attempt
(server-log-cassandra-pytest-<shard>-<attempt>), so a re-run that also
fails no longer replaces the first attempt's log. Both steps also run
when the job is cancelled, which a timeout or a cancel of the run does.

if-no-files-found is dropped: the step always creates the file. The
[logging] block in devtools/run-cassandra-tests says the artifact relies
on the info level.

Checked with actionlint and shellcheck and a dry run of the step.
devtools/run-cassandra-tests creates a random admin password for each
run and passes it to the test suite. Under GitHub Actions it now
registers the password with ::add-mask:: right after creating it, so the
runner hides it in any later job log output. Outside GitHub Actions
nothing changes.

Checked with bash -n, shellcheck (no new findings) and a run of the
block with GITHUB_ACTIONS set to true, empty and false.

@LeeroyHannigan LeeroyHannigan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks. Both new steps run only after a failure or a cancel, so they cannot turn a passing job red. The journal step ends in || true, and matrix.shard with the run attempt keeps each artifact name unique. The daemonized server logs to syslog under the tag extenddb, so journalctl -t extenddb selects its lines, as in the other workflows.

bash -n devtools/run-cassandra-tests passes. The new mask lines print one ::add-mask:: line when GITHUB_ACTIONS is true, and nothing otherwise. shellcheck and actionlint report no finding that main does not have already. CI passed, and the branch merges with main. I did not run a cancelled job, so this review does not check that the cancelled() steps run after a timeout-minutes cancel.

No other PR saves the Cassandra server log. #1527 edits the same workflow to skip jobs, and the two PRs change different steps.

@navareamol
navareamol added this pull request to the merge queue Dec 2, 2026
Merged via the queue into main with commit 857f307 Dec 2, 2026
63 checks passed
@navareamol
navareamol deleted the ci/cassandra-pytest-server-log branch December 2, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants