Skip to content

Conversation

@natalieparellano
Copy link
Member

@natalieparellano natalieparellano commented Jun 15, 2022

Edit: resolved the TODOs I think.

Together with #860 this should close out #849.

Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano changed the title Dockerfiles phase 1 generate Dockerfiles phase 1 (generate changes) Jun 15, 2022
@natalieparellano
Copy link
Member Author

natalieparellano commented Jun 15, 2022

Apologies in advance for the huge diff - this is built off of #867. If/when that is merged, the diff should be smaller ...but still huge.

Edit: re-pointing the branch for now.

@natalieparellano natalieparellano force-pushed the dockerfiles-phase-1-generate branch from 3dd721b to 5c2bf0e Compare June 15, 2022 17:36
@natalieparellano natalieparellano changed the base branch from main to refactor/move-logger June 15, 2022 17:37
Logger: &log.Logger{Handler: logHandler},
}
when("#Build", func() {
when("env", 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 file was getting a little unwieldy, hence the huge diff. I'll add some comments to try to make it more understandable.

@natalieparellano
Copy link
Member Author

TODO: need to gate this on experimental features enabled

Generate changes to support Dockerfiles feature

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Natalie Arellano added 3 commits June 21, 2022 15:15
Mainly: the creation of a group-extensions field in group.toml

Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
@natalieparellano natalieparellano marked this pull request as ready for review June 21, 2022 20:19
@natalieparellano natalieparellano requested a review from a team as a code owner June 21, 2022 20:19
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Comment on lines +842 to +887
when("for extension", func() {
it.Before(func() {
h.SkipIf(t, kind == buildpack.KindBuildpack, "")
})

when("dockerfiles", func() {
it("includes run.Dockerfile", func() {
h.Mkfile(t,
"",
filepath.Join(appDir, "run.Dockerfile-A-v1"),
)

br, err := descriptor.Build(buildpack.Plan{}, config, mockEnv)
h.AssertNil(t, err)

h.AssertEq(t, br.Dockerfiles[0].ExtensionID, "A")
h.AssertEq(t, br.Dockerfiles[0].Kind, buildpack.DockerfileKindRun)
h.AssertEq(t, br.Dockerfiles[0].Path, filepath.Join(layersDir, "A", "run.Dockerfile"))
})
})

when("/bin/build is missing", func() {
it.Before(func() {
descriptor.Extension.ID = "B"
descriptor.Dir = filepath.Join(storeDir, "B", "v1")
})

it("treats the extension root as a pre-populated output directory", func() {
bpPlan := buildpack.Plan{
Entries: []buildpack.Require{
{Name: "some-dep"},
{Name: "some-other-dep"},
{Name: "some-unmet-dep"},
},
}

br, err := descriptor.Build(bpPlan, config, mockEnv)
h.AssertNil(t, err)

t.Log("processes build.toml")
h.AssertEq(t, br.MetRequires, []string{"some-dep", "some-other-dep"})
t.Log("processes run.Dockerfile")
h.AssertEq(t, br.Dockerfiles[0].ExtensionID, "B")
h.AssertEq(t, br.Dockerfiles[0].Kind, buildpack.DockerfileKindRun)
h.AssertEq(t, br.Dockerfiles[0].Path, filepath.Join(descriptor.Dir, "run.Dockerfile"))
})
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 is the most relevant test

Comment on lines +153 to +167
if kind == buildpack.KindExtension {
t.Log("sets CNB_OUTPUT_DIR")
actual = h.Rdfile(t, filepath.Join(appDir, "build-env-cnb-output-dir-A-v1.clear"))
h.AssertEq(t, actual, filepath.Join(layersDir, "A"))
t.Log("does not set CNB_LAYERS_DIR")
actual = h.Rdfile(t, filepath.Join(appDir, "build-env-cnb-layers-dir-A-v1.clear"))
h.AssertEq(t, isUnset(actual), true)
} else {
t.Log("sets CNB_LAYERS_DIR")
actual = h.Rdfile(t, filepath.Join(appDir, "build-env-cnb-layers-dir-A-v1.clear"))
h.AssertEq(t, actual, filepath.Join(layersDir, "A"))
t.Log("does not set CNB_OUTPUT_DIR")
actual = h.Rdfile(t, filepath.Join(appDir, "build-env-cnb-output-dir-A-v1.clear"))
h.AssertEq(t, isUnset(actual), true)
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Also relevant

Base automatically changed from refactor/move-logger to main June 24, 2022 17:24
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Copy link
Contributor

@mboldt mboldt left a comment

Choose a reason for hiding this comment

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

Looks good!

@natalieparellano natalieparellano merged commit ce23c65 into main Jun 28, 2022
@natalieparellano natalieparellano deleted the dockerfiles-phase-1-generate branch June 28, 2022 14:38
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.

3 participants