Tom Canova commented on Bug JENKINS-26510

Upgrading to the current IBM JDK appears to have resolved the problem. I also refactored the code to reduce the chattiness between the master and slaves, though the refactored code also did not work until the JDK update. Here's the refactored code:

def recipeFileList
def CATEGORY_ID = ''
def branches = [:]
def cloudantSnippets = new com.ibm.devops.CloudantSnippets()

node('A') {
  checkout scm: [ $class : 'GitSCM', branches: [[$class: 'hudson.plugins.git.BranchSpec', name: '*/develop']], userRemoteConfigs : [[ url: 'https://hub.jazz.net/git/user/project', credentialsId: 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa'  ] ] ] 

  dir('resources') {
    sh """
       date
       echo ':::::::::::::::::::: divide list of recipes into files each containing 200 ::::::::::::::::::::'
       rm -f cookbook-recipes*.txt
       cat all-cookbook-recipes-*.txt >cookbook-recipes.txt
       awk 'NR%200==1{x=sprintf("cookbook-recipes-%04d.txt", ++i);}{print > x}' cookbook-recipes.txt
       ls cookbook-recipes-*.txt | sort >sorted-recipe-list.txt
    """
    recipeFileList = readFile('sorted-recipe-list.txt').tokenize()
  }
  sh """
    rm -f workspace.b*
    tar cjf workspace.bz2 config data logging.properties pom.xml resources src test descriptors
  """
  CATEGORY_ID = cloudantSnippets.shareFile('workspace.bz2', VCAP_SERVICE_TYPE, VCAP_SERVICE_NAME, VCAP_SERVICE_USERNAME,VCAP_SERVICE_PASSWORD)
  archive 'CLOUDANT_ID'

  for (int i = 0; i < recipeFileList.size(); i++) {
    String recipeFileName = "${recipeFileList.get(i)}"
    branches["${recipeFileName}"] = {
      node('parsing') {
        def mvnHome = tool 'Local maven-3.2.3'
        sh 'rm -rf *'
        cloudantSnippets.getSharedFile('workspace.bz2', CATEGORY_ID, VCAP_SERVICE_USERNAME,VCAP_SERVICE_PASSWORD)
        sh """
           tar xjf workspace.bz2
           echo ':::::::::::::::::::: ${recipeFileName} : generate settings.xml file with encrypted passwords to be used for accessing artifactory ::::::::::::::::::::'
           wget -N --quiet http://artifactory:8081/artifactory/plugins-release-local/com/ibm/devops/GenerateSecureSettings/1.0/GenerateSecureSettings-1.0-all.jar
           export PATH=${mvnHome}/bin:${env.PATH}
           set +vx
           export SOME_PASSWORD='$SOME_PASSWORD'
           ${tool 'local IBM Java 7'}/bin/java -jar GenerateSecureSettings-1.0-all.jar
           unset SOME_PASSWORD
           echo " :::::::::::::::::::: Running RecipeListParseTest with $recipeFileName ::::::::::::::::::::"
           mkdir -p target
           set -vx
           ${tool 'Local maven-3.2.3'}/bin/mvn -s settings.xml -DrunSuite='**/RecipeListParseTest.class'  -DrecipeFile='${recipeFileName}' -DDB_SERVER=1.1.1.1 -Duima_datapath='resources' -DDB_LAZY=YES -DoutputDir='output/subset' -DJAVA_ARG_LINE='-Xmx5G -Xms1G -XX:MaxPermSize=256m -XX:HeapDumpPath=/dev/null' test -U | grep -v 'process.*start' | grep -v 'process.*end' | grep -v 'invoked.*returning' | tee target/${recipeFileName}.mvn.log | grep '======' 
        """
        sh """
           echo "Upload JSON Output for ${recipeFileName}"
           tar cjf target/classes/output/${recipeFileName}.json.bz2 target/classes/output/subset
           tar cjf target/${recipeFileName}.mvn.log.bz2 target/${recipeFileName}.mvn.log
        """
        
        cloudantSnippets.shareFile("target/classes/output/${recipeFileName}.json.bz2", VCAP_SERVICE_TYPE, VCAP_SERVICE_NAME, VCAP_SERVICE_USERNAME,VCAP_SERVICE_PASSWORD, CATEGORY_ID)
        cloudantSnippets.shareFile("target/${recipeFileName}.mvn.log.bz2", VCAP_SERVICE_TYPE, VCAP_SERVICE_NAME, VCAP_SERVICE_USERNAME,VCAP_SERVICE_PASSWORD, CATEGORY_ID)
      }
    }
  }
}

parallel branches

node('A') {
  for (int i = 0; i < recipeFileList.size(); i++) {
    String recipeFileName = "${recipeFileList.get(i)}"
    try {
        cloudantSnippets.getSharedFile("target/classes/output/${recipeFileName}.json.bz2", CATEGORY_ID, VCAP_SERVICE_USERNAME, VCAP_SERVICE_PASSWORD)
        cloudantSnippets.getSharedFile("target/${recipeFileName}.mvn.log.bz2", CATEGORY_ID, VCAP_SERVICE_USERNAME, VCAP_SERVICE_PASSWORD)
        sh """
           echo " :::::::::::::::::::: Retrieve json for $recipeFileName ::::::::::::::::::::"        
           tar xjf target/classes/output/${recipeFileName}.json.bz2
           tar xjf target/${recipeFileName}.mvn.log.bz2
        """
      } catch (Exception ex) {
        echo "Error retrieving ${recipeFileName}"
        ex.printStackTrace()
      }
  }
  sh """
     date
     echo "Running on \$HOSTNAME \$(ifconfig|grep inet|head -1|awk '{print \$2}') in the workspace \${PWD}. Are you finished with this workspace?">input_prompt
  """
  def input_prompt=readFile('input_prompt')
  input input_prompt
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to