My build has a variable which is actually a script to extract a setting from pom.xml in the source code repo (Perforce). I access this at the beginning of the build (when setting build.version), but also reference it many times later in the build.
srcProductVersion = (<version> tag from pom.xml)
srcBuildNumber = incrementing counter
build.version = srcProductVersion-srcBuildNumber
I recently discovered that if I access srcProductVersion from a step running on a node where the Perforce client is not installed, an error is generated and the variable comes back undefined. This is a problem; in addition to failing my build and invalidating my method, we seem to be putting undue load on the Perforce server. It implies to me that we are accessing Perforce every time I access this variable, or any of the variables that reference it. I think I had been in the impression that we would read the file once and then use the cached value after that.
Can someone shed some light on this mechanism, and what I can do to work around this issue? We have recently started implementing a new capability that also uses this method.