From 512d31b8ab601ec925f1f16e9b9b83ea63107469 Mon Sep 17 00:00:00 2001 From: Anthony Dahanne Date: Wed, 17 Apr 2024 09:58:54 -0400 Subject: [PATCH] Add Java 22 --- .github/pipeline-descriptor.yml | 16 ++- .github/workflows/pb-update-go.yml | 2 +- .github/workflows/pb-update-jdk-22.yml | 103 ++++++++++++++++++ .../workflows/pb-update-native-image-22.yml | 103 ++++++++++++++++++ buildpack.toml | 28 +++++ 5 files changed, 250 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/pb-update-jdk-22.yml create mode 100644 .github/workflows/pb-update-native-image-22.yml diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index fa306e5..db94a30 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -34,6 +34,13 @@ dependencies: with: type: jdk version: "21" +- name: JDK 22 + id: jdk + version_pattern: "22\\.[\\d]+\\.[\\d]+" + uses: docker://ghcr.io/paketo-buildpacks/actions/oracle-dependency:main + with: + type: jdk + version: "22" - name: Native Image 17 id: native-image-svm version_pattern: "17\\.[\\d]+\\.[\\d]+" @@ -47,4 +54,11 @@ dependencies: uses: docker://ghcr.io/paketo-buildpacks/actions/oracle-dependency:main with: type: graalvm - version: "21" \ No newline at end of file + version: "21" +- name: Native Image 22 + id: native-image-svm + version_pattern: "22\\.[\\d]+\\.[\\d]+" + uses: docker://ghcr.io/paketo-buildpacks/actions/oracle-dependency:main + with: + type: graalvm + version: "22" \ No newline at end of file diff --git a/.github/workflows/pb-update-go.yml b/.github/workflows/pb-update-go.yml index e9f5bef..df0ef0a 100644 --- a/.github/workflows/pb-update-go.yml +++ b/.github/workflows/pb-update-go.yml @@ -1,7 +1,7 @@ name: Update Go "on": schedule: - - cron: 51 2 * * 1 + - cron: 27 2 * * 1 workflow_dispatch: {} jobs: update: diff --git a/.github/workflows/pb-update-jdk-22.yml b/.github/workflows/pb-update-jdk-22.yml new file mode 100644 index 0000000..7b7d0f8 --- /dev/null +++ b/.github/workflows/pb-update-jdk-22.yml @@ -0,0 +1,103 @@ +name: Update JDK 22 +"on": + schedule: + - cron: 0 5 * * 1-5 + workflow_dispatch: {} +jobs: + update: + name: Update Buildpack Dependency + runs-on: + - ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.20" + - name: Install update-buildpack-dependency + run: | + #!/usr/bin/env bash + + set -euo pipefail + + go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency@latest + - uses: buildpacks/github-actions/setup-tools@v5.5.3 + with: + crane-version: 0.19.0 + yj-version: 5.1.0 + - uses: actions/checkout@v4 + - id: dependency + uses: docker://ghcr.io/paketo-buildpacks/actions/oracle-dependency:main + with: + type: jdk + version: "22" + - name: Update Buildpack Dependency + id: buildpack + run: | + #!/usr/bin/env bash + + set -euo pipefail + + VERSION_DEPS=$(yj -tj < buildpack.toml | jq -r ".metadata.dependencies[] | select( .id == env.ID ) | select( .version | test( env.VERSION_PATTERN ) )") + ARCH=${ARCH:-amd64} + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r 'select( .purl | contains( env.ARCH ) ) | .version') + + if [ -z "$OLD_VERSION" ]; then + ARCH="" # empty means noarch + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r ".version") + fi + + update-buildpack-dependency \ + --buildpack-toml buildpack.toml \ + --id "${ID}" \ + --arch "${ARCH}" \ + --version-pattern "${VERSION_PATTERN}" \ + --version "${VERSION}" \ + --cpe-pattern "${CPE_PATTERN:-}" \ + --cpe "${CPE:-}" \ + --purl-pattern "${PURL_PATTERN:-}" \ + --purl "${PURL:-}" \ + --uri "${URI}" \ + --sha256 "${SHA256}" \ + --source "${SOURCE_URI}" \ + --source-sha256 "${SOURCE_SHA256}" + + git add buildpack.toml + git checkout -- . + + if [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $1}')" != "$(echo "$VERSION" | awk -F '.' '{print $1}')" ]; then + LABEL="semver:major" + elif [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $2}')" != "$(echo "$VERSION" | awk -F '.' '{print $2}')" ]; then + LABEL="semver:minor" + else + LABEL="semver:patch" + fi + + echo "old-version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" + echo "new-version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "version-label=${LABEL}" >> "$GITHUB_OUTPUT" + env: + ARCH: "" + CPE: ${{ steps.dependency.outputs.cpe }} + CPE_PATTERN: "" + ID: jdk + PURL: ${{ steps.dependency.outputs.purl }} + PURL_PATTERN: "" + SHA256: ${{ steps.dependency.outputs.sha256 }} + SOURCE_SHA256: ${{ steps.dependency.outputs.source_sha256 }} + SOURCE_URI: ${{ steps.dependency.outputs.source }} + URI: ${{ steps.dependency.outputs.uri }} + VERSION: ${{ steps.dependency.outputs.version }} + VERSION_PATTERN: 22\.[\d]+\.[\d]+ + - uses: peter-evans/create-pull-request@v6 + with: + author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> + body: Bumps `JDK 22` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. + branch: update/buildpack/jdk-22 + commit-message: |- + Bump JDK 22 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + + Bumps JDK 22 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}. + delete-branch: true + labels: ${{ steps.buildpack.outputs.version-label }}, type:dependency-upgrade + signoff: true + title: Bump JDK 22 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/pb-update-native-image-22.yml b/.github/workflows/pb-update-native-image-22.yml new file mode 100644 index 0000000..903f73b --- /dev/null +++ b/.github/workflows/pb-update-native-image-22.yml @@ -0,0 +1,103 @@ +name: Update Native Image 22 +"on": + schedule: + - cron: 0 5 * * 1-5 + workflow_dispatch: {} +jobs: + update: + name: Update Buildpack Dependency + runs-on: + - ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.20" + - name: Install update-buildpack-dependency + run: | + #!/usr/bin/env bash + + set -euo pipefail + + go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency@latest + - uses: buildpacks/github-actions/setup-tools@v5.5.3 + with: + crane-version: 0.19.0 + yj-version: 5.1.0 + - uses: actions/checkout@v4 + - id: dependency + uses: docker://ghcr.io/paketo-buildpacks/actions/oracle-dependency:main + with: + type: graalvm + version: "22" + - name: Update Buildpack Dependency + id: buildpack + run: | + #!/usr/bin/env bash + + set -euo pipefail + + VERSION_DEPS=$(yj -tj < buildpack.toml | jq -r ".metadata.dependencies[] | select( .id == env.ID ) | select( .version | test( env.VERSION_PATTERN ) )") + ARCH=${ARCH:-amd64} + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r 'select( .purl | contains( env.ARCH ) ) | .version') + + if [ -z "$OLD_VERSION" ]; then + ARCH="" # empty means noarch + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r ".version") + fi + + update-buildpack-dependency \ + --buildpack-toml buildpack.toml \ + --id "${ID}" \ + --arch "${ARCH}" \ + --version-pattern "${VERSION_PATTERN}" \ + --version "${VERSION}" \ + --cpe-pattern "${CPE_PATTERN:-}" \ + --cpe "${CPE:-}" \ + --purl-pattern "${PURL_PATTERN:-}" \ + --purl "${PURL:-}" \ + --uri "${URI}" \ + --sha256 "${SHA256}" \ + --source "${SOURCE_URI}" \ + --source-sha256 "${SOURCE_SHA256}" + + git add buildpack.toml + git checkout -- . + + if [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $1}')" != "$(echo "$VERSION" | awk -F '.' '{print $1}')" ]; then + LABEL="semver:major" + elif [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $2}')" != "$(echo "$VERSION" | awk -F '.' '{print $2}')" ]; then + LABEL="semver:minor" + else + LABEL="semver:patch" + fi + + echo "old-version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" + echo "new-version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "version-label=${LABEL}" >> "$GITHUB_OUTPUT" + env: + ARCH: "" + CPE: ${{ steps.dependency.outputs.cpe }} + CPE_PATTERN: "" + ID: native-image-svm + PURL: ${{ steps.dependency.outputs.purl }} + PURL_PATTERN: "" + SHA256: ${{ steps.dependency.outputs.sha256 }} + SOURCE_SHA256: ${{ steps.dependency.outputs.source_sha256 }} + SOURCE_URI: ${{ steps.dependency.outputs.source }} + URI: ${{ steps.dependency.outputs.uri }} + VERSION: ${{ steps.dependency.outputs.version }} + VERSION_PATTERN: 22\.[\d]+\.[\d]+ + - uses: peter-evans/create-pull-request@v6 + with: + author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> + body: Bumps `Native Image 22` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. + branch: update/buildpack/native-image-22 + commit-message: |- + Bump Native Image 22 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + + Bumps Native Image 22 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}. + delete-branch: true + labels: ${{ steps.buildpack.outputs.version-label }}, type:dependency-upgrade + signoff: true + title: Bump Native Image 22 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/buildpack.toml b/buildpack.toml index db2598c..5a10115 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -166,6 +166,20 @@ api = "0.7" type = "Oracle No-Fee Terms and Conditions License" uri = "https://www.oracle.com/downloads/licenses/no-fee-license.html" + [[metadata.dependencies]] + cpes = ["cpe:2.3:a:oracle:jdk:22.0.1:*:*:*:*:*:*:*"] + id = "jdk" + name = "Oracle JDK" + purl = "pkg:generic/oracle-jdk@22.0.1?arch=amd64" + sha256 = "bb1a6995ae63a04456b1f08fae70a71be59fc1e350c2748a252e87b07bc1c36e" + stacks = ["*"] + uri = "https://download.oracle.com/java/22/archive/jdk-22.0.1_linux-x64_bin.tar.gz" + version = "22.0.1" + + [[metadata.dependencies.licenses]] + type = "Oracle No-Fee Terms and Conditions License" + uri = "https://www.oracle.com/downloads/licenses/no-fee-license.html" + [[metadata.dependencies]] cpes = ["cpe:2.3:a:oracle:jdk:17.0.11:*:*:*:*:*:*:*:*"] id = "native-image-svm" @@ -194,5 +208,19 @@ api = "0.7" type = "GraalVM Free Terms and Conditions License" uri = "https://www.oracle.com/downloads/licenses/graal-free-license.html" + [[metadata.dependencies]] + cpes = ["cpe:2.3:a:oracle:jdk:22.0.1:*:*:*:*:*:*:*:*"] + id = "native-image-svm" + name = "Oracle GraalVM" + purl = "pkg:generic/graalvm-jdk@22.0.1" + sha256 = "d583cdb01ca023a37eed45d9d184b68b7a8d7f50b58dde1369041f294c34f4a3" + stacks = ["*"] + uri = "https://download.oracle.com/graalvm/22/archive/graalvm-jdk-22.0.1_linux-x64_bin.tar.gz" + version = "22.0.1" + + [[metadata.dependencies.licenses]] + type = "GraalVM Free Terms and Conditions License" + uri = "https://www.oracle.com/downloads/licenses/graal-free-license.html" + [[stacks]] id = "*"