From 6d5c63fb8cc6b532d4c9613fa40b8c5ff8b20982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edd=C3=BA=20Mel=C3=A9ndez?= Date: Fri, 24 Dec 2021 16:38:50 -0500 Subject: [PATCH] Add JRE 17 See https://blog.adoptium.net/2021/12/eclipse-temurin-jres-are-back/ --- .github/pipeline-descriptor.yml | 8 ++ .github/workflows/update-jre-17.yml | 112 ++++++++++++++++++++++++++++ buildpack.toml | 14 ++++ 3 files changed, 134 insertions(+) create mode 100644 .github/workflows/update-jre-17.yml diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index 1545061..6731d74 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -59,3 +59,11 @@ dependencies: implementation: hotspot type: jdk version: "[17,18)" +- name: JRE 17 + id: jre + version_pattern: "17\\.[\\d]+\\.[\\d]+" + uses: docker://ghcr.io/paketo-buildpacks/actions/adoptium-dependency:main + with: + implementation: hotspot + type: jre + version: "[17,18)" diff --git a/.github/workflows/update-jre-17.yml b/.github/workflows/update-jre-17.yml new file mode 100644 index 0000000..71028a9 --- /dev/null +++ b/.github/workflows/update-jre-17.yml @@ -0,0 +1,112 @@ +name: Update JRE 17 +"on": + schedule: + - cron: 0 5 * * 1-5 + workflow_dispatch: {} +jobs: + update: + name: Update Buildpack Dependency + runs-on: + - ubuntu-latest + steps: + - uses: actions/setup-go@v2 + with: + go-version: "1.16" + - name: Install update-buildpack-dependency + run: | + #!/usr/bin/env bash + + set -euo pipefail + + GO111MODULE=on go get -u -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency + - name: Install yj + run: | + #!/usr/bin/env bash + + set -euo pipefail + + echo "Installing yj ${YJ_VERSION}" + + mkdir -p "${HOME}"/bin + echo "${HOME}/bin" >> "${GITHUB_PATH}" + + curl \ + --location \ + --show-error \ + --silent \ + --output "${HOME}"/bin/yj \ + "https://github.com/sclevine/yj/releases/download/v${YJ_VERSION}/yj-linux" + + chmod +x "${HOME}"/bin/yj + env: + YJ_VERSION: 5.0.0 + - uses: actions/checkout@v2 + - id: dependency + uses: docker://ghcr.io/paketo-buildpacks/actions/adoptium-dependency:main + with: + implementation: hotspot + type: jre + version: '[17,18)' + - name: Update Buildpack Dependency + id: buildpack + run: |- + #!/usr/bin/env bash + + set -euo pipefail + + OLD_VERSION=$(yj -tj < buildpack.toml | jq -r " + .metadata.dependencies[] | + select( .id == env.ID ) | + select( .version | test( env.VERSION_PATTERN ) ) | + .version") + + update-buildpack-dependency \ + --buildpack-toml buildpack.toml \ + --id "${ID}" \ + --version-pattern "${VERSION_PATTERN}" \ + --version "${VERSION}" \ + --cpe-pattern "${CPE_PATTERN:-}" \ + --cpe "${CPE:-}" \ + --purl-pattern "${PURL_PATTERN:-}" \ + --purl "${PURL:-}" \ + --uri "${URI}" \ + --sha256 "${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 "::set-output name=old-version::${OLD_VERSION}" + echo "::set-output name=new-version::${VERSION}" + echo "::set-output name=version-label::${LABEL}" + env: + CPE: ${{ steps.dependency.outputs.cpe }} + CPE_PATTERN: "" + ID: jre + PURL: ${{ steps.dependency.outputs.purl }} + PURL_PATTERN: "" + SHA256: ${{ steps.dependency.outputs.sha256 }} + URI: ${{ steps.dependency.outputs.uri }} + VERSION: ${{ steps.dependency.outputs.version }} + VERSION_PATTERN: 17\.[\d]+\.[\d]+ + - uses: peter-evans/create-pull-request@v3 + with: + author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> + body: Bumps `JRE 17` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. + branch: update/buildpack/jre-17 + commit-message: |- + Bump JRE 17 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + + Bumps JRE 17 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 JRE 17 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + token: ${{ secrets.JAVA_GITHUB_TOKEN }} diff --git a/buildpack.toml b/buildpack.toml index 752b99e..5da908f 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -196,6 +196,20 @@ api = "0.7" type = "GPL-2.0 WITH Classpath-exception-2.0" uri = "https://openjdk.java.net/legal/gplv2+ce.html" + [[metadata.dependencies]] + cpes = ["cpe:2.3:a:oracle:jre:17.0.1:*:*:*:*:*:*:*"] + id = "jre" + name = "Adoptium JRE" + purl = "pkg:generic/adoptium-jre@17.0.1?arch=amd64" + sha256 = "9d58cb741509a88e0ae33eb022334fb900b409b198eca6fe76246f0677b392ad" + stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] + uri = "https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.1%2B12/OpenJDK17U-jre_x64_linux_hotspot_17.0.1_12.tar.gz" + version = "17.0.1" + + [[metadata.dependencies.licenses]] + type = "GPL-2.0 WITH Classpath-exception-2.0" + uri = "https://openjdk.java.net/legal/gplv2+ce.html" + [[stacks]] id = "io.buildpacks.stacks.bionic"