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] // script[Pipeline] }[Pipeline] // node[Pipeline] End of PipelineERROR: P4: Task Exception: Invalid credentials
Finished: FAILURE
- causes
-
JENKINS-57314 P4 Sync to label after sync to head without deleting non labeled files
-
- Open
-
[JENKINS-58745] P4Groovy p4.run() does not locate credentials in folder
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 |
Link | New: This issue causes JENKINS-57314 [ JENKINS-57314 ] |
Assignee | New: Joel Brown [ joel_brown ] |
Issue Type | Original: Improvement [ 4 ] | New: Bug [ 1 ] |
Status | Original: Open [ 1 ] | New: In Progress [ 3 ] |
Resolution | New: Fixed [ 1 ] | |
Status | Original: In Progress [ 3 ] | New: Fixed but Unreleased [ 10203 ] |
Status | Original: Fixed but Unreleased [ 10203 ] | New: Closed [ 6 ] |
Ready for release.