Skip to content

Commit

Permalink
Support clone all repo by ssh protocol in testJob (#4228)
Browse files Browse the repository at this point in the history
  • Loading branch information
Accelerator1996 committed Jan 5, 2023
1 parent c070735 commit a65325c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 8 deletions.
6 changes: 5 additions & 1 deletion buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,13 @@ def setupEnv() {
TKG_BRANCH = tkg[1]
//For Zos, the right repo should be something like: [email protected]:runtimes/openj9-openjdk-jdk**-zos.git and for now there is only jdk11
env.JDK_REPO = params.JDK_REPO ? params.JDK_REPO : ""
if (env.SPEC.startsWith('zos')) {
if (env.SPEC.startsWith('zos') || params.USE_GIT_SSH) {
ADOPTOPENJDK_REPO = ADOPTOPENJDK_REPO.replace("https://github.com/","[email protected]:")
OPENJ9_REPO = OPENJ9_REPO.replace("https://github.com/","[email protected]:")
}
if (params.USE_GIT_SSH) {
env.JDK_REPO = env.JDK_REPO.replace("https://github.com/","[email protected]:")
}
OPENJ9_BRANCH = params.OPENJ9_BRANCH ? params.OPENJ9_BRANCH : "master"
}

Expand Down Expand Up @@ -77,6 +80,7 @@ def setupEnv() {
env.EXTERNAL_TEST_CMD=params.EXTERNAL_TEST_CMD ? params.EXTERNAL_TEST_CMD : "mvn clean install"
env.DYNAMIC_COMPILE=params.DYNAMIC_COMPILE ? params.DYNAMIC_COMPILE : false
env.USE_JRE=params.USE_JRE ? params.USE_JRE : false
env.USE_GIT_SSH = params.USE_GIT_SSH ? params.USE_GIT_SSH : false
env.RERUN_LINK = ""
env.FAILED_TEST_TARGET = ""
env.DOCKER_REGISTRY_URL = params.DOCKER_REGISTRY_URL ? params.DOCKER_REGISTRY_URL : ""
Expand Down
5 changes: 3 additions & 2 deletions buildenv/jenkins/getDependency
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ def testBuild() {
timeout(time: time_limit, unit: 'HOURS') {
try {
if( params.BUILD_TYPE == "systemtest" ){
def repoPrefix = params.USE_GIT_SSH ? "[email protected]:" : "https://github.com/"
sh 'curl -OLJks "https://api.adoptopenjdk.net/v3/binary/latest/8/ga/linux/x64/jdk/hotspot/normal/adoptopenjdk"'
sh 'mkdir ${WORKSPACE}/j2sdk-image'
sh 'tar -xzf OpenJDK8U-jdk_x64_linux_hotspot*.gz -C ${WORKSPACE}/j2sdk-image --strip-components 1'
sh '${WORKSPACE}/j2sdk-image/jre/bin/java -version'
sh 'git clone https://github.com/adoptium/aqa-systemtest'
sh 'git clone https://github.com/adoptium/STF'
sh "git clone ${repoPrefix}adoptium/aqa-systemtest"
sh "git clone ${repoPrefix}adoptium/STF"
sh 'ant -f ./aqa-systemtest/openjdk.build/build.xml -Djava.home=${WORKSPACE}/j2sdk-image/jre -Dprereqs_root=${WORKSPACE}/systemtest_prereqs configure'
sh 'ant -f ./aqa-systemtest/openjdk.test.mauve/build.xml -Djava.home=${WORKSPACE}/j2sdk-image/jre -Dprereqs_root=${WORKSPACE}/systemtest_prereqs configure'
archiveArtifacts '**/systemtest_prereqs/cvsclient/org-netbeans-lib-cvsclient.jar'
Expand Down
2 changes: 2 additions & 0 deletions buildenv/jenkins/testJobTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ if (!binding.hasVariable('USER_CREDENTIALS_ID')) USER_CREDENTIALS_ID = ""
if (!binding.hasVariable('GENERATE_JOBS')) GENERATE_JOBS = false
if (!binding.hasVariable('CLOUD_PROVIDER')) CLOUD_PROVIDER = ""
if (!binding.hasVariable('RERUN_ITERATIONS')) RERUN_ITERATIONS = "0"
if (!binding.hasVariable('USE_GIT_SSH')) USE_GIT_SSH = false

if (!binding.hasVariable('BUILDS_TO_KEEP')) {
BUILDS_TO_KEEP = 10
Expand Down Expand Up @@ -438,6 +439,7 @@ ARCH_OS_LIST.each { ARCH_OS ->
booleanParam('PERSONAL_BUILD', false, "Is this a personal build?")
booleanParam('USE_TESTENV_PROPERTIES', USE_TESTENV_PROPERTIES.toBoolean(), "use properties defined in the testenv.properties")
stringParam('RERUN_ITERATIONS', RERUN_ITERATIONS, "Optional. Number of times to repeat execution of failed test target(s).")
booleanParam('USE_GIT_SSH', USE_GIT_SSH.toBoolean(), "Use ssh protocol? True, if clone all repo by ssh.")
}
cpsScm {
scm {
Expand Down
3 changes: 3 additions & 0 deletions compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ if [ $USE_TESTENV_PROPERTIES == true ]; then
testenv_file="./testenv/testenv_arm32.properties"
fi
while read line; do
if [[ "$USE_GIT_SSH" = "true" ]]; then
line=$(echo "$line" | sed "s|https://github.com/|[email protected]:|")
fi
export $line
done <$testenv_file
if [ $JDK_IMPL == "openj9" ] || [ $JDK_IMPL == "ibm" ]; then
Expand Down
9 changes: 7 additions & 2 deletions external/tomcat/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,20 @@ source $(dirname "$0")/test_base_functions.sh
#Set up Java to be used by the tomcat test
echo_setup

git clone -q -b 1.6.x --single-branch https://github.com/apache/apr.git $TEST_HOME/tmp/apr
if [[ "$USE_GIT_SSH" = "true" ]]; then
repo_prefix="[email protected]:"
else
repo_prefix="https://github.com/"
fi
git clone -q -b 1.6.x --single-branch ${repo_prefix}apache/apr.git $TEST_HOME/tmp/apr
cd $TEST_HOME/tmp/apr
./buildconf
./configure --prefix=$TEST_HOME/tmp/apr-build
make
make install
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TEST_HOME/tmp/apr-build/lib"

git clone -q https://github.com/apache/tomcat-native.git $TEST_HOME/tmp/tomcat-native
git clone -q ${repo_prefix}apache/tomcat-native.git $TEST_HOME/tmp/tomcat-native
cd $TEST_HOME/tmp/tomcat-native/native
sh buildconf --with-apr=$TEST_HOME/tmp/apr
./configure --with-apr=$TEST_HOME/tmp/apr --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$TEST_HOME/tmp/tomcat-native-build
Expand Down
9 changes: 8 additions & 1 deletion get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,11 @@ getTestKitGen()
echo "get testKitGen..."
cd $TESTDIR
if [ "$TKG_REPO" = "" ]; then
TKG_REPO="https://github.com/adoptium/TKG.git"
TKG_REPO="https://github.com/adoptium/TKG.git"
fi
if [ "$USE_GIT_SSH" = "true" ];then
TKG_REPO=$(echo "${TKG_REPO}" | sed "s|https://github.com/|[email protected]:|")
fi

executeCmdWithRetry "TKG" "git clone -q $TKG_REPO"
rt_code=$?
Expand Down Expand Up @@ -502,6 +505,10 @@ getFunctionalTestMaterial()
then
OPENJ9_BRANCH="-b $OPENJ9_BRANCH"
fi
if [ "$USE_GIT_SSH" = "true" ]
then
OPENJ9_REPO=`echo $OPENJ9_REPO | sed "s|https://github.com/|[email protected]:|"`
fi

executeCmdWithRetry "openj9" "git clone --depth 1 --reference-if-able ${HOME}/openjdk_cache $OPENJ9_BRANCH $OPENJ9_REPO"
rt_code=$?
Expand Down
9 changes: 7 additions & 2 deletions perf/bumbleBench/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,27 @@
<property environment="env" />
<property name="DEST" value="${BUILD_ROOT}/perf/bumbleBench" />
<property name="SRC" location="." />
<property environment="SystemVariable" />
<property name="isSSH" value="${SystemVariable.USE_GIT_SSH}" />

<condition property="isZOS" value="true">
<equals arg1="${os.name}" arg2="z/OS"/>
</condition>

<condition property="git-prefix" value="git" else="https">
<isset property="isZOS"/>
</condition>
</condition>
<condition property="repo-prefix" value="git@github:" else="${git-prefix}://github.com/">
<equals arg1="${isSSH}" args="true"/>
</condition>

<target name="init">
<mkdir dir="${DEST}" />
</target>

<target name="getBumbleBench" depends="init" description="Clone the distribution">
<echo message="Cloning BumbleBench"/>
<var name="git_command" value="clone --depth 1 -b master ${git-prefix}://github.com/adoptium/bumblebench.git"/>
<var name="git_command" value="clone --depth 1 -b master ${repo-prefix}adoptium/bumblebench.git"/>
<echo message="git ${git_command}" />
<exec executable="git" failonerror="false" dir=".">
<arg line="${git_command}" />
Expand Down

0 comments on commit a65325c

Please sign in to comment.