Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matrix 詹金斯参数化矩阵作业 我正在建立一个詹金斯作业,运行一些C++代码的测试。代码是在一个Jenkins作业期间生成的。有许多子项目,它们的代码位于自己的文件夹中_Matrix_Jenkins - Fatal编程技术网

Matrix 詹金斯参数化矩阵作业 我正在建立一个詹金斯作业,运行一些C++代码的测试。代码是在一个Jenkins作业期间生成的。有许多子项目,它们的代码位于自己的文件夹中

Matrix 詹金斯参数化矩阵作业 我正在建立一个詹金斯作业,运行一些C++代码的测试。代码是在一个Jenkins作业期间生成的。有许多子项目,它们的代码位于自己的文件夹中,matrix,jenkins,Matrix,Jenkins,我的想法是有一个矩阵作业,其中每个配置在一个代码文件文件夹上运行测试。有两件事我不确定最好的方法是什么 我想设置矩阵作业,以便在添加更多子文件夹时自动拾取。类似于将文件夹列表作为参数传递给作业,并将该参数用作作业的轴 我希望测试不会在特定文件夹上运行,除非父作业更改了该文件夹中的某些代码 现在如何设置这个测试是完全开放的-我正在寻找想法。如果你曾经设置过类似的东西-你是如何做到的?我有类似的任务-运行一个矩阵作业,将不同数量的文件夹作为一个轴。文件夹处于版本控制中,但很容易成为工件。我所做的是创

我的想法是有一个矩阵作业,其中每个配置在一个代码文件文件夹上运行测试。有两件事我不确定最好的方法是什么

  • 我想设置矩阵作业,以便在添加更多子文件夹时自动拾取。类似于将文件夹列表作为参数传递给作业,并将该参数用作作业的轴

  • 我希望测试不会在特定文件夹上运行,除非父作业更改了该文件夹中的某些代码


  • 现在如何设置这个测试是完全开放的-我正在寻找想法。如果你曾经设置过类似的东西-你是如何做到的?

    我有类似的任务-运行一个矩阵作业,将不同数量的文件夹作为一个轴。文件夹处于版本控制中,但很容易成为工件。我所做的是创建两个工作,一个是主工作和普通工作,另一个是从工作和矩阵工作。以下是需要在主作业中作为提升groovy运行的代码:

    import hudson.model.*
    def currentBuild = Thread.currentThread().executable;
    def jobName = 'SlaveMatrixJob' // Name of the matrix job to configure
    def axisFolders = []
    def strings =""
    
    // Get the matrix job
    def job = hudson.model.Hudson.instance.getItem(jobName)
    assert job != null, "The job $jobName could not be found"
    
    // Check it is a matrix job
    assert job.getClass() == hudson.matrix.MatrixProject.class, "The job $jobName is of class '${job.getClass().name}', but expecting 'hudson.matrix.MatrixProject'"
    
    // Get the folders
    new File("C:\\Path\\Path").eachDirMatch ~/_test.*/, {it ->
       println "Got folder: ${it.name}"
       axisFolders << it.name
    }
    
    // Check if the array is empty
    assert !axisFolders.isEmpty(), "No folders found to set in the matrix, aborting"
    
    //Sort them
    axisFolders.sort()
    
    // Now set new axis list for test folders
    def newAxisList = new hudson.matrix.AxisList()
    newAxisList.add(new hudson.matrix.TextAxis('TEST_FOLDERS', axisFolders))
    job.setAxes(newAxisList)
    println "Matrix Job $jobName new axis list: ${job.getAxes().toString()}"
    
    导入hudson.model*
    def currentBuild=Thread.currentThread()可执行文件;
    def jobName='SlaveMatrixJob'//要配置的矩阵作业的名称
    def axisFolders=[]
    def strings=“”
    //获得矩阵工作
    def job=hudson.model.hudson.instance.getItem(作业名)
    断言作业!=null,“找不到作业$jobName”
    //检查它是否是矩阵作业
    assert job.getClass()==hudson.matrix.MatrixProject.class,“作业$jobName属于类“${job.getClass().name}”,但应为“hudson.matrix.MatrixProject”
    //获取文件夹
    新文件(“C:\\Path\\Path”).eachDirMatch~/\u test.*/,{it->
    println“获取文件夹:${it.name}”
    
    axisFolders如果在版本控制中有单独的作业绑定到子文件夹,则只测试已更改的代码。我使用为不同文件夹动态添加相同的作业。抱歉,我不清楚-子文件夹和代码本身是由另一个工具生成的。代码不在版本控制中,因为它是一个工件self.谢谢,这与我开发的解决方案非常相似。最终,我选择保留一个列出所有源文件夹的配置文件-每当该文件在源代码管理中更新时,就会启动一个作业,使用REST API更新另一个文件夹的配置。谢谢你的提示-我没有意识到你可以从一个jo运行groovyB