-
Bug
-
Resolution: Unresolved
-
Minor
-
None
When we are using masked plugin with Perforce plugin 1.3.31 or 1.3.34 though the sync happens on the common variable labeling files.
I define a variable P4USR, P4PWD
P4PWD is masked passwd defined in Global Configuration and in Build job we enable the mask plugin checkbox.
The sync happens properly but the labeling fails
Labelling Build in Perforce using ${JOB_NAME}_${BUILD_ID}
16:00:11 <${P4PWD}>: Found unresolved macro at '${P4PWD}'
16:00:11 Build step 'Create or Update Label in Perforce' marked build as failure
However instead of P4PWD if I use unmasked variables there is no problem. I wanted to use the Mask Plugin and majority of jobs are configured to use that.
I was going to open a new bug due to a similar issue, but I believe the root cause may be the same.
My issue is that I have the perforce password as an environment variable set at the beginning of the build (technically through the cloudbees folders plus capability for folders to have environment variables, but works the same if you say, inject the environment variable at the beginning of the build). The macro is resolved correctly for the checkout, but fails to resolve if the label portion is used.
I looked at how the variables are being dereferenced, and for getting the decrypted password for the label portion, rather than using the build's environment, only a barebones number of macros are being passed to the substitution, resulting in the same unresolved macro error.
I replaced a single line in src/main/java/hudson/plugins/perforce/PerforceTagAction.java:
190 depot.setPassword(scm.getDecryptedP4Passwd(this.getBuild().getProject(), this.getBuild().getBuiltOn()));
with
190 depot.setPassword(scm.getDecryptedP4Passwd(this.getBuild()));
and after that it works fine in my test environment.
I know this plugin has been eclipsed by the official perforce one, but it's an easy fix. Hey Rob, do you still plan on releasing with patches like this? Should I do a pull request?
Thanks,
Caleb