-
Notifications
You must be signed in to change notification settings - Fork 5
Isolate GitLab-specific command handling and logging #52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Draft again because it needs #51, actual new content is in the 2 last commits (mostly the very last one). A chunk of that is just moving code around and |
e36a1ae
to
c7c5967
Compare
c7c5967
to
5f71b64
Compare
51f7eb7
to
68ce7f3
Compare
68ce7f3
to
8eeb5a8
Compare
7eca60e
to
9bf1753
Compare
#51 is merged in, so undrafting this. |
9bf1753
to
b06dd23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR isolates GitLab-specific command handling and logging by replacing direct gitlab_runner::outputln!
calls with standard tracing::info!
logging and introducing a custom GitLab forwarder layer to route specific logs to GitLab when needed.
Key changes:
- Replaces
outputln!
macro calls withtracing::info!
throughout the codebase - Adds a new
logging.rs
module withGitLabForwarder
to handle GitLab-specific log forwarding - Refactors command handling by extracting action types and implementations into a new
actions.rs
module
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
src/upload.rs | Replaces outputln! with info! for upload progress messages |
src/prune.rs | Replaces outputln! with info! for package deletion messages |
src/monitor.rs | Replaces outputln! with info! for build monitoring messages |
src/main.rs | Integrates new GitLabForwarder logging layer and adds module declarations |
src/logging.rs | New module implementing GitLab-specific log forwarding functionality |
src/handler.rs | Major refactoring to extract action implementations and integrate new logging |
src/build_meta.rs | Replaces outputln! with info! for package readiness messages |
src/actions.rs | New module containing extracted action structs and implementations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Replacin The actions split seems reasonable; I guess future PRs will further seperate from assuming gitlab backing. |
src/handler.rs
Outdated
let mut artifacts = GitLabArtifacts { | ||
job: &self.job, | ||
artifacts: &mut self.artifacts, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this seems to be done a few time would it make sense to implement Into? That or have a inner structure encapsulating it to avoid the conversion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't really do that easily, because the whole point of this change is to avoid the borrow checker seeing the entire self
as used the whole time. I could do the inner structure, but that makes accessing self.job
outside of the context of artifacts look rather confusing (and a field containing self.job
being mutably borrowed would also make some code later in the file much uglier). Note that by the end of this PR, there are only two occurrences, so I don't think this is a huge problem.
Please provide descriptions for your PRs |
Preserving `_link`, in particular, is problematic, as that preserves the link to the original package (akin to `keeplink`), which has caused numerous issues, such as: - Changes to the origin can result in build conflicts, which currently result in the runner waiting forever due to the bad state. - Broken links inhibit the ability to get the `xsrcmd5`, which is needed for monitoring the build logs. But keeping files around is of questionable utility regardless, and `osc-plugin-dput` doesn't even do that anymore. For simplicity, just remove this entire feature altogether.
Passing around `self` trips up the borrow checker if we need to get a reference to a field at the same time, and it looks a bit confusing anyway.
Instead of hardcoding the dependence on gitlab-runner's outputln, a custom macro is used with a unique field name. This field is picked up by a rather cursed bridge layer rewrites the events to instead use the fields gitlab-runner wants.
All the generic command handling is now part of an `actions` module, leaving only GitLab-specific functionality in `handler`.
b06dd23
to
2443889
Compare
No description provided.