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

P4Groovy p4.run() does not locate credentials in folder

      When credentials to use are in a folder, using them in a script with p4.run() will not find the credential.

      Repro:

      create a folder.

      within the folder, create a credential and a pipleline job.

      The job's script references the credential in the folder.

      {{ script{}}
      {{ def ws = [$class: 'ManualWorkspaceImpl', name: "jenkins-${NODE_NAME}-${JOB_NAME}", }}
      {{ spec: [view: "//depot/main/utilities/AppUtilities/src/... //jenkins-${NODE_NAME}-${JOB_NAME}/..."]]}}
      {{ def p4 = p4(credential: 'build-u18-20182', workspace: ws)}}
      {{ def output = p4.run('sync')}}
      {{ }}}

       

      A p4sync step using the same credential succeeds.

      ------------------------

      console log:
      [Pipeline] Start of Pipeline[Pipeline] nodeRunning on Jenkins in /var/lib/jenkins/jobs/pipelines/jobs/simple sync/workspace[Pipeline] {[Pipeline] script[Pipeline]

      {[Pipeline] p4[Pipeline] }

      [Pipeline] // script[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials
      Finished: FAILURE

          [JENKINS-58745] P4Groovy p4.run() does not locate credentials in folder

          Joel Brown created issue -
          Joel Brown made changes -
          Description Original: When credentials to use are in a folder, using them in a script with p4.run() will not find the credential.

          Repro:

          create a folder.

          within the folder, create a credential and a pipleline job.

          The job's script references the credential in the folder.

          {{ script{}}
          {{ def ws = [$class: 'ManualWorkspaceImpl', name: "jenkins-${NODE_NAME}-${JOB_NAME}", }}
          {{ spec: [view: "//depot/main/utilities/AppUtilities/src/... //jenkins-${NODE_NAME}-${JOB_NAME}/..."]]}}
          {{ def p4 = p4(credential: 'build-u18-20182', workspace: ws)}}
          {{ def output = p4.run('sync')}}
          {{ }}}

          ------------------------

          console log:
          [Pipeline] Start of Pipeline[Pipeline] nodeRunning on [Jenkins|http://jbrown-swarmu18.das.perforce.com:8080/computer/(master)/] in /var/lib/jenkins/jobs/pipelines/jobs/simple sync/workspace[Pipeline] {[Pipeline] script[Pipeline] {[Pipeline] p4[Pipeline] }[Pipeline] // script[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials
          Finished: FAILURE
          New: When credentials to use are in a folder, using them in a script with p4.run() will not find the credential.

          Repro:

          create a folder.

          within the folder, create a credential and a pipleline job.

          The job's script references the credential in the folder.

          {\{ script{}}
           \{{ def ws = [$class: 'ManualWorkspaceImpl', name: "jenkins-${NODE_NAME}-${JOB_NAME}", }}
           {{ spec: [view: "//depot/main/utilities/AppUtilities/src/... //jenkins-${NODE_NAME}-${JOB_NAME}/..."]]}}
           \{{ def p4 = p4(credential: 'build-u18-20182', workspace: ws)}}
           \{{ def output = p4.run('sync')}}
           \{{ }}}

           

          A p4sync step using the same credential succeeds.

          ------------------------

          console log:
           [Pipeline] Start of Pipeline[Pipeline] nodeRunning on [Jenkins|http://jbrown-swarmu18.das.perforce.com:8080/computer/(master)/] in /var/lib/jenkins/jobs/pipelines/jobs/simple sync/workspace[Pipeline] {[Pipeline] script[Pipeline]

          {[Pipeline] p4[Pipeline] }

          [Pipeline] // script[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials
           Finished: FAILURE
          Frederico Pratas made changes -
          Link New: This issue causes JENKINS-57314 [ JENKINS-57314 ]
          Joel Brown made changes -
          Assignee New: Joel Brown [ joel_brown ]
          Joel Brown made changes -
          Issue Type Original: Improvement [ 4 ] New: Bug [ 1 ]
          Paul Allen made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Paul Allen made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Progress [ 3 ] New: Fixed but Unreleased [ 10203 ]
          Paul Allen made changes -
          Status Original: Fixed but Unreleased [ 10203 ] New: Closed [ 6 ]

            joel_brown Joel Brown
            joel_brown Joel Brown
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: