I am getting the following error when i try triggering a build using the following command:
curl http://jenkins_server:port/jenkins/job/job_name/build?token=token_name
I had the same problem after setting up a test Jenkins server. The solution was to authenticate using my Jenkins admin password:
curl -u admin:<mypassword> http://localhost:8080/job/Test/build?token=<mytoken>
Use the same username and password you use to login to Jenkins. There was no need to install additional plugins.
I suggest you try Jenkins Python API. It provides an build_job
action that is super easy to trigger a job.
build_job(name, parameters=None, token=None)
Trigger build job.
Parameters:
name – name of job
parameters – parameters for job, or None, dict
token – Jenkins API token
On 1.625.3, giving Anonymous read access to almost everything worked for me.
UPDATE: I guess I should clarify since this got downvoted. I was able to reproduce that error message, and when I turned on read access for the Anonymous user on all of the access types, it resolved the problem. Just saying...