0

How to input json file as input parameter to jenkins job?

user3032779
  • 1
  • 1
  • 1

1 Answers1

3

If you prefer to use Jenkins Pipeline, you can refer the following code:

node {
    deleteDir()
    stage("upload") {
         def inputFile = input message: 'Upload file', parameters: [file(name: 'input.json')]
         new hudson.FilePath(new File("$workspace/input.json")).copyFrom(inputFile)
    inputFile.delete()
    }
   stage("checkout") {
         echo fileExists('input.json').toString()
         def props = readJSON file: '$workspace/input.json' // Read the json file
    }
    }

Some Links to refer: