Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@NonCPS annotation inside Jenkinsfile #69

Open
cvakiitho opened this issue Apr 23, 2020 · 1 comment
Open

@NonCPS annotation inside Jenkinsfile #69

cvakiitho opened this issue Apr 23, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@cvakiitho
Copy link

Hi,
This is more of a question than an issue, and I couldn't find a better place to ask.
In some of our Jenkinsfiles we use functions outside of node() block, I know it's not a best practice, but anyway it looks like this:

Jenkinsfile

node('ci'){...)
@NonCPS
String someRegexFn(String){ ... )

is there any way to test this function in jenkins-spock without having to add:

import com.cloudbees.groovy.cps.NonCPS;

To the Jenkinsfile?

I guess it is a similar issue to #21 (comment)

@awittha
Copy link
Contributor

awittha commented May 28, 2020

At the moment, I cannot think of such a way.

We'd probably have to modify the implementation of getPipelineScriptForTest(...) to automatically inject imports for all of the classes that Jenkins does. That would be a good thing for jenkins-spock to do, for completeness' and correctness' sake.

@awittha awittha self-assigned this May 28, 2020
@awittha awittha added the enhancement New feature or request label May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants