Skip to content
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

Allow setting marker for grouping output #2361

Open
septatrix opened this issue Feb 9, 2024 · 2 comments
Open

Allow setting marker for grouping output #2361

septatrix opened this issue Feb 9, 2024 · 2 comments
Labels

Comments

@septatrix
Copy link
Contributor

Problem

mkosi can generate a lot of output, especially when installing packages and within the build script. Github Actions, Gitlab Jobs and Azure Devops all support means to group log lines into collapsible sections. I think it would be great if complete_step would use these mechanisms to make the output easier to browse.

Possible solution

This could be implemented either natively by detecting if mkosi is run in one of those environment and using the corresponding log lines or by introducing a new setting (maybe using environment variables) where one can define an line to be printed before and after a step. The latter would be easier to expand to other CI solutions (e.g. I did not lookup Jenkins, Travis etc. though I guess they have similar mechanisms). A problem with the latter, however, would be that the log lines sometimes require some templating. For Github and Azure this is only the title for the log line but Gitlab also wants a timestamp as well as a section name (which is not equal to the title/header) though this could be solved with f-formatted string and us passing a bunch of stuff into them which the user may then reference.

Alternative solution

Add silent or quit flags which would result in capturing all output and only print it in case of failure. This, however, is a very drastic approach.

References

PS: I think this would also be great for the CI. Sadly pytest does not support it out of the box so we would have to roll our own solution.

@septatrix
Copy link
Contributor Author

septatrix commented Mar 6, 2024

I have a first draft over at my fork: septatrix#1, CI run: https://github.com/septatrix/mkosi/actions/runs/8178215540/job/22361691351?pr=1

image

Currently the pre-/postamble is hardcoded in the source as that was simpler than preserving the environment variable across the pytest invocation. Furthermore I hardcoded the LEVEL to 1 as doing this at the topmost level seemed to be too coarse though I am open to ideas to improve this. For the mkosi CI it seems that having this at a more coarse level might be favorable as there is a lot of output which is currently not inside a collapsible section. However, I hope to have this also be usable for normal build CIs where mkosi is only invoked once. In those cases having the sections collapse at a lower level would likely be better and a lot of the stuff which is currently outside of sections would not be shown anyhow as that are mostly debug messages due to --debug.

behrmann added a commit to behrmann/mkosi that referenced this issue Mar 12, 2024
behrmann added a commit to behrmann/mkosi that referenced this issue Mar 13, 2024
behrmann added a commit to behrmann/mkosi that referenced this issue Mar 13, 2024
behrmann added a commit to behrmann/mkosi that referenced this issue Mar 13, 2024
behrmann added a commit to behrmann/mkosi that referenced this issue Mar 13, 2024
behrmann added a commit to behrmann/mkosi that referenced this issue Mar 13, 2024
behrmann added a commit to behrmann/mkosi that referenced this issue Mar 13, 2024
DaanDeMeyer pushed a commit to behrmann/mkosi that referenced this issue Mar 14, 2024
@septatrix
Copy link
Contributor Author

As said in the PR this issue it's about people using mkosi inside their CI, not the selftests of mkosi in this repo. Could you please reopen this issue?

@behrmann behrmann reopened this Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants