-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
Tested on Windows only.
System env not available for polled or triggered jobs.
For example the following Workspace name does not get the hostname, but rather "COMPUTERNAME".
Workspace name: jenkins-${NODE_NAME}-${JOB_NAME}-${COMPUTERNAME}
If this job is started by polling or by a trigger, the workspace does not use the system environment variable, and when run, the Description is not updated with the last used change.
When you use Build Now, it does find the env variable, and updates the Description appropriately.
$ p4 clients -t -e jenkins-master-Job1*
Client jenkins-master-Job1-COMPUTERNAME 2016/11/16 11:03:00 root C:\Program Files (x86)\Jenkins\workspace\Job1 ''
Client jenkins-master-Job1-JK-WIND7-DBG 2016/11/16 10:51:12 root C:\Program Files (x86)\Jenkins\workspace\Job1 'Change:15305 '
This is true for at least Freestyle and Multi-configuration projects.
Interesting, I'm kind of surprised you got COMPUTERNAME to resolve at all since system environment variables on the node or master are typically not available to the various plugin configurations used in Jenkins jobs. You can certainly use system environment variables in Shell and .bat build steps, but those are resolved when they run. Are you defining your workspace name in the Perforce job configuration? Also interesting, do you need both node and computername to unique-ify the workspace name? Won't those two values always be the same anyway the jobs on that Jenkins? On the surface, it'd seem job and node would be enough.