Skip to content

Commit

Permalink
adding java 21 on acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pacostas authored and mhdawson committed Feb 26, 2024
1 parent f91fcbf commit 7616df9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 66 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
search_depth: 1
repo: ${{ github.repository }}
output_path: "/github/workspace/${{ env.UBI_RUN_JAVA_11_SHA256_FILENAME }}"
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}

- name: Find and Download Previous run Java 17 sha256 image hash code
id: fetch_previous_run_java_17_sha256_image_hash_code
Expand Down Expand Up @@ -840,7 +840,17 @@ jobs:
"path": "build-java-17/run.oci.sha256",
"name": ($repo + "-" + $tag + "-" + "run-java-17.oci.sha256"),
"content_type": "application/gzip"
},
},
{
"path": "build-java-21/run.oci",
"name": ($repo + "-" + $tag + "-" + "run-java-21.oci"),
"content_type": "application/gzip"
},
{
"path": "build-java-21/run.oci.sha256",
"name": ($repo + "-" + $tag + "-" + "run-java-21.oci.sha256"),
"content_type": "application/gzip"
},
{
"path": "build-java-21/run.oci",
"name": ($repo + "-" + $tag + "-" + "run-java-21.oci"),
Expand All @@ -850,7 +860,7 @@ jobs:
"path": "build-java-21/run.oci.sha256",
"name": ($repo + "-" + $tag + "-" + "run-java-21.oci.sha256"),
"content_type": "application/gzip"
},
},
{
"path": "build-nodejs-16/run.oci",
"name": ($repo + "-" + $tag + "-" + "run-nodejs-16.oci"),
Expand Down
67 changes: 4 additions & 63 deletions metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ func testMetadata(t *testing.T, context spec.G, it spec.S) {
majorVersion: 17,
typeName: "java",
},
{
majorVersion: 21,
typeName: "java",
},
}

for _, engine := range engines {
Expand Down Expand Up @@ -210,69 +214,6 @@ func testMetadata(t *testing.T, context spec.G, it spec.S) {
})
}

by("confirming that the run java-21 image is correct", func() {
dir := filepath.Join(tmpDir, "run-index-java-21")
err := os.Mkdir(dir, os.ModePerm)
Expect(err).NotTo(HaveOccurred())

archive, err := os.Open(stack.RunJava21Archive)
Expect(err).NotTo(HaveOccurred())
defer archive.Close()

err = vacation.NewArchive(archive).Decompress(dir)
Expect(err).NotTo(HaveOccurred())

path, err := layout.FromPath(dir)
Expect(err).NotTo(HaveOccurred())

index, err := path.ImageIndex()
Expect(err).NotTo(HaveOccurred())

indexManifest, err := index.IndexManifest()
Expect(err).NotTo(HaveOccurred())

Expect(indexManifest.Manifests).To(HaveLen(1))
Expect(indexManifest.Manifests[0].Platform).To(Equal(&v1.Platform{
OS: "linux",
Architecture: "amd64",
}))

image, err := index.Image(indexManifest.Manifests[0].Digest)
Expect(err).NotTo(HaveOccurred())

file, err := image.ConfigFile()
Expect(err).NotTo(HaveOccurred())

Expect(file.Config.Labels).To(SatisfyAll(
HaveKeyWithValue("io.buildpacks.stack.id", "io.buildpacks.stacks.ubi8"),
HaveKeyWithValue("io.buildpacks.stack.description", "ubi8 java-21 image to support buildpacks"),
HaveKeyWithValue("io.buildpacks.stack.distro.name", "rhel"),
HaveKeyWithValue("io.buildpacks.stack.distro.version", MatchRegexp(`8\.\d+`)),
HaveKeyWithValue("io.buildpacks.stack.homepage", "https://github.com/paketo-community/ubi-base-stack"),
HaveKeyWithValue("io.buildpacks.stack.maintainer", "Paketo Community"),
HaveKeyWithValue("io.buildpacks.stack.metadata", MatchJSON("{}")),
))

runReleaseDateJava21, err := time.Parse(time.RFC3339, file.Config.Labels["io.buildpacks.stack.released"])
Expect(err).NotTo(HaveOccurred())
Expect(runReleaseDateJava21).NotTo(BeZero())

Expect(file.Config.User).To(Equal("1001:1000"))

Expect(image).To(SatisfyAll(
HaveFileWithContent("/etc/group", ContainSubstring("cnb:x:1000:")),
HaveFileWithContent("/etc/passwd", ContainSubstring("cnb:x:1001:1000::/home/cnb:/bin/bash")),
HaveDirectory("/home/cnb"),
))

Expect(image).To(HaveFileWithContent("/etc/os-release", SatisfyAll(
ContainLines(MatchRegexp(`PRETTY_NAME=\"Red Hat Enterprise Linux 8\.\d+ \(Ootpa\)\"`)),
ContainSubstring(`HOME_URL="https://github.com/paketo-community/ubi-base-stack"`),
ContainSubstring(`SUPPORT_URL="https://github.com/paketo-community/ubi-base-stack/blob/main/README.md"`),
ContainSubstring(`BUG_REPORT_URL="https://github.com/paketo-community/ubi-base-stack/issues/new"`),
)))
})

Expect(runReleaseDate).To(Equal(buildReleaseDate))
})
}
Expand Down

0 comments on commit 7616df9

Please sign in to comment.