silas / node-jenkins

Jenkins client
https://www.npmjs.com/package/jenkins
MIT License
356 stars 85 forks source link

jenkins: job.build: trigger job with upload parameter #92

Open emulexoar opened 4 years ago

emulexoar commented 4 years ago

Hi;

I was trying to trigger a jenkins job with an upload file parameter. using the jenkins.job.build below. I was able to trigger the job but the file is not being upload. please advise what I have done wrong thanks.

const jenkins = require('jenkins')({ baseUrl: 'http://usertoken:token@localhost:8080', crumbIssuer: true, formData: require('form-data') });

jenkins.job.build({ name: 'MyJenkinsJobName', parameters: { "name": 'MyJenkinsJobName', "file": fs.createReadStream('demo2.txt') }}, function (err, formData) { console.log("called inside build") if (err) throw err;