Commit ded8ee5a authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent deed6022
......@@ -34,7 +34,7 @@ module UploadsActions
headers['Pragma'] = ''
ttl, directives = *cache_settings
ttl ||= 6.months
ttl ||= 0
directives ||= { private: true, must_revalidate: true }
expires_in ttl, directives
......
---
title: Disable upload HTTP caching to fix case when object storage is enabled and
proxy_download is disabled
merge_request: 19494
author:
type: fixed
......@@ -15,7 +15,7 @@ class RemoveRendundantIndexFromReleases < ActiveRecord::Migration[5.2]
remove_concurrent_index_by_name :releases, 'index_releases_on_project_id'
# This is an extra index that is not present in db/schema.rb but known to exist on some installs
remove_concurrent_index_by_name :releases, 'releases_project_id_idx'
remove_concurrent_index_by_name :releases, 'releases_project_id_idx' if index_exists_by_name?(:releases, 'releases_project_id_idx')
end
def down
......
......@@ -3,18 +3,17 @@
module Gitlab
module CycleAnalytics
class GroupStageSummary
attr_reader :group, :from, :current_user, :options
attr_reader :group, :current_user, :options
def initialize(group, options:)
@group = group
@from = options[:from]
@current_user = options[:current_user]
@options = options
end
def data
[serialize(Summary::Group::Issue.new(group: group, from: from, current_user: current_user, options: options)),
serialize(Summary::Group::Deploy.new(group: group, from: from, options: options))]
[serialize(Summary::Group::Issue.new(group: group, current_user: current_user, options: options)),
serialize(Summary::Group::Deploy.new(group: group, options: options))]
end
private
......
......@@ -5,11 +5,10 @@ module Gitlab
module Summary
module Group
class Base
attr_reader :group, :from, :options
attr_reader :group, :options
def initialize(group:, from:, options:)
def initialize(group:, options:)
@group = group
@from = from
@options = options
end
......
......@@ -20,7 +20,8 @@ module Gitlab
def find_deployments
deployments = Deployment.joins(:project).merge(Project.inside_path(group.full_path))
deployments = deployments.where(projects: { id: options[:projects] }) if options[:projects]
deployments = deployments.where("deployments.created_at > ?", from)
deployments = deployments.where("deployments.created_at > ?", options[:from])
deployments = deployments.where("deployments.created_at < ?", options[:to]) if options[:to]
deployments.success.count
end
end
......
......@@ -5,11 +5,10 @@ module Gitlab
module Summary
module Group
class Issue < Group::Base
attr_reader :group, :from, :current_user, :options
attr_reader :group, :current_user, :options
def initialize(group:, from:, current_user:, options:)
def initialize(group:, current_user:, options:)
@group = group
@from = from
@current_user = current_user
@options = options
end
......@@ -25,10 +24,19 @@ module Gitlab
private
def find_issues
issues = IssuesFinder.new(current_user, group_id: group.id, include_subgroups: true, created_after: from).execute
issues = IssuesFinder.new(current_user, finder_params).execute
issues = issues.where(projects: { id: options[:projects] }) if options[:projects]
issues.count
end
def finder_params
{
group_id: group.id,
include_subgroups: true,
created_after: options[:from],
created_before: options[:to]
}.compact
end
end
end
end
......
......@@ -7,9 +7,9 @@ shared_examples 'content 5 min private cached with revalidation' do
end
end
shared_examples 'content long term private cached with revalidation' do
shared_examples 'content not cached' do
it 'ensures content will not be cached without revalidation' do
expect(subject['Cache-Control']).to eq('max-age=15778476, private, must-revalidate')
expect(subject['Cache-Control']).to eq('max-age=0, private, must-revalidate')
end
end
......@@ -490,7 +490,7 @@ describe UploadsController do
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content long term private cached with revalidation' do
it_behaves_like 'content not cached' do
subject do
get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
......@@ -510,7 +510,7 @@ describe UploadsController do
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content long term private cached with revalidation' do
it_behaves_like 'content not cached' do
subject do
get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
......@@ -563,7 +563,7 @@ describe UploadsController do
expect(response).to have_gitlab_http_status(200)
end
it_behaves_like 'content long term private cached with revalidation' do
it_behaves_like 'content not cached' do
subject do
get :show, params: { model: 'note', mounted_as: 'attachment', id: note.id, filename: 'dk.png' }
......
......@@ -44,6 +44,14 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
expect(subject.first[:value]).to eq(2)
end
end
context 'when `from` and `to` parameters are provided' do
subject { described_class.new(group, options: { from: 10.days.ago, to: Time.now, current_user: user }).data }
it 'finds issues from 5 days ago' do
expect(subject.first[:value]).to eq(2)
end
end
end
context 'with other projects' do
......@@ -97,6 +105,14 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
expect(subject.second[:value]).to eq(2)
end
end
context 'when `from` and `to` parameters are provided' do
subject { described_class.new(group, options: { from: 10.days.ago, to: Time.now, current_user: user }).data }
it 'finds deployments from 5 days ago' do
expect(subject.second[:value]).to eq(2)
end
end
end
context 'with other projects' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment