Skip to content

Commit a65325c

Browse files
Support clone all repo by ssh protocol in testJob (#4228)
1 parent c070735 commit a65325c

File tree

7 files changed

+35
-8
lines changed

7 files changed

+35
-8
lines changed

buildenv/jenkins/JenkinsfileBase

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ def setupEnv() {
4343
TKG_BRANCH = tkg[1]
4444
//For Zos, the right repo should be something like: [email protected]:runtimes/openj9-openjdk-jdk**-zos.git and for now there is only jdk11
4545
env.JDK_REPO = params.JDK_REPO ? params.JDK_REPO : ""
46-
if (env.SPEC.startsWith('zos')) {
46+
if (env.SPEC.startsWith('zos') || params.USE_GIT_SSH) {
4747
ADOPTOPENJDK_REPO = ADOPTOPENJDK_REPO.replace("https://github.com/","[email protected]:")
4848
OPENJ9_REPO = OPENJ9_REPO.replace("https://github.com/","[email protected]:")
4949
}
50+
if (params.USE_GIT_SSH) {
51+
env.JDK_REPO = env.JDK_REPO.replace("https://github.com/","[email protected]:")
52+
}
5053
OPENJ9_BRANCH = params.OPENJ9_BRANCH ? params.OPENJ9_BRANCH : "master"
5154
}
5255

@@ -77,6 +80,7 @@ def setupEnv() {
7780
env.EXTERNAL_TEST_CMD=params.EXTERNAL_TEST_CMD ? params.EXTERNAL_TEST_CMD : "mvn clean install"
7881
env.DYNAMIC_COMPILE=params.DYNAMIC_COMPILE ? params.DYNAMIC_COMPILE : false
7982
env.USE_JRE=params.USE_JRE ? params.USE_JRE : false
83+
env.USE_GIT_SSH = params.USE_GIT_SSH ? params.USE_GIT_SSH : false
8084
env.RERUN_LINK = ""
8185
env.FAILED_TEST_TARGET = ""
8286
env.DOCKER_REGISTRY_URL = params.DOCKER_REGISTRY_URL ? params.DOCKER_REGISTRY_URL : ""

buildenv/jenkins/getDependency

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ def testBuild() {
1717
timeout(time: time_limit, unit: 'HOURS') {
1818
try {
1919
if( params.BUILD_TYPE == "systemtest" ){
20+
def repoPrefix = params.USE_GIT_SSH ? "[email protected]:" : "https://github.com/"
2021
sh 'curl -OLJks "https://api.adoptopenjdk.net/v3/binary/latest/8/ga/linux/x64/jdk/hotspot/normal/adoptopenjdk"'
2122
sh 'mkdir ${WORKSPACE}/j2sdk-image'
2223
sh 'tar -xzf OpenJDK8U-jdk_x64_linux_hotspot*.gz -C ${WORKSPACE}/j2sdk-image --strip-components 1'
2324
sh '${WORKSPACE}/j2sdk-image/jre/bin/java -version'
24-
sh 'git clone https://github.com/adoptium/aqa-systemtest'
25-
sh 'git clone https://github.com/adoptium/STF'
25+
sh "git clone ${repoPrefix}adoptium/aqa-systemtest"
26+
sh "git clone ${repoPrefix}adoptium/STF"
2627
sh 'ant -f ./aqa-systemtest/openjdk.build/build.xml -Djava.home=${WORKSPACE}/j2sdk-image/jre -Dprereqs_root=${WORKSPACE}/systemtest_prereqs configure'
2728
sh 'ant -f ./aqa-systemtest/openjdk.test.mauve/build.xml -Djava.home=${WORKSPACE}/j2sdk-image/jre -Dprereqs_root=${WORKSPACE}/systemtest_prereqs configure'
2829
archiveArtifacts '**/systemtest_prereqs/cvsclient/org-netbeans-lib-cvsclient.jar'

buildenv/jenkins/testJobTemplate

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ if (!binding.hasVariable('USER_CREDENTIALS_ID')) USER_CREDENTIALS_ID = ""
6262
if (!binding.hasVariable('GENERATE_JOBS')) GENERATE_JOBS = false
6363
if (!binding.hasVariable('CLOUD_PROVIDER')) CLOUD_PROVIDER = ""
6464
if (!binding.hasVariable('RERUN_ITERATIONS')) RERUN_ITERATIONS = "0"
65+
if (!binding.hasVariable('USE_GIT_SSH')) USE_GIT_SSH = false
6566

6667
if (!binding.hasVariable('BUILDS_TO_KEEP')) {
6768
BUILDS_TO_KEEP = 10
@@ -438,6 +439,7 @@ ARCH_OS_LIST.each { ARCH_OS ->
438439
booleanParam('PERSONAL_BUILD', false, "Is this a personal build?")
439440
booleanParam('USE_TESTENV_PROPERTIES', USE_TESTENV_PROPERTIES.toBoolean(), "use properties defined in the testenv.properties")
440441
stringParam('RERUN_ITERATIONS', RERUN_ITERATIONS, "Optional. Number of times to repeat execution of failed test target(s).")
442+
booleanParam('USE_GIT_SSH', USE_GIT_SSH.toBoolean(), "Use ssh protocol? True, if clone all repo by ssh.")
441443
}
442444
cpsScm {
443445
scm {

compile.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ if [ $USE_TESTENV_PROPERTIES == true ]; then
1717
testenv_file="./testenv/testenv_arm32.properties"
1818
fi
1919
while read line; do
20+
if [[ "$USE_GIT_SSH" = "true" ]]; then
21+
line=$(echo "$line" | sed "s|https://github.com/|[email protected]:|")
22+
fi
2023
export $line
2124
done <$testenv_file
2225
if [ $JDK_IMPL == "openj9" ] || [ $JDK_IMPL == "ibm" ]; then

external/tomcat/test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ source $(dirname "$0")/test_base_functions.sh
1616
#Set up Java to be used by the tomcat test
1717
echo_setup
1818

19-
git clone -q -b 1.6.x --single-branch https://github.com/apache/apr.git $TEST_HOME/tmp/apr
19+
if [[ "$USE_GIT_SSH" = "true" ]]; then
20+
repo_prefix="[email protected]:"
21+
else
22+
repo_prefix="https://github.com/"
23+
fi
24+
git clone -q -b 1.6.x --single-branch ${repo_prefix}apache/apr.git $TEST_HOME/tmp/apr
2025
cd $TEST_HOME/tmp/apr
2126
./buildconf
2227
./configure --prefix=$TEST_HOME/tmp/apr-build
2328
make
2429
make install
2530
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$TEST_HOME/tmp/apr-build/lib"
2631

27-
git clone -q https://github.com/apache/tomcat-native.git $TEST_HOME/tmp/tomcat-native
32+
git clone -q ${repo_prefix}apache/tomcat-native.git $TEST_HOME/tmp/tomcat-native
2833
cd $TEST_HOME/tmp/tomcat-native/native
2934
sh buildconf --with-apr=$TEST_HOME/tmp/apr
3035
./configure --with-apr=$TEST_HOME/tmp/apr --with-java-home=$JAVA_HOME --with-ssl=yes --prefix=$TEST_HOME/tmp/tomcat-native-build

get.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,11 @@ getTestKitGen()
431431
echo "get testKitGen..."
432432
cd $TESTDIR
433433
if [ "$TKG_REPO" = "" ]; then
434-
TKG_REPO="https://github.com/adoptium/TKG.git"
434+
TKG_REPO="https://github.com/adoptium/TKG.git"
435435
fi
436+
if [ "$USE_GIT_SSH" = "true" ];then
437+
TKG_REPO=$(echo "${TKG_REPO}" | sed "s|https://github.com/|[email protected]:|")
438+
fi
436439

437440
executeCmdWithRetry "TKG" "git clone -q $TKG_REPO"
438441
rt_code=$?
@@ -502,6 +505,10 @@ getFunctionalTestMaterial()
502505
then
503506
OPENJ9_BRANCH="-b $OPENJ9_BRANCH"
504507
fi
508+
if [ "$USE_GIT_SSH" = "true" ]
509+
then
510+
OPENJ9_REPO=`echo $OPENJ9_REPO | sed "s|https://github.com/|[email protected]:|"`
511+
fi
505512

506513
executeCmdWithRetry "openj9" "git clone --depth 1 --reference-if-able ${HOME}/openjdk_cache $OPENJ9_BRANCH $OPENJ9_REPO"
507514
rt_code=$?

perf/bumbleBench/build.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,27 @@
2222
<property environment="env" />
2323
<property name="DEST" value="${BUILD_ROOT}/perf/bumbleBench" />
2424
<property name="SRC" location="." />
25+
<property environment="SystemVariable" />
26+
<property name="isSSH" value="${SystemVariable.USE_GIT_SSH}" />
2527

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

3032
<condition property="git-prefix" value="git" else="https">
3133
<isset property="isZOS"/>
32-
</condition>
34+
</condition>
35+
<condition property="repo-prefix" value="git@github:" else="${git-prefix}://github.com/">
36+
<equals arg1="${isSSH}" args="true"/>
37+
</condition>
3338

3439
<target name="init">
3540
<mkdir dir="${DEST}" />
3641
</target>
3742

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

0 commit comments

Comments
 (0)