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

detects valid p4 output as authentication error

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • p4-plugin
    • None
    • all

      We have a job description that contains the text:

      "Perforce password (P4PASSWD) invalid or unset"

      In src/main/java/com/tek42/perforce/parse/AbstractPerforceTemplate.java this is detected as an authentication error, aborting the source update, and preventing the build from running.

          [JENKINS-16972] detects valid p4 output as authentication error

          Are you sure that this is not an error from p4 tools view?
          Did you set user/password correctly?

          Kanstantsin Shautsou added a comment - Are you sure that this is not an error from p4 tools view? Did you set user/password correctly?

          Rob Petti added a comment -

          This is a valid ticket. The perforce client does not provide an easy method to distinguish between errors and valid output, so the plugin looks for errors using basic string comparisons. If valid output contains a string that happens to match an error string, as is the case in this ticket description, the plugin will fail the build.

          Rob Petti added a comment - This is a valid ticket. The perforce client does not provide an easy method to distinguish between errors and valid output, so the plugin looks for errors using basic string comparisons. If valid output contains a string that happens to match an error string, as is the case in this ticket description, the plugin will fail the build.

          Why not use p4java library?

          Kanstantsin Shautsou added a comment - Why not use p4java library?

          Rob Petti added a comment -

          Because that would require a full rewrite of the plugin. I also do not believe the p4java api supports streaming of data, which would cause memory issues for large operations.

          Rob Petti added a comment - Because that would require a full rewrite of the plugin. I also do not believe the p4java api supports streaming of data, which would cause memory issues for large operations.

          Kanstantsin Shautsou added a comment - git already started using jgit. This http://www.perforce.com/perforce/doc.current/manuals/p4java-javadoc/com/perforce/p4java/impl/generic/core/Stream.html ?

          Rob Petti added a comment -

          The git plugin is completely different from the perforce plugin, so I'm not sure what bearing that has.

          That link seems to describe the API for Perforce's "Stream" functionality, which is more or less just a replacement for client mappings.

          I am referring to being able to parse and filter log output as it is captured in order to prevent out of memory exceptions that would otherwise occur. I do not know if the p4java API has the ability to filter results in this way.

          Regardless, none of this has anything to do with this ticket. While switching over to the official p4java api would resolve the issue, I don't believe it is a viable solution at this time.

          Rob Petti added a comment - The git plugin is completely different from the perforce plugin, so I'm not sure what bearing that has. That link seems to describe the API for Perforce's "Stream" functionality, which is more or less just a replacement for client mappings. I am referring to being able to parse and filter log output as it is captured in order to prevent out of memory exceptions that would otherwise occur. I do not know if the p4java API has the ability to filter results in this way. Regardless, none of this has anything to do with this ticket. While switching over to the official p4java api would resolve the issue, I don't believe it is a viable solution at this time.

          I haven't had a chance to look at the code, but the -s flag on the command line may help. It causes Perforce to preface each line of output with whether it is an info or error message.

          Matthew Attaway added a comment - I haven't had a chance to look at the code, but the -s flag on the command line may help. It causes Perforce to preface each line of output with whether it is an info or error message.

          Rob Petti added a comment -

          We already use that parameter, but unfortunately it's inaccurate. The perforce client marks some output as errors when they clearly are not errors, such as files that are already in sync.

          I will take a look later to see if there's an easy way to fix this. I suspect that changing the error handling to only match the full string (since job descriptions should at least start with a tab) should do the trick.

          Rob Petti added a comment - We already use that parameter, but unfortunately it's inaccurate. The perforce client marks some output as errors when they clearly are not errors, such as files that are already in sync. I will take a look later to see if there's an easy way to fix this. I suspect that changing the error handling to only match the full string (since job descriptions should at least start with a tab) should do the trick.

            Unassigned Unassigned
            russt Russ Tremain
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: