Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-28522

masked variable in p4 passwd causes labelling problem

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Component/s: perforce-plugin
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          cmayeux Caleb Mayeux added a comment -

          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

          Show
          cmayeux Caleb Mayeux added a comment - 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
          Hide
          rpetti Rob Petti added a comment -

          Sure, give it a good once-over and send a pull request. I'll release it when I can find a moment.

          Show
          rpetti Rob Petti added a comment - Sure, give it a good once-over and send a pull request. I'll release it when I can find a moment.
          Hide
          neelbaviskar Nilesh Baviskar added a comment -

          Does this issue resolved?

          I too facing similar issue since long and today wanted file a bug its already there so just adding this comment.
          I am too facing similar issue in mask password plugin while and it fails while applying label.

          Thanks,
          Nilesh

          Show
          neelbaviskar Nilesh Baviskar added a comment - Does this issue resolved? I too facing similar issue since long and today wanted file a bug its already there so just adding this comment. I am too facing similar issue in mask password plugin while and it fails while applying label. Thanks, Nilesh
          Hide
          rpetti Rob Petti added a comment -

          PR with the fix was never sent, so no, it hasn't been fixed.

          Show
          rpetti Rob Petti added a comment - PR with the fix was never sent, so no, it hasn't been fixed.

            People

            • Assignee:
              Unassigned
              Reporter:
              ankans2001_jenkins Ankan Saha
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: