-
Notifications
You must be signed in to change notification settings - Fork 213
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
Mixins install order isn't fixed which results in cache miss and redundant images #2469
Labels
bug
Oops, sorry!
Comments
We should install mixins in the order they are specified in the porter.yaml, so this is a bug that needs to be fixed. Thanks for raising this issue! |
carolynvs
added a commit
to carolynvs/porter
that referenced
this issue
Nov 28, 2022
When we are querying mixins, such as when we are asking each mixin for Dockerfile lines to include in the bundle image, we call them in go routines. Depending on how quickly they return, the order is not guaranteed and may change. I have updated our mixin query function to sort the results of querying the mixins in a consistent order, the order that they are defined in the bundle. Fixes getporter#2469 During build in particular, this ensures that we optimize layer caching as much as possible by always outputing the same contents of the Dockerfile when building a bundle. Previously, it could include the mixins in varying order which prevented reuse of layers from previous builds. Signed-off-by: Carolyn Van Slyck <[email protected]>
4 tasks
carolynvs
added a commit
to carolynvs/porter
that referenced
this issue
Nov 28, 2022
When we are querying mixins, such as when we are asking each mixin for Dockerfile lines to include in the bundle image, we call them in go routines. Depending on how quickly they return, the order is not guaranteed and may change. I have updated our mixin query function to sort the results of querying the mixins in a consistent order, the order that they are defined in the bundle. The Execute function now returns a bit more information about the results of each mixin command, and it's up to the caller to decide how to handle errors when not all mixins are required to have a successful exit code. Lint allows mixins to not implement that command, so in that case we check if the command isn't implemented and skip over it. Fixes getporter#2469 During build in particular, this ensures that we optimize layer caching as much as possible by always outputing the same contents of the Dockerfile when building a bundle. Previously, it could include the mixins in varying order which prevented reuse of layers from previous builds. Signed-off-by: Carolyn Van Slyck <[email protected]>
carolynvs
added a commit
that referenced
this issue
Nov 30, 2022
* Sort mixin output in order declared When we are querying mixins, such as when we are asking each mixin for Dockerfile lines to include in the bundle image, we call them in go routines. Depending on how quickly they return, the order is not guaranteed and may change. I have updated our mixin query function to sort the results of querying the mixins in a consistent order, the order that they are defined in the bundle. The Execute function now returns a bit more information about the results of each mixin command, and it's up to the caller to decide how to handle errors when not all mixins are required to have a successful exit code. Lint allows mixins to not implement that command, so in that case we check if the command isn't implemented and skip over it. Fixes #2469 During build in particular, this ensures that we optimize layer caching as much as possible by always outputing the same contents of the Dockerfile when building a bundle. Previously, it could include the mixins in varying order which prevented reuse of layers from previous builds. Signed-off-by: Carolyn Van Slyck <[email protected]> * Remove unused variable Signed-off-by: Carolyn Van Slyck <[email protected]> * Fix race condition in unit test Signed-off-by: Carolyn Van Slyck <[email protected]> * Make vet happy Signed-off-by: Carolyn Van Slyck <[email protected]> * Fix capturing the error when lint isn't supported The "unsupported command" text is printed to stderr. I have updated our mixin/plugin runner to capture the command output and include it in the returned error when the command fails. That way we can check if a mixin command failed because the command isn't implemented. Signed-off-by: Carolyn Van Slyck <[email protected]> * Incorporate review feedback Signed-off-by: Carolyn Van Slyck <[email protected]> Signed-off-by: Carolyn Van Slyck <[email protected]>
@tamirkamara A fix is now available in v1.0.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
When multiple mixins are specified in the definition they are installed in "random" order which doesn't make good use of caching and results in multiple images
To Reproduce
...
Expected behavior
Expect to see just the first build run every layer and the rest to be cached. But you will probably see a few like the below.
Porter Command and Output
Notice that
stage-0 5/17
isn't the same in both builds, hence can't be cached.Build N
Build N+1
Version
Copy the output of
porter version
below[porter v1.0.2 (0656f1f)]
The text was updated successfully, but these errors were encountered: