Newman: Newman docker jenkins pipeline collections issue

Created on 27 Aug 2018  路  2Comments  路  Source: postmanlabs/newman

Hi,
Im seeing an issue as part of the jenkins pipeline which uses the newman_ubuntu1404 docker image
1 out of 10 times it will find the collection in the workspace
The code is housed in github and pulled from artifactory
This is my step in the larger jenkins file:

stage('Automation') {
    node('ts-build') {
      def collectionName = 'collections/something.postman_collection.json'
      docker.image('postman/newman_ubuntu1404').inside("--entrypoint=''"){
        sh "newman run '$collectionName'"
     }
  }
}

Example error seen:
[projectbuildname_master-FOSPOKGVSAWFE7SOECOW3VH7STOR2NG44KPBCXIO4PUTQPHZI5DA] Running shell script

  • newman run collections/something.postman_collection.json

error: ENOENT: no such file or directory, open 'collections/something.postman_collection.json'

Any help on this would be appreciated!

await user response docker documentation jenkins question

Most helpful comment

Sorry for the late reply,
Got it sorted, needed a
sh "cd ../" to find the dir in the workspace
So

stage('Automation') {
node('ts-build') {
      def collectionName = 'collections/something.postman_collection.json'
      docker.image('postman/newman_ubuntu1404').inside("--entrypoint=''"){
       sh "cd ../"        
       sh "newman run '$collectionName'"
     }
  }
}

Hopefully this is useful to others!
Please close this

All 2 comments

@kieronlangdon Apologies for the delayed response, could you update the sh section in your build block to include an ls -la; before the newman run ... command and share the results?

Also, since this is a Docker run, could you refer the instructions in https://github.com/postmanlabs/newman/tree/develop/docker on how to mount directories to load files?

Sorry for the late reply,
Got it sorted, needed a
sh "cd ../" to find the dir in the workspace
So

stage('Automation') {
node('ts-build') {
      def collectionName = 'collections/something.postman_collection.json'
      docker.image('postman/newman_ubuntu1404').inside("--entrypoint=''"){
       sh "cd ../"        
       sh "newman run '$collectionName'"
     }
  }
}

Hopefully this is useful to others!
Please close this

Was this page helpful?
0 / 5 - 0 ratings