Need help with RPC URL
Description
Environment
Attachments
Activity

Mark Rekveld August 30, 2017 at 7:40 PM
Hi Vinay,
The required permissions are documented here: Required Permissions
There is no explicit permissions check other then requesting the job list in the root of Jenkins, if there is any auth related error, then this should popup on Jenkins configuration page in JIRA and in the JIRA logs.
As for your auth scenario; all synchronization actions start from the root in Jenkins and work there way down through the job tree, but there is no way to hook into that process. So given your Synapse-Testing-jobs scenario, there is no way for the plugin currently to know of that job without first synchronizing its parents, Non-PAR, Non-Prod-Jobs, and DT_Tools_Pipeline.
I could give it some thought to see if there could be a way to add a job to a site from within JIRA, so that you can then add the Synapse-Testing-jobs job directly and not have to deal with its parents.
Cheers,
Mark

Vinay Vira August 30, 2017 at 2:55 PM
Hey Mark,
Thanks for the feedback. That sounds like a better alternative. I did follow your instructions and it worked. Although its not the best option, because it takes time to enable each sub-folder then refresh the screen for each level but better than having all jobs enabled.
I have one more question, when we do the integration using the root URL is there any kind of permission that is being checked on? Does performing the integration validate any permission of the user that is authenticating the integration or just need to be a user and have access to Jenkins?
Also an example based on the scenario, would it be possible that I as a user have been given access to one of the sub-folders (Synapse-Testing-jobs) and that's the only folder I have access to create new jobs/commit builds etc. Now when I do the integration in JIRA it would only integrate folders where I have access and not where I don't have access? This way we can use the permissions to integrate specific folders. Lastly, if you can just give me some overview of how permissions are managed or specified, because I had access to view all jobs but I couldn't actually create a new job or builds until I was granted access to the Synapse-Testing-jobs folder.
Thanks
Vinay

Mark Rekveld August 30, 2017 at 9:17 AM
If I understand your question correctly you would like to limit the number of jobs in Jenkins that are synchronized to JIRA.
This is possible, but not using a RPC URL that doesn't point to the root of Jenkins. The plugin needs the absolute root URL of Jenkins so it can assert if Crumbs are used or if the Jenkins plugin provided by this project is installed.
If you want to limit the jobs to only include the jobs os a specific Folder Job then take the following steps:
Add the Jenkins site using the root URL as RPC URL, but leave "Auto enable new Jobs" unchecked.
Once the job list of the Jenkins instance is synchronized, enable the folder jobs you want to include, after enabling a Folder Job allow for the job to be synchronized, after which you can select a sub folder job.
Enable the jobs of the Folder Job you are interested in.
This will enable only the jobs you enabled, a downside is that any new job will need to be manually enabled before it's builds will be synchronized. New jobs that are added to enabled Folder Jobs will be added to the list on the "Jenkins configuration" page, but will not be enabled.
There is a workaround for this, and that is to enable "Auto enable new Jobs" for the Jenkins site once you have completed the previous steps. This will automatically enable any new job that is added under the Jenkins root, or under any enabled Folder Job.
Taking you scenario 2 as example this would mean taking the following steps:
Add a new Jenkins site with RPC URL https://sharedtechjenkins-green.clouddqt.capitalone.com/ and allow for the Job list to be synchronized.
Enable the Non-PAR job and allow for the sub jobs to be synchronized.
Enable the Non-Prod-Jobs job and allow for the sub jobs to be synchronized.
Enable the DT_Tools_Pipeline job and allow for the sub jobs to be synchronized.
Enable the Synapse-Testing-jobs job and allow for the sub jobs to be synchronized.
Enable any jobs you want to be included.
Optionally, enable "Auto enable new Jobs" to automatically enable new jobs, if you do this before step 5, then all sub jobs of Synapse-Testing-jobs will be enabled once it gets enabled and is synchronized.
Step 8 does have the downside that any new job in the root of Jenkins will also be enabled, and this will also enable any jobs it contains. I have created to limit this behaviour.
Hope this helps.
Cheers,
Mark Rekveld
Details
Details
Assignee
Reporter

We have recently installed the Jenkins plugin for JIRA to pull CIBuild info on the JIRA issue.
Background on Jenkins:
Jenkins home page: https://jenkins-green.clouddqt.capitalone.com/ (image 1)
The test job has been created in the folder, its 5 sub-folders in (image 2): https://sharedtechjenkins-green.clouddqt.capitalone.com/job/Non-PAR/job/Non-Prod-Jobs/job/DT_Tools_Pipeline/job/Synapse-Testing-jobs/
Jenkins home page -> Shared Tech -> NonPar -> NonProdJobs -> DT Tools Pipeline -> Synapse Testing jobs - > (job name: DeliveryServicingTest)
Integration
The integration was done under Manage Jenkins Site on the Jenkins Configuration page. (image 3)
The integration was done by adding site using the "Add Site" option (image 4)
the first integration (Jenkins-All) was done with using the (RPC url https://jenkins-green.clouddqt.capitalone.com/) of the home page. This integration did not show the number of jobs, it simply showed all the folders that are on the same Jenkins home page. (image 5).
The second integration (DSTest) was done by adding the (RPC URL https://sharedtechjenkins-green.clouddqt.capitalone.com/job/Non-PAR/job/Non-Prod-Jobs/job/DT_Tools_Pipeline/job/Synapse-Testing-jobs/) of the last sub-folder where the test job is placed. This integration showed 18 jobs that are in that sub-folder. (image 6/image 5)
The third integration was done with not the main home page but the second page of one of the folders. (image 7): (RPC URL https://sharedtechjenkins-green.clouddqt.capitalone.com/ ) This integration shows all the jobs that are in each of the folders and its sub-folders. It shows over 1000 jobs including the test job that was created in one of the sub folders
Results:
JIRA issue ID was placed in the description of the test job. This is so that the JIRA issue shows the build status when a new build was committed on that job.
scenario 1: Integration of Jenkins home page (RPC URL- RPC url https://jenkins-green.clouddqt.capitalone.com/) - FAILED
scenario 2: Integration of the last sub-folder which showed 18 jobs including the test job where the builds were commited (RPC URL used https://sharedtechjenkins-green.clouddqt.capitalone.com/job/Non-PAR/job/Non-Prod-Jobs/job/DT_Tools_Pipeline/job/Synapse-Testing-jobs/) - *FAILED*
scenario 3: Lastly the integration done using (RPC URL https://sharedtechjenkins-green.clouddqt.capitalone.com/ ) - *PASSED* When the build was committed on the test job, the JIRA issue entered in the job description was synced successfully and it displayed all the CIbuild info (image 8). This is the expected result.
Issue: Although we got it to work the issue is that the RPC url being used for the passed scenario displays over 1000 jobs that are in all the folders/sub-folders. The issue here is that we have a very large organization and pulling all the jobs is not ideal because not all jobs are to be synced with JIRA issues. The best option we see is to integrate the specific sub-folder and using that RPC URL to only bring in jobs in that one folder. This works in terms of the Jenkins integration pulling the jobs but it fails to sync with JIRA issue. Basically we would like to use the RPC URL described in scenario 2 above to successfully show the CIbuilds in JIRA.
Let me know if you have any other questions or need clarification.