Hello list,

We are busy converting our jobs to the Multibranch Pipeline.

We had a lot of jobs generated by the JobDSL.
- Build develop
- Build feature branches
- Sonar builds for develop and feature branches

We configured our jobs in the same repository as our JobDSL.

For the Multibranch Pipeline, we want to create a shared library, so we can
have a common ground for all our old jobs.

We based our shared library on one we found on Github [1] and called the
builder as follows:

@Library('chefci') _
org.typo3.chefci.v2.cookbook.CookbookPipeline.builder(this, steps)

Then we wanted to change the stages to suit our needs and created a Maven stage:

void execute() {
    script.stage(stageName) {
                mavenSettingsConfig: 'e6609549-d884-4978-9750-61bdb982db2e',
                publisherStrategy: 'EXPLICIT',
                options: [
                        script.junitPublisher(healthScaleFactor: 1.0),
        ) {
            script.sh "mvn clean --batch-mode --update-snapshots
-Pintegration deploy"

This didn't work, because of the `script.when` line.

Is it possible to have a `when` block when using this method?

Also, is this a good way to setup a shared library for the declarative
pipeline? Are there anymore good examples? I find a lot of
documentation, but a lot is unclear if it is for the scripted or
declarative pipeline.

I hope someone can help me with this.

With regards,

Nick Stolwijk


~~~ Try to leave this world a little better than you found it and, when
your turn comes to die, you can die happy in feeling that at any rate you
have not wasted your time but have done your best ~~~

Lord Baden-Powell

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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 

Reply via email to