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

Pack should support run image extension on Platform API 0.12 #1698

Merged
merged 19 commits into from
Apr 13, 2023

Conversation

natalieparellano
Copy link
Member

@natalieparellano natalieparellano commented Apr 3, 2023

Fixes #1620

@github-actions github-actions bot added the type/enhancement Issue that requests a new feature or improvement. label Apr 3, 2023
@github-actions github-actions bot added this to the 0.30.0 milestone Apr 3, 2023
Signed-off-by: Natalie Arellano <narellano@vmware.com>
look in <layers>/generated/build for Dockerfiles
instead of looking in the order.

Extensions could have been present in the order, but not detected.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
…ayers>/analyzed.toml and check if extend is true.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
…ions

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano force-pushed the runext/pack-build-1620 branch from 4f16428 to 46578c1 Compare April 6, 2023 13:47
Signed-off-by: Natalie Arellano <narellano@vmware.com>
…irectory

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano force-pushed the runext/pack-build-1620 branch from 4ee84fb to 8863809 Compare April 6, 2023 14:18
@github-actions github-actions bot added the type/chore Issue that requests non-user facing changes. label Apr 6, 2023
…te successfully

<layers>/generated/build isn't guaranteed to exist

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano force-pushed the runext/pack-build-1620 branch from 925077c to 0861bc7 Compare April 7, 2023 19:35
@@ -798,7 +798,7 @@ func testAcceptance(
it("creates builder", func() {
// Linux containers (including Linux containers on Windows)
extSimpleLayersDiffID := "sha256:b9e4a0ddfb650c7aa71d1e6aceea1665365e409b3078bfdc1e51c2b07ab2b423"
extReadEnvDiffID := "sha256:b49f178f802bbeb04acf4776bd41dcea8c47504ce31b06b580ec697387629cf2"
extReadEnvDiffID := "sha256:ab7419c5e0b1a0789bd07cef2ed0573ec6e98eb05d7f05eb95d4f035243e331c"
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed the fixture, so the SHA changed

})
})

when("there are run image extensions", func() {
Copy link
Member Author

Choose a reason for hiding this comment

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

This test won't run in CI until there's a lifecycle that supports run image extension. But I've verified with my dev lifecycle that it does the job.

@natalieparellano natalieparellano marked this pull request as ready for review April 7, 2023 19:39
@natalieparellano natalieparellano requested review from a team as code owners April 7, 2023 19:39
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano force-pushed the runext/pack-build-1620 branch from 7901654 to d83204c Compare April 7, 2023 20:26
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano
Copy link
Member Author

Personally I think Codecov is being too picky, but I'll see about adding some more tests. I think this is ready for feedback now

l.assert.ContainsAll(l.output, "[detector]", "[analyzer]", "[extender]", "[exporter]")
// Earlier pack versions print `[extender]`, later pack versions print `[extender (build)]`.
// Removing the `]` for the extend phase allows us to navigate compat suite complexity without undo headache.
// When previous pack is old enough, we can make the matcher more precise.
Copy link
Contributor

Choose a reason for hiding this comment

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

nice explanatory comment :)

// CopyOutErr copies container directories to a handler function. The handler is responsible for closing the Reader.
// CopyOutErr differs from CopyOut in that it does not require the source files to exist in the container
// in order to exit without error.
func CopyOutErr(handler func(closer io.ReadCloser) error, srcs ...string) ContainerOperation {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit but also the two hardest things in computer science, amirite ? I had to read your carefully written note to understand what this name means.

What are the options?

i think there's an existing go idiom where you could rename the other function to MustCopyOut and then call this one CopyOut ? which of course would only endlessly confuse people who used to know the behavior/contract of the old function, i.e. the existing maintainers...

i think in some other languages with paradigms for optional types there's conventions around putting words like "maybe" to indicate that something might return what you asked for but it's the caller's job to check. To make that explicit in go could we add "permits" e.g. CopyOutPermitsErr ? is there some other word?

it's possible that this is a golang idiom; feel free to tell me I'm wrong.

Copy link
Member

Choose a reason for hiding this comment

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

I added a test to this branch/PR d6aedda to try and cover this. But I didn't understand the statement well enough to write a test "does not require the source files to exist in the container in order to exit without error".

I think maybe CopyOutMaybe is a better name? I'd like a test for this too, but I'm struggling to understand it.

Copy link
Member Author

Choose a reason for hiding this comment

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

CopyOutMaybe sounds good to me - updated in 24ce465 along with the comment to hopefully be more clear

internal/build/lifecycle_execution.go Outdated Show resolved Hide resolved
jkutner and others added 5 commits April 13, 2023 09:52
Signed-off-by: Joe Kutner <jpkutner@gmail.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Also test that -stack is provided for older platforms

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano
Copy link
Member Author

Green!

@jkutner jkutner merged commit 2e1320b into main Apr 13, 2023
@jkutner jkutner deleted the runext/pack-build-1620 branch April 13, 2023 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/chore Issue that requests non-user facing changes. type/enhancement Issue that requests a new feature or improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC #0105] pack should support run image extension
3 participants