Dockerfiles phase 1 (generate changes)#869
Merged
natalieparellano merged 9 commits intomainfrom Jun 28, 2022
Merged
Conversation
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Member
Author
|
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. |
3dd721b to
5c2bf0e
Compare
| Logger: &log.Logger{Handler: logHandler}, | ||
| } | ||
| when("#Build", func() { | ||
| when("env", func() { |
Member
Author
There was a problem hiding this comment.
This file was getting a little unwieldy, hence the huge diff. I'll add some comments to try to make it more understandable.
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>
5c2bf0e to
6757d25
Compare
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>
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")) | ||
| }) |
Member
Author
There was a problem hiding this comment.
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) | ||
| } |
Signed-off-by: Natalie Arellano <narellano@vmware.com>
Signed-off-by: Natalie Arellano <narellano@vmware.com>
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.
Edit: resolved the TODOs I think.
Together with #860 this should close out #849.