Skip to content

Commit

Permalink
change additional buildpack to java
Browse files Browse the repository at this point in the history
Signed-off-by: edithwuly <[email protected]>
  • Loading branch information
edithwuly committed May 22, 2023
1 parent 8d55b54 commit d8498fe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
shell: bash
- name: Run benchmark
run: |
git clone https://github.com/buildpacks/samples.git
mkdir out || (exit 0)
go test -bench=. -benchtime=1s ./benchmarks/... -tags=benchmarks | tee ./out/benchmark.txt
Expand Down
22 changes: 13 additions & 9 deletions benchmarks/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ import (
)

var (
baseImg string
trustedImg string
builder string
mockAppPath string
paketoBuilder string
additionalBuildapck string
baseImg string
trustedImg string
builder string
mockAppPath string
paketoBuilder string
additionalMockAppPath string
additionalBuildapck string
)

func BenchmarkBuild(b *testing.B) {
Expand Down Expand Up @@ -63,10 +64,10 @@ func BenchmarkBuild(b *testing.B) {
}
})

b.Run("with Addtional Buildpack", func(b *testing.B) {
b.Run("with Additional Buildpack", func(b *testing.B) {
for i := 0; i < b.N; i++ {
// perform the operation we're analyzing
cmd.SetArgs([]string{fmt.Sprintf("%s%d", trustedImg, i), "-p", mockAppPath, "-B", paketoBuilder, "--buildpack", additionalBuildapck})
cmd.SetArgs([]string{fmt.Sprintf("%s%d", trustedImg, i), "-p", additionalMockAppPath, "-B", paketoBuilder, "--buildpack", additionalBuildapck})
if err = cmd.Execute(); err != nil {
b.Error(errors.Wrapf(err, "running build #%d", i))
}
Expand Down Expand Up @@ -113,7 +114,10 @@ func setEnv() {
if paketoBuilder = os.Getenv("paketoBuilder"); paketoBuilder == "" {
paketoBuilder = "paketobuildpacks/builder-jammy-base"
}
if additionalMockAppPath = os.Getenv("additionalMockAppPath"); additionalMockAppPath == "" {
additionalMockAppPath = filepath.Join("..", "samples", "apps", "java-maven")
}
if additionalBuildapck = os.Getenv("additionalBuildapck"); additionalBuildapck == "" {
additionalBuildapck = "docker://cnbs/sample-package:hello-universe"
additionalBuildapck = "paketobuildpacks/java:latest"
}
}

0 comments on commit d8498fe

Please sign in to comment.