Automate JDK CI upgrades using AdoptOpenJDK API
An issue is created if a new release is detected. Closes gh-15164pull/15487/head
parent
3cc441c83e
commit
edc1a4fb86
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
java8)
|
||||||
|
echo "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u192-b12/OpenJDK8U-jdk_x64_linux_hotspot_8u192b12.tar.gz"
|
||||||
|
;;
|
||||||
|
java11)
|
||||||
|
echo "https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.1%2B13/OpenJDK11U-jdk_x64_linux_hotspot_11.0.1_13.tar.gz"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Unknown java version"
|
||||||
|
exit 1
|
||||||
|
esac
|
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
case "$JDK_VERSION" in
|
||||||
|
java8)
|
||||||
|
BASE_URL="https://api.adoptopenjdk.net/v2/info/releases/openjdk8"
|
||||||
|
;;
|
||||||
|
java11)
|
||||||
|
BASE_URL="https://api.adoptopenjdk.net/v2/info/releases/openjdk11"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo $"Unknown java version"
|
||||||
|
exit 1;
|
||||||
|
esac
|
||||||
|
|
||||||
|
response=$( curl -s ${BASE_URL}\?openjdk_impl\=hotspot\&os\=linux\&arch\=x64\&release\=latest\&type\=jdk )
|
||||||
|
latest=$( jq -r '.binaries[0].binary_link' <<< "$response" )
|
||||||
|
|
||||||
|
current=$( git-repo/ci/images/get-jdk-url.sh ${JDK_VERSION} )
|
||||||
|
|
||||||
|
if [[ $current = $latest ]]; then
|
||||||
|
echo "Already up-to-date"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
|
|
||||||
|
existing_issues=$( curl -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/issues\?labels\=${JDK_VERSION}-image-upgrade\&state\=open )
|
||||||
|
parsed_issues=$(jq -r '.' <<< "$existing_issues" )
|
||||||
|
if [[ ${parsed_issues} = [] ]]; then
|
||||||
|
curl \
|
||||||
|
-s \
|
||||||
|
-u ${GITHUB_USERNAME}:${GITHUB_PASSWORD} \
|
||||||
|
-H "Content-type:application/json" \
|
||||||
|
-d "{\"title\":\"Upgrade ${JDK_VERSION} version in CI image\",\"body\": \"${latest}\",\"labels\":[\"${JDK_VERSION}-image-upgrade\"]}" \
|
||||||
|
-f \
|
||||||
|
-X \
|
||||||
|
POST "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/issues" > /dev/null || { echo "Failed to create issue" >&2; exit 1; }
|
||||||
|
else
|
||||||
|
echo "Issue already exists."
|
||||||
|
fi
|
@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
platform: linux
|
||||||
|
inputs:
|
||||||
|
- name: git-repo
|
||||||
|
params:
|
||||||
|
GITHUB_REPO:
|
||||||
|
GITHUB_ORGANIZATION:
|
||||||
|
GITHUB_PASSWORD:
|
||||||
|
GITHUB_USERNAME:
|
||||||
|
JDK_VERSION:
|
||||||
|
run:
|
||||||
|
path: git-repo/ci/scripts/detect-jdk-updates.sh
|
Loading…
Reference in New Issue