[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title aurelien leboulanger created an issue Jenkins / JENKINS-40013 Unable to set and use global groovy functions Issue Type: Improvement Assignee: Andrew Bayer Components: pipeline-model-definition-plugin Created: 2016/Nov/24 1:23 PM Environment: Jenkins 2.25 pipeline model defintion 0.6 Labels: plugin pipeline Priority: Major Reporter: aurelien leboulanger In default pipeline syntax i can define global groovy functions which i can use everywhere in the pipeline; which is not the case with the pipeline model definition. #!/usr/bin/env groovy def initialization(args) { # some groovy code } stage 'build' node('unix') { initialization release: "${RELEASE}", profile: "${PROFILE}", image: "${IMAGE}" } I try to use the script tag but it's a stage scope.
[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title aurelien leboulanger updated an issue Jenkins / JENKINS-40013 Unable to set and use global groovy functions Change By: aurelien leboulanger In default pipeline syntax i can define global groovy functions which i can use everywhere in the pipeline; which is not the case with the pipeline model definition. {code:java}#!/usr/bin/env groovydef initialization(args) { # some groovy code}stage 'build'node('unix') {initialization release: "${RELEASE}", profile: "${PROFILE}", image: "${IMAGE}"}{code}I try tried to use the script tag but it's a stage scope. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title Andrew Bayer commented on JENKINS-40013 Re: Unable to set and use global groovy functions I'm able to do that fine - i.e., pipeline { agent none stages { stage("foo") { steps { sayHi("Steve") } } } } def sayHi(String s) { echo "Hi, ${s}" } Can you give me an example that's not working for you? Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title aurelien leboulanger commented on JENKINS-40013 Re: Unable to set and use global groovy functions your sample works for me The issue was with the usage of the @NonCPS annotation pipeline { agent none stages { stage("foo") { steps { getCurrentWorkspacePath("Steve") } } } } @NonCPS static def getCurrentWorkspacePath(environments) { def matcher = environments =~ 'export IMAGE_DIR\\s*=\\s*(.+)' matcher ? matcher[0][1] : null } Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title Andrew Bayer commented on JENKINS-40013 Re: Unable to set and use global groovy functions Ah. Hrm. Let me see what I can figure out. Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title Andrew Bayer commented on JENKINS-40013 Re: Unable to set and use global groovy functions Still can't reproduce this - what error are you getting? Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-40013) Unable to set and use global groovy functions
Title: Message Title aurelien leboulanger closed an issue as Fixed @NonCPS usage break the pipeline. Jenkins / JENKINS-40013 Unable to set and use global groovy functions Change By: aurelien leboulanger Status: Open Closed Resolution: Fixed Add Comment This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout