Skip to content

Commit

Permalink
Update Exclude files
Browse files Browse the repository at this point in the history
Update Exclude files

- Update script to include latest exclude files from artifactory for JDK versions

Signed-off-by: Kapil Powar <[email protected]>
  • Loading branch information
kapilpowar17 committed Dec 19, 2023
1 parent 45537f2 commit 80b6a9a
Show file tree
Hide file tree
Showing 2 changed files with 154 additions and 103 deletions.
40 changes: 22 additions & 18 deletions buildenv/jenkins/jck_sync
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ timestamps{
echo ("clone the SCM GIT repo")
try {
def gitConfig = scm.getUserRemoteConfigs().get(0)
timeout(time: 1, unit: 'HOURS') {
cleanWs disableDeferredWipeout: true, deleteDirs: true
}
checkout scm: [$class: 'GitSCM',
branches: [[name: "${scm.branches[0].name}"]],
extensions: [
Expand Down Expand Up @@ -37,10 +40,11 @@ timestamps{

def syncJckMaterial(){
echo ("Starting script to sync JCK materials .....")
def JCK_VERSION = params.JDK_VERSION ? "-j ${params.JDK_VERSION}": ""
def JCK_GIT_BRANCH = params.JCK_GIT_BRANCH ? "-gb ${params.JCK_GIT_BRANCH}": ""
def ARTIFACTORY_URL = params.ARTIFACTORY_URL ? "-au ${params.ARTIFACTORY_URL}": ""
def JCK_GIT_REPO = params.JCK_GIT_REPO ? "-repo ${params.JCK_GIT_REPO}": ""
def JCK_VERSION_OPTION = params.JDK_VERSION ? "-j ${params.JDK_VERSION}": ""
def JCK_GIT_BRANCH_OPTION = params.JCK_GIT_BRANCH ? "-gb ${params.JCK_GIT_BRANCH}": ""
def ARTIFACTORY_URL_OPTION = params.ARTIFACTORY_URL ? "-au ${params.ARTIFACTORY_URL}": ""
def ARTIFACTORY_API_URL_OPTION = params.ARTIFACTORY_API_URL ? "-ap ${params.ARTIFACTORY_API_URL}": ""
def JCK_GIT_REPO_OPTION = params.JCK_GIT_REPO ? "-repo ${params.JCK_GIT_REPO}": ""
def PR_NUMBER = 0
stage('JCKUpdater') {
getJavaSDK()
Expand All @@ -52,17 +56,17 @@ def syncJckMaterial(){
]) {
dir("${WORKSPACE}/aqa-tests/jck/jck-semiauto-updater"){
sshagent(credentials:["${params.USER_CREDENTIALS_ID}"], ignoreMissing: true){
def SCRIPT = "./jckupdater.sh ${JCK_VERSION} -at \"\$ARTIFACTORY_CREDENTIALS\" ${JCK_GIT_REPO} -gt \"\$GIT_CREDENTIALS\" ${ARTIFACTORY_URL} ${JCK_GIT_BRANCH} "
def SCRIPT = "./jckupdater.sh ${JCK_VERSION_OPTION} -at \"\$ARTIFACTORY_CREDENTIALS\" ${JCK_GIT_REPO_OPTION} -gt \"\$GIT_CREDENTIALS\" ${ARTIFACTORY_URL_OPTION} ${ARTIFACTORY_API_URL_OPTION} ${JCK_GIT_BRANCH_OPTION} "
def tempOutputFile = "temp_output.txt"
def EXITCODE = sh(script: "${SCRIPT} > ${tempOutputFile}", returnStatus: true)
def scriptOutput = readFile(tempOutputFile).trim()
echo ("JCKUpdater script output:")
echo scriptOutput
if (EXITCODE == 2) {
error ("JCKUpdater script returned exit code 2, as no new update available. The job is completed without further action.")
currentBuild.result = "SUCCESS"
} else if (EXITCODE == 0) {
echo ("Script returned exit code 0, new update is available and PR is created.")
def scriptOutput = readFile(tempOutputFile).trim()
echo ("JCKUpdater script output:")
echo scriptOutput
def matcher = (scriptOutput =~ /PR_NUMBER=\s*(\d+)/)
PR_NUMBER = matcher ? matcher[0][1] : null
if (PR_NUMBER == null || PR_NUMBER == 0) {
Expand All @@ -79,37 +83,37 @@ def syncJckMaterial(){
}
stage('Test') {
def CHILD_JOB_NAME="Grinder_JCK"
def BUILD_URL="${JENKINS_URL}job/${CHILD_JOB_NAME}/"
def CHILD_PARAMS = []
def buildURL="${JENKINS_URL}job/${CHILD_JOB_NAME}/"
def childParams = []
// loop through all the params and change the parameters if needed
params.each { param ->
def value = param.value.toString()
if (param.key == "JCK_GIT_BRANCH") {
if (value.trim() == ""){
value = "autoBranch" //default branch name given in JCKUpdater.sh script
}
CHILD_PARAMS << string(name: param.key, value: value)
childParams << string(name: param.key, value: value)
} else {
if (value == "true" || value == "false") {
CHILD_PARAMS << booleanParam(name: param.key, value: value.toBoolean())
childParams << booleanParam(name: param.key, value: value.toBoolean())
} else {
CHILD_PARAMS << string(name: param.key, value: value)
childParams << string(name: param.key, value: value)
}
}
}
def BUILD_INFO = build job: CHILD_JOB_NAME, parameters: CHILD_PARAMS
def COMMENT="Job [#${BUILD_INFO.number}](${BUILD_URL}${BUILD_INFO.number}) completed with status: ${BUILD_INFO.result}"
createComment(COMMENT,PR_NUMBER)
def buildInfo = build job: CHILD_JOB_NAME, parameters: childParams
def comment="Job [#${buildInfo.number}](${buildURL}${buildInfo.number}) completed with status: ${buildInfo.result}"
createComment(comment,PR_NUMBER)
}
}

//Download JAVA SDK
def getJavaSDK(){
def JDK_VERSION_OPTION = params.JDK_VERSION ? "-j ${params.JDK_VERSION}" : ""
def CUSTOMIZED_SDK_URL_OPTION = "-c ${params.CUSTOMIZED_SDK_URL}"
def CUSTOMIZED_SDK_OPTION = "-c ${params.CUSTOMIZED_SDK}"
def CLONE_OPENJ9_OPTION = "--clone_openj9 false"
def PLATFORM_OPTION = "-p x86-64_linux"
def GET_SH_CMD = "./get.sh -s `pwd`/.. ${PLATFORM_OPTION} ${JDK_VERSION_OPTION} ${CUSTOMIZED_SDK_URL_OPTION} ${CLONE_OPENJ9_OPTION} "
def GET_SH_CMD = "./get.sh -s `pwd`/.. ${PLATFORM_OPTION} ${JDK_VERSION_OPTION} ${CUSTOMIZED_SDK_OPTION} ${CLONE_OPENJ9_OPTION} "
dir("${WORKSPACE}/aqa-tests") {
if (params.CUSTOMIZED_SDK_URL_CREDENTIAL_ID) {
withCredentials([usernamePassword(credentialsId: "${params.CUSTOMIZED_SDK_URL_CREDENTIAL_ID}", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
Expand Down
Loading

0 comments on commit 80b6a9a

Please sign in to comment.