Read about our upcoming Code of Conduct on this issue

Commit d2d4059e authored by GitLab Bot's avatar GitLab Bot
Browse files

Add latest changes from gitlab-org/gitlab@master

parent 5137254cfcca
......@@ -131,7 +131,7 @@ sudo -u git -H bundle exec rails runner -e production 'puts Sidekiq::Queue.new("
Major versions are reserved for backwards incompatible changes. We recommend that
you first upgrade to the latest available minor version within your major version.
Please follow the [Upgrade Recommendations](../policy/maintenance.md#upgrade-recommendations)
to identify the ideal upgrade path.
to identify a supported upgrade path.
Before upgrading to a new major version, you should ensure that any background
migration jobs from previous releases have been completed. To see the current size
......@@ -183,11 +183,18 @@ users first upgrade to the latest 11.11 patch release. Once upgraded to 11.11.x,
users can upgrade to 12.0.x. Failure to do so may result in database migrations
not being applied, which could lead to application errors.
Example 1: you are currently using GitLab 11.11.3, which is the latest patch
It is also required that you upgrade to 12.0.x before moving to a later version
of 12.x.
Example 1: you are currently using GitLab 11.11.8, which is the latest patch
release for 11.11.x. You can upgrade as usual to 12.0.x.
Example 2: you are currently using a version of GitLab 10.x. To upgrade, first
upgrade to 11.11.3. Once upgraded to 11.11.3 you can safely upgrade to 12.0.x.
upgrade to the last 10.x release (10.8.7) then the last 11.x release (11.11.8).
Once upgraded to 11.11.8 you can safely upgrade to 12.0.x.
See our [documentation on upgrade paths](../policy/maintenance.md#upgrade-recommendations)
for more information.
## Miscellaneous
......
......@@ -435,18 +435,7 @@ and you will have access to more advanced querying capabilities.
Log data is automatically deleted after 15 days using [Curator](https://www.elastic.co/guide/en/elasticsearch/client/curator/5.5/about.html).
This is a preliminary release of Elastic Stack as a GitLab-managed application. By default,
the ability to install it is disabled.
To allow installation of Elastic Stack as a GitLab-managed application, ask a GitLab
administrator to run following command within a Rails console:
```ruby
Feature.enable(:enable_cluster_application_elastic_stack)
```
Once the feature flag is set, to enable log shipping, install Elastic Stack into the cluster with the
**Install** button.
To enable log shipping, install Elastic Stack into the cluster with the **Install** button.
NOTE: **Note:**
The [`stable/elastic-stack`](https://github.com/helm/charts/tree/master/stable/elastic-stack)
......
# Dependency Proxy **(PREMIUM ONLY)**
# Dependency Proxy **(ULTIMATE ONLY)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/7934) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.11.
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/7934) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.11.
NOTE: **Note:**
This is the user guide. In order to use the dependency proxy, an administrator
......
......@@ -755,6 +755,12 @@ class MergeRequestDiffFull < MergeRequestDiff
end
end
class MergeRequestContextCommit < Grape::Entity
expose :sha, :relative_order, :new_file, :renamed_file,
:deleted_file, :too_large, :a_mode, :b_mode, :new_path, :old_path,
:diff, :binary
end
class SSHKey < Grape::Entity
expose :id, :title, :key, :created_at
end
......
......@@ -4,6 +4,8 @@ module API
class MergeRequests < Grape::API
include PaginationParams
CONTEXT_COMMITS_POST_LIMIT = 20
before { authenticate_non_get! }
helpers ::Gitlab::IssuableMetadata
......@@ -290,6 +292,72 @@ def handle_merge_request_errors!(errors)
present commits, with: Entities::Commit
end
desc 'Get the context commits of a merge request' do
success Entities::CommitEntity
end
get ':id/merge_requests/:merge_request_iid/context_commits' do
merge_request = find_merge_request_with_access(params[:merge_request_iid])
project = merge_request.project
not_found! unless project.context_commits_enabled?
context_commits = merge_request.context_commits
CommitEntity.represent(context_commits, type: :full, request: merge_request)
end
params do
requires :commits, type: Array, allow_blank: false, desc: 'List of context commits sha'
end
desc 'create context commits of merge request' do
success Entities::Commit
end
post ':id/merge_requests/:merge_request_iid/context_commits' do
commit_ids = params[:commits]
if commit_ids.size > CONTEXT_COMMITS_POST_LIMIT
render_api_error!("Context commits array size should not be more than #{CONTEXT_COMMITS_POST_LIMIT}", 400)
end
merge_request = find_merge_request_with_access(params[:merge_request_iid])
project = merge_request.project
not_found! unless project.context_commits_enabled?
authorize!(:update_merge_request, merge_request)
project = merge_request.target_project
result = ::MergeRequests::AddContextService.new(project, current_user, merge_request: merge_request, commits: commit_ids).execute
if result.instance_of?(Array)
present result, with: Entities::Commit
else
render_api_error!(result[:message], result[:http_status])
end
end
params do
requires :commits, type: Array, allow_blank: false, desc: 'List of context commits sha'
end
desc 'remove context commits of merge request'
delete ':id/merge_requests/:merge_request_iid/context_commits' do
commit_ids = params[:commits]
merge_request = find_merge_request_with_access(params[:merge_request_iid])
project = merge_request.project
not_found! unless project.context_commits_enabled?
authorize!(:destroy_merge_request, merge_request)
project = merge_request.target_project
commits = project.repository.commits_by(oids: commit_ids)
if commits.size != commit_ids.size
render_api_error!("One or more context commits' sha is not valid.", 400)
end
MergeRequestContextCommit.delete_bulk(merge_request, commits)
status 204
end
desc 'Show the merge request changes' do
success Entities::MergeRequestChanges
end
......
......@@ -10,6 +10,7 @@ class Gitaly
cache_invalidator
inforef_uploadpack_cache
commit_without_batch_check
use_core_delta_islands
].freeze
DEFAULT_ON_FLAGS = Set.new([]).freeze
......
......@@ -24,7 +24,14 @@ def deserialize(value)
def serialize(value)
arg = value ? [value].pack(PACK_FORMAT) : nil
super(arg)
BINARY_TYPE.new.serialize(arg)
end
# Casts a SHA1 in hexadecimal to the proper binary format.
def self.serialize(value)
arg = value ? [value].pack(PACK_FORMAT) : nil
BINARY_TYPE.new.serialize(arg)
end
end
end
......
......@@ -791,6 +791,21 @@ def go(format: 'html')
end
end
describe 'GET context commits' do
it 'returns the commits for context commits' do
get :context_commits,
params: {
namespace_id: project.namespace.to_param,
project_id: project,
id: merge_request.iid
},
format: 'json'
expect(response).to have_gitlab_http_status(:success)
expect(json_response).to be_an Array
end
end
describe 'GET exposed_artifacts' do
let(:merge_request) do
create(:merge_request,
......
......@@ -17,6 +17,7 @@
context 'as a user' do
let(:user) { create(:user) }
let(:archive_name) { "#{project.path}-master" }
before do
project.add_developer(user)
......@@ -30,9 +31,18 @@
end
it 'responds with redirect to the short name archive if fully qualified' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master/#{project.path}-master" }, format: "zip"
get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master/#{archive_name}" }, format: "zip"
expect(assigns(:ref)).to eq("master")
expect(assigns(:filename)).to eq(archive_name)
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
it 'responds with redirect for a path with multiple slashes' do
get :archive, params: { namespace_id: project.namespace, project_id: project, id: "improve/awesome/#{archive_name}" }, format: "zip"
expect(assigns(:ref)).to eq("improve/awesome")
expect(assigns(:filename)).to eq(archive_name)
expect(response.header[Gitlab::Workhorse::SEND_DATA_HEADER]).to start_with("git-archive:")
end
......
# frozen_string_literal: true
FactoryBot.define do
factory :merge_request_context_commit do
association :merge_request, factory: :merge_request
author_name { 'test' }
author_email { 'test@test.com' }
message { '' }
relative_order { 0 }
sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
end
end
# frozen_string_literal: true
FactoryBot.define do
factory :merge_request_context_commit_diff_file do
association :merge_request_context_commit
sha { Digest::SHA1.hexdigest(SecureRandom.hex) }
relative_order { 0 }
new_file { true }
renamed_file { false }
deleted_file { false }
too_large { false }
a_mode { 0 }
b_mode { 100644 }
new_path { 'foo' }
old_path { 'foo' }
diff { '' }
binary { false }
end
end
# frozen_string_literal: true
require 'spec_helper'
describe 'Group navbar' do
it_behaves_like 'verified navigation bar' do
let(:user) { create(:user) }
let(:group) { create(:group) }
let(:structure) do
[
{
nav_item: _('Group overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
(_('Contribution Analytics') if Gitlab.ee?)
]
},
{
nav_item: _('Issues'),
nav_sub_items: [
_('List'),
_('Board'),
_('Labels'),
_('Milestones')
]
},
{
nav_item: _('Merge Requests'),
nav_sub_items: []
},
{
nav_item: _('Kubernetes'),
nav_sub_items: []
},
{
nav_item: _('Members'),
nav_sub_items: []
}
]
end
before do
group.add_maintainer(user)
sign_in(user)
visit group_path(group)
end
end
end
......@@ -171,6 +171,31 @@
end
end
context "when browsing a `improve/awesome` branch", :js do
before do
visit(project_tree_path(project, "improve/awesome"))
end
it "shows files from a repository" do
expect(page).to have_content("VERSION")
.and have_content(".gitignore")
.and have_content("LICENSE")
end
end
context "when browsing a `test-#` branch", :js do
before do
project.repository.create_branch('test-#', project.repository.root_ref)
visit(project_tree_path(project, "test-#"))
end
it "shows files from a repository" do
expect(page).to have_content("VERSION")
.and have_content(".gitignore")
.and have_content("LICENSE")
end
end
context "when browsing a specific ref", :js do
let(:ref) { project_tree_path(project, "6d39438") }
......
# frozen_string_literal: true
require 'spec_helper'
describe 'Project navbar' do
it_behaves_like 'verified navigation bar' do
let(:user) { create(:user) }
let(:project) { create(:project, :repository) }
let(:structure) do
[
{
nav_item: _('Project overview'),
nav_sub_items: [
_('Details'),
_('Activity'),
_('Releases')
]
},
{
nav_item: _('Repository'),
nav_sub_items: [
_('Files'),
_('Commits'),
_('Branches'),
_('Tags'),
_('Contributors'),
_('Graph'),
_('Compare'),
(_('Locked Files') if Gitlab.ee?)
]
},
{
nav_item: _('Issues'),
nav_sub_items: [
_('List'),
_('Boards'),
_('Labels'),
_('Milestones')
]
},
{
nav_item: _('Merge Requests'),
nav_sub_items: []
},
{
nav_item: _('CI / CD'),
nav_sub_items: [
_('Pipelines'),
_('Jobs'),
_('Artifacts'),
_('Schedules')
]
},
{
nav_item: _('Operations'),
nav_sub_items: [
_('Metrics'),
_('Environments'),
_('Error Tracking'),
_('Serverless'),
_('Kubernetes'),
_('Auto DevOps')
]
},
{
nav_item: _('Analytics'),
nav_sub_items: [
(_('Code Review') if Gitlab.ee?),
_('Cycle Analytics'),
_('Repository Analytics')
]
},
{
nav_item: _('Wiki'),
nav_sub_items: []
},
{
nav_item: _('Snippets'),
nav_sub_items: []
},
{
nav_item: _('Settings'),
nav_sub_items: [
_('General'),
_('Members'),
_('Integrations'),
_('Repository'),
_('CI / CD'),
_('Operations'),
(_('Audit Events') if Gitlab.ee?)
].compact
}
]
end
before do
project.add_maintainer(user)
sign_in(user)
visit project_path(project)
end
end
end
# frozen_string_literal: true
require 'spec_helper'
describe ContextCommitsFinder do
describe "#execute" do
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request) }
let(:commit) { create(:commit, id: '6d394385cf567f80a8fd85055db1ab4c5295806f') }
it 'filters commits by valid sha/commit message' do
params = { search: commit.id }
commits = described_class.new(project, merge_request, params).execute
expect(commits.length).to eq(1)
expect(commits[0].id).to eq(commit.id)
end
it 'returns nothing when searched by invalid sha/commit message' do
params = { search: 'zzz' }
commits = described_class.new(project, merge_request, params).execute
expect(commits).to be_empty
end
end
end
......@@ -14,9 +14,6 @@ describe('Applications', () => {
beforeEach(() => {
Applications = Vue.extend(applications);
gon.features = gon.features || {};
gon.features.enableClusterApplicationElasticStack = true;
});
afterEach(() => {
......
# frozen_string_literal: true
require 'spec_helper'
describe AttrEncrypted do
describe '#encrypted_attributes' do
subject do
Class.new(ActiveRecord::Base) do
self.table_name = 'projects'
attr_accessor :encrypted_foo
attr_accessor :encrypted_foo_iv
attr_encrypted :foo, key: 'This is a key that is 256 bits!!'
end
end
it 'does not share state with other instances' do
instance = subject.new
instance.foo = 'bar'
another_instance = subject.new
expect(instance.encrypted_attributes[:foo][:operation]).to eq(:encrypting)
expect(another_instance.encrypted_attributes[:foo][:operation]).to be_nil
end
end
end
......@@ -25,7 +25,7 @@
describe '#serialize' do
it 'converts a SHA String to binary data' do
expect(attribute.serialize(sha).to_s).to eq(binary_sha)
expect(described_class.serialize(sha).to_s).to eq(binary_sha)
end
end
end
......@@ -125,6 +125,8 @@ merge_requests:
- merge_user
- merge_request_diffs
- merge_request_diff
- merge_request_context_commits
- merge_request_context_commit_diff_files
- events
- merge_requests_closing_issues
- cached_closes_issues
......@@ -170,6 +172,9 @@ merge_request_diff_commits:
- merge_request_diff
merge_request_diff_files:
- merge_request_diff
merge_request_context_commits:
- merge_request
- diff_files
ci_pipelines:
- project
- user
......
......@@ -225,6 +225,31 @@ MergeRequestDiffFile:
- b_mode
- too_large
- binary
MergeRequestContextCommit:
- id
- authored_date
- committed_date
- relative_order
- sha
- author_name
- author_email
- committer_name
- committer_email
- message
- merge_request_id
MergeRequestContextCommitDiffFile:
- sha
- relative_order
- new_file
- renamed_file
- deleted_file
- new_path
- old_path
- a_mode
- b_mode
- too_large
- binary
- text
MergeRequest::Metrics:
- id
- created_at
......
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