Invoking a declarative pipeline from shared libraries

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Invoking a declarative pipeline from shared libraries

ctrlengineeringuk
Hi,

I am trying to invoke my declarative pipeline from shared libraries (so my jenkinsfile is as brief as possible) but it doesn't seem to work properly and the "pipeline" block seems to get executed, but functions like "when" are not evaluated...

Jenkinsfile:

#!groovy
def application = Constants.SONARQUBE_POC
def build = new org.ppluk.JenkinsPipelineBootstrap().setupBuild(application.name, application.next_version)


Shared library:
#!groovy
// vim: set syntax=groovy:
// Author: 
// Description: Declarative Pipeline Bootstrap actions

package org.ppluk


String setupBuild(String applicationName, String nextVersion) {
pipeline {
    agent { label "Java" }
    tools { maven "M3" }
    stages {
        stage('test') {
            when { branch "feature/*" }
            steps {
                echo "helloworld"
            }
        }
    }
}}

Is what I am attempting to do actually possible?


--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/d799363c-4519-4a47-be6f-f1fd1c4d2730%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Invoking a declarative pipeline from shared libraries

Sebastien Crete
Where you define your shared libraries ?

with shared-lib in DP .... i think is ncessary define in vars ... so your vars/myfile can call some lib ....

https://stackoverflow.com/questions/44943438/jenkins-shared-library-instantiate-util-class-and-use-in-workflowscript

i think ...

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0c4059ee-4d53-40de-b6a2-de299352e08c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Invoking a declarative pipeline from shared libraries

Andrew Bayer
See https://issues.jenkins-ci.org/browse/JENKINS-46547 - this will probably make it into Declarative 1.3, landing hopefully end of October.

On Wed, Sep 13, 2017 at 2:25 PM Sebastien Crete <[hidden email]> wrote:
Where you define your shared libraries ?

with shared-lib in DP .... i think is ncessary define in vars ... so your vars/myfile can call some lib ....

https://stackoverflow.com/questions/44943438/jenkins-shared-library-instantiate-util-class-and-use-in-workflowscript

i think ...

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/0c4059ee-4d53-40de-b6a2-de299352e08c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAPbPdObF3NYmqopWxw8cum3%2B6%2BMLyVSaZf9CKkF0MK9KyPEu_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.