Skip to content

Commit

Permalink
Adds utility buildpacks for javascript apps (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
TisVictress authored Apr 7, 2022
1 parent af22e25 commit 47a73cf
Show file tree
Hide file tree
Showing 110 changed files with 43,218 additions and 40 deletions.
80 changes: 80 additions & 0 deletions buildpack.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ api = "0.6"

[[order]]

[[order.group]]
id = "paketo-buildpacks/ca-certificates"
optional = true
version = "3.1.0"

[[order.group]]
id = "paketo-buildpacks/watchexec"
optional = true
version = "2.3.5"

[[order.group]]
id = "paketo-buildpacks/node-engine"
version = "0.12.3"
Expand All @@ -34,8 +44,28 @@ api = "0.6"
id = "paketo-buildpacks/nginx"
version = "0.6.0"

[[order.group]]
id = "paketo-buildpacks/environment-variables"
optional = true
version = "4.1.0"

[[order.group]]
id = "paketo-buildpacks/image-labels"
optional = true
version = "4.1.0"

[[order]]

[[order.group]]
id = "paketo-buildpacks/ca-certificates"
optional = true
version = "3.1.0"

[[order.group]]
id = "paketo-buildpacks/watchexec"
optional = true
version = "2.3.5"

[[order.group]]
id = "paketo-buildpacks/node-engine"
version = "0.12.3"
Expand All @@ -52,8 +82,28 @@ api = "0.6"
id = "paketo-buildpacks/nginx"
version = "0.6.0"

[[order.group]]
id = "paketo-buildpacks/environment-variables"
optional = true
version = "4.1.0"

[[order.group]]
id = "paketo-buildpacks/image-labels"
optional = true
version = "4.1.0"

[[order]]

[[order.group]]
id = "paketo-buildpacks/ca-certificates"
optional = true
version = "3.1.0"

[[order.group]]
id = "paketo-buildpacks/watchexec"
optional = true
version = "2.3.5"

[[order.group]]
id = "paketo-buildpacks/node-engine"
version = "0.12.3"
Expand All @@ -74,8 +124,28 @@ api = "0.6"
id = "paketo-buildpacks/httpd"
version = "0.3.0"

[[order.group]]
id = "paketo-buildpacks/environment-variables"
optional = true
version = "4.1.0"

[[order.group]]
id = "paketo-buildpacks/image-labels"
optional = true
version = "4.1.0"

[[order]]

[[order.group]]
id = "paketo-buildpacks/ca-certificates"
optional = true
version = "3.1.0"

[[order.group]]
id = "paketo-buildpacks/watchexec"
optional = true
version = "2.3.5"

[[order.group]]
id = "paketo-buildpacks/node-engine"
version = "0.12.3"
Expand All @@ -92,6 +162,16 @@ api = "0.6"
id = "paketo-buildpacks/httpd"
version = "0.3.0"

[[order.group]]
id = "paketo-buildpacks/environment-variables"
optional = true
version = "4.1.0"

[[order.group]]
id = "paketo-buildpacks/image-labels"
optional = true
version = "4.1.0"

[[order]]

[[order.group]]
Expand Down
8 changes: 4 additions & 4 deletions integration/httpd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,16 +128,16 @@ func testHttpd(t *testing.T, context spec.G, it spec.S) {
var err error
name, err = occam.RandomName()
Expect(err).NotTo(HaveOccurred())
source, err = occam.Source(filepath.Join("testdata", "ca_cert_httpd"))
source, err = occam.Source(filepath.Join("testdata", "ca_cert_apps"))
Expect(err).NotTo(HaveOccurred())

caCert, err := ioutil.ReadFile(fmt.Sprintf("%s/app/certs/ca.pem", source))
caCert, err := ioutil.ReadFile(filepath.Join(source, "client_certs", "ca.pem"))
Expect(err).ToNot(HaveOccurred())

caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)

cert, err := tls.LoadX509KeyPair(fmt.Sprintf("%s/app/certs/cert.pem", source), fmt.Sprintf("%s/app/certs/key.pem", source))
cert, err := tls.LoadX509KeyPair(filepath.Join(source, "client_certs", "cert.pem"), filepath.Join(source, "client_certs", "key.pem"))
Expect(err).ToNot(HaveOccurred())

client = &http.Client{
Expand All @@ -157,7 +157,7 @@ func testHttpd(t *testing.T, context spec.G, it spec.S) {
image, logs, err = pack.WithNoColor().Build.
WithBuildpacks(webServersBuildpack).
WithPullPolicy("never").
Execute(name, filepath.Join(source, "app"))
Execute(name, filepath.Join(source, "httpd"))
Expect(err).NotTo(HaveOccurred())

Expect(logs).To(ContainLines(ContainSubstring("CA Certificates Buildpack")))
Expand Down
8 changes: 5 additions & 3 deletions integration/nginx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,16 +124,18 @@ func testNginx(t *testing.T, context spec.G, it spec.S) {

it.Before(func() {
var err error
source, err = occam.Source(filepath.Join("testdata", "ca_cert_nginx"))
name, err = occam.RandomName()
Expect(err).NotTo(HaveOccurred())
source, err = occam.Source(filepath.Join("testdata", "ca_cert_apps"))
Expect(err).NotTo(HaveOccurred())

caCert, err := ioutil.ReadFile(fmt.Sprintf("%s/client-certs/ca.pem", source))
caCert, err := ioutil.ReadFile(filepath.Join(source, "client_certs", "ca.pem"))
Expect(err).ToNot(HaveOccurred())

caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)

cert, err := tls.LoadX509KeyPair(fmt.Sprintf("%s/client-certs/cert.pem", source), fmt.Sprintf("%s/client-certs/key.pem", source))
cert, err := tls.LoadX509KeyPair(filepath.Join(source, "client_certs", "cert.pem"), filepath.Join(source, "client_certs", "key.pem"))
Expect(err).ToNot(HaveOccurred())

client = &http.Client{
Expand Down
Loading

0 comments on commit 47a73cf

Please sign in to comment.