LOGIN
Sign In or Register
Avatar
Not Registered Yet?

Join Now! It's FREE. Get full access and benefit from this site

Reset My password - Remind Me My username

Username
Password
Remember me
How to Trigger builds remotely in Jenkins?
 
1. Create a user - You need to create a user in jenkins using you would like to trigger a jenkins jobs from remote loction or script
 
How to create users in Jenkins?
Manage Jenkins --> Manage Users --> Create User
 
2. Assign a right privillage to the specific user?
How to assign privillage to the user?
Manage Jenkins --> Configure Global Security --> Enabled "Anyone can do anything"
OR
Manage Jenkins --> Configure Global Security --> Configure "Matrix-based security" for the specific users and assign atleast following Permissions.
 
Overall - Read
Job - Build
Job - Read
Job - Workspace
 
3. Find out jenkins user "API Token"
How to find jenkins user "API Token"?
"
Click on the user name located at top right(e.g http://54.171.140.1:8080/user/admin1/) --> Configure --> Locate the "API Token" section.
 
4. Enabled "Trigger builds remotely" in Jenkins Job Configuration.
Click on the desired job --> Configure --> Locate the "Trigger builds remotely" under "Build Triggers" Tab
Enabled the check box of "Trigger builds remotely"
Provide some Authentication Token e.g - iFBDOBhNhaxL4T9ass93HRXun2JF161Z
$ Save
 
5. Formulate the command to run using curl. 
> curl --user userid:API-Token http://IP OR HOST:PORT/job/JOB_NAME/build?token=Authentication_Token
eg.curl --user admin1:91367cf0389eaf89669f74c9963c9fb3 http://54.171.140.1:8080/job/ANT-BUILD/build?token=iFBDOBhNhaxL4T9ass93HRXun2JF161Z
 
Some of other formats which is being tried in google but need to be tested with specific users. there are working with "Anonymous"
> curl -X POST http://admin1:This email address is being protected from spambots. You need JavaScript enabled to view it..1:8080/job/ANT-BUILD/build?token=iFBDOBhNhaxL4T9ass93HRXun2JF161Z
 
> wget http://admin1:This email address is being protected from spambots. You need JavaScript enabled to view it..1:8080/job/ANT-BUILD/build?token=iFBDOBhNhaxL4T9ass93HRXun2JF161Z

If you are a Windows User!
 
‘gitbash’ is a program combined of git and bash. A bash is shell that runs commands once you type the name of command and press enter. :)
 
Download  the git bash from here https://git-scm.com/download/win and install it.
 
 

What corporate management say about us?

Rajesh is very knowledgeable instructor he has a good exposure on real time issue and case studies he is experienced in large environment issue and challenges. I really liked how Rajesh used a lot of examples so that concepts were more easily understood, I like the examples that Rajesh give to help us remember things…they are usually real scenario, real life problems that we encounter frequently. <br /> He is well organised in terms of study materiel that you can refer anytime after you complete your course. His blogs are crisp and has to the point key content that he discussed during session to remember if you refer them remotely.

Gaurav Vishnoi
I am having 11+ years of experience in java, due to increasing complexity of system and environment I opted for this tanning and find it very useful., Noida
Sep 02, 2016