build: remove PersistentPreRunE hack for experimental --stream#2737
Closed
thaJeztah wants to merge 1 commit intodocker:masterfrom
Closed
build: remove PersistentPreRunE hack for experimental --stream#2737thaJeztah wants to merge 1 commit intodocker:masterfrom
thaJeztah wants to merge 1 commit intodocker:masterfrom
Conversation
This hack was added in an attempt to continue supporting the experimental (non-buildkit) `--stream` option, by dynamically updating the API version required if buildkit isn't enabled. This hack didn't work, however, because at the moment the override is added, the command is not yet attached to the "root" (`docker`) command, and because of that, the command itself is the `root` command; `cmd.Root()` returned the `build` command. As a result, validation steps defined as `PersistentPreRunE` on the root command were not executed, causing invalid flags/options to not producing an error. Attempts to use an alternative approach (for example, cobra supports both a `PersistentPreRun` and `PersistentPreRunE`) did not work either, because `PersistentPreRunE` takes precedence over `PersistentPreRun`, and only one will be executed. Given that the `--stream` option (without BuildKit) was experimental in older API versions, we are "allowed" to break this behavior, so removing this hack. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Member
Author
Codecov Report
@@ Coverage Diff @@
## master #2737 +/- ##
==========================================
- Coverage 57.15% 57.14% -0.01%
==========================================
Files 297 297
Lines 18657 18648 -9
==========================================
- Hits 10663 10656 -7
+ Misses 7132 7131 -1
+ Partials 862 861 -1 |
Member
Author
|
erm.. brainfart. this was not about stream need to revise this |
Member
Author
|
Need to search again which versions of the api support this with, and without buildit 😞 |
silvin-lubecki
approved these changes
Sep 22, 2020
Contributor
silvin-lubecki
left a comment
There was a problem hiding this comment.
I'm ok to break experimental things, so LGTM 👍
hc0503
approved these changes
Nov 6, 2020
Member
Author
|
closing in favour of #2842 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This hack was added in an attempt to continue supporting the experimental
(non-buildkit)
--streamoption, by dynamically updating the API versionrequired if buildkit isn't enabled.
This hack didn't work, however, because at the moment the override is
added, the command is not yet attached to the "root" (
docker) command,and because of that, the command itself is the
rootcommand;cmd.Root()returned thebuildcommand.As a result, validation steps defined as
PersistentPreRunEon the rootcommand were not executed, causing invalid flags/options to not producing
an error.
Attempts to use an alternative approach (for example, cobra supports both
a
PersistentPreRunandPersistentPreRunE) did not work either, becausePersistentPreRunEtakes precedence overPersistentPreRun, and only onewill be executed.
Given that the
--streamoption (without BuildKit) was experimental inolder API versions, we are "allowed" to break this behavior, so removing
this hack.
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)