Hi,
You may want to take a look at the global env variables for the pipeline on 
your own Jenkins server:
http://*JenkinsHost*/job/*MyJobName*/pipeline-syntax/globals

replace the bold part with yours. You may find many things already defined 
into environment. To access them into groovy script just use the variable 
directly or using double quote into string:

def myVar = env.BRANCH_NAME
def myVar = "${env.BRANCH_NAME}"

As for the error you are getting, it's the sandbox policies that block the 
execution for "security" reason. 
Either use case:
1- You use the direct pipeline script: You can disable it into the project 
pipeline config page by unchecking the *Use Groovy Sandbox*
2- You use scm to fetch the jenkinsfile: You need to go into the Manage 
Jenkins and then click on *In-process Script Approval* and approve the 
wanted function until the script pass for every script possible branches.

Jerome

-- 
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 jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0e394866-1b80-440c-b4b2-95e1765fd909%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to