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

Add parameter substitution for p4 user config field

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • p4-plugin
    • Jenkins Version: 1.480
      Perforce Plugin: 1.3.17
      OS: Amazon Linux 2012.03

      Steps to Reproduce:
      1. Click "Manage Jenkins" -> Global Properties
      2. Create an Environment Variable as follows: name: P4USER value: p4service (or another P4 Username)
      3. Select an Existing Job that uses Perforce for Source Code Management
      4. Select the Username field and enter "${P4USER}"

      Result:

      Result: build fails as follows:
      Started by user Administrator
      Building in workspace /usr/share/tomcat6/.jenkins/jobs/dpapi-int/workspace
      Using master perforce client: jenkins-dpapi-int
      [workspace] $ /usr/local/bin/p4 workspace -o jenkins-dpapi-int
      Caught exception communicating with perforce. Access for user 'com.tek42.perforce.PerforceException: Access for user '
      	at com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:382)
      	at com.tek42.perforce.parse.AbstractPerforceTemplate.getPerforceResponse(AbstractPerforceTemplate.java:292)
      	at com.tek42.perforce.parse.Workspaces.getWorkspace(Workspaces.java:61)
      	at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1461)
      	at hudson.plugins.perforce.PerforceSCM.getPerforceWorkspace(PerforceSCM.java:1422)
      	at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:793)
      	at hudson.model.AbstractProject.checkout(AbstractProject.java:1256)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:589)
      	at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:88)
      	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:494)
      	at hudson.model.Run.execute(Run.java:1502)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:236)
      ERROR: Unable to communicate with perforce. Access for user '
      Sending e-mails to: eng-n2i@netshelter.com
      Finished: FAILURE
      

      As you can see by the above: "Caught exception communicating with perforce. Access for user 'com.tek42.perforce.PerforceException: Access for user '"

      Use Case:
      If a user wishes to use exactly one user for all Jobs that use Perforce for SCM, he could enter this user in the Global Properties and then change the credentials user to poll Perforce at any time across all Jobs.

          [JENKINS-15053] Add parameter substitution for p4 user config field

          Rob Petti added a comment -

          Problem does not seem specific to global parameters, but is related to the P4USER field itself.

          Rob Petti added a comment - Problem does not seem specific to global parameters, but is related to the P4USER field itself.

          Colin Johnson added a comment -

          Thanks for picking up the ticket so quickly - tomorrow I will give try the same global parameter substitution with the P4PORT and password fields as well to see if these fields have problems.

          Colin Johnson added a comment - Thanks for picking up the ticket so quickly - tomorrow I will give try the same global parameter substitution with the P4PORT and password fields as well to see if these fields have problems.

          Code changed in jenkins
          User: Rob Petti
          Path:
          src/main/java/hudson/plugins/perforce/PerforceSCM.java
          http://jenkins-ci.org/commit/perforce-plugin/07728739877255e61f634e32b6bd002f4dde97d6
          Log:
          [FIXED JENKINS-15053] add parameter substitution support for P4USER and P4PORT

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Rob Petti Path: src/main/java/hudson/plugins/perforce/PerforceSCM.java http://jenkins-ci.org/commit/perforce-plugin/07728739877255e61f634e32b6bd002f4dde97d6 Log: [FIXED JENKINS-15053] add parameter substitution support for P4USER and P4PORT

            rpetti Rob Petti
            colinbjohnson Colin Johnson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: