diff --git a/buildpack.toml b/buildpack.toml index af59bd31..d96bf1f6 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -19,6 +19,10 @@ api = "0.5" id = "paketo-buildpacks/node-engine" version = "0.6.2" + [[order.group]] + id = "railwayapp/node-config" + version = "0.0.1" + [[order.group]] id = "paketo-buildpacks/yarn" version = "0.4.0" @@ -67,6 +71,10 @@ api = "0.5" id = "paketo-buildpacks/node-engine" version = "0.6.2" + [[order.group]] + id = "railwayapp/node-config" + version = "0.0.1" + [[order.group]] id = "paketo-buildpacks/npm-install" version = "0.4.0" @@ -111,6 +119,10 @@ api = "0.5" id = "paketo-buildpacks/node-engine" version = "0.6.2" + [[order.group]] + id = "railwayapp/node-config" + version = "0.0.1" + [[order.group]] id = "paketo-buildpacks/node-module-bom" optional = true diff --git a/integration/node_start_test.go b/integration/node_start_test.go index e1df0e77..28115586 100644 --- a/integration/node_start_test.go +++ b/integration/node_start_test.go @@ -64,6 +64,7 @@ func testNodeStart(t *testing.T, context spec.G, it spec.S) { Execute(name, source) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Start Buildpack"))) Expect(logs).NotTo(ContainLines(ContainSubstring("Procfile Buildpack"))) @@ -106,6 +107,7 @@ func testNodeStart(t *testing.T, context spec.G, it spec.S) { Execute(name, source) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Start Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Procfile Buildpack"))) @@ -113,7 +115,7 @@ func testNodeStart(t *testing.T, context spec.G, it spec.S) { Expect(logs).To(ContainLines(ContainSubstring("Environment Variables Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Image Labels Buildpack"))) - Expect(image.Buildpacks[4].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) + Expect(image.Buildpacks[5].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) Expect(image.Labels["some-label"]).To(Equal("some-value")) container, err = docker.Container.Run. @@ -156,6 +158,7 @@ func testNodeStart(t *testing.T, context spec.G, it spec.S) { Execute(name, source) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Start Buildpack"))) @@ -163,8 +166,6 @@ func testNodeStart(t *testing.T, context spec.G, it spec.S) { Expect(logs).NotTo(ContainLines(ContainSubstring("Environment Variables Buildpack"))) Expect(logs).NotTo(ContainLines(ContainSubstring("Image Labels Buildpack"))) - Expect(image.Buildpacks[2].Key).To(Equal("paketo-buildpacks/node-module-bom")) - container, err = docker.Container.Run. WithEnv(map[string]string{"PORT": "8080"}). WithPublish("8080"). @@ -226,6 +227,7 @@ func testNodeStart(t *testing.T, context spec.G, it spec.S) { Execute(name, filepath.Join(source, "node_server")) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("CA Certificates Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Start Buildpack"))) diff --git a/integration/npm_test.go b/integration/npm_test.go index 45e77f3c..1d0c0b80 100644 --- a/integration/npm_test.go +++ b/integration/npm_test.go @@ -65,6 +65,7 @@ func testNPM(t *testing.T, context spec.G, it spec.S) { Execute(name, source) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("NPM Install Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) @@ -73,8 +74,6 @@ func testNPM(t *testing.T, context spec.G, it spec.S) { Expect(logs).NotTo(ContainLines(ContainSubstring("Environment Variables Buildpack"))) Expect(logs).NotTo(ContainLines(ContainSubstring("Image Labels Buildpack"))) - Expect(image.Buildpacks[3].Key).To(Equal("paketo-buildpacks/node-module-bom")) - container, err = docker.Container.Run. WithEnv(map[string]string{"PORT": "8080"}). WithPublish("8080"). @@ -115,6 +114,7 @@ func testNPM(t *testing.T, context spec.G, it spec.S) { Execute(name, source) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("NPM Install Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) @@ -125,9 +125,8 @@ func testNPM(t *testing.T, context spec.G, it spec.S) { Expect(logs).To(ContainLines(ContainSubstring("Image Labels Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Run Script"))) - Expect(image.Buildpacks[7].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) + Expect(image.Buildpacks[8].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) Expect(image.Labels["some-label"]).To(Equal("some-value")) - Expect(image.Buildpacks[3].Key).To(Equal("paketo-buildpacks/node-module-bom")) container, err = docker.Container.Run. WithEnv(map[string]string{"PORT": "8080"}). @@ -189,12 +188,12 @@ func testNPM(t *testing.T, context spec.G, it spec.S) { Execute(name, filepath.Join(source, "npm_server")) Expect(err).NotTo(HaveOccurred()) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("CA Certificates Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("NPM Install Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("NPM Start Buildpack"))) - Expect(image.Buildpacks[3].Key).To(Equal("paketo-buildpacks/node-module-bom")) // NOTE: NODE_OPTIONS="--use-openssl-ca" is NOT required since the node binary is compiled with `--openssl-use-def-ca-store` container, err = docker.Container.Run. diff --git a/integration/yarn_test.go b/integration/yarn_test.go index a3b068a0..a02fa2cd 100644 --- a/integration/yarn_test.go +++ b/integration/yarn_test.go @@ -65,6 +65,7 @@ func testYarn(t *testing.T, context spec.G, it spec.S) { Expect(err).NotTo(HaveOccurred()) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Yarn Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Yarn Install Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) @@ -73,8 +74,6 @@ func testYarn(t *testing.T, context spec.G, it spec.S) { Expect(logs).NotTo(ContainLines(ContainSubstring("Environment Variables Buildpack"))) Expect(logs).NotTo(ContainLines(ContainSubstring("Image Labels Buildpack"))) - Expect(image.Buildpacks[4].Key).To(Equal("paketo-buildpacks/node-module-bom")) - container, err = docker.Container.Run. WithEnv(map[string]string{"PORT": "8080"}). WithPublish("8080"). @@ -108,6 +107,7 @@ func testYarn(t *testing.T, context spec.G, it spec.S) { Expect(err).NotTo(HaveOccurred()) Expect(logs).To(ContainLines(ContainSubstring("Node Engine Buildpack"))) + Expect(logs).To(ContainLines(ContainSubstring("Railway Node Config Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Yarn Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Yarn Install Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) @@ -118,9 +118,8 @@ func testYarn(t *testing.T, context spec.G, it spec.S) { Expect(logs).To(ContainLines(ContainSubstring("Image Labels Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Node Run Script"))) - Expect(image.Buildpacks[8].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) + Expect(image.Buildpacks[9].Layers["environment-variables"].Metadata["variables"]).To(Equal(map[string]interface{}{"SOME_VARIABLE": "some-value"})) Expect(image.Labels["some-label"]).To(Equal("some-value")) - Expect(image.Buildpacks[4].Key).To(Equal("paketo-buildpacks/node-module-bom")) container, err = docker.Container.Run. WithEnv(map[string]string{"PORT": "8080"}). @@ -188,8 +187,6 @@ func testYarn(t *testing.T, context spec.G, it spec.S) { Expect(logs).To(ContainLines(ContainSubstring("Node Module Bill of Materials Generator Buildpack"))) Expect(logs).To(ContainLines(ContainSubstring("Yarn Start Buildpack"))) - Expect(image.Buildpacks[4].Key).To(Equal("paketo-buildpacks/node-module-bom")) - // NOTE: NODE_OPTIONS="--use-openssl-ca" is NOT required since the node binary is compiled with `--openssl-use-def-ca-store` container, err = docker.Container.Run. WithPublish("8080"). diff --git a/package.toml b/package.toml index 575a5d3a..07589394 100644 --- a/package.toml +++ b/package.toml @@ -40,3 +40,6 @@ [[dependencies]] uri = "docker://gcr.io/paketo-buildpacks/node-module-bom:0.1.0" + +[[dependencies]] + uri = "docker://ghcr.io/railwayapp/node-config:0.0.1"