|
|
|
@ -4,9 +4,11 @@ set -e
|
|
|
|
|
case "$JDK_VERSION" in
|
|
|
|
|
java8)
|
|
|
|
|
BASE_URL="https://api.adoptopenjdk.net/v2/info/releases/openjdk8"
|
|
|
|
|
ISSUE_TITLE="Upgrade Java 8 version in CI image"
|
|
|
|
|
;;
|
|
|
|
|
java11)
|
|
|
|
|
BASE_URL="https://api.adoptopenjdk.net/v2/info/releases/openjdk11"
|
|
|
|
|
ISSUE_TITLE="Upgrade Java 11 version in CI image"
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo $"Unknown java version"
|
|
|
|
@ -23,14 +25,15 @@ if [[ $current = $latest ]]; then
|
|
|
|
|
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
|
|
|
|
|
existing_tasks=$( curl -s https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/issues\?labels\=type:%20task\&state\=open\&creator\=spring-buildmaster )
|
|
|
|
|
existing_jdk_issues=$( echo "$existing_tasks" | jq -c --arg TITLE $ISSUE_TITLE '.[] | select(.title==$TITLE)' )
|
|
|
|
|
|
|
|
|
|
if [[ ${existing_jdk_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\"]}" \
|
|
|
|
|
-d "{\"title\":\"${ISSUE_TITLE}\",\"body\": \"${latest}\",\"labels\":[\"status: waiting-for-triage\",\"type: task\"]}" \
|
|
|
|
|
-f \
|
|
|
|
|
-X \
|
|
|
|
|
POST "https://api.github.com/repos/${GITHUB_ORGANIZATION}/${GITHUB_REPO}/issues" > /dev/null || { echo "Failed to create issue" >&2; exit 1; }
|
|
|
|
|