Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get latest nightly build files from given base url #2695

Merged
merged 1 commit into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,9 @@ def setup() {
timestamps{
setupEnv()

if (params.CUSTOMIZED_SDK_URL) {
if (params.SDK_RESOURCE == 'nightly' && params.CUSTOMIZED_SDK_URL) {
CUSTOMIZED_SDK_URL_OPTION = "-c '${params.CUSTOMIZED_SDK_URL}'"
} else if (params.CUSTOMIZED_SDK_URL) {
SDK_RESOURCE = "customized"
CUSTOMIZED_SDK_URL_OPTION = "-c '${params.CUSTOMIZED_SDK_URL}'"
} else {
Expand Down
29 changes: 23 additions & 6 deletions get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,30 @@ getBinaryOpenjdk()
fi
fi

if [ "$CUSTOMIZED_SDK_URL" != "" ]; then
# if these are passed through via withCredentials(CUSTOMIZED_SDK_URL_CREDENTIAL_ID) these will not be visible within job output,
# if supplied when run manually with --username and --password these will be seen in plaintext within job output
if [ "$USERNAME" != "" ] && [ "$PASSWORD" != "" ]; then
curl_options="--user $USERNAME:$PASSWORD"
fi

if [ "$SDK_RESOURCE" == "nightly" ] && [ "$CUSTOMIZED_SDK_URL" != "" ]; then
result=$(curl -k ${curl_options} ${CUSTOMIZED_SDK_URL} | grep ">[0-9]*\/<" | sed -e 's/[^0-9/ ]//g' | sed 's/\/.*$//')
IFS=' ' read -r -a array <<< "$result"
arr=(${result/ / })
max=${arr[0]}
for n in "${arr[@]}" ; do
((n > max)) && max=$n
done
latestBuildUrl="${CUSTOMIZED_SDK_URL}${max}/"
echo "downloading files from $latestBuildUrl"
download_urls=$(curl -k ${curl_options} ${latestBuildUrl} | grep -E ">.*pax<|>.*tar.gz<|>.*zip<" | sed 's/^.*">//' | sed 's/<\/a>.*//')
arr=(${download_urls/ / })
download_url=()
for n in "${arr[@]}" ; do
download_url+=" ${latestBuildUrl}${n}"
done
elif [ "$CUSTOMIZED_SDK_URL" != "" ]; then
download_url=$CUSTOMIZED_SDK_URL
# if these are passed through via withCredentials(CUSTOMIZED_SDK_URL_CREDENTIAL_ID) these will not be visible within job output,
# if supplied when run manually with --username and --password these will be seen in plaintext within job output
if [ "$USERNAME" != "" ] && [ "$PASSWORD" != "" ]; then
curl_options="--user $USERNAME:$PASSWORD"
fi
images="test-images.tar.gz debug-image.tar.gz"
download_urls=($download_url)
# for now, auto-download is enabled only if users provide one URL and filename contains OpenJ9-JDK
Expand Down