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

progress: auto-select progress based on the environment #765

Merged
merged 1 commit into from
Dec 20, 2024

Conversation

mvo5
Copy link
Collaborator

@mvo5 mvo5 commented Dec 19, 2024

This commit adds automatic progress bar selection based on checking
if we run on a terminal or not. When running on a terminal we use
the nice "terminalProgressBar". If that is not set we assuem
we run in a script or CI/CD environment and select plainProgressBar.

Thanks Colin for the hint about the bad integration test.

achilleas-k
achilleas-k previously approved these changes Dec 19, 2024
bib/internal/progress/progress.go Outdated Show resolved Hide resolved
@cgwalters
Copy link
Contributor

Ideally we would check for a terminal but with podman we never have one.

docker/podman run -t ?

See also https://github.com/containers/podman-bootc/pull/61/files#diff-000666f7f8953356d352cfc7388aac26f46bb3f75ef9f413b8908a7bf8eb2729R352

which was motivated by bootc having progress too.

(And that relates to the larger overlap/duplication/desire-to-bridge between bootc progress and osbuild progress in containers/bootc#921 (comment) )

@mvo5
Copy link
Collaborator Author

mvo5 commented Dec 19, 2024

Ideally we would check for a terminal but with podman we never have one.

docker/podman run -t ?

See also https://github.com/containers/podman-bootc/pull/61/files#diff-000666f7f8953356d352cfc7388aac26f46bb3f75ef9f413b8908a7bf8eb2729R352

which was motivated by bootc having progress too.

(And that relates to the larger overlap/duplication/desire-to-bridge between bootc progress and osbuild progress in containers/bootc#921 (comment) )

Thanks!

Uh, that is rather embarrassing, I may indeed have just written my integration test incorrectly (had forgoten about -t) . I'm an idiot. Well, I guess it's good, it makes things easier.

@cgwalters
Copy link
Contributor

LGTM

@mvo5 mvo5 requested a review from achilleas-k December 20, 2024 08:11
ondrejbudai
ondrejbudai previously approved these changes Dec 20, 2024
Copy link
Member

@ondrejbudai ondrejbudai left a comment

Choose a reason for hiding this comment

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

Thanks! ❤️

@ondrejbudai
Copy link
Member

pylint seems to be complaining in the integration tests. Can you take a look, Michael?

This commit adds automatic progress bar selection based on checking
if we run on a terminal or not. When running on a terminal we use
the nice "terminalProgressBar". If that is not set we assuem
we run in a script or CI/CD environment and select plainProgressBar.

Thanks Colin for the hint about the bad integration test.
@mvo5 mvo5 enabled auto-merge December 20, 2024 10:09
@mvo5 mvo5 added this pull request to the merge queue Dec 20, 2024
Merged via the queue into osbuild:main with commit ce6decd Dec 20, 2024
10 of 12 checks passed
@chunfuwen
Copy link

I validated it by running in a script ( assuming plainProgressBar). I noticed below picture shown as order
plainprogressbar_01
plainprogressbar_02
plainprogressbar_03

Something surprise me that there are lots of: [/] Image building step in the output, which looks a little noisy

@chunfuwen
Copy link

Moreover, I didn't see that the progress for Stage org.osbuild.container-deploy has one 100% percentage bar(until command finish), and only saw at the beginning, there is this one [stdout] [1 / 3] Stage org.osbuild.container-deploy [--------------->________________________________] 33.33%

@benblasco
Copy link

Is this in any way configurable by the user? My understanding is that this is hard-coded, whereas users may want to see the full output when manually building for learning and troubleshooting purposes. Thoughts? I will create an issue if folks think this is a valid requirement.

@achilleas-k
Copy link
Member

I will create an issue if folks think this is a valid requirement.

Sure, go ahead. I think having an option for it makes sense.

@hanthor
Copy link

hanthor commented Jan 3, 2025

Yes I would be nice to have that in the build logs on GH Actions.

mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Jan 6, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in osbuild#765 that
a better README would have avoided. Hopefully this answers the
questions :)
@mvo5
Copy link
Collaborator Author

mvo5 commented Jan 6, 2025

I validated it by running in a script ( assuming plainProgressBar). I noticed below picture shown as order
[..]

Something surprise me that there are lots of: [/] Image building step in the output, which looks a little noisy

Something funky is going on there, the "plainProgressBar" should not contain "[/]" style spinners. So far the detection is based around if the running system is a terminal (and modelled after what bootc is doing in it's progress PR). We could tweak this further. In most CI/CD pipelines and automations (e.g. via cron/systemd-timers) the detection should be correct but maybe I'm missing something, I am definitely interested in learning more about why we got "plainProgressBar" here. The commandline would be nice, it seems from the image parts are cut(?).

I opened #776 that adds some more documentation, sorry that this was not included earlier and caused some confusion here.

In a nutshell: it is possible to override via "--progress=plain" to get the old behavior and we are happy to look into tweaking the auto-detection or the defaults (i.e. ensure we do what is best for our users).

mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Jan 6, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in osbuild#765 that
a better README would have avoided. Hopefully this answers the
questions :)
mvo5 added a commit to mvo5/bootc-image-builder that referenced this pull request Jan 7, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in osbuild#765 that
a better README would have avoided. Hopefully this answers the
questions :)
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in #765 that
a better README would have avoided. Hopefully this answers the
questions :)
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in #765 that
a better README would have avoided. Hopefully this answers the
questions :)
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in #765 that
a better README would have avoided. Hopefully this answers the
questions :)
github-merge-queue bot pushed a commit that referenced this pull request Jan 8, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in #765 that
a better README would have avoided. Hopefully this answers the
questions :)
pull bot pushed a commit to centos-workstation/bootc-image-builder that referenced this pull request Jan 8, 2025
This commit adds the missing documentation for `--progress` in the
README. Not having this lead to some confusion, e.g. in questions
in osbuild#765 that
a better README would have avoided. Hopefully this answers the
questions :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants