Skip to content

Commit

Permalink
Bumps buildpack API to 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Moran authored and arjun024 committed Nov 15, 2021
1 parent c54c29e commit 1cfdd5e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 8 additions & 4 deletions build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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,
},
},
},
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api = "0.5"
api = "0.6"

[buildpack]
homepage = "https://github.com/paketo-buildpacks/nginx"
Expand Down

0 comments on commit 1cfdd5e

Please sign in to comment.