18

I want to use the Embeddable Build Status Plugin for Jenkins. I am using Cloudbees. I granted Job/ViewStatus permissions to the anonymous user. When I add the Markdown to the README.md no icon is shown. I tried both the protected and the unprotected link.

# protected
[![Build Status](https://johnjohndoe.ci.cloudbees.com/job/TypedPreferences/badge/icon)](https://johnjohndoe.ci.cloudbees.com/job/TypedPreferences/)

# unprotected
[![Build Status](https://johnjohndoe.ci.cloudbees.com/buildStatus/icon?job=TypedPreferences)](https://johnjohndoe.ci.cloudbees.com/job/TypedPreferences/)
JJD
  • 50,076
  • 60
  • 203
  • 339

3 Answers3

21

By default DEV@cloud Jenkins instances are not visible, at all, to anonymous users. If you have configured role-based security and want anonymous users to have the selected roles, configure your system and check the box Enable read-only access for anonymous users.

Jesse Glick
  • 24,539
  • 10
  • 90
  • 112
  • Thanks! Nevertheless, I had to reference the *unprotected* image. – JJD Apr 01 '14 at 17:23
  • I tried this but the image does not load, https://github.com/tradespoke/daysto/blob/master/README.md what access rights did you set in cloudbees? – Filip Apr 02 '14 at 15:27
  • 1
    Well, you can either use the unprotected image URL and grant only Job/ViewStatus to `anonymous`; or use the protected URL and grant `Overall/Read` and `Job/Read` to `anonymous`, if your site is not secret. Either way you need to _Enable read-only access for anonymous users_. – Jesse Glick Apr 02 '14 at 17:36
  • 1
    I looked in role and users management, but you were simply right : it is in Jenkins => "Administrer Jenkins" (french) => "Configurer le système" => "Enable read-only access for anonymous users". Thx – Antoine Aug 13 '14 at 12:52
  • I have checked and configured the permissions, but somehow it's still not working. Is there anything else I have to check? – Lukas Jan 02 '16 at 22:17
  • 1
    I had an issue which I suspect was a caching issue - for once it worked on someone else's machine but not mine! You could try a different browser to verify, perhaps. – PJeffes Jun 20 '16 at 09:59
  • Be careful when you enable anonymous users. It open too much, basically all your build details, all jobs are open. Also anyone can download any published artifacts. – Ashish May 14 '18 at 02:23
8

Well, the question has been asked some time ago, but for others reaching it here, having the problem, that the image is still not shown within the Readme.md on GitHub/GitHub-Enterprise after performing the above mentioned configuration:

Make sure that both services are using the same protocol. In my case, we had GitHub-Enterprise running under HTTPS and Jenkins was running on HTTP.
The badge will not be shown in this case because of the possible security breach introduced by mixed content. You will find an appropriate error message in the console output of your browser (i.e. F12 in Chrome):

Mixed Content: The page at 'https://.../README.md' was loaded over HTTPS, 
but requested an insecure image 'http://.../job/master/badge/icon'. 
This request has been blocked; the content must be served over HTTPS.

It's of course quite obvious but something that can also be easily missed when searching on the wrong track.

Tobias Breuer
  • 825
  • 1
  • 11
  • 19
  • Good point at the time but may no longer be relevant because github uses camo to anonymize urls: https://help.github.com/en/articles/about-anonymized-image-urls – PeterVermont Mar 08 '19 at 10:49
  • 1
    The exact situation that Tobias explained here happened to me today (May 3rd, 2020), so I think Tobias's answer could still be relevant. – lonelyjoe May 03 '20 at 21:09
  • @PeterVermont - The issue may still be relevant to on-premises hosted GitHub Enterprise servers. I'm getting the same issue and the Jenkins server is HTTP, GitHub server, HTTPS. Same error. No Camo proxy involved I guess. – tjmoore Jun 08 '20 at 16:08
1

I had an issue with space in the project name, so do not forget to replace spaces with %20

example:

[![Build Status](../Long%20Project%20Name/...)](.../Long%20Project%20Name/...)
Dawe
  • 562
  • 1
  • 9
  • 19