[Ruby/RAILS] HOW TO SEND FILE WHILE SUBMITTING JOB

58 views
Skip to first unread message

Loganathan Sellappa

unread,
Jul 22, 2014, 5:33:19 AM7/22/14
to jenkins_a...@googlegroups.com
Hello,

I am newbie to Jenkins. I want to implement the below api, is their a way in jenkins_api_client gem to achieve this? 


curl http://jenkins/job/$JOB_NAME/build -F file0=@PATH_TO_FILE -F json='{"parameter": [{"name":"FILE_LOCATION_AS_SET_IN_JENKINS", "file":"file0"}]}' --user USER:PASSWORD



I already tried the below code in rails console and looks like it triggers different api

opts = {"vcim.hostname"=>"https://d4p4-uportal.com", 
           "vcim.db.host"=>"10.146.8.165",
            "vcim.db.username"=>"postgres",
            "vcim.db.password"=>"postgres",
            "vcim.username"=>"test",
            "vcim.password"=>"Newpword1#", 
            "test.producttype"=>"vcim-backend", 
            "api.key"=>"a34bbe23-13e1-4a48-b296-e018df04bd48*6iO^A0Z4zn6wtMxRYG2n5SosKRDL2OeutJ4Gaz%7w!rl$H$zsO4VI!h8J%zvt@bv!8@6&b0aeTjnT9kSQJ39!5x&56ccWGovEVM", 
            "vcim.amqp"=>"10.146.8.167",
             "vcim.amqp.queue"=>"vCIMGlobal",
            "vcim.testbed.spec"=>"vcim-1.testbed"} 

@client.job.build("ListVMs.vPCCustomer", opts)

O/P:

POST /job/ListVMs.vPCCustomer/buildWithParameters
 => "302" 


Regards,
Loganathan
Reply all
Reply to author
Forward
0 new messages