Getting jobs to share the same workspace can be done by “AND set the Use custom 
workspace in Advanced Project Options to tell each job to use the same 
workspace”. I must have mistakenly assumed that that workspace contains source 
code to be built ?????

You never asked How can I handle an environment variable set for one build to 
an other build?" in your original message ????

To access environment tokens in Build-flow I have used :

build.properties["environment"]["JOB_NAME"]
build.number

the first can be used to get ANY environment variable either defined by Jenkins 
or injected/defined in your job.

Use this groovy to get all the properties of a build:

out.println 'Build Object Properties:'
build.properties.each { out.println "$it.key -> $it.value" }



From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of tps800
Sent: Thursday, May 21, 2015 4:22 AM
To: jenkinsci-users@googlegroups.com
Subject: Re: How can I handle over an environment variable within a build flow?

On Tuesday, May 19, 2015 at 4:26:40 PM UTC+2, rginga wrote:
Let’s see,,,


1.       What SCM are you using? I use Perforce and can tell the Perforce 
Plugin “not” to manage “client views” and create one in a fixed location AND 
set the Use custom workspace in Advanced Project Options to tell each job to 
use the same workspace. Therefore, Jenkins will not create a workspace with the 
job name. you do this in each of job1, job2, job,3 etc
My question was, "How can I handle an environment variable set for one build to 
an other build?". What does this have to do with the used SCM???

build( "linux-3.10.y.prep", PARENT_WORKSPACE:build.workspace, 
PARENT_JOB_NAME:build.job_name)
[...]

Is there a list available listing all properties for "build.*" I can use?
The property "build.job_name" just doesn't exist. I've tried "build.job.name" 
and "build.jobname" but all with no success:
{
groovy.lang.MissingPropertyException<http://stacktrace.jenkins-ci.org/search?query=groovy.lang.MissingPropertyException>:
 No such property: jobname for class: com.cloudbees.plugins.flow.FlowRun

at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap&entity=method>



at 
org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty&entity=method>



at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty&entity=method>



at 
Script1.run(Script1.groovy:1)<http://stacktrace.jenkins-ci.org/search/?query=Script1.run&entity=method>



at Script1$run.call(Unknown Source)



at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)



at Script1$run.call(Unknown Source)



at com.cloudbees.plugins.flow.FlowDSL.executeFlowScript(FlowDSL.groovy:84)



at 
com.cloudbees.plugins.flow.FlowRun$BuildWithWorkspaceRunnerImpl.doRun(FlowRun.java:180)



at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)



at hudson.model.Run.execute(Run.java:1744)



at hudson.model.Run.run(Run.java:1682)



at com.cloudbees.plugins.flow.FlowRun.run(FlowRun.java:153)



at hudson.model.ResourceController.execute(ResourceController.java:98)



at hudson.model.Executor.run(Executor.java:374)



FATAL: No such property: jobname for class: com.cloudbees.plugins.flow.FlowRun



groovy.lang.MissingPropertyException<http://stacktrace.jenkins-ci.org/search?query=groovy.lang.MissingPropertyException>:
 No such property: jobname for class: com.cloudbees.plugins.flow.FlowRun



at 
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap&entity=method>



at 
org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:63)<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty&entity=method>



at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:227)<http://stacktrace.jenkins-ci.org/search/?query=org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty&entity=method>



at 
Script1.run(Script1.groovy:1)<http://stacktrace.jenkins-ci.org/search/?query=Script1.run&entity=method>



at Script1$run.call(Unknown Source)



at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)



at Script1$run.call(Unknown Source)



at com.cloudbees.plugins.flow.FlowDSL.executeFlowScript(FlowDSL.groovy:84)



at 
com.cloudbees.plugins.flow.FlowRun$BuildWithWorkspaceRunnerImpl.doRun(FlowRun.java:180)



at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)



at hudson.model.Run.execute(Run.java:1744)



at hudson.model.Run.run(Run.java:1682)



at com.cloudbees.plugins.flow.FlowRun.run(FlowRun.java:153)



at hudson.model.ResourceController.execute(ResourceController.java:98)



at hudson.model.Executor.run(Executor.java:374)



Finished: FAILURE

}
--
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<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/93c37ecf-f5c4-43f3-b061-3e17b6405a1d%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/93c37ecf-f5c4-43f3-b061-3e17b6405a1d%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
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/6C6EE445A6F6CE4E8A0FFB51B071A4E2D85B444C%40AMERMBX02.PERKINELMER.NET.
For more options, visit https://groups.google.com/d/optout.

Reply via email to