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

How to use 'p4 print' with P4Groovy?

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • Jenkins 2.138.1
      P4Plugin 1.9.3

      When I try to use 'p4 print' inside P4Groovy (p4-plugin) I get the error:

      ERROR: P4: Task Exception: com.perforce.p4java.exception.ConnectionException: Null output stream in writeText state map
      

      Is this a bug or am I using it wrong?

      Example code:

      pipeline {
        agent { label 'master' }
        stages {
          stage("Repro") {
            steps {
              script {
      	   def p4 = p4(credential: 'JenkinsMaster', workspace: manualSpec(charset: 'none', cleanup: false, name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}', pinHost: false, spec: clientSpec(allwrite: false, backup: true, changeView: '', clobber: true, compress: false, line: 'LOCAL', locked: false, modtime: false, rmdir: false, serverID: '', streamName: '', type: 'WRITABLE', view: '//depot/Project1/... //jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}/...')))
      	   def myClient = p4.fetch('client', env.P4_CLIENT)
      	   println ("Stream is: " + myClient.get("Stream") )
      	   
              p4.run('print', '-q', '//depot/Project1/VERSION')
              // def version = p4.run('print', '-q', '//depot/Project1/VERSION')
              //echo "version: ${version}"
              }
            }
          }
        }
      }
      

            msmeeth Matthew Smeeth
            p4karl Karl Wirth
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: