diff --git a/buildenv/jenkins/JenkinsfileBase b/buildenv/jenkins/JenkinsfileBase index 2d2b42161a..600eb56160 100644 --- a/buildenv/jenkins/JenkinsfileBase +++ b/buildenv/jenkins/JenkinsfileBase @@ -429,7 +429,7 @@ def setup() { step([$class: 'CopyArtifact', fingerprintArtifacts: true, flatten: true, - filter: "**/*.tar.gz,**/*.tgz,**/*.zip,**/*.jar,**/*.Z", + filter: "**/*.tar.gz,**/*.tgz,**/*.zip,**/*.jar,**/*.Z,**/*sbom*.json", projectName: "${params.UPSTREAM_JOB_NAME}", selector: [$class: 'SpecificBuildSelector', buildNumber: "${params.UPSTREAM_JOB_NUMBER}"]]) } diff --git a/get.sh b/get.sh index b508c53b00..8144ba858b 100755 --- a/get.sh +++ b/get.sh @@ -307,131 +307,133 @@ getBinaryOpenjdk() done fi - jar_files=`ls` - jar_file_array=(${jar_files//\\n/ }) - last_index=$(( ${#jar_file_array[@]} - 1 )) + jdk_files=`ls` + jdk_file_array=(${jdk_files//\\n/ }) + last_index=$(( ${#jdk_file_array[@]} - 1 )) if [[ $last_index == 0 ]]; then if [[ $download_url =~ '*.tar.gz' ]] || [[ $download_url =~ '*.zip' ]]; then - nested_zip="${jar_file_array[0]}" + nested_zip="${jdk_file_array[0]}" echo "${nested_zip} is a nested zip" unzip -q $nested_zip -d . rm $nested_zip - jar_files=`ls *jdk*.tar.gz *jre*.tar.gz *testimage*.tar.gz *debugimage*.tar.gz *jdk*.zip *jre*.zip *testimage*.zip *debugimage*.zip 2> /dev/null || true` + jdk_files=`ls *jdk*.tar.gz *jre*.tar.gz *testimage*.tar.gz *debugimage*.tar.gz *jdk*.zip *jre*.zip *testimage*.zip *debugimage*.zip 2> /dev/null || true` echo "Found files under ${nested_zip}:" - echo "${jar_files}" - jar_file_array=(${jar_files//\\n/ }) - last_index=$(( ${#jar_file_array[@]} - 1 )) + echo "${jdk_files}" + jdk_file_array=(${jdk_files//\\n/ }) + last_index=$(( ${#jdk_file_array[@]} - 1 )) fi fi - # if $jar_file_array contains debug-image, move debug-image element to the end of the array + # if $jdk_file_array contains debug-image, move debug-image element to the end of the array # debug image jar needs to be extracted after jdk as debug image jar extraction location depends on jdk structure # debug image jar extracts into j2sdk-image/jre dir if it exists. Otherwise, extracts into j2sdk-image dir - for i in "${!jar_file_array[@]}"; do - if [[ "${jar_file_array[$i]}" =~ "debug-image" ]] || [[ "${jar_file_array[$i]}" =~ "debugimage" ]]; then + for i in "${!jdk_file_array[@]}"; do + if [[ "${jdk_file_array[$i]}" =~ "debug-image" ]] || [[ "${jdk_file_array[$i]}" =~ "debugimage" ]]; then if [ "$i" -ne "$last_index" ]; then - debug_image_jar="${jar_file_array[$i]}" + debug_image_jar="${jdk_file_array[$i]}" # remove the element - unset jar_file_array[$i] + unset jdk_file_array[$i] # add $debug_image_jar to the end of the array - jar_file_array=( "${jar_file_array[@]}" "${debug_image_jar}" ) + jdk_file_array=( "${jdk_file_array[@]}" "${debug_image_jar}" ) break fi fi done - for jar_name in "${jar_file_array[@]}" - do - # if jar_name contains debug-image, extract into j2sdk-image/jre or j2sdk-image dir + for file_name in "${jdk_file_array[@]}" + do + if [[ "$file_name" =~ "sbom" ]]; then + jdkSBOMFile="$file_name" + elif [[ "$file_name" =~ "debug-image" ]] || [[ "$file_name" =~ "debugimage" ]]; then + # if file_name contains debug-image, extract into j2sdk-image/jre or j2sdk-image dir # Otherwise, files will be extracted under ./tmp - if [[ "$jar_name" =~ "debug-image" ]] || [[ "$jar_name" =~ "debugimage" ]]; then - extract_dir="./j2sdk-image" - if [ -d "$SDKDIR/jdkbinary/j2sdk-image/jre" ]; then - extract_dir="./j2sdk-image/jre" - fi - echo "Uncompressing $jar_name over $extract_dir..." - if [[ $jar_name == *zip ]] || [[ $jar_name == *jar ]]; then - unzip -q $jar_name -d $extract_dir - else - # some debug-image tar has parent folder ... strip it - if tar --version 2>&1 | grep GNU 2>&1; then - gzip -cd $jar_name | tar xof - -C $extract_dir --strip 1 - else - mkdir dir.$$ && cd dir.$$ && gzip -cd ../$jar_name | tar xof - && cd * && tar cf - . | (cd ../../$extract_dir && tar xpf -) && cd ../.. && rm -rf dir.$$ - fi - fi + extract_dir="./j2sdk-image" + if [ -d "$SDKDIR/jdkbinary/j2sdk-image/jre" ]; then + extract_dir="./j2sdk-image/jre" + fi + echo "Uncompressing $file_name over $extract_dir..." + if [[ $file_name == *zip ]] || [[ $file_name == *jar ]]; then + unzip -q $file_name -d $extract_dir else - if [ -d "$SDKDIR/jdkbinary/tmp" ]; then - rm -rf $SDKDIR/jdkbinary/tmp/* - else - mkdir $SDKDIR/jdkbinary/tmp - fi - echo "Uncompressing file: $jar_name ..." - if [[ $jar_name == *zip ]] || [[ $jar_name == *jar ]]; then - unzip -q $jar_name -d ./tmp - elif [[ $jar_name == *.pax* ]]; then - cd ./tmp - pax -p xam -rzf ../$jar_name + # some debug-image tar has parent folder ... strip it + if tar --version 2>&1 | grep GNU 2>&1; then + gzip -cd $file_name | tar xof - -C $extract_dir --strip 1 else - gzip -cd $jar_name | (cd tmp && tar xof -) + mkdir dir.$$ && cd dir.$$ && gzip -cd ../$file_name | tar xof - && cd * && tar cf - . | (cd ../../$extract_dir && tar xpf -) && cd ../.. && rm -rf dir.$$ fi + fi + else + if [ -d "$SDKDIR/jdkbinary/tmp" ]; then + rm -rf $SDKDIR/jdkbinary/tmp/* + else + mkdir $SDKDIR/jdkbinary/tmp + fi + echo "Uncompressing file: $file_name ..." + if [[ $file_name == *zip ]] || [[ $file_name == *jar ]]; then + unzip -q $file_name -d ./tmp + elif [[ $file_name == *.pax* ]]; then + cd ./tmp + pax -p xam -rzf ../$file_name + else + gzip -cd $file_name | (cd tmp && tar xof -) + fi - cd $SDKDIR/jdkbinary/tmp - jar_dirs=`ls -d */` - jar_dir_array=(${jar_dirs//\\n/ }) - len=${#jar_dir_array[@]} - if [ "$len" == 1 ]; then - jar_dir_name=${jar_dir_array[0]} - if [[ "$jar_dir_name" =~ "test-image" ]] && [ "$jar_dir_name" != "openjdk-test-image" ]; then - mv $jar_dir_name ../openjdk-test-image - elif [[ "$jar_dir_name" =~ jre* ]] && [ "$jar_dir_name" != "j2re-image" ]; then - mv $jar_dir_name ../j2re-image - elif [[ "$jar_dir_name" =~ jdk* ]] && [ "$jar_dir_name" != "j2sdk-image" ]; then - # If test sdk has already been expanded, this one must be the additional sdk - isAdditional=0 - if [ -f "./j2sdk-image/release" ]; then - isAdditional=1 - else - if [ "$ADDITIONAL_ARTIFACTS_REQUIRED" == "RI_JDK" ]; then - # Check release info - if [ -d "./$jar_dir_name/Contents" ]; then # Mac - release_info=$( cat ./$jar_dir_name/Contents/Home/release ) - UNZIPPED_ADDITIONAL_SDK="./$jar_dir_name/Contents/Home/" - else - release_info=$( cat ./$jar_dir_name/release ) - UNZIPPED_ADDITIONAL_SDK="./$jar_dir_name/" - fi - if [[ "$release_info" == *"Oracle"* ]]; then - isAdditional=1 - fi + cd $SDKDIR/jdkbinary/tmp + jar_dirs=`ls -d */` + jar_dir_array=(${jar_dirs//\\n/ }) + len=${#jar_dir_array[@]} + if [ "$len" == 1 ]; then + jar_dir_name=${jar_dir_array[0]} + if [[ "$jar_dir_name" =~ "test-image" ]] && [ "$jar_dir_name" != "openjdk-test-image" ]; then + mv $jar_dir_name ../openjdk-test-image + elif [[ "$jar_dir_name" =~ jre* ]] && [ "$jar_dir_name" != "j2re-image" ]; then + mv $jar_dir_name ../j2re-image + elif [[ "$jar_dir_name" =~ jdk* ]] && [ "$jar_dir_name" != "j2sdk-image" ]; then + # If test sdk has already been expanded, this one must be the additional sdk + isAdditional=0 + if [ -f "./j2sdk-image/release" ]; then + isAdditional=1 + else + if [ "$ADDITIONAL_ARTIFACTS_REQUIRED" == "RI_JDK" ]; then + # Check release info + if [ -d "./$jar_dir_name/Contents" ]; then # Mac + release_info=$( cat ./$jar_dir_name/Contents/Home/release ) + UNZIPPED_ADDITIONAL_SDK="./$jar_dir_name/Contents/Home/" + else + release_info=$( cat ./$jar_dir_name/release ) + UNZIPPED_ADDITIONAL_SDK="./$jar_dir_name/" fi - fi - if [ $isAdditional == 1 ]; then - if [ -d "$SDKDIR/additionaljdkbinary" ]; then - rm -rf $SDKDIR/additionaljdkbinary - else - mkdir $SDKDIR/additionaljdkbinary + if [[ "$release_info" == *"Oracle"* ]]; then + isAdditional=1 fi - mv $UNZIPPED_ADDITIONAL_SDK/* $SDKDIR/additionaljdkbinary - echo "RI JDK available at $SDKDIR/additionaljdkbinary/" - echo "RI JDK version:" - $SDKDIR/additionaljdkbinary/bin/java -version - else - mv $jar_dir_name ../j2sdk-image fi - # The following only needed if openj9 has a different image name convention - elif [ "$jar_dir_name" != "j2sdk-image" ]; then + fi + if [ $isAdditional == 1 ]; then + if [ -d "$SDKDIR/additionaljdkbinary" ]; then + rm -rf $SDKDIR/additionaljdkbinary + else + mkdir $SDKDIR/additionaljdkbinary + fi + mv $UNZIPPED_ADDITIONAL_SDK/* $SDKDIR/additionaljdkbinary + echo "RI JDK available at $SDKDIR/additionaljdkbinary/" + echo "RI JDK version:" + $SDKDIR/additionaljdkbinary/bin/java -version + else mv $jar_dir_name ../j2sdk-image fi - elif [ "$len" -gt 1 ]; then - mv ../tmp ../j2sdk-image + # The following only needed if openj9 has a different image name convention + elif [ "$jar_dir_name" != "j2sdk-image" ]; then + mv $jar_dir_name ../j2sdk-image fi - cd $SDKDIR/jdkbinary + elif [ "$len" -gt 1 ]; then + mv ../tmp ../j2sdk-image fi - done + cd $SDKDIR/jdkbinary + fi + done if [ "$PLATFORM" = "s390x_zos" ]; then chmod -R 755 j2sdk-image @@ -442,7 +444,7 @@ checkURL() { local filename="$1" if [[ $filename =~ "test-image" ]]; then required=$TEST_IMAGES_REQUIRED - elif [[ $filename =~ "debug-image" ]] || [[ "$jar_name" =~ "debugimage" ]]; then + elif [[ $filename =~ "debug-image" ]] || [[ "$file_name" =~ "debugimage" ]]; then required=$DEBUG_IMAGES_REQUIRED fi }