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

Perforce ticketed credentials in p4 plugin incompatible with p4 command-line behavior

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • p4-plugin
    • Jenkins 1.565.3 Linux/Mac OS X

      Experiencing some weird behavior re: tickets and p4 jenkins plugin.

      BEFORE:

      [~jenkins] root# rm .p4tickets
      [~jenkins] root# ls -al
      

      NOW GO TO JENKINS, and test password credential

      AFTER:

      [~jenkins] root# ls -al
      total 8
      drwxr-xr-x+ 4 jenkins  staff  136 Mar 10 15:55 ./
      drwxr-xr-x  9 root     admin  306 Mar 10 15:31 ../
      -r--------  1 root     staff   68 Mar 10 15:55 .p4tickets
      

      So the act of testing the password credential adds a ticket file.

      Next, I remove .p4tickets and test my ticketed credential. Does not create .p4tickets and test succeeds.

      Now I go to a job that depends on ticketed credential I just tested, and run it.

      Job fails with:

      SEVERE: P4: Unable to use Workspace: com.perforce.p4java.exception.AccessException: Perforce password (P4PASSWD) invalid or unset.
      
      com.perforce.p4java.exception.AccessException: Perforce password (P4PASSWD) invalid or unset.
      
      	at com.perforce.p4java.impl.mapbased.server.Server.handleErrorStr(Server.java:4987)
      	at com.perforce.p4java.impl.mapbased.server.Server.getClient(Server.java:2433)
      	at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:69)
      	at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:63)
      	at org.jenkinsci.plugins.p4.tasks.AbstractTask.getConnection(AbstractTask.java:78)
      	at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:50)
      	at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:278)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:615)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
      	at hudson.model.Run.execute(Run.java:1706)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:232)
      Mar 10, 2015 4:02:07 PM org.jenkinsci.plugins.p4.tasks.AbstractTask setWorkspace
      SEVERE: P4: Unable to setup workspace: com.perforce.p4java.exception.AccessException: Perforce password (P4PASSWD) invalid or unset.
      
      Mar 10, 2015 4:02:07 PM hudson.model.Run execute
      INFO: p4ws-main_build_linux-x64 #5 aborted
      java.lang.InterruptedException: P4: Unable to setup workspace: com.perforce.p4java.exception.AccessException: Perforce password (P4PASSWD) invalid or unset.
      
      	at org.jenkinsci.plugins.p4.tasks.AbstractTask.setWorkspace(AbstractTask.java:63)
      	at org.jenkinsci.plugins.p4.PerforceScm.checkout(PerforceScm.java:278)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1252)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:615)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
      	at hudson.model.Run.execute(Run.java:1706)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:232)
      

      Finally, I go back and test the password version, which recreates .p4tickets.

      Now I use my ticketed credential and it works.

      Long story short, $P4TICKETS has to exist before you can use a ticket.

      That is unexpected and does not conform to normal p4 command-line behavior, e.g:

      	$ p4 -p perforce:1666 -P <TICKET-STRING> -u <PERFORCE-USER> login -s
      	User <PERFORCE-USER> ticket expires in 200403 hours 47 minutes.
      

      This works with or without $P4TICKETS file, and does not create it.

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

              Created:
              Updated:
              Resolved: