From 1cfdd5ecaace4b1308d224325b5bd49f60794e36 Mon Sep 17 00:00:00 2001 From: Ryan Moran Date: Wed, 10 Nov 2021 09:38:35 -0800 Subject: [PATCH] Bumps buildpack API to 0.6 --- build.go | 3 +++ build_test.go | 12 ++++++++---- buildpack.toml | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/build.go b/build.go index 99b67a4a..cb6a2208 100644 --- a/build.go +++ b/build.go @@ -101,12 +101,15 @@ func Build(entryResolver EntryResolver, dependencyService DependencyService, pro { Type: "web", Command: fmt.Sprintf(`nginx -p $PWD -c "%s"`, nginxConfPath), + Default: true, }, } launchMetadata.BOM = bom } if !shouldInstall(layer.Metadata, currConfigureBinSHA256, dependency.SHA256) { + layer.Launch, layer.Build = launch, build + return packit.BuildResult{ Layers: []packit.Layer{layer}, Build: buildMetadata, diff --git a/build_test.go b/build_test.go index 9600d8da..e8beb68a 100644 --- a/build_test.go +++ b/build_test.go @@ -167,6 +167,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: fmt.Sprintf(`nginx -p $PWD -c "%s"`, filepath.Join(workspaceDir, "nginx.conf")), + Default: true, }, }, }, @@ -210,7 +211,6 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { Expect(dependencyService.InstallCall.Receives.CnbPath).To(Equal(cnbPath)) Expect(dependencyService.InstallCall.Receives.LayerPath).To(Equal(filepath.Join(layersDir, "nginx"))) Expect(calculator.SumCall.CallCount).To(Equal(1)) - }) context("when version source is buildpack.yml", func() { @@ -298,6 +298,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: fmt.Sprintf(`nginx -p $PWD -c "%s"`, filepath.Join(workspaceDir, "nginx.conf")), + Default: true, }, }, }, @@ -349,14 +350,16 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { context("when rebuilding a layer", func() { it.Before(func() { - err := ioutil.WriteFile(filepath.Join(layersDir, "nginx.toml"), []byte(fmt.Sprintf(`launch = true -[metadata] + err := ioutil.WriteFile(filepath.Join(layersDir, "nginx.toml"), []byte(fmt.Sprintf(`[metadata] dependency-sha = "some-sha" configure-bin-sha = "some-bin-sha" built_at = "%s" - `, timeStamp.Format(time.RFC3339Nano))), 0644) + `, timeStamp.Format(time.RFC3339Nano))), 0600) Expect(err).NotTo(HaveOccurred()) + + entryResolver.MergeLayerTypesCall.Returns.Launch = true }) + it("does not re-build the nginx layer", func() { result, err := build(packit.BuildContext{ CNBPath: cnbPath, @@ -415,6 +418,7 @@ func testBuild(t *testing.T, context spec.G, it spec.S) { { Type: "web", Command: fmt.Sprintf(`nginx -p $PWD -c "%s"`, filepath.Join(workspaceDir, "nginx.conf")), + Default: true, }, }, }, diff --git a/buildpack.toml b/buildpack.toml index 53a7dc80..9e2fb654 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,4 +1,4 @@ -api = "0.5" +api = "0.6" [buildpack] homepage = "https://github.com/paketo-buildpacks/nginx"