-
Notifications
You must be signed in to change notification settings - Fork 396
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
Environment Variables Not Recognized in Agent section #180
Comments
Yep it's a bug. def local = env.ENV_VAR
pipeline {
agent {
label local
}
//...
} |
ballab1
added a commit
to ballab1/JenkinsPipelineUnit
that referenced
this issue
Jul 20, 2020
…of test cases from jenkinsci#180)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm using Maven to execute the groovy script that calls the JPU module.
In my setUp(), I use binding.setVariable to set the environment variable loadDirectory.
In the Jenkinsfiles that are currently being used by my company, the customWorkspace method is used with loadDirectory as the parameter inside the Agent Node section of the pipeline
Within the Stage Steps sections, the loadDirectory is able to be to be used. But when I attempt to set customWorkspace to the loadDirectory environment variable in the Agent Node section I receive the following error:
[ERROR] Failed to execute goal org.codehaus.gmavenplus:gmavenplus-plugin:1.8.1:execute (default-cli) on project test4: Error occurred while calling a method on a Groovy class from classpath. InvocationTargetException: No such property: loadDirectory for class: com.lesfurets.jenkins.unit.declarative.AgentDeclaration -> [Help 1]
I've attached the related files so you can see the code I'm using in more detail.
TestMain is originally TestMain.groovy, and testPipeline is originally testPipeline.Jenkinsfile, but those file types are not allowed to be uploaded to github.
TestMain.txt
testPipeline .txt
The text was updated successfully, but these errors were encountered: