[libvirt PATCH] ci: integration: Rename all Avocado standard stream log files to *.log

By default, stdout/stderr Avocado test log files do not have any file extension which confuses GitLab's web UI to mangle the MIME type for these and so the browser will never offer the option to open such file from in a text editor rather than dowloading it. Since GitLab sets a proper MIME for .txt and .log file extensions, rename all Avocado log files without an extension to *.log . This pairs nicely with the coredumpctl info file which we already name as 'coredumpctl.txt' because of this. Signed-off-by: Erik Skultety <eskultet@redhat.com> --- Here are 2 artifact web UI views on a failed job which you can try yourself in your browser: Before this patch: https://gitlab.com/eskultety/libvirt/-/jobs/2232852413/artifacts/browse/logs... After this patch: https://gitlab.com/eskultety/libvirt/-/jobs/2234111527/artifacts/browse/logs... ci/integration.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ci/integration.yml b/ci/integration.yml index 519494cfd5..2808e829ef 100644 --- a/ci/integration.yml +++ b/ci/integration.yml @@ -36,6 +36,9 @@ - sudo coredumpctl info --no-pager > logs/coredumpctl.txt - sudo mv /var/log/libvirt logs/libvirt - sudo chown -R $(whoami):$(whoami) logs + # rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type + - find logs/avocado/ -type f ! -name "*.log" -exec + sh -c 'DIR=$(dirname {}); NAME=$(basename {}); mv $DIR/$NAME{,.log}' \; variables: SCRATCH_DIR: "/tmp/scratch" artifacts: -- 2.34.1

On Tue, Mar 22, 2022 at 01:11:22PM +0100, Erik Skultety wrote:
By default, stdout/stderr Avocado test log files do not have any file extension which confuses GitLab's web UI to mangle the MIME type for these and so the browser will never offer the option to open such file from in a text editor rather than dowloading it. Since GitLab sets a proper MIME for .txt and .log file extensions, rename all Avocado log files without an extension to *.log . This pairs nicely with the coredumpctl info file which we already name as 'coredumpctl.txt' because of this.
Or should be ask the Avocado maintainers to do this so files have a sensible name from the start. IMHO it is bad practice for any app to create files without an meaningful extension. That said I don't mind the workaround here in the meantime.
Signed-off-by: Erik Skultety <eskultet@redhat.com> ---
Here are 2 artifact web UI views on a failed job which you can try yourself in your browser: Before this patch: https://gitlab.com/eskultety/libvirt/-/jobs/2232852413/artifacts/browse/logs... After this patch: https://gitlab.com/eskultety/libvirt/-/jobs/2234111527/artifacts/browse/logs...
ci/integration.yml | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/ci/integration.yml b/ci/integration.yml index 519494cfd5..2808e829ef 100644 --- a/ci/integration.yml +++ b/ci/integration.yml @@ -36,6 +36,9 @@ - sudo coredumpctl info --no-pager > logs/coredumpctl.txt - sudo mv /var/log/libvirt logs/libvirt - sudo chown -R $(whoami):$(whoami) logs + # rename all Avocado stderr/stdout logs to *.log so that GitLab's web UI doesn't mangle the MIME type + - find logs/avocado/ -type f ! -name "*.log" -exec + sh -c 'DIR=$(dirname {}); NAME=$(basename {}); mv $DIR/$NAME{,.log}' \;
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

On Tue, Mar 22, 2022 at 01:47:32PM +0000, Daniel P. Berrangé wrote:
On Tue, Mar 22, 2022 at 01:11:22PM +0100, Erik Skultety wrote:
By default, stdout/stderr Avocado test log files do not have any file extension which confuses GitLab's web UI to mangle the MIME type for these and so the browser will never offer the option to open such file from in a text editor rather than dowloading it. Since GitLab sets a proper MIME for .txt and .log file extensions, rename all Avocado log files without an extension to *.log . This pairs nicely with the coredumpctl info file which we already name as 'coredumpctl.txt' because of this.
Or should be ask the Avocado maintainers to do this so files have a sensible name from the start. IMHO it is bad practice for any app to create files without an meaningful extension.
created an Avocado issue: https://github.com/avocado-framework/avocado/issues/5293 ...and pushed this change Thanks, Erik

On Tue, Mar 22, 2022 at 01:11:22PM +0100, Erik Skultety wrote:
Since GitLab sets a proper MIME for .txt and .log file extensions, rename all Avocado log files without an extension to *.log . This pairs nicely with the coredumpctl info file which we already name as 'coredumpctl.txt' because of this.
Just a nit that you should feel free to ignore, especially seeing how you've already pushed this patch, but isn't what you've written above an argument for either using .txt here or using .log for the coredumpctl case too? -- Andrea Bolognani / Red Hat / Virtualization

On Tue, Mar 22, 2022 at 05:17:28PM +0000, Andrea Bolognani wrote:
On Tue, Mar 22, 2022 at 01:11:22PM +0100, Erik Skultety wrote:
Since GitLab sets a proper MIME for .txt and .log file extensions, rename all Avocado log files without an extension to *.log . This pairs nicely with the coredumpctl info file which we already name as 'coredumpctl.txt' because of this.
Just a nit that you should feel free to ignore, especially seeing how you've already pushed this patch, but isn't what you've written above an argument for either using .txt here or using .log for the coredumpctl case too?
I mean, okay, technically you're right, but can coredumpctl.txt really be considered anything even remotely connected to logging that would justify the extension? (since you decided to paint the shed...) Erik

On Tue, Mar 22, 2022 at 06:23:47PM +0100, Erik Skultety wrote:
On Tue, Mar 22, 2022 at 05:17:28PM +0000, Andrea Bolognani wrote:
On Tue, Mar 22, 2022 at 01:11:22PM +0100, Erik Skultety wrote:
Since GitLab sets a proper MIME for .txt and .log file extensions, rename all Avocado log files without an extension to *.log . This pairs nicely with the coredumpctl info file which we already name as 'coredumpctl.txt' because of this.
Just a nit that you should feel free to ignore, especially seeing how you've already pushed this patch, but isn't what you've written above an argument for either using .txt here or using .log for the coredumpctl case too?
I mean, okay, technically you're right, but can coredumpctl.txt really be considered anything even remotely connected to logging that would justify the extension? (since you decided to paint the shed...)
I don't see how it's different from the stdout.log generated by Avocado - in both cases you're writing the output produced by a program to a file. Anyway, it doesn't really matter, we can mix and match as long as it's still possible to conveniently visualize the file in the browser as opposed to having to jump through additional hoops :) -- Andrea Bolognani / Red Hat / Virtualization
participants (3)
-
Andrea Bolognani
-
Daniel P. Berrangé
-
Erik Skultety