{"action":"created","issue":{"url":"https://api.github.com/repos/salimfadhley/jenkinsapi/issues/354","labels_url":"https://api.github.com/repos/salimfadhley/jenkinsapi/issues/354/labels{/name}","comments_url":"https://api.github.com/repos/salimfadhley/jenkinsapi/issues/354/comments","events_url":"https://api.github.com/repos/salimfadhley/jenkinsapi/issues/354/events","html_url":"https://github.com/salimfadhley/jenkinsapi/issues/354","id":71369017,"number":354,"title":"Ability to trigger a build from a Job","user":{"login":"meteorfox","id":232300,"avatar_url":"https://avatars.githubusercontent.com/u/232300?v=3","gravatar_id":"","url":"https://api.github.com/users/meteorfox","html_url":"https://github.com/meteorfox","followers_url":"https://api.github.com/users/meteorfox/followers","following_url":"https://api.github.com/users/meteorfox/following{/other_user}","gists_url":"https://api.github.com/users/meteorfox/gists{/gist_id}","starred_url":"https://api.github.com/users/meteorfox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meteorfox/subscriptions","organizations_url":"https://api.github.com/users/meteorfox/orgs","repos_url":"https://api.github.com/users/meteorfox/repos","events_url":"https://api.github.com/users/meteorfox/events{/privacy}","received_events_url":"https://api.github.com/users/meteorfox/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-27T18:47:14Z","updated_at":"2015-04-28T02:39:58Z","closed_at":null,"body":"I've looked at the examples, docs, unit tests, and even searched the github issues, but I can't seem to find how does one submit a parametrized build, or even just a normal build, of a Job using this library.\r\n\r\nIdeally, I'm looking for a function that takes the Job object, or a job name, and does the POST to submit the build, which then returns a Build object, or the build number.\r\n\r\nThanks ahead."},"comment":{"url":"https://api.github.com/repos/salimfadhley/jenkinsapi/issues/comments/96889550","html_url":"https://github.com/salimfadhley/jenkinsapi/issues/354#issuecomment-96889550","issue_url":"https://api.github.com/repos/salimfadhley/jenkinsapi/issues/354","id":96889550,"user":{"login":"lechat","id":154792,"avatar_url":"https://avatars.githubusercontent.com/u/154792?v=3","gravatar_id":"","url":"https://api.github.com/users/lechat","html_url":"https://github.com/lechat","followers_url":"https://api.github.com/users/lechat/followers","following_url":"https://api.github.com/users/lechat/following{/other_user}","gists_url":"https://api.github.com/users/lechat/gists{/gist_id}","starred_url":"https://api.github.com/users/lechat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lechat/subscriptions","organizations_url":"https://api.github.com/users/lechat/orgs","repos_url":"https://api.github.com/users/lechat/repos","events_url":"https://api.github.com/users/lechat/events{/privacy}","received_events_url":"https://api.github.com/users/lechat/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T02:39:58Z","updated_at":"2015-04-28T02:39:58Z","body":"Hi,\r\n\r\nHere is the code:\r\n\r\n```\r\n# Assume that Jenkins object in jenkins variable\r\nmy_job = jenkins['my_job']\r\n# Trigger the job with parameters\r\nq = my_job.invoke(build_params={'param1': 'some_value', 'param2': 'some_other_value'})\r\n# invoke returns QueueItem, we need to ask it for a build object\r\nbuild_num = q.get_build_number()\r\n# Now we ask job to give us build by number\r\nbuild = my_job.get_build(build_num)\r\n```\r\n\r\nYou could see more help in jenkinsapi_tests/systests/test_invocation.py\r\n\r\nHope this helps.\r\n"}}