Log runner details at the start of each job - #135
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a “runner details” header to the GitLab trace output at the start of each job, aiming to match the upstream gitlab-runner header format (runner version line + “on …, systemd ID …” line).
Changes:
- Emit a runner header at the beginning of job execution (
job.output_runner_header()), including app version info and a shortened runner token. - Update integration/unit tests to tolerate the new header prefix and validate expected header content.
- Add token-shortening logic (with
regex) and adjust the mock runner token to include aglrt-prefix.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| gitlab-runner/src/run.rs | Calls output_runner_header() at the start of each job run. |
| gitlab-runner/src/job.rs | Implements output_runner_header() formatting and output. |
| gitlab-runner/src/client.rs | Adds app version formatting and runner-token shortening logic. |
| gitlab-runner/tests/integration.rs | Updates job log assertions to account for the new header. |
| gitlab-runner/tests/runhandler.rs | Loosens log assertions to allow additional header content. |
| gitlab-runner/Cargo.toml | Adds regex dependency. |
| gitlab-runner-mock/src/lib.rs | Updates mock runner token prefix to match expected shortening logic. |
| Cargo.lock | Locks regex dependency updates. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
94a9bf1 to
64997a2
Compare
|
Re the LLM review: I accidentally left the On replacing using The error string was introduced in 7f8d2da and appears to be a typo from copy pasting. I've opened a separate MR for that: #136 |
| // runner authentication token | ||
| regex!("^glrt-(t[123]_)?|^t[123]_|^glrtr-"), | ||
| // job token | ||
| regex!("^glcbt-"), |
There was a problem hiding this comment.
why is this checking for a job token? Also if you could document what you're trying to do that would be nice.
There was a problem hiding this comment.
I did it this way to reproduce the behaviour of the official runner:
https://gitlab.com/gitlab-org/gitlab-runner/-/blob/654132dc91a40f80a4fd5bb290a18a13b7064aa0/helpers/shorten_token.go
I'm happy to drop everything but regex!("^glrt-(t[123]_)?|^t[123]_|^glrtr-"), but I was trying to keep to the original behaviour in case there's a good reason they wrote it that way.
There was a problem hiding this comment.
I've dropped everything but the ^glrt-(t[123]_)?|^t[123]_|^glrtr- checks and removed regex as a dependency in favour of chaining str::strip_prefix.
| format!( | ||
| "{} {} ({})", | ||
| self.metadata | ||
| .platform |
There was a problem hiding this comment.
I'm just now realizing...are we supposed to use platform for this? The demo & lava runner do set it to the binary name, but the tests seem to use names like platform-3 which...doesn't really sound like a runner name.
This isn't necessarily load-bearing for this change, it's still a bit odd though.
c0b8020 to
da08719
Compare
This prints a header containing runner details to the gitlab log at the start of each job. The format of the header is: ``` Running with demo-runner 0.3.2 (7fd27f7-dirty) on gitlab-runner-rs test runner XPgS3LCJG, systemd ID: s_82de14b38222 ``` I attempted to match the string printed by the original gitlab-runner. Fixes: collabora/lava-gitlab-runner#18
da08719 to
40760ce
Compare
This prints a header containing runner details to the gitlab log at the start of each job.
The format of the header is:
I attempted to match the string printed by the original gitlab-runner.
Fixes: collabora/lava-gitlab-runner#18