Skip to content

Instantly share code, notes, and snippets.

@4lun
Last active July 9, 2019 07:47
Show Gist options
  • Save 4lun/50313ccd6c6f550a9763212d146aece3 to your computer and use it in GitHub Desktop.
Save 4lun/50313ccd6c6f550a9763212d146aece3 to your computer and use it in GitHub Desktop.
How to trigger a remote build via a URL for a Jenkins job
  1. Create new user (e.g. webhook) with the following permissions: Overall > Read, Job > Build, Job > Read & Job > Workspace. Login as the user and get their API token
  2. Under a job, enable "Trigger Builds Remotely" and set an authentication token
  3. Trigger a POST request with the following structure:

http://{USER}:{API_TOKEN}@{JENKINS_URL}/job/{JOB}/build?token={AUTHENTICATION_TOKEN}

@ThinkerBoy
Copy link

Thank you ,this is very userful

@kavalerchik
Copy link

kavalerchik commented Jan 21, 2018

Where do I get the AUTHENTICATION_TOKEN from? The API_TOKEN I found under my user name (http://localhost:8080/user/admin/configure).
Should I just create my own in bullet 2 above?
Thanks

@a0s
Copy link

a0s commented Feb 17, 2018

How can i skip (disable) USER/API_TOKEN validation? Using AUTHENTICATION_TOKEN only is enough secure...

@AlexaTester
Copy link

Hay how can i get The API Token??
i can get the Authentication Token from Trigger Build Remotely, but i struck at getting API Token.
Can you please help me out to get this. Because when i execute the Job i did not have provision to place the Username and Password.
Am in bit hurry can you please help me on this

Thanks,
Gouri

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment