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

perforce session ticket is not always parsed correctly

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: perforce-plugin
    • Labels:
      None
    • Environment:
      RedHat EL 5.5
    • Similar Issues:

      Description

      The perforce plugin does not always parse the session ticket from "p4 login -p" correctly, causing the job to fail.

      I noticed this when using the coverity plugin in combination with the perforce plugin. The coverity plugin causes some extra text to be emitted from the "p4 login -p" command, which seems to confuse the parser in the perforce plugin.

      Example of the extra text:
      timm@daxtsmtf02> cov-build --dir foo p4 login -p
      Enter password:
      53637D707C9CB35CF2436B90972121A0
      [WARNING] No files were emitted. This may be due to a problem with your configuration
      or because no files were actually compiled by your build command.
      Please make sure you have configured the compilers actually used in the compilation.
      For more details, please look at:
      /home/timm/foo/build-log.txt
      timm@daxtsmtf02>

      When this happens in Jenkins, it looks like the perforce plugin is just taking the last line of output (instead of the second line) as the session ticket. Example from Jenkins console log:

      [workspace] $ cov-build --dir /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp p4 workspace -o MTFRA_ME_static_analysis
      [workspace] $ cov-build --dir /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp p4 login -p
      [workspace] $ cov-build --dir /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp p4 -P " /userspace/timm/jenkins/jenkinsHome/coverity/temp-1900101495130713288.tmp/build-log.txt" workspace -o MTFRA_ME_static_analysis
      Caught exception communicating with perforce. Perforce password (P4PASSWD) invalid or unset.com.tek42.perforce.PerforceException: Perforce password (P4PASSWD) invalid or unset.

      I managed to workaround this problem by adding an option the coverity plugin which suppress the output of the extra text. But it is not ideal as the extra text is actually a warning message which might be useful at other stages in the build, and I have to suppress it for all stages.

      Note: there is a related ticket open against the coverity plugin (JENKINS-14834) which says the coverity plugin should not be active during the pre-build steps. If that was fixed, it would resolve this issue. But I opened this ticket for the perforce plugin as I think an improvement in the way the perforce plugin gets the session ticket would be a good change to make.

        Attachments

          Issue Links

            Activity

            Hide
            rpetti Rob Petti added a comment -

            I don't know what coverity is, or how it's injecting itself in front of the p4 commands, but just taking the second line as you suggested should at least fix the ticket issue.

            I am concerned, however, since the other command parsing algorithms are just as naive because we assume that we'll only ever be interacting directly with perforce. If the other commands throw similar 'junk' output, you will probably still run into other issues further down the line.

            Show
            rpetti Rob Petti added a comment - I don't know what coverity is, or how it's injecting itself in front of the p4 commands, but just taking the second line as you suggested should at least fix the ticket issue. I am concerned, however, since the other command parsing algorithms are just as naive because we assume that we'll only ever be interacting directly with perforce. If the other commands throw similar 'junk' output, you will probably still run into other issues further down the line.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Rob Petti
            Path:
            src/main/java/com/tek42/perforce/parse/AbstractPerforceTemplate.java
            http://jenkins-ci.org/commit/perforce-plugin/707d9d2251eec668e0ac1ff816477589471e65c4
            Log:
            [FIXED JENKINS-15862] take ticket from second line of 'p4 login' output

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rob Petti Path: src/main/java/com/tek42/perforce/parse/AbstractPerforceTemplate.java http://jenkins-ci.org/commit/perforce-plugin/707d9d2251eec668e0ac1ff816477589471e65c4 Log: [FIXED JENKINS-15862] take ticket from second line of 'p4 login' output
            Hide
            timm Tim Mason added a comment -

            Hi Rob,

            coverity is a static analysis tool. In normal usage (outside of Jenkins), the coverity binary is prepended to the normal build command line.
            e.g. "cov-build g++ foo.cc".

            I'm not familiar with the specifics of how plugins interact with Jenkins, but it looks like the coverity plugin has some classes which inherit from LauncherDecorator, these prepend "cov-build " to the command, when the LauncherDecorator::decorate() method is called. It seems like it is doing this for every command, when it should just be done for the build commands.

            Anyway, thanks for fixing the login parsing. I will test the fix and if it doesn't work I'll stick with the workaround.

            Show
            timm Tim Mason added a comment - Hi Rob, coverity is a static analysis tool. In normal usage (outside of Jenkins), the coverity binary is prepended to the normal build command line. e.g. "cov-build g++ foo.cc". I'm not familiar with the specifics of how plugins interact with Jenkins, but it looks like the coverity plugin has some classes which inherit from LauncherDecorator, these prepend "cov-build " to the command, when the LauncherDecorator::decorate() method is called. It seems like it is doing this for every command, when it should just be done for the build commands. Anyway, thanks for fixing the login parsing. I will test the fix and if it doesn't work I'll stick with the workaround.

              People

              • Assignee:
                ez2cwhy ez2cwhy
                Reporter:
                timm Tim Mason
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: