Why are builds not being triggered with Build Token Root Plugin?

Article ID:204338790
1 minute readKnowledge base

Issue

  • Builds are not triggered through curl command and I receive an unauthentication message

  • Builds are not triggered and the job is inside a folder

Environment

  • CloudBees Jenkins Enterprise

  • Build Token Root Plugin

Resolution

Builds are not triggered through curl command and I receive an unauthentication message

This issue usually happen because you didn’t use the escape character ""

For normal builds use:

curl -X POST https://<JENKINS_URL>/buildByToken/build?job=MY_JOB\&token=MY_TOKEN

For builds with parameters you need to use the structure below where Type is the parameter:

curl -X POST https://<JENKINS_URL>/buildByToken/buildWithParameters/build?job=MY_JOB\&token=MY_TOKEN\&Type=Mexican

Diagnostics

Changing the logging level to FINE helped identify the root cause.

build_token_root_logger.png

Builds are not triggered and the job is inside a folder

As a job name you need to specify the Full Project Name you can get from Jenkins GUI.

build token root plugin full project name

So for exampe for the Job below which has as a token mytoken

https://felix.ci.cloudbees.com/job/myfolder/job/build-token-root-plugin-inside-folder/

The right command to trigger the job is:

curl -X POST https://felix.ci.cloudbees.com/buildByToken/build?job=myfolder/build-token-root-plugin-inside-folder\&token=mytoken