We have this complex groovy script for jenkins that looks something like
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
}
What we are getting is
java.lang.NoSuchMethodError: No such DSL method 'ansible' found among steps
It seems to be happening in the run_stages
function
Any input on what I am doing wrong? thanks!
That error message means that the command or "step" you are using is not valid. This is either because you typed something wrong, or a plugin is not installed that provides that step. I would guess you don't have the ansible plugin installed.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.