diff --git a/buildpack.toml b/buildpack.toml index d390564c..722258c8 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -14,7 +14,7 @@ api = "0.7" include-files = ["bin/build", "bin/detect", "bin/run", "bin/optimize-memory", "buildpack.toml"] pre-package = "./scripts/build.sh" [metadata.default-versions] - node = "18.*.*" + node = "20.*.*" [[metadata.dependencies]] checksum = "sha256:9d4f5fcafb8e67f5fb251f661d27634bba27899c89b712f84d4fd2bbc89f91ea" diff --git a/integration/openssl_test.go b/integration/openssl_test.go index 6f9d0c7d..daea8bfb 100644 --- a/integration/openssl_test.go +++ b/integration/openssl_test.go @@ -136,5 +136,44 @@ func testOpenSSL(t *testing.T, context spec.G, it spec.S) { )) }) }) + + context("when running Node 20", func() { + it("uses the OpenSSL CA store to verify certificates", func() { + var ( + logs fmt.Stringer + err error + ) + + image, logs, err = pack.WithNoColor().Build. + WithBuildpacks( + settings.Buildpacks.NodeEngine.Online, + settings.Buildpacks.BuildPlan.Online, + ). + WithPullPolicy("never"). + WithEnv(map[string]string{ + "BP_NODE_VERSION": "20.*.*", + }). + Execute(name, source) + Expect(err).ToNot(HaveOccurred(), logs.String) + + container, err = docker.Container.Run. + WithPublish("8080"). + WithCommand("node server.js"). + Execute(image.ID) + Expect(err).NotTo(HaveOccurred()) + + Eventually(container).Should(Serve("hello world")) + Expect(container).To(Serve(ContainSubstring("v20.")).WithEndpoint("/version")) + Expect(container).To(Serve(ContainSubstring("301 Moved")).WithEndpoint("/test-openssl-ca")) + + Expect(logs).To(ContainLines( + " Configuring launch environment", + ` NODE_ENV -> "production"`, + fmt.Sprintf(` NODE_HOME -> "/layers/%s/node"`, strings.ReplaceAll(settings.Buildpack.ID, "/", "_")), + ` NODE_OPTIONS -> "--use-openssl-ca"`, + ` NODE_VERBOSE -> "false"`, + )) + }) + }) }) } diff --git a/integration/project_path_test.go b/integration/project_path_test.go index 894eb044..4ad35053 100644 --- a/integration/project_path_test.go +++ b/integration/project_path_test.go @@ -73,11 +73,11 @@ func testProjectPath(t *testing.T, context spec.G, it spec.S) { fmt.Sprintf("%s 1.2.3", settings.Buildpack.Name), " Resolving Node Engine version", " Candidate version sources (in priority order):", - " .node-version -> \"16.*\"", + " .node-version -> \"18.*\"", " -> \"\"", )) Expect(logs).To(ContainLines( - MatchRegexp(` Selected Node Engine version \(using \.node-version\): 16\.\d+\.\d+`), + MatchRegexp(` Selected Node Engine version \(using \.node-version\): 18\.\d+\.\d+`), )) container, err = docker.Container.Run. diff --git a/integration/provides_test.go b/integration/provides_test.go index df61cc93..df291689 100644 --- a/integration/provides_test.go +++ b/integration/provides_test.go @@ -68,11 +68,11 @@ func testProvides(t *testing.T, context spec.G, it spec.S) { " -> \"\"", )) Expect(logs).To(ContainLines( - MatchRegexp(` Selected Node Engine version \(using \): 18\.\d+\.\d+`), + MatchRegexp(` Selected Node Engine version \(using \): 20\.\d+\.\d+`), )) Expect(logs).To(ContainLines( " Executing build process", - MatchRegexp(` Installing Node Engine 18\.\d+\.\d+`), + MatchRegexp(` Installing Node Engine 20\.\d+\.\d+`), MatchRegexp(` Completed in \d+(\.\d+)?`), )) Expect(logs).To(ContainLines( diff --git a/integration/reuse_layer_rebuild_test.go b/integration/reuse_layer_rebuild_test.go index 74b526da..38c0d26b 100644 --- a/integration/reuse_layer_rebuild_test.go +++ b/integration/reuse_layer_rebuild_test.go @@ -206,7 +206,7 @@ func testReusingLayerRebuild(t *testing.T, context spec.G, it spec.S) { settings.Buildpacks.NodeEngine.Online, settings.Buildpacks.BuildPlan.Online, ). - WithEnv(map[string]string{"BP_NODE_VERSION": "~16"}). + WithEnv(map[string]string{"BP_NODE_VERSION": "~18"}). Execute(name, source) Expect(err).NotTo(HaveOccurred()) @@ -220,15 +220,15 @@ func testReusingLayerRebuild(t *testing.T, context spec.G, it spec.S) { fmt.Sprintf("%s 1.2.3", settings.Buildpack.Name), " Resolving Node Engine version", " Candidate version sources (in priority order):", - " BP_NODE_VERSION -> \"~16\"", + " BP_NODE_VERSION -> \"~18\"", " -> \"\"", )) Expect(logs).To(ContainLines( - MatchRegexp(` Selected Node Engine version \(using BP_NODE_VERSION\): 16\.\d+\.\d+`), + MatchRegexp(` Selected Node Engine version \(using BP_NODE_VERSION\): 18\.\d+\.\d+`), )) Expect(logs).To(ContainLines( " Executing build process", - MatchRegexp(` Installing Node Engine 16\.\d+\.\d+`), + MatchRegexp(` Installing Node Engine 18\.\d+\.\d+`), MatchRegexp(` Completed in \d+(\.\d+)?`), )) Expect(logs).To(ContainLines( @@ -273,7 +273,7 @@ func testReusingLayerRebuild(t *testing.T, context spec.G, it spec.S) { settings.Buildpacks.NodeEngine.Online, settings.Buildpacks.BuildPlan.Online, ). - WithEnv(map[string]string{"BP_NODE_VERSION": "~18"}). + WithEnv(map[string]string{"BP_NODE_VERSION": "~20"}). Execute(name, source) Expect(err).NotTo(HaveOccurred()) @@ -287,15 +287,15 @@ func testReusingLayerRebuild(t *testing.T, context spec.G, it spec.S) { fmt.Sprintf("%s 1.2.3", settings.Buildpack.Name), " Resolving Node Engine version", " Candidate version sources (in priority order):", - " BP_NODE_VERSION -> \"~18\"", + " BP_NODE_VERSION -> \"~20\"", " -> \"\"", )) Expect(logs).To(ContainLines( - MatchRegexp(` Selected Node Engine version \(using BP_NODE_VERSION\): 18\.\d+\.\d+`), + MatchRegexp(` Selected Node Engine version \(using BP_NODE_VERSION\): 20\.\d+\.\d+`), )) Expect(logs).To(ContainLines( " Executing build process", - MatchRegexp(` Installing Node Engine 18\.\d+\.\d+`), + MatchRegexp(` Installing Node Engine 20\.\d+\.\d+`), MatchRegexp(` Completed in \d+(\.\d+)?`), )) Expect(logs).To(ContainLines( diff --git a/integration/simple_app_test.go b/integration/simple_app_test.go index 62f34449..e144475a 100644 --- a/integration/simple_app_test.go +++ b/integration/simple_app_test.go @@ -258,15 +258,15 @@ func testSimple(t *testing.T, context spec.G, it spec.S) { fmt.Sprintf("%s 1.2.3", settings.Buildpack.Name), " Resolving Node Engine version", " Candidate version sources (in priority order):", - " .node-version -> \"16.*\"", + " .node-version -> \"18.*\"", " -> \"\"", )) Expect(logs).To(ContainLines( - MatchRegexp(` Selected Node Engine version \(using \.node-version\): 16\.\d+\.\d+`), + MatchRegexp(` Selected Node Engine version \(using \.node-version\): 18\.\d+\.\d+`), )) Expect(logs).To(ContainLines( " Executing build process", - MatchRegexp(` Installing Node Engine 16\.\d+\.\d+`), + MatchRegexp(` Installing Node Engine 18\.\d+\.\d+`), MatchRegexp(` Completed in \d+(\.\d+)?`), )) Expect(logs).To(ContainLines( @@ -344,15 +344,15 @@ func testSimple(t *testing.T, context spec.G, it spec.S) { fmt.Sprintf("%s 1.2.3", settings.Buildpack.Name), " Resolving Node Engine version", " Candidate version sources (in priority order):", - " .nvmrc -> \"16.*\"", + " .nvmrc -> \"18.*\"", " -> \"\"", )) Expect(logs).To(ContainLines( - MatchRegexp(` Selected Node Engine version \(using \.nvmrc\): 16\.\d+\.\d+`), + MatchRegexp(` Selected Node Engine version \(using \.nvmrc\): 18\.\d+\.\d+`), )) Expect(logs).To(ContainLines( " Executing build process", - MatchRegexp(` Installing Node Engine 16\.\d+\.\d+`), + MatchRegexp(` Installing Node Engine 18\.\d+\.\d+`), MatchRegexp(` Completed in \d+(\.\d+)?`), )) Expect(logs).To(ContainLines( diff --git a/integration/testdata/custom_project_path_app/hello_world_server/.node-version b/integration/testdata/custom_project_path_app/hello_world_server/.node-version index f76c46dd..20be6fc3 100644 --- a/integration/testdata/custom_project_path_app/hello_world_server/.node-version +++ b/integration/testdata/custom_project_path_app/hello_world_server/.node-version @@ -1 +1 @@ -16.* +18.* diff --git a/integration/testdata/node_version_app/.node-version b/integration/testdata/node_version_app/.node-version index f76c46dd..20be6fc3 100644 --- a/integration/testdata/node_version_app/.node-version +++ b/integration/testdata/node_version_app/.node-version @@ -1 +1 @@ -16.* +18.* diff --git a/integration/testdata/nvmrc_app/.nvmrc b/integration/testdata/nvmrc_app/.nvmrc index f76c46dd..20be6fc3 100644 --- a/integration/testdata/nvmrc_app/.nvmrc +++ b/integration/testdata/nvmrc_app/.nvmrc @@ -1 +1 @@ -16.* +18.* diff --git a/nvmrc_parser.go b/nvmrc_parser.go index ebb8dfce..dc2b60fb 100644 --- a/nvmrc_parser.go +++ b/nvmrc_parser.go @@ -18,6 +18,7 @@ var ( "fermium": 14, "gallium": 16, "hydrogen": 18, + "iron": 20, } ) diff --git a/nvmrc_parser_test.go b/nvmrc_parser_test.go index 9593913e..fa09ec49 100644 --- a/nvmrc_parser_test.go +++ b/nvmrc_parser_test.go @@ -43,7 +43,7 @@ func testNvmrcParser(t *testing.T, context spec.G, it spec.S) { "10.1.1": "10.1.1", "10.1.*": "10.1.*", "10.*": "10.*", - "lts/*": "18.*", + "lts/*": "20.*", "lts/argon": "4.*", "lts/boron": "6.*", "lts/carbon": "8.*", @@ -52,6 +52,7 @@ func testNvmrcParser(t *testing.T, context spec.G, it spec.S) { "lts/fermium": "14.*", "lts/gallium": "16.*", "lts/hydrogen": "18.*", + "lts/iron": "20.*", "node": "*", }