Skip to content

cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones#1533

Merged
debarshiray merged 5 commits intocontainers:mainfrom
debarshiray:wip/rishi/src-cmd-exitError
Sep 10, 2024
Merged

cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones#1533
debarshiray merged 5 commits intocontainers:mainfrom
debarshiray:wip/rishi/src-cmd-exitError

Conversation

@debarshiray
Copy link
Copy Markdown
Member

@debarshiray debarshiray commented Sep 3, 2024

This will make it easier to propagate the exit codes of subordinate
processes through an exitError instance, when toolbox(1) is invoked
inside a container, and invocation is forwarded to the host.

Cobra doesn't honour the root command's SilenceErrors, if an error
occurred when parsing the command line for a command, even though the
command was found. However, Cobra does honour SilenceErrors, if the
error occurred afterwards.

Therefore, to avoid setting SilenceErrors in each and every command, it
was set in the PersistentPreRunE hook (ie., preRun), which is called
after all command line parsing has been successfully completed.

#957

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Sep 3, 2024
@debarshiray debarshiray force-pushed the wip/rishi/src-cmd-exitError branch from 4ff621c to 17eea5f Compare September 3, 2024 14:44
@softwarefactory-project-zuul
Copy link
Copy Markdown

Build failed.
https://softwarefactory-project.io/zuul/t/local/buildset/4b92cfd91992441aa73f7c6e195d43d9

unit-test NODE_FAILURE Node request 200-0007562451 failed in 0s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 26s
unit-test-restricted NODE_FAILURE Node request 200-0007562453 failed in 0s
system-test-fedora-rawhide NODE_FAILURE Node request 200-0007562454 failed in 0s
✔️ system-test-fedora-40 SUCCESS in 1h 32m 29s
✔️ system-test-fedora-39 SUCCESS in 1h 33m 31s

@debarshiray
Copy link
Copy Markdown
Member Author

recheck

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/bb18f0e98e2a4eccaa20bb939688e322

✔️ unit-test SUCCESS in 5m 38s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 40s
✔️ unit-test-restricted SUCCESS in 5m 37s
✔️ system-test-fedora-rawhide SUCCESS in 1h 30m 02s
✔️ system-test-fedora-40 SUCCESS in 1h 32m 02s
✔️ system-test-fedora-39 SUCCESS in 1h 36m 53s

@debarshiray debarshiray changed the title [WIP] ... cmd/root, cmd/run: Handle printing all errors but the CLI parsing ones Sep 4, 2024
@softwarefactory-project-zuul
Copy link
Copy Markdown

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/98e34ece958f43da80dc75b7de281ed3

✔️ unit-test SUCCESS in 5m 37s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 14s
✔️ unit-test-restricted SUCCESS in 5m 43s
✔️ system-test-fedora-rawhide SUCCESS in 1h 29m 19s
✔️ system-test-fedora-40 SUCCESS in 1h 29m 22s
✔️ system-test-fedora-39 SUCCESS in 1h 34m 45s

It shouldn't be necessary to use the --assumeyes option when creating a
Toolbx container, if the corresponding image is already present in the
local containers/storage image store.  It's harmful to test it with the
option, even when it shouldn't be needed, because it's off by default
and most users won't enable it.

Therefore, it's better to test the most common scenario that most users
will encounter.

containers#1536
This will make it easier to propagate the exit codes of subordinate
processes through an exitError instance, when toolbox(1) is invoked
inside a container, and invocation is forwarded to the host.

Cobra doesn't honour the root command's SilenceErrors, if an error
occurred when parsing the command line for a command, even though the
command was found.  However, Cobra does honour SilenceErrors, if the
error occurred afterwards.

Therefore, to avoid setting SilenceErrors in each and every command, it
was set in the PersistentPreRunE hook (ie., preRun), which is called
after all command line parsing has been successfully completed.

containers#957
@debarshiray debarshiray force-pushed the wip/rishi/src-cmd-exitError branch from dc88e73 to ee90bc9 Compare September 5, 2024 19:28
@softwarefactory-project-zuul
Copy link
Copy Markdown

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/7af9f89aa5ab42e0867a3fab6469bab5

✔️ unit-test SUCCESS in 4m 14s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 30s
✔️ unit-test-restricted SUCCESS in 4m 15s
✔️ system-test-fedora-rawhide SUCCESS in 1h 30m 45s
✔️ system-test-fedora-40 SUCCESS in 1h 28m 50s
✔️ system-test-fedora-39 SUCCESS in 1h 30m 37s

@softwarefactory-project-zuul
Copy link
Copy Markdown

Build succeeded.
https://softwarefactory-project.io/zuul/t/local/buildset/40829f1295b248db82ececde040ebcfd

✔️ unit-test SUCCESS in 5m 08s
✔️ unit-test-migration-path-for-coreos-toolbox SUCCESS in 3m 10s
✔️ unit-test-restricted SUCCESS in 5m 29s
✔️ system-test-fedora-rawhide SUCCESS in 1h 36m 16s
✔️ system-test-fedora-40 SUCCESS in 1h 34m 59s
✔️ system-test-fedora-39 SUCCESS in 1h 37m 21s

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.

1 participant