Skip to content

Commit

Permalink
Revert "Enable Dynamic agent (#2397)"
Browse files Browse the repository at this point in the history
This reverts commit 42b30ea.
  • Loading branch information
llxia authored Mar 25, 2021
1 parent 42b30ea commit 3c52d41
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 78 deletions.
4 changes: 2 additions & 2 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def setupEnv() {
SSH_AGENT_CREDENTIAL = params.SSH_AGENT_CREDENTIAL ? params.SSH_AGENT_CREDENTIAL : ""
KEEP_WORKSPACE = params.KEEP_WORKSPACE ? params.KEEP_WORKSPACE : false
OPENJ9_SHA = params.OPENJ9_SHA ? params.OPENJ9_SHA : ""
CLOUD_PROVIDER = params.CLOUD_PROVIDER ? params.CLOUD_PROVIDER : ""
env.JDK_BRANCH = params.JDK_BRANCH ? params.JDK_BRANCH : ""
env.USER_CREDENTIALS_ID = params.USER_CREDENTIALS_ID ? params.USER_CREDENTIALS_ID : ""
env.TEST_JDK_HOME = "$WORKSPACE/openjdkbinary/j2sdk-image"
Expand Down Expand Up @@ -576,7 +575,7 @@ def runTest( ) {
echo "env.DISPLAY is ${env.DISPLAY}"
makeTest("${RUNTEST_CMD}")
}
else if (env.SPEC.startsWith('linux') && !LABEL.contains('ci.agent.dynamic')) {
else if (env.SPEC.startsWith('linux')) {
// Add an additional 10 second timeout due to issue: https://github.com/AdoptOpenJDK/openjdk-build/issues/2368#issuecomment-756683888
wrap([$class: 'Xvfb', autoDisplayName: true, timeout:10]) {
def DISPLAY = sh (
Expand Down Expand Up @@ -876,6 +875,7 @@ def run_parallel_tests() {
if (params.PARALLEL && params.PARALLEL != "None") {
stage ("Parallel Tests") {
def childJobs = parallel parallel_tests

node {
def buildResult = ""
childJobs.each {
Expand Down
108 changes: 34 additions & 74 deletions buildenv/jenkins/openjdk_tests
Original file line number Diff line number Diff line change
Expand Up @@ -68,22 +68,18 @@ def PLATFORM_MAP = [
's390_linux' : [
'SPEC' : 'linux_390',
'LABEL' : 'ci.role.test&&hw.arch.s390x&&sw.os.linux&&hw.bits.32',
'DynamicAgents' : ['fyre']
],
's390x_linux' : [
'SPEC' : 'linux_390-64_cmprssptrs',
'LABEL' : 'ci.role.test&&hw.arch.s390x&&sw.os.linux',
'DynamicAgents' : ['fyre']
],
's390x_linux_mixed' : [
'SPEC' : 'linux_390-64_mxdptrs',
'LABEL' : 'ci.role.test&&hw.arch.s390x&&sw.os.linux',
'DynamicAgents' : ['fyre']
],
's390x_linux_xl' : [
'SPEC' : 'linux_390-64',
'LABEL' : 'ci.role.test&&hw.arch.s390x&&sw.os.linux',
'DynamicAgents' : ['fyre']
],
's390x_zos' : [
'SPEC' : 'zos_390-64_cmprssptrs',
Expand Down Expand Up @@ -120,17 +116,14 @@ def PLATFORM_MAP = [
'x86-64_linux' : [
'SPEC' : 'linux_x86-64_cmprssptrs',
'LABEL' : 'ci.role.test&&hw.arch.x86&&sw.os.linux',
'DynamicAgents' : ['azure', 'fyre']
],
'x86-64_linux_mixed' : [
'SPEC' : 'linux_x86-64_mxdptrs',
'LABEL' : 'ci.role.test&&hw.arch.x86&&sw.os.linux',
'DynamicAgents' : ['azure', 'fyre']
],
'x86-64_linux_xl' : [
'SPEC' : 'linux_x86-64',
'LABEL' : 'ci.role.test&&hw.arch.x86&&sw.os.linux',
'DynamicAgents' : ['azure', 'fyre']
],
'x86-64_mac' : [
'SPEC' : 'osx_x86-64_cmprssptrs',
Expand Down Expand Up @@ -161,6 +154,7 @@ def PLATFORM_MAP = [
if ( !params.TARGET ) {
assert false : "Please provide TARGET value"
}

def PLATFORMS = params.PLATFORM.trim().split("\\s*,\\s*");
def JDK_VERSIONS = params.JDK_VERSION.trim().split("\\s*,\\s*");
def JDK_IMPLS = params.JDK_IMPL.trim().split("\\s*,\\s*");
Expand Down Expand Up @@ -216,10 +210,6 @@ if (JDK_VERSIONS.size() > 1 || JDK_IMPLS.size() > 1 || PLATFORMS.size() >1 || PL
if (PLATFORM_MAP.containsKey(params.PLATFORM)) {
SPEC = PLATFORM_MAP[params.PLATFORM]["SPEC"]
LABEL = params.LABEL ? params.LABEL : PLATFORM_MAP[params.PLATFORM]["LABEL"]
dynamicAgents = []
if (PLATFORM_MAP[params.PLATFORM].containsKey('DynamicAgents')) {
dynamicAgents = PLATFORM_MAP[params.PLATFORM]["DynamicAgents"]
}

if (params.DOCKER_REQUIRED) {
LABEL += "&&sw.tool.docker"
Expand All @@ -233,81 +223,51 @@ if (JDK_VERSIONS.size() > 1 || JDK_IMPLS.size() > 1 || PLATFORMS.size() >1 || PL
println "LABEL: ${LABEL}"

stage('Queue') {
String[] onlineNodes = nodesByLabel(LABEL)
if (onlineNodes.size() < 1) {
if (nodesByLabel(LABEL).size() < 1) {
int ACTIVE_NODE_TIMEOUT = params.ACTIVE_NODE_TIMEOUT ? params.ACTIVE_NODE_TIMEOUT : 0

timeout(ACTIVE_NODE_TIMEOUT) {
// If there is available node before timeout
// node(LABEL) has to be used for spinning up a dynamic vm agent
node(LABEL) {
echo "find the node with label as ${env.NODE_NAME}"
}
}
} else {
boolean isNodeIdle = false
node('master') {
for (String onlineNode : onlineNodes) {
def nodeStatus = sh(script: "curl ${env.JENKINS_URL}computer/${onlineNode}/api/xml?xpath=/*/idle",
returnStdout: true,
returnStatus: false
).trim()
if (nodeStatus.contains("true")) {
isNodeIdle = true
break
}
}
}
// IF no nodes are idle we will check if there is supported virtual agent
// When Parallel the race condition could happen. Say the number of multiply jobs is larger than the available nodes the query's result may be delayed and wrong
// In this case jobs will be fooled to fall back to wait local busy nodes.
if (!isNodeIdle && (CLOUD_PROVIDER.length()) != 0) {
if (CLOUD_PROVIDER in dynamicAgents) {
LABEL += '&&ci.agent.dynamic'
echo "find the node ${env.NODE_NAME}"
}
}
}

node(LABEL) {
if (params.PLATFORM.contains('zos')) {
/* Ensure correct CC env */
env._CC_CCMODE = '1'
env._CXX_CCMODE = '1'
env._C89_CCMODE = '1'
node(LABEL) {
if (params.PLATFORM.contains('zos')) {
/* Ensure correct CC env */
env._CC_CCMODE = '1'
env._CXX_CCMODE = '1'
env._C89_CCMODE = '1'

def gitConfig = scm.getUserRemoteConfigs()[0]
def SCM_GIT_REPO = gitConfig.getUrl()
def SCM_GIT_BRANCH = scm.branches[0].name
cleanWs()
def gitConfig = scm.getUserRemoteConfigs()[0]
def SCM_GIT_REPO = gitConfig.getUrl()
def SCM_GIT_BRANCH = scm.branches[0].name
cleanWs()

// SCM_GIT_REPO value only gets expanded in sh
def SCM_GIT_REPO_VAL = sh(script: "echo ${SCM_GIT_REPO}", returnStdout: true).trim()
SCM_GIT_REPO_VAL = SCM_GIT_REPO_VAL.replace("https://github.com/","git@github.com:")
// SCM_GIT_REPO value only gets expanded in sh
def SCM_GIT_REPO_VAL = sh(script: "echo ${SCM_GIT_REPO}", returnStdout: true).trim()
SCM_GIT_REPO_VAL = SCM_GIT_REPO_VAL.replace("https://github.com/","git@github.com:")

sh "git clone -b ${SCM_GIT_BRANCH} ${SCM_GIT_REPO_VAL} openjdk-tests"
} else {
def gitConfig = scm.getUserRemoteConfigs().get(0)
sh "git clone -b ${SCM_GIT_BRANCH} ${SCM_GIT_REPO_VAL} openjdk-tests"
} else {
def gitConfig = scm.getUserRemoteConfigs().get(0)

// Adopt windows machines require env here https://github.com/AdoptOpenJDK/openjdk-tests/issues/1803
ref_cache = "${env.HOME}/openjdk_cache"
// Adopt windows machines require env here https://github.com/AdoptOpenJDK/openjdk-tests/issues/1803
ref_cache = "${env.HOME}/openjdk_cache"

checkout scm: [$class: 'GitSCM',
branches: [[name: "${scm.branches[0].name}"]],
extensions: [
[$class: 'CleanBeforeCheckout'],
[$class: 'CloneOption', reference: ref_cache],
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'openjdk-tests']],
userRemoteConfigs: [[url: "${gitConfig.getUrl()}"]]
]
}
jenkinsfile = load "${WORKSPACE}/openjdk-tests/buildenv/jenkins/JenkinsfileBase"
if (LABEL.contains('ci.agent.dynamic') && CLOUD_PROVIDER == 'azure') {
//Set dockerimage for azure agent. Fyre has stencil to setup the right environment
docker.image('adoptopenjdk/centos6_build_image').pull()
docker.image('adoptopenjdk/centos6_build_image').inside {
jenkinsfile.testBuild()
}
} else {
jenkinsfile.testBuild()
}
checkout scm: [$class: 'GitSCM',
branches: [[name: "${scm.branches[0].name}"]],
extensions: [
[$class: 'CleanBeforeCheckout'],
[$class: 'CloneOption', reference: ref_cache],
[$class: 'RelativeTargetDirectory', relativeTargetDir: 'openjdk-tests']],
userRemoteConfigs: [[url: "${gitConfig.getUrl()}"]]
]
}
jenkinsfile = load "${WORKSPACE}/openjdk-tests/buildenv/jenkins/JenkinsfileBase"
jenkinsfile.testBuild()
}
}
jenkinsfile.run_parallel_tests()
Expand Down
4 changes: 2 additions & 2 deletions buildenv/jenkins/testJobTemplate
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ if (!binding.hasVariable('VENDOR_TEST_REPOS')) VENDOR_TEST_REPOS = ""
if (!binding.hasVariable('VENDOR_TEST_BRANCHES')) VENDOR_TEST_BRANCHES = ""
if (!binding.hasVariable('VENDOR_TEST_DIRS')) VENDOR_TEST_DIRS = ""
if (!binding.hasVariable('USER_CREDENTIALS_ID')) USER_CREDENTIALS_ID = ""
if (!binding.hasVariable('CLOUD_PROVIDER')) CLOUD_PROVIDER = ""



if (!binding.hasVariable('BUILDS_TO_KEEP')) {
BUILDS_TO_KEEP = 10
Expand Down Expand Up @@ -245,7 +246,6 @@ ARCH_OS_LIST.each { ARCH_OS ->
stringParam('UPSTREAM_TEST_JOB_NAME', "", "Auto-populated. Upstream test job name. It will be used together with PARALLEL=Dynamic")
stringParam('UPSTREAM_TEST_JOB_NUMBER', "", "Auto-populated. Upstream test job number. It will be used together with PARALLEL=Dynamic")
booleanParam('LIGHT_WEIGHT_CHECKOUT', LIGHT_WEIGHT_CHECKOUT.toBoolean(), "Optional. Default is false for Grinders")
stringParam('CLOUD_PROVIDER', CLOUD_PROVIDER, "Available cloud provider, e.g. azure, fyre")
}
cpsScm {
scm {
Expand Down

0 comments on commit 3c52d41

Please sign in to comment.