Readthedocs.org: Wrong badge status in README.rst file, but correct status in RTD documentation

Created on 22 Aug 2018  路  7Comments  路  Source: readthedocs/readthedocs.org

Details

Expected Result

Build status badge on the README.rst in the root directory shows up as "Failed" (Displaying as red color). However, the builds are passing and I was able to see the correct
documentation.

Actual Result

Build status badge color is displaying as red on the README.rst file in the root directory, even when the builds have passed and the documentation was properly built. When I look at it on Github, it shows up as red. However, when I go to the documentation, it the "docs" badge is green as says "passing".

I tried rebuilding the documentation, rearranging links, but I haven't had success yet.

I have also tried to put the link on a "badge_test.md" file (in root directory) without success. I literally copied and pasted the badge link from RTD for markdown.

I wanted to know if anyone else has this issue, or if anyone has an idea of how to fix it.

Bug Operations

All 7 comments

The problem is that github is caching the badge internally with a control-cache header with max-age=31536000. The badge does have a contro-cache header, but it redirects to the new azure storage https://rtdcommunitypublic.blob.core.windows.net/static/projects/badges/passing-flat.13d664e1afd7.svg, which doesn't have a control-cache header, I suppose that there is the problem, I think this can be configured in azure some how.

Thanks for the insightful comment. In that case, do you know if that is something that I can fix on my end? Or are Github/Microsoft the only ones with the ability to fix the caching-issue?

Sadly there is nothing users can do here, hope the rtd team can find the setting to fix this in the Azure storage.

That makes sense. In that case, I'll wait and hopefully it can be fixed.

But thanks again!

Just linking some prior art on this, #3323

As @stsewd suggested, the final URL (https://rtdcommunitypublic.blob.core.windows.net/static/projects/badges/passing-flat.13d664e1afd7.svg) does not set the cache control header.

I see two oddities here but hopefully we can resolve them quickly. Firstly, the code to handle redirecting to the badges uses an undocumented (as far as I can tell) method in the staticfiles app. This should probably just use settings.STATIC_URL instead and the final URL should be https://assets.readthedocs.org/static/projects/badges/passing-flat.svg`.

>>> from django.contrib.staticfiles.templatetags.staticfiles import static
>>> from django.conf import settings
>>> settings.STATIC_URL
u'https://rtdstoragetest-media.readthedocs.io/static/'
>>> url = 'projects/badges/passing-flat.svg'
>>> static(url)    # notice this output URL doesn't match STATIC_URL
'https://rtdstoragetest.blob.core.windows.net/static/projects/badges/passing-flat.13d664e1afd7.svg'

Secondly, it looks like the cache-control header on the underlying storage (which if it goes through STATIC_URL might be the Azure CDN rather than Azure's blob storage) must be set.

Just linking some prior art on this, #3323

This is almost certainly related. Thanks.

Was this page helpful?
0 / 5 - 0 ratings