Cmake arguments sometimes are added to path in parallel build

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      I'm trying to simulate matrix build using Pipeline

      Pipeline snippet

       

      def cmake_tasks(os_labels, configs, DL_on_off) {
          tasks = [:]
          def DL_dir_labels = ['ON': 'DL', 'OFF': 'noDL']
          for(int i = 0; i < os_labels.size(); i++) {
             def os = os_labels[i]
             for (int j = 0; j < configs.size(); j++) {
                for (int k = 0; k < DL_on_off.size(); k++) {
                   def config = configs[j]
                   def DL = DL_on_off[k]
                   def DL_dir_label = DL_dir_labels["${DL}"]
                   def generator = "Ninja"
                   def steps = [[withCmake: true]]
                   def cmakeArgs = "-Dsomevar=somevalue"
                   def cmake_inst = 'InSearchPath'
                   
                   tasks["${os}/${config}/${DL_dir_label}"] = {
                      node("build && ${os}") {
                         stage("${os}/${config}/${DL_dir_label}") {
                             if (os == "windows") {
                                 // does not matter
                             } else {
                                 cmakeBuild(buildDir: "build_${config}_${DL_dir_label}", 
                                            buildType: config, 
                                            cleanBuild: true, 
                                            cmakeArgs: cmakeArgs, 
                                            generator: generator, 
                                            installation: cmake_inst, 
                                            sourceDir: ".", 
                                            steps: steps)
                             }
                         }
                      }
                   }
                }
             }
          }
          return tasks
      }
      
      pipeline {
          agent none
          stages {
              stage('Configure & Build') {
                 steps {
                    script { 
                       def OSes = ["windows", "linux"] 
                       def configs = ["Release", "Debug"] 
                       def DL_inc = ["ON", "OFF"] 
                       parallel cmake_tasks(OSes, configs, DL_inc) 
                    }
                 }
              }
          }
      }
      
       
      

       

       

      Sometimes I see failed steps with the output similar to the following (please, note that "CMAKE_BUILD_TYPE=Debug" is concatenated with a path):

      Cleaning build dir /jenkins/workspace/project@7/build_Debug_DL ... [build_Debug_DL] $ cmake -G Ninja -D CMAKE_BUILD_TYPE=Debug -Dsomevar=somevalue /jenkins/workspace/project@7
      CMake Error: The source directory "/jenkins/workspace/project@7/build_Debug_DL/CMAKE_BUILD_TYPE=Debug" does not exist.
      Specify --help for usage, or press the help button on the CMake GUI.
      

            Assignee:
            Martin Weber
            Reporter:
            Vladimir Eremeev
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: