throttle() in declarative pipelines

1,932 views
Skip to first unread message

Jochen Hinrichsen

unread,
Jul 19, 2017, 3:36:19 AM7/19/17
to Jenkins Users
Has anyone used the 'Throttle Concurrent Builds Plugin' in a declarative pipeline?

From what i understand, throttle() will throttle nodes, which are optional in a dp:

    pipeline {
        agent any
    }

When introducing an explicit node

    pipeline {
        throttle(['THROTTLE1']) {
            node {
            }
        }
    }

Jenkins complains 'WorkflowScript: 3: Invalid agent type "throttle" specified. Must be one of [docker, dockerfile, label, any, None]'

Thoughts?

Michael Pailloncy

unread,
Jul 19, 2017, 9:48:10 AM7/19/17
to jenkins...@googlegroups.com
Regarding the associated documentation, throttle is defined as a step and since you are using the declarative way, have you tried something like : 


pipeline {
    agent any
    stages {
        stage('My throttled build') {
            steps {
                throttle(['THROTTLE1']) {
                    node {
                        sh "sleep 500"
                        echo "Done"
                    }
                }
            }
        }
    }
}


Hope this helps.


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ed4879df-b386-4370-bc57-ae679ab5db2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages