詹金斯|平行|运行类实例的问题

时间:2019-07-30 05:20:37

标签: jenkins-pipeline jenkins-groovy

我正在尝试从2个类实例并行运行阶段,但是我从其中之一获取此错误:“ roovy.lang.MissingFieldException:无此类字段”,但是如果我正在运行其中一个,则好吧。

groovy类位于src文件夹中,我正在将它们与库一起使用,并为每个类创建一个实例。

这是我在jenkins文件中的并行代码:

def parallelStagesMap = pipelineDailyStages.collectEntries {
            def name = it.getSetupname()
            echo "name: " + name
            ["${name}" : it.generateStage(name)]
          }

这些是类: 打包阶段

class DSmall extends DStages implements Serializable{

  def local_mx
  def local_g
  def local_agent

  DamSmall(environment, local_setupname, local_rp_launch_id, local_ssbuild, local_catagry, local_runners, local_artifactstodownload, local_resourcepool, local_mngnetwork, local_datastore, local_vmfolder, local_dcap_deploy, local_remotedebugport, local_m, local_g, local_agentoracle){
    super(environment, local_setupname, local_rp_launch_id, local_ssbuild, local_catagry, local_runners, local_artifactstodownload, local_resourcepool, local_mngnetwork, local_datastore, local_vmfolder, local_deploy, local_remotedebugport)

    this.local_m = local_m
    this.local_g = local_g
    this.local_agent = local_agent
  }


  def generateStage(a){
    return {
        this.environment.stage("stage: ${a}") {
                this.environment.echo "This is da."
        }
    }
  }
}

class DaSmall extends DStages implements Serializable{

  def local_m
  def local_agent
  def local_oracletemplate
  def local_oracle_start_db

  DasSmall(environment, local_setupname, local_rp_launch_id, local_ssbuild, local_catagry, local_runners, local_artifactstodownload, local_resourcepool, local_mngnetwork, local_datastore, local_vmfolder, local_dcap_deploy, local_remotedebugport, local_mxs, local_agent, local_oracletemplate, local_oracle_start_db){
    super(environment, local_setupname, local_rp_launch_id, local_ssbuild, local_catagry, local_runners, local_artifactstodownload, local_resourcepool, local_mngnetwork, local_datastore, local_vmfolder, local_deploy, local_remotedebugport)

    this.local_mxs = local_mxs
    this.local_agentoracle = local_agentoracle
    this.local_oracletemplate = local_oracletemplate
    this.local_oracle_start_db = local_oracle_start_db
  }


  def generateStage(a){
    return {
        this.environment.stage("stage: ${a}") {
                this.environment.echo "This is da."
        }
    }
  }
}

1 个答案:

答案 0 :(得分:0)

最后我找到了一个解决方案,我从vars文件夹中的另一个常规文件(不是jenkins文件)创建了类实例