0

次のようなジェンキン用の複雑なグルーヴィーなスクリプトがあります

def run_pipeline() {
  try {
    stage('Build') {
      sh "docker build . -t ansible"
    }
    stage('Linux Common Tag') {
      def stage_common = [
        [tag: 'common', serial: '100%', user: "${env.ANSIBLE_USER}", playbook: 'platform.yml'],
      ]

      run_stages(stage_common, serial)
    }
}

def run_stages(stages, serial) {
  stages.each { phase ->
    def serial_percent=serial.containsKey(phase.tag) ? serial[phase.tag]: phase.serial
    ansible(phase.tag, phase.user, phase.password, limit=phase.limit, playbook=phase.playbook, serial=serial_percent)
  }

  execute_stages()
}

def ansible(tag, user, password, limit='', serial='100%' playbook='platform.yml') {
    // stuff in here
}

私たちが得ているのは

 java.lang.NoSuchMethodError: No such DSL method 'ansible' found among steps

run_stages関数で起こっているようです

私が間違っていることについて何か意見はありますか?ありがとう!

4

1 に答える 1