Skip to content

Commit

Permalink
Update active lts version from 18.x to 20.x (#767)
Browse files Browse the repository at this point in the history
  • Loading branch information
brayanhenao authored Oct 25, 2023
1 parent a39dddf commit 568bc14
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 23 deletions.
2 changes: 1 addition & 1 deletion buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
39 changes: 39 additions & 0 deletions integration/openssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`,
))
})
})
})
}
4 changes: 2 additions & 2 deletions integration/project_path_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.*\"",
" <unknown> -> \"\"",
))
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.
Expand Down
4 changes: 2 additions & 2 deletions integration/provides_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ func testProvides(t *testing.T, context spec.G, it spec.S) {
" <unknown> -> \"\"",
))
Expect(logs).To(ContainLines(
MatchRegexp(` Selected Node Engine version \(using <unknown>\): 18\.\d+\.\d+`),
MatchRegexp(` Selected Node Engine version \(using <unknown>\): 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(
Expand Down
16 changes: 8 additions & 8 deletions integration/reuse_layer_rebuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -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\"",
" <unknown> -> \"\"",
))
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(
Expand Down Expand Up @@ -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())

Expand All @@ -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\"",
" <unknown> -> \"\"",
))
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(
Expand Down
12 changes: 6 additions & 6 deletions integration/simple_app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.*\"",
" <unknown> -> \"\"",
))
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(
Expand Down Expand Up @@ -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.*\"",
" <unknown> -> \"\"",
))
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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.*
18.*
2 changes: 1 addition & 1 deletion integration/testdata/node_version_app/.node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.*
18.*
2 changes: 1 addition & 1 deletion integration/testdata/nvmrc_app/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.*
18.*
1 change: 1 addition & 0 deletions nvmrc_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var (
"fermium": 14,
"gallium": 16,
"hydrogen": 18,
"iron": 20,
}
)

Expand Down
3 changes: 2 additions & 1 deletion nvmrc_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand All @@ -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": "*",
}

Expand Down

0 comments on commit 568bc14

Please sign in to comment.