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"
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://184.108.40.206: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
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://220.127.116.11: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"