You can call any function the normal way:

*stage (build) {*
*      buildProject(meta)*
*}*

*def buildProject(meta) {*
*      node {*
*          //whatever i need to do*
*      }*
*}*

On Tuesday, March 21, 2017 at 10:02:34 AM UTC-7, ishan jain wrote:
>
> Probably i am being silly, but seriously i am not able to call a function 
> which i have defined in my Jenkinsfile from within a step. Here is a sample:
>
> *def meta = "something"*
>
> *stage (build) {*
>
> *      buildProject(meta)*
> *}*
>
> *def buildProject(meta) {*
> *return {*
> *      node {*
> *          //whatever i need to do*
> *      }*
> *  }*
> *}*
>
> This simply does not do anything. I tried various combos to try n call it, 
> but nothing. *How exactly should i call a function ?*
>
> *def meta = "something"*
>
> *stage (build) {*
> *      node {*
> *      buildProject(meta)*
> *  }*
> *}*
>
> *def buildProject(meta) {*
> *return {*
>       
> *          //whatever i need to do*
>       
> *  }*
> *}*
>
>
>
> *def meta = "something"*
>
> *stage (build) {*
> *      step {*
> *      buildProject(meta)*
> *     }*
> *}*
>
> *def buildProject(meta) {*
> *return {*
> *      node {*
> *          //whatever i need to do*
> *      }*
> *  }*
> *}*
>
>
>
> *def meta = "something"*
>
> *stage (build) {*
>
> *      def output =  buildProject(meta)*
> *}*
>
> *def buildProject(meta) {*
> *return {*
> *      node {*
> *          //whatever i need to do*
> *      }*
> *  }*
> *}*
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d01ff147-2576-4841-a632-1a72d60178ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to