Skip to content
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
6 changes: 4 additions & 2 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ def setup() {
VENDOR_TEST_BRANCHES = (params.VENDOR_TEST_BRANCHES) ? "--vendor_branches \"${params.VENDOR_TEST_BRANCHES}\"" : ""
VENDOR_TEST_DIRS = (params.VENDOR_TEST_DIRS) ? "--vendor_dirs \"${params.VENDOR_TEST_DIRS}\"" : ""
VENDOR_TEST_SHAS = (params.VENDOR_TEST_SHAS) ? "--vendor_shas \"${params.VENDOR_TEST_SHAS}\"" : ""

env.IS_SVT_TESTREPO = (params.VENDOR_TEST_REPOS && params.VENDOR_TEST_REPOS.contains('SVTTestRepo')) ? true : false
echo "IS_SVT_TESTREPO is set to ${env.IS_SVT_TESTREPO}"

Expand All @@ -572,7 +573,8 @@ def setup() {
ADDITIONAL_ARTIFACTS_REQUIRED_OPTION = (params.ADDITIONAL_ARTIFACTS_REQUIRED) ? "--additional_artifacts_required ${params.ADDITIONAL_ARTIFACTS_REQUIRED}" : ""

CURL_OPTS = (params.CURL_OPTS) ? "--curl_opts \"${params.CURL_OPTS}\"" : ""
GET_SH_CMD = "./get.sh -s `pwd`/.. -p $PLATFORM -r ${SDK_RESOURCE} ${JDK_VERSION_OPTION} ${JDK_IMPL_OPTION} ${CUSTOMIZED_SDK_URL_OPTION} ${CLONE_OPENJ9_OPTION} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${TKG_REPO_OPTION} ${TKG_BRANCH_OPTION} ${VENDOR_TEST_REPOS} ${VENDOR_TEST_BRANCHES} ${VENDOR_TEST_DIRS} ${VENDOR_TEST_SHAS} ${TEST_IMAGES_REQUIRED} ${DEBUG_IMAGES_REQUIRED} ${CODE_COVERAGE_OPTION} ${CURL_OPTS} ${ADDITIONAL_ARTIFACTS_REQUIRED_OPTION}"
SETUP_JCK_RUN_OPTION = (params.SETUP_JCK_RUN) ? "--setup_jck_run true" : ""
GET_SH_CMD = "./get.sh -s `pwd`/.. -p $PLATFORM -r ${SDK_RESOURCE} ${JDK_VERSION_OPTION} ${JDK_IMPL_OPTION} ${CUSTOMIZED_SDK_URL_OPTION} ${CLONE_OPENJ9_OPTION} ${OPENJ9_REPO_OPTION} ${OPENJ9_BRANCH_OPTION} ${OPENJ9_SHA_OPTION} ${TKG_REPO_OPTION} ${TKG_BRANCH_OPTION} ${VENDOR_TEST_REPOS} ${VENDOR_TEST_BRANCHES} ${VENDOR_TEST_DIRS} ${VENDOR_TEST_SHAS} ${TEST_IMAGES_REQUIRED} ${DEBUG_IMAGES_REQUIRED} ${CODE_COVERAGE_OPTION} ${CURL_OPTS} ${ADDITIONAL_ARTIFACTS_REQUIRED_OPTION} ${SETUP_JCK_RUN_OPTION}"
RESOLVED_MAKE = "if [ `uname` = AIX ] || [ `uname` = SunOS ] || [ `uname` = *BSD ]; then MAKE=gmake; else MAKE=make; fi"
dir( WORKSPACE) {
// use sshagent with Jenkins credentials ID for all platforms except zOS
Expand Down Expand Up @@ -665,7 +667,7 @@ def get_sources() {
sh "$GET_SH_CMD"
}
}
if (params.SETUP_JCK_RUN && env.BUILD_LIST.contains('jck') && SDK_RESOURCE.contains('customized')) {
if (params.SETUP_JCK_RUN && env.BUILD_LIST.contains('jck')) {
setup_jck_interactives()
}
}
Expand Down
2 changes: 2 additions & 0 deletions docs/pages/JenkinFeatures.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ Additional test repositories that can be overlaid onto existing AQA test materia
This is used for laying down any test material, particularly useful for running private tests that cannot be open-sourced. Examples of how these parameters are used can be seen by looking at the smoke tests in the temurin-build repository and some MSI tests in the installer repository. TKG can discover any test material, as long as you tell it where to look (through setting these parameters), and that these repositories contain build instructions (via build.xml ant scripts) and execution instructions (via playlist.xml files).

- `VENDOR_TEST_REPOS`: optional, comma-separated list of repositories containing additional test material.
- **Special handling for compliance repositories**: If a repository URL contains the word "compliance" and `SETUP_JCK_RUN` is set to true, the `jck_run` folder from that repository will be moved to the Jenkins home directory for JCK test execution. Other repositories in the comma-separated list will have their contents copied to the test directory only.
- `VENDOR_TEST_BRANCHES`: optional, comma-separated list of branches for additional test material.
- `VENDOR_TEST_SHAS`: optional, pin to particular SHAS of VENDOR_TEST_REPOS.
- `VENDOR_TEST_DIRS`: optional, directories within VENDOR_TEST_REPOS where to find test material.
- `USER_CREDENTIALS_ID`: optional, credentials to use if VENDOR_TEST_REPOS require them.
- `SETUP_JCK_RUN`: optional, boolean (default: false). When set to true and `VENDOR_TEST_REPOS` contains a repository with "compliance" in its URL, the `jck_run` folder from the compliance repository will be moved to the Jenkins home directory. This is used for setting up JCK test environments. The move operation only occurs when `BUILD_LIST` contains "jck".

### Platform and Machine Selection Parameters
Choose which platform to run tests on and optionally specify the machine label to send the test job to a certain machine if desired.
Expand Down
76 changes: 76 additions & 0 deletions get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ DEBUG_IMAGES_REQUIRED=true
CURL_OPTS="s"
CODE_COVERAGE=false
ADDITIONAL_ARTIFACTS_REQUIRED=""
SETUP_JCK_RUN="false"

usage ()
{
Expand All @@ -63,6 +64,7 @@ usage ()
echo ' [--vendor_shas ] : optional. Comma separated SHAs of the vendor repositories'
echo ' [--vendor_branches ] : optional. Comma separated vendor branches'
echo ' [--vendor_dirs ] : optional. Comma separated directories storing vendor test resources'
echo ' [--setup_jck_run ] : optional. true or false. Setup jck_run folder if compliance repo is provided. Default to false'
echo ' [--code_coverage ] : optional. indicate if code coverage is required'
}

Expand Down Expand Up @@ -150,6 +152,9 @@ parseCommandLineArgs()
"--additional_artifacts_required" )
ADDITIONAL_ARTIFACTS_REQUIRED="$1"; shift;;

"--setup_jck_run" )
SETUP_JCK_RUN="$1"; shift;;

"--help" | "-h" )
usage; exit 0;;

Expand Down Expand Up @@ -704,6 +709,59 @@ getFunctionalTestMaterial()
cd $TESTDIR
}

moveComplianceRepoToJckRun() {
echo "*************************************************************************"
echo "* Replacing jenkins_home/jck_run contents with compliance_repo/jck_run "
echo "*************************************************************************"

# Determine jenkins home directory (two levels up from TESTDIR)
jenkins_home="$(cd "$TESTDIR/../.." && pwd)"
echo "Jenkins home: ${jenkins_home}"

if [ -d "$TESTDIR/jck_run" ]; then
echo "Cleaning ${jenkins_home}/jck_run/arctic folder prior to extract"
rm -rf "${jenkins_home}/jck_run/arctic"

echo "Copying jck_run directory to ${jenkins_home}"
cp -r "$TESTDIR/jck_run" "${jenkins_home}/" 2>&1

if [ $? -eq 0 ]; then
echo "Successfully copied jck_run to ${jenkins_home}"

# Set permissions if not on Windows
if [[ ! "$PLATFORM" == *"windows"* ]]; then
chgrp jck "${jenkins_home}/jck_run" 2>/dev/null || echo "Warning: Could not change group to jck"
chmod g+s "${jenkins_home}/jck_run" 2>/dev/null || echo "Warning: Could not set setgid bit"
fi

# Copy scripts folder to jck_run
if [ -d "$TESTDIR/scripts" ]; then
echo "Copying scripts folder to jck_run"
cp -r "$TESTDIR/scripts" "${jenkins_home}/jck_run/" 2>&1

if [ $? -eq 0 ]; then
echo "Successfully copied scripts to ${jenkins_home}/jck_run"
else
echo "Warning: Failed to copy scripts folder"
fi
fi

# Set final permissions if not on Windows
if [[ ! "$PLATFORM" == *"windows"* ]]; then
chgrp -R jck "${jenkins_home}/jck_run" 2>/dev/null || echo "Warning: Could not recursively change group to jck"
chmod -R 775 "${jenkins_home}/jck_run" 2>/dev/null || echo "Warning: Could not set permissions to 775"
fi
else
echo "Error: Failed to copy jck_run directory"
return 1
fi
else
echo "Warning: jck_run directory not found in $TESTDIR"
fi

echo "*************************************************************************"
}

getVendorTestMaterial() {
echo "get vendor test material..."
cd $TESTDIR
Expand All @@ -712,6 +770,7 @@ getVendorTestMaterial() {
declare -a vendor_branches_array
declare -a vendor_shas_array
declare -a vendor_dirs_array
local is_compliance_repo=false

# convert VENDOR_REPOS to array
vendor_repos_array=(`echo $VENDOR_REPOS | sed 's/,/\n/g'`)
Expand Down Expand Up @@ -744,6 +803,12 @@ getVendorTestMaterial() {
branchOption="-b $branch"
fi

# Check if this is a compliance repo
if [[ "$repoURL" == *"compliance"* ]]; then
is_compliance_repo=true
echo "Compliance repository detected: $repoURL"
fi

if [[ "$dir" =~ "jck" ]]; then
echo "BUILD_LIST is $BUILD_LIST"
if [[ "$BUILD_LIST" =~ "jck" || "$BUILD_LIST" =~ "external" ||"$BUILD_LIST" =~ "all" ]]; then
Expand Down Expand Up @@ -792,6 +857,17 @@ getVendorTestMaterial() {
cd $TESTDIR

done

# After processing all vendor repos, check if we need to move compliance repo to jck_run
if [ "$is_compliance_repo" = true ] && [ "$SETUP_JCK_RUN" = "true" ]; then
echo "SETUP_JCK_RUN is true and compliance repo detected"
if [[ "$BUILD_LIST" =~ "jck" ]]; then
echo "BUILD_LIST contains 'jck', proceeding with jck_run setup"
moveComplianceRepoToJckRun
else
echo "BUILD_LIST does not contain 'jck', skipping jck_run setup"
fi
fi
}

testJavaVersion()
Expand Down