[JIRA] (JENKINS-51874) Parameterized Remote Trigger does not use URL for Build Token Root Plugin

4 views
Skip to first unread message

Tommy.Ludwig.CSJF@gmail.com (JIRA)

unread,
Jun 12, 2018, 12:02:02 AM6/12/18
to jenkinsc...@googlegroups.com
Tommy Ludwig created an issue
 
Jenkins / Bug JENKINS-51874
Parameterized Remote Trigger does not use URL for Build Token Root Plugin
Issue Type: Bug Bug
Assignee: KaiHsiang Chang
Attachments: image-2018-06-12-12-56-59-772.png
Components: parameterized-remote-trigger-plugin
Created: 2018-06-12 04:01
Environment: Jenkins ver 2.126 (local) and 2.118 (remote)
Parameterized Remote Trigger Plugin ver 3.0.0
Build Token Root Plugin ver 1.4
Priority: Major Major
Reporter: Tommy Ludwig

I have configured a Remote Host as shown in the following screenshot. Notably, I have checked the box to use the 'build token root' support. I expect no authentication is necessary for this, per the description of the Build Token Root Plugin.

However, when I try to run a remote job from a pipeline using this:

triggerRemoteJob job: 'fake-qg1', parameters: 'someParam=hi world', remoteJenkinsName: 'Remote Test Jenkins', token: 'sometokenyoullneverguess'

It does not use the build token root endpoint, and therefore it fails due to authentication issues.

[Pipeline] triggerRemoteJob
################################################################################################################
  Parameterized Remote Trigger Configuration:
    - job:                     fake-qg1 
    - remoteJenkinsName:       Remote Test Jenkins
    - auth:                    'No Authentication'
    - parameters:              [someParam=hi world]
    - blockBuildUntilComplete: true
    - connectionRetryLimit:    5
################################################################################################################
ERROR: Remote build failed with 'ForbiddenException' for the following reason: 'Server returned 403 - Forbidden. User does not have enough permissions for this request: http://***redacted***/jenkins/job/fake-qg1/api/json'.

If I use an API Token, then it, of course works. But I want to use the 'Build Token Root Plugin' method of triggering the job. The correct URL (I believe something like /jenkins/buildByToken/buildWithParameters? job=NAME&token=SECRET) needs to be used instead of the regular job API which requires an authenticated user.

I have confirmed that the build token root URL is available on the remote Jenkins, but it appears the Parameterized Remote Trigger Plugin is not even trying to use it, despite having checked the "Enable 'build token root' support" checkbox in the Remote Host configuration.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo

dshvedchenko@gmail.com (JIRA)

unread,
May 23, 2019, 9:16:03 AM5/23/19
to jenkinsc...@googlegroups.com
Denis Shvedchenko commented on Bug JENKINS-51874
 
Re: Parameterized Remote Trigger does not use URL for Build Token Root Plugin

Hello, from stack trace it is obvious that root cause lays in 

https://github.com/jenkinsci/parameterized-remote-trigger-plugin/blob/master/src/main/java/org/jenkinsci/plugins/ParameterizedRemoteTrigger/RemoteBuildConfiguration.java#L624

Executing side tries to understand whenever remote job supports parameters or not before constructing url that optionally uses Build Root Token, that performed in HttpHelper.buildTriggerUrl(...)

May 23, 2019 1:02:09 PM org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper sendHTTPCall
WARNING: Server returned 403 - Forbidden. User does not have enough permissions for this request: https://*****************************/job
/reference/job/provider/api/json?tree=actions[parameterDefinitions],property[parameterDefinitions],name,fullName,displayName,fullDisplayName,url - [HTTP/
1.1 403 Forbidden]
org.jenkinsci.plugins.ParameterizedRemoteTrigger.exceptions.ForbiddenException: Server returned 403 - Forbidden. User does not have enough permissions fo
r this request: https://************************************/job/reference/job/provider/api/json?tree=actions[parameterDefinitions],property[param
eterDefinitions],name,fullName,displayName,fullDisplayName,url
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.sendHTTPCall(HttpHelper.java:474)
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.tryCall(HttpHelper.java:571)
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.tryGet(HttpHelper.java:591)
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.doGet(RemoteBuildConfiguration.java:877)
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.getRemoteJobMetadata(RemoteBuildConfiguration.java:1049)
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.performTriggerAndGetQueueId(RemoteBuildConfiguration.java:624) <-----
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.perform(RemoteBuildConfiguration.java:591)
        at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.perform(RemoteBuildConfiguration.java:557)
        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
        at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
        at hudson.model.Build$BuildExecution.build(Build.java:206)
        at hudson.model.Build$BuildExecution.doRun(Build.java:163)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
        at hudson.model.Run.execute(Run.java:1816)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:97)
        at hudson.model.Executor.run(Executor.java:429)
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

bvklingeren+jenkinsio@gmail.com (JIRA)

unread,
May 7, 2020, 5:30:08 PM5/7/20
to jenkinsc...@googlegroups.com

I found out that you need to allow anonymous access in the global security settings of the Jenkins instance. This way, the Parameterized Remote Trigger Plugin is able to fetch the remote job metadata to decide if it should execute a normal build or a build with parameters.

However, it would be nice to have the plugin decide if it should execute a normal build or a build with parameters without fetching metadata when the build token root plugin is active, maybe based on the presence of parameters?

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages