Then I can see the "buildEnvironmentFor" printed BEFORE the P4 step run.
Looking at the docs, this API is called at the beginning of a well written workflow step to get the env variables.
But this doesn't set the env for main flow only for other steps that does call buildEnvironmentFor.
The sh or batch step doesn't call buildEnvironmentFor either...
I want to do
currentBuild.displayName = "#${BUILD_NUMBER}.${env.P4_CHANGELIST}"
for example...
how do I get the env back ? (without writing my own step?)
The extension point is called multiple times during a build and as so the environment changes. I would only attempt to use this after the sync. I'm not sure what you are trying to do, it looks like you are trying to access old builds?
I have now got my head around on how the extension point works.
The problem was to get to currentBuild.getRawBuild().getEnvironment() without good documentation.
just using env doesn't work.
I can now proceed to pull the values out
Excellent, is this ready for me to sync and test ?
ah, just saw your JIRA note stating it is ready for release.
I have been trying to make this work....
if I modify the code to:
@Extension()
public class P4EnvironmentContributor extends EnvironmentContributor {
Then I can see the "buildEnvironmentFor" printed BEFORE the P4 step run.
Looking at the docs, this API is called at the beginning of a well written workflow step to get the env variables.
But this doesn't set the env for main flow only for other steps that does call buildEnvironmentFor.
The sh or batch step doesn't call buildEnvironmentFor either...
I want to do
currentBuild.displayName = "#${BUILD_NUMBER}.${env.P4_CHANGELIST}"
for example...
how do I get the env back ? (without writing my own step?)
found it...
currentBuild.getRawBuild().getEnvironment()
The extension point is called multiple times during a build and as so the environment changes. I would only attempt to use this after the sync. I'm not sure what you are trying to do, it looks like you are trying to access old builds?
I have now got my head around on how the extension point works.
The problem was to get to currentBuild.getRawBuild().getEnvironment() without good documentation.
just using env doesn't work.
I can now proceed to pull the values out