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

Support for P4 TICKETS

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Perforce has a P4 TICKETS option that caches the credentials for a period.
      This allows build steps to re-use the credentials to perform command line actions.

      I couldn't find way to enable this.
      Currently we have to hard code username/passwords into scripts and tools which is a security risk.

        Attachments

          Activity

          Hide
          rpetti Rob Petti added a comment -

          P4TICKETS is used in the background already.

          Show
          rpetti Rob Petti added a comment - P4TICKETS is used in the background already.
          Hide
          mornejoubert Morne Joubert added a comment -

          If I use p4 in a shell or batch file it requires authentication.
          Are there any documentation on how to access the tickets in a step?

          Show
          mornejoubert Morne Joubert added a comment - If I use p4 in a shell or batch file it requires authentication. Are there any documentation on how to access the tickets in a step?
          Hide
          rpetti Rob Petti added a comment -

          No, it should just work.

          Show
          rpetti Rob Petti added a comment - No, it should just work.
          Hide
          mornejoubert Morne Joubert added a comment -

          Thanks. Will provide you with some logs to see if you can pick up why p4 complains about the username password if I don't hard code it.

          Show
          mornejoubert Morne Joubert added a comment - Thanks. Will provide you with some logs to see if you can pick up why p4 complains about the username password if I don't hard code it.
          Hide
          mornejoubert Morne Joubert added a comment -

          I have a test job to show the problem:

          Building remotely on gb-mlb-pm-002 (linux) in workspace /var/lib/jenkins/workspace/Trigger TOOLS MA_SW_ci_tools
          Using remote perforce client: Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078
          [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 workspace -o -S //MA_SW/ci_tools Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078
          [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 login -a -p
          [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 -P CB36E3E1DC213D9D0161CA6FF7C5309B workspace -o -S //MA_SW/ci_tools Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078
          Last build changeset: 50593
          [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 -P CB36E3E1DC213D9D0161CA6FF7C5309B changes -s submitted -m 1 //Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078/...
          Sync'ing workspace to changelist 50593.
          [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 -P CB36E3E1DC213D9D0161CA6FF7C5309B -s sync //Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078/...@50593
          Sync complete, took 752 ms
          [Trigger TOOLS MA_SW_ci_tools] $ /bin/sh -xe /tmp/hudson3065486592967532870.sh
          + /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 describe 48315
          Perforce password (P4PASSWD) invalid or unset.
          Build step 'Execute shell' marked build as failure

          I can see a line: p4 login -a -p
          Which , according to:
          http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_login.html
          "-p Display the ticket, rather than storing it in the local ticket file."

          The authentication ticket is then used in later steps: -P CB36E3E1DC213D9D0161CA6FF7C5309B

          So either the ticket value needs to be exposed to later Job steps can used it via some variable.
          Or the ticket needs to be stored in a local ticket file.
          (http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4TICKETS.html)

          Show
          mornejoubert Morne Joubert added a comment - I have a test job to show the problem: Building remotely on gb-mlb-pm-002 (linux) in workspace /var/lib/jenkins/workspace/Trigger TOOLS MA_SW_ci_tools Using remote perforce client: Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078 [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 workspace -o -S //MA_SW/ci_tools Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078 [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 login -a -p [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 -P CB36E3E1DC213D9D0161CA6FF7C5309B workspace -o -S //MA_SW/ci_tools Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078 Last build changeset: 50593 [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 -P CB36E3E1DC213D9D0161CA6FF7C5309B changes -s submitted -m 1 //Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078/... Sync'ing workspace to changelist 50593. [Trigger TOOLS MA_SW_ci_tools] $ /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 -P CB36E3E1DC213D9D0161CA6FF7C5309B -s sync //Trigger_TOOLS_MA_SW_ci_tools_jenkins_mlb-2062542078/...@50593 Sync complete, took 752 ms [Trigger TOOLS MA_SW_ci_tools] $ /bin/sh -xe /tmp/hudson3065486592967532870.sh + /u-blox/gallery/perforce/p4/lin_64/2013.3/bin/p4 describe 48315 Perforce password (P4PASSWD) invalid or unset. Build step 'Execute shell' marked build as failure I can see a line: p4 login -a -p Which , according to: http://www.perforce.com/perforce/doc.current/manuals/cmdref/p4_login.html "-p Display the ticket, rather than storing it in the local ticket file." The authentication ticket is then used in later steps: -P CB36E3E1DC213D9D0161CA6FF7C5309B So either the ticket value needs to be exposed to later Job steps can used it via some variable. Or the ticket needs to be stored in a local ticket file. ( http://www.perforce.com/perforce/doc.current/manuals/cmdref/P4TICKETS.html )
          Hide
          rpetti Rob Petti added a comment -

          It's exposed in P4TICKET.

          Show
          rpetti Rob Petti added a comment - It's exposed in P4TICKET.
          Hide
          mornejoubert Morne Joubert added a comment -

          Ah, is is exposed as a env variable.... didn't pick that up, sorry.

          Just tried it.

          adding -P $P4TICKET to the beginning of my commands worked.

          Show
          mornejoubert Morne Joubert added a comment - Ah, is is exposed as a env variable.... didn't pick that up, sorry. Just tried it. adding -P $P4TICKET to the beginning of my commands worked.

            People

            • Assignee:
              Unassigned
              Reporter:
              mornejoubert Morne Joubert
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: