How to input json file as input parameter to jenkins job?
解决方案
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:
If you dont want to use a Jenkins pipeline job refer this link