Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2016-03-04 15:18:47 +0300
committerRémy Coutable <remy@rymai.me>2016-03-04 15:20:49 +0300
commit60f9ce6af84625933348f422235d1d82f7b907d1 (patch)
treed2c7edb6d1dd9a34eb46bb615fd22144cdd055b5
parente6c783d32f70bc24f670b6a5e1b9b6ad1660b1a6 (diff)
Merge branch 'fix/invalidate-builds-badge-cache' into 'master'
Invalidate cache for builds badge This fixes cache issue with badges (we should not cache badge images). Closes #13982 See merge request !3086
-rw-r--r--CHANGELOG16
-rw-r--r--app/controllers/projects/badges_controller.rb13
-rw-r--r--features/project/badges/build.feature5
-rw-r--r--features/steps/project/badges/build.rb4
4 files changed, 38 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index f23760745d5..cc5c005ae4f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,21 @@
Please view this file on the master branch, on stable branches it's out of date.
+v 8.6.0 (unreleased)
+ - Contributions to forked projects are included in calendar
+ - Improve the formatting for the user page bio (Connor Shea)
+ - Fix issue when pushing to projects ending in .wiki
+ - Fix avatar stretching by providing a cropping feature (Johann Pardanaud)
+ - Don't load all of GitLab in mail_room
+ - Strip leading and trailing spaces in URL validator (evuez)
+ - Return empty array instead of 404 when commit has no statuses in commit status API
+ - Update documentation to reflect Guest role not being enforced on internal projects
+ - Allow search for logged out users
+ - Don't show Issues/MRs from archived projects in Groups view
+ - Increase the notes polling timeout over time (Roberto Dip)
+
+v 8.5.4 (unreleased)
+ - Do not cache requests for badges (including builds badge)
+
v 8.5.3
- Flush repository caches before renaming projects
diff --git a/app/controllers/projects/badges_controller.rb b/app/controllers/projects/badges_controller.rb
index a4dd94b941c..dc9c96df003 100644
--- a/app/controllers/projects/badges_controller.rb
+++ b/app/controllers/projects/badges_controller.rb
@@ -1,4 +1,6 @@
class Projects::BadgesController < Projects::ApplicationController
+ before_action :set_no_cache
+
def build
respond_to do |format|
format.html { render_404 }
@@ -8,4 +10,15 @@ class Projects::BadgesController < Projects::ApplicationController
end
end
end
+
+ private
+
+ def set_no_cache
+ expires_now
+
+ # Add some deprecated headers for older agents
+ #
+ response.headers['Pragma'] = 'no-cache'
+ response.headers['Expires'] = 'Fri, 01 Jan 1990 00:00:00 GMT'
+ end
end
diff --git a/features/project/badges/build.feature b/features/project/badges/build.feature
index 9417f62d680..bcf80ed620e 100644
--- a/features/project/badges/build.feature
+++ b/features/project/badges/build.feature
@@ -20,3 +20,8 @@ Feature: Project Badges Build
And project has another build that is running
When I display builds badge for a master branch
Then I should see a build running badge
+
+ Scenario: I want to see a fresh badge on each request
+ Given recent build is successful
+ When I display builds badge for a master branch
+ Then I should see a badge that has not been cached
diff --git a/features/steps/project/badges/build.rb b/features/steps/project/badges/build.rb
index cbfc35bed65..47540f356e9 100644
--- a/features/steps/project/badges/build.rb
+++ b/features/steps/project/badges/build.rb
@@ -20,6 +20,10 @@ class Spinach::Features::ProjectBadgesBuild < Spinach::FeatureSteps
expect_badge('running')
end
+ step 'I should see a badge that has not been cached' do
+ expect(page.response_headers).to include('Cache-Control' => 'no-cache')
+ end
+
def expect_badge(status)
svg = Nokogiri::XML.parse(page.body)
expect(page.response_headers).to include('Content-Type' => 'image/svg+xml')