Skip to content

Commit

Permalink
Support Semeru Artifactoriy SDK URL for releases
Browse files Browse the repository at this point in the history
resolves: adoptium#5696 and automation/issues/82

Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
  • Loading branch information
llxia committed Oct 16, 2024
1 parent c9db601 commit c5d3d11
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ def setup() {
stage('Setup') {
setupEnv()
if (params.CUSTOMIZED_SDK_URL) {
if (params.SDK_RESOURCE == 'nightly') {
if (params.SDK_RESOURCE == 'nightly' || params.SDK_RESOURCE == 'releases') {
// remove single quote to allow variables to be set in CUSTOMIZED_SDK_URL
CUSTOMIZED_SDK_URL_OPTION = "-c ${params.CUSTOMIZED_SDK_URL}"
} else if (!params.SDK_RESOURCE || params.SDK_RESOURCE == 'customized') {
Expand Down
34 changes: 30 additions & 4 deletions get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ getBinaryOpenjdk()
download_url+=" ${latestBuildUrl}${n}"
fi
done
elif [ "$CUSTOMIZED_SDK_URL" != "" ]; then
elif [ "$SDK_RESOURCE" == "customized" ] && [ "$CUSTOMIZED_SDK_URL" != "" ]; then
download_url=$CUSTOMIZED_SDK_URL
images="test-images.tar.gz debug-image.tar.gz"
download_urls=($download_url)
Expand Down Expand Up @@ -233,7 +233,11 @@ getBinaryOpenjdk()
arch="x64"
fi
if [[ $arch = *"x86-32"* ]]; then
arch="x32"
if [ "$JDK_IMPL" == "openj9" ]; then
arch="x86-32"
else
arch="x32"
fi
fi
release_type="ea"
if [ "$SDK_RESOURCE" = "releases" ]; then
Expand All @@ -244,9 +248,31 @@ getBinaryOpenjdk()
if [ "$SDK_RESOURCE" = "nightly" ]; then
echo "Semeru API does not provide openj9 SDK nightly at the moment. Please use CUSTOMIZED_SDK_URL to provide the SDK URL directly."
exit 1
elif [ "$CUSTOMIZED_SDK_URL" == "" ]; then
echo "Please use CUSTOMIZED_SDK_URL to provide the base SDK URL for Artifactory."
exit 1
else
download_url="https://ibm.com/semeru-runtimes/api/v3/binary/latest/${JDK_VERSION}/${release_type}/${os}/${arch}/jdk/openj9/${heap_size}/ibm https://ibm.com/semeru-runtimes/api/v3/binary/latest/${JDK_VERSION}/${release_type}/${os}/${arch}/testimage/openj9/${heap_size}/ibm"
info_url="https://ibm.com/semeru-runtimes/api/v3/assets/feature_releases/${JDK_VERSION}/${release_type}?architecture=${arch}&heap_size=${heap_size}&image_type=jdk&jvm_impl=openj9&os=${os}&project=jdk&vendor=ibm https://ibm.com/semeru-runtimes/api/v3/assets/feature_releases/${JDK_VERSION}/${release_type}?architecture=${arch}&heap_size=${heap_size}&image_type=testimage&jvm_impl=openj9&os=${os}&project=jdk&vendor=ibm"
download_url_base="${CUSTOMIZED_SDK_URL}/${arch}_${os}/"
# Artifactory cannot handle duplicate slashes (//) in URL. Remove // except after http:// or https://
download_url_base=$(echo "$download_url_base" | sed -r 's|([^:])/+|\1/|g')
echo "artifactory URL: ${download_url_base}"
download_api_url_base=(${download_url_base//\/ui\/native\//\/artifactory\/api\/storage\/})
echo "use artifactory API to get the jdk and/or test images: ${download_api_url_base}"
download_urls=$(curl -k ${curl_options} ${download_api_url_base} | grep -E '.*\.tar\.gz"|.*\.zip"' | grep -E 'testimage|jdk'| sed 's/.*"uri" : "\([^"]*\)".*/\1/')
arr=(${download_urls/ / })
download_url=()
download_url_base=(${download_url_base//\/ui\/native\//\/artifactory\/})
echo "downloading files from $latestBuildUrl"
for n in "${arr[@]}" ; do
if [[ $n =~ 'testimage' ]]; then
if [ "$TEST_IMAGES_REQUIRED" == "true" ]; then
download_url+=" ${download_url_base}${n}"
fi
else
download_url+=" ${download_url_base}${n}"
fi
done
download_url=$(echo "$download_url" | sed -r 's|([^:])/+|\1/|g')
fi
else
download_url="https://api.adoptium.net/v3/binary/latest/${JDK_VERSION}/${release_type}/${os}/${arch}/jdk/${JDK_IMPL}/${heap_size}/adoptium?project=jdk https://api.adoptium.net/v3/binary/latest/${JDK_VERSION}/${release_type}/${os}/${arch}/sbom/${JDK_IMPL}/${heap_size}/adoptium?project=jdk"
Expand Down

0 comments on commit c5d3d11

Please sign in to comment.