Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit fbf3859

Browse files
1 parent bcc578e commit fbf3859

26 files changed

Lines changed: 891 additions & 89 deletions

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* @paketo-buildpacks/builders-maintainers
1+
* @paketo-community/builders-maintainers
2+
* @paketo-community/java-maintainers

.github/workflows/push-image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ jobs:
5252
PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }}
5353
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
5454
run: |
55-
DOCKERHUB_ORG="${GITHUB_REPOSITORY_OWNER/-/}" # translates 'paketo-buildpacks' to 'paketobuildpacks'
55+
DOCKERHUB_ORG="${GITHUB_REPOSITORY_OWNER/-/}" # translates 'paketo-community' to 'paketocommunity'
5656
# Strip off the Github org prefix from repo name
57-
# paketo-buildpacks/builder-with-some-name --> builder-with-some-name
57+
# paketo-community/builder-with-some-name --> builder-with-some-name
5858
registry_repo=$(echo "${{ github.repository }}" | sed 's/^.*\///')
5959
6060
echo "${PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD}" | docker login --username "${PAKETO_BUILDPACKS_DOCKERHUB_USERNAME}" --password-stdin

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
# Paketo Jammy Buildpackless Tiny Builder
1+
# Paketo Jammy Java Tiny Builder
22

3-
## `paketobuildpacks/builder-jammy-buildpackless-tiny`
3+
## `paketobuildpacks/builder-jammy-java-tiny`
44

55
This builder uses the [Paketo Jammy Tiny
66
Stack](https://github.com/paketo-buildpacks/jammy-tiny-stack) (Ubuntu Jammy
7-
Jellyfish build image, distroless-like run image) and contains **no buildpacks
8-
nor order groups**. To use this builder, you must specify buildpacks at build
7+
Jellyfish build image, distroless-like run image) and contains
8+
***only Java composite buildpacks**. To use this builder,
9+
you must specify buildpacks at build
910
time using whatever mechanisms your CNB platform of choice offers.
1011

1112
For example, with the `pack` CLI, use `--buildpack` as follows:
1213
```
13-
pack build go-with-buildpackless-builder \
14-
--buildpack gcr.io/paketo-buildpacks/go \
15-
--builder paketobuildpacks/builder-jammy-buildpackless-tiny:latest
14+
pack build great-java-app \
15+
--builder paketobuildpacks/builder-jammy-java-tiny:latest
1616
```
1717

1818
To see which versions of build and run images and the lifecycle are in a given
1919
builder version, see the
20-
[Releases](https://github.com/paketo-buildpacks/builder-jammy-buildpackless-tiny/releases)
20+
[Releases](https://github.com/paketo-buildpacks/builder-jammy-java-tiny/releases)
2121
on this repository. This information is also available in the `builder.toml`.
2222

2323
For more information about this builder and how to use it, visit the [Paketo

builder.toml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
1-
description = "Tiny base image (Ubuntu Jammy Jellyfish build image, distroless-like run image) with no buildpacks included. To use, specify buildpacks at build time."
1+
description = "Tiny base image (Ubuntu Jammy Jellyfish build image, distroless-like run image) with only Java buildpacks included. To use, specify buildpacks at build time."
2+
3+
[[buildpacks]]
4+
uri = "docker://gcr.io/paketo-buildpacks/java-native-image:9.8.0"
5+
version = "9.8.0"
6+
7+
[[buildpacks]]
8+
uri = "docker://gcr.io/paketo-buildpacks/java:15.2.0"
9+
version = "15.2.0"
210

311
[lifecycle]
412
version = "0.20.0"
513

14+
[[order]]
15+
16+
[[order.group]]
17+
id = "paketo-buildpacks/java-native-image"
18+
version = "9.8.0"
19+
20+
[[order]]
21+
22+
[[order.group]]
23+
id = "paketo-buildpacks/java"
24+
version = "15.2.0"
25+
626
[stack]
727
build-image = "docker.io/paketobuildpacks/build-jammy-tiny:0.2.43"
828
id = "io.buildpacks.stacks.jammy.tiny"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module github.com/paketo-buildpacks/builder-jammy-buildpackless-tiny
1+
module github.com/paketo-community/builder-jammy-java-tiny
22

33
go 1.22.5
44

smoke.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

smoke/init_test.go

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
package smoke_test
22

33
import (
4-
"encoding/json"
54
"flag"
6-
"os"
75
"testing"
86
"time"
97

8+
"github.com/onsi/gomega/format"
109
"github.com/sclevine/spec"
1110
"github.com/sclevine/spec/report"
1211

1312
. "github.com/onsi/gomega"
1413
)
1514

16-
var (
17-
Builder string
18-
19-
config struct {
20-
Procfile string `json:"procfile"`
21-
}
22-
)
15+
var Builder string
2316

2417
func init() {
2518
flag.StringVar(&Builder, "name", "", "")
2619
}
2720

2821
func TestSmoke(t *testing.T) {
22+
format.MaxLength = 0
2923
Expect := NewWithT(t).Expect
3024

3125
flag.Parse()
@@ -34,13 +28,8 @@ func TestSmoke(t *testing.T) {
3428

3529
SetDefaultEventuallyTimeout(60 * time.Second)
3630

37-
file, err := os.Open("../smoke.json")
38-
Expect(err).NotTo(HaveOccurred())
39-
40-
Expect(json.NewDecoder(file).Decode(&config)).To(Succeed())
41-
Expect(file.Close()).To(Succeed())
42-
43-
suite := spec.New("Buildpackless Smoke", spec.Parallel(), spec.Report(report.Terminal{}))
44-
suite("Procfile", testProcfile)
31+
suite := spec.New("Smoke", spec.Parallel(), spec.Report(report.Terminal{}))
32+
suite("Java Native Image", testJavaNativeImage)
33+
suite("Java", testJava)
4534
suite.Run(t)
4635
}

smoke/java_native_image_test.go

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
package smoke_test
2+
3+
import (
4+
"fmt"
5+
"os"
6+
"path/filepath"
7+
"testing"
8+
9+
"github.com/paketo-buildpacks/occam"
10+
"github.com/sclevine/spec"
11+
12+
. "github.com/onsi/gomega"
13+
. "github.com/paketo-buildpacks/occam/matchers"
14+
)
15+
16+
func testJavaNativeImage(t *testing.T, context spec.G, it spec.S) {
17+
var (
18+
Expect = NewWithT(t).Expect
19+
Eventually = NewWithT(t).Eventually
20+
21+
pack occam.Pack
22+
docker occam.Docker
23+
)
24+
25+
it.Before(func() {
26+
pack = occam.NewPack().WithVerbose().WithNoColor()
27+
docker = occam.NewDocker()
28+
})
29+
30+
context("detects a Java Native Image app", func() {
31+
var (
32+
image occam.Image
33+
container occam.Container
34+
35+
name string
36+
source string
37+
)
38+
39+
it.Before(func() {
40+
var err error
41+
name, err = occam.RandomName()
42+
Expect(err).NotTo(HaveOccurred())
43+
})
44+
45+
it.After(func() {
46+
Expect(docker.Container.Remove.Execute(container.ID)).To(Succeed())
47+
Expect(docker.Volume.Remove.Execute(occam.CacheVolumeNames(name))).To(Succeed())
48+
Expect(docker.Image.Remove.Execute(image.ID)).To(Succeed())
49+
Expect(os.RemoveAll(source)).To(Succeed())
50+
})
51+
52+
it("builds successfully", func() {
53+
var err error
54+
source, err = occam.Source(filepath.Join("testdata", "java-native-image"))
55+
Expect(err).NotTo(HaveOccurred())
56+
57+
var logs fmt.Stringer
58+
image, logs, err = pack.Build.
59+
WithPullPolicy("never").
60+
WithBuilder(Builder).
61+
WithEnv(map[string]string{"BP_NATIVE_IMAGE": "true", "BP_JVM_VERSION": "17", "BP_MAVEN_BUILD_ARGUMENTS": "-Pnative --batch-mode -Dmaven.test.skip=true --no-transfer-progress package", "USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM": "false"}).
62+
Execute(name, source)
63+
Expect(err).ToNot(HaveOccurred(), logs.String)
64+
65+
container, err = docker.Container.Run.
66+
WithEnv(map[string]string{"PORT": "8080"}).
67+
WithPublish("8080").
68+
Execute(image.ID)
69+
Expect(err).NotTo(HaveOccurred())
70+
71+
Eventually(container).Should(BeAvailable())
72+
73+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for BellSoft Liberica")))
74+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Maven")))
75+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Executable JAR")))
76+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Spring Boot")))
77+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Native Image")))
78+
})
79+
})
80+
}
Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,37 @@ import (
99
"github.com/paketo-buildpacks/occam"
1010
"github.com/sclevine/spec"
1111

12-
"runtime"
13-
1412
. "github.com/onsi/gomega"
1513
. "github.com/paketo-buildpacks/occam/matchers"
1614
)
1715

18-
func testProcfile(t *testing.T, context spec.G, it spec.S) {
16+
func testJava(t *testing.T, context spec.G, it spec.S) {
1917
var (
2018
Expect = NewWithT(t).Expect
2119
Eventually = NewWithT(t).Eventually
2220

2321
pack occam.Pack
2422
docker occam.Docker
25-
arch string
2623
)
2724

2825
it.Before(func() {
2926
pack = occam.NewPack().WithVerbose().WithNoColor()
3027
docker = occam.NewDocker()
31-
arch = runtime.GOARCH
3228
})
3329

34-
context("procfile buildpack specified at build time", func() {
30+
context("detects a Java app", func() {
3531
var (
3632
image occam.Image
3733
container occam.Container
3834

39-
name string
40-
source string
41-
process string
35+
name string
36+
source string
4237
)
4338

4439
it.Before(func() {
4540
var err error
4641
name, err = occam.RandomName()
4742
Expect(err).NotTo(HaveOccurred())
48-
49-
if arch == "amd64" {
50-
fmt.Println("Running on AMD64 architecture")
51-
process = "amd64-process"
52-
} else if arch == "arm64" {
53-
fmt.Println("Running on ARM64 architecture")
54-
process = "arm64-process"
55-
}
5643
})
5744

5845
it.After(func() {
@@ -62,18 +49,17 @@ func testProcfile(t *testing.T, context spec.G, it spec.S) {
6249
Expect(os.RemoveAll(source)).To(Succeed())
6350
})
6451

65-
it("builds Procfile app successfully", func() {
52+
it("builds successfully", func() {
6653
var err error
67-
source, err = occam.Source(filepath.Join("testdata", "procfile"))
54+
// this is OK, the app also works for running with a JVM
55+
source, err = occam.Source(filepath.Join("testdata", "java-native-image"))
6856
Expect(err).NotTo(HaveOccurred())
6957

7058
var logs fmt.Stringer
7159
image, logs, err = pack.Build.
60+
WithPullPolicy("never").
7261
WithBuilder(Builder).
73-
WithBuildpacks(
74-
config.Procfile,
75-
).
76-
WithAdditionalBuildArgs("--default-process", process).
62+
WithEnv(map[string]string{"BP_JVM_VERSION": "17"}).
7763
Execute(name, source)
7864
Expect(err).ToNot(HaveOccurred(), logs.String)
7965

@@ -85,7 +71,10 @@ func testProcfile(t *testing.T, context spec.G, it spec.S) {
8571

8672
Eventually(container).Should(BeAvailable())
8773

88-
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Procfile")))
74+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for BellSoft Liberica")))
75+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Maven")))
76+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Executable JAR")))
77+
Expect(logs).To(ContainLines(ContainSubstring("Paketo Buildpack for Spring Boot")))
8978
})
9079
})
9180
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/

0 commit comments

Comments
 (0)