Skip to content
Snippets Groups Projects
Commit fa7788f9 authored by Rémy Coutable's avatar Rémy Coutable
Browse files

Merge remote-tracking branch 'ce/8-5-stable' into ce-8-5-stable-to-ee-8-5-stable-ee

parents 0eed4bcb 610a4f91
Branches andrey-remove-group-caching
No related tags found
1 merge request!199[WIP] CE 8-5-stable to EE 8-5-stable-ee
Pipeline #12797178 failed
Showing
with 323 additions and 62 deletions
image: "ruby:2.2"
image: "ruby:2.1"
 
services:
- mysql:latest
- redis:latest
 
cache:
key: "ruby22"
key: "ruby21"
paths:
- vendor
 
Loading
Loading
@@ -155,87 +155,87 @@ bundler:audit:
- mysql
allow_failure: true
 
# Ruby 2.1 jobs
# Ruby 2.2 jobs
 
spec:feature:ruby21:
image: ruby:2.1
spec:feature:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test bundle exec rake assets:precompile 2>/dev/null
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:feature
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spec:api:ruby21:
image: ruby:2.1
spec:api:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:api
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spec:models:ruby21:
image: ruby:2.1
spec:models:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:models
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spec:lib:ruby21:
image: ruby:2.1
spec:lib:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:lib
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spec:services:ruby21:
image: ruby:2.1
spec:services:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:services
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spec:benchmark:ruby21:
image: ruby:2.1
spec:benchmark:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test bundle exec rake spec:benchmark
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
Loading
Loading
@@ -243,56 +243,56 @@ spec:benchmark:ruby21:
- mysql
allow_failure: true
 
spec:other:ruby21:
image: ruby:2.1
spec:other:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spec:other
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spinach:project:half:ruby21:
image: ruby:2.1
spinach:project:half:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:half
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spinach:project:rest:ruby21:
image: ruby:2.1
spinach:project:rest:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:project:rest
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
- ruby
- mysql
 
spinach:other:ruby21:
image: ruby:2.1
spinach:other:ruby22:
image: ruby:2.2
only:
- master
script:
- RAILS_ENV=test SIMPLECOV=true bundle exec rake spinach:other
cache:
key: "ruby21"
key: "ruby22"
paths:
- vendor
tags:
Loading
Loading
2.2.4
2.1.8
Loading
Loading
@@ -70,6 +70,8 @@ v 8.5.0 (unreleased)
- Allow SAML users to login with no previous account without having to allow
all Omniauth providers to do so.
- Allow existing users to auto link their SAML credentials by logging in via SAML
- Make it possible to erase a build (trace, artifacts) using UI and API
- Ability to revert changes from a Merge Request or Commit
 
v 8.4.4
- Update omniauth-saml gem to 1.4.2
Loading
Loading
Loading
Loading
@@ -54,7 +54,7 @@ gem "browser", '~> 1.0.0'
 
# Extracting information from a git repository
# Provide access to Gitlab::Git library
gem "gitlab_git", '~> 8.1'
gem "gitlab_git", '~> 8.2'
 
# LDAP Auth
# GitLab fork with several improvements to original library. For full list of changes
Loading
Loading
Loading
Loading
@@ -353,7 +353,7 @@ GEM
json
get_process_mem (0.2.0)
gherkin-ruby (0.3.2)
github-linguist (4.7.3)
github-linguist (4.7.5)
charlock_holmes (~> 0.7.3)
escape_utils (~> 1.1.0)
mime-types (>= 1.19)
Loading
Loading
@@ -379,11 +379,11 @@ GEM
gitlab-license (0.0.4)
gitlab_emoji (0.3.1)
gemojione (~> 2.2, >= 2.2.1)
gitlab_git (8.1.0)
gitlab_git (8.2.0)
activesupport (~> 4.0)
charlock_holmes (~> 0.7.3)
github-linguist (~> 4.7.0)
rugged (~> 0.23.3)
rugged (~> 0.24.0b13)
gitlab_meta (7.0)
gitlab_omniauth-ldap (1.2.1)
net-ldap (~> 0.9)
Loading
Loading
@@ -724,7 +724,7 @@ GEM
rubyntlm (0.5.2)
rubypants (0.2.0)
rufus-scheduler (3.1.10)
rugged (0.23.3)
rugged (0.24.0b13)
safe_yaml (1.0.4)
sanitize (2.1.0)
nokogiri (>= 1.4.4)
Loading
Loading
@@ -963,7 +963,7 @@ DEPENDENCIES
gitlab-flowdock-git-hook (~> 1.0.1)
gitlab-license (~> 0.0.4)
gitlab_emoji (~> 0.3.0)
gitlab_git (~> 8.1)
gitlab_git (~> 8.2)
gitlab_meta (= 7.0)
gitlab_omniauth-ldap (~> 1.2.1)
gollum-lib (~> 4.1.0)
Loading
Loading
Loading
Loading
@@ -93,7 +93,7 @@ Instructions on how to start GitLab and how to run the tests can be found in the
GitLab is a Ruby on Rails application that runs on the following software:
 
- Ubuntu/Debian/CentOS/RHEL
- Ruby (MRI) 2.1 or 2.2
- Ruby (MRI) 2.1
- Git 1.7.10+
- Redis 2.8+
- MySQL or PostgreSQL
Loading
Loading
Loading
Loading
@@ -64,6 +64,7 @@ class @Milestone
constructor: ->
@bindIssuesSorting()
@bindMergeRequestSorting()
@bindTabsSwitching
 
bindIssuesSorting: ->
$("#issues-list-unassigned, #issues-list-ongoing, #issues-list-closed").sortable(
Loading
Loading
@@ -122,3 +123,12 @@ class @Milestone
Milestone.updateMergeRequest(ui.item, merge_request_url, data)
 
).disableSelection()
bindMergeRequestSorting: ->
$('a[data-toggle="tab"]').on 'show.bs.tab', (e) ->
currentTabClass = $(e.target).data('show')
previousTabClass = $(e.relatedTarget).data('show')
$(previousTabClass).hide()
$(currentTabClass).removeClass('hidden')
$(currentTabClass).show()
Loading
Loading
@@ -237,3 +237,5 @@
}
}
}
Loading
Loading
@@ -11,3 +11,60 @@ li.milestone {
height: 6px;
}
}
.milestone-content {
.issues-count {
margin-right: 17px;
float: right;
width: 105px;
}
.issue-row {
.color-label {
border-radius: 2px;
padding: 3px !important;
}
// Issue title
span a {
color: rgba(0,0,0,0.64);
}
}
}
.milestone-summary {
margin-bottom: 25px;
.milestone-stat {
margin-right: 10px;
}
.time-elapsed {
color: $orange-light;
}
}
.issues-sortable-list {
.issue-detail {
display: block;
.issue-number{
color: rgba(0,0,0,0.44);
margin-right: 5px;
}
.color-label {
padding: 6px 10px;
margin-right: 7px;
margin-top: 10px;
}
.avatar {
float: none;
}
}
}
.milestone-detail {
border-bottom: 1px solid $border-color;
padding: 20px 0;
}
Loading
Loading
@@ -25,7 +25,7 @@ class ApplicationController < ActionController::Base
 
helper_method :abilities, :can?, :current_application_settings
helper_method :import_sources_enabled?, :github_import_enabled?, :github_import_configured?, :gitlab_import_enabled?, :gitlab_import_configured?, :bitbucket_import_enabled?, :bitbucket_import_configured?, :gitorious_import_enabled?, :google_code_import_enabled?, :fogbugz_import_enabled?, :git_import_enabled?
helper_method :repository
helper_method :repository, :can_collaborate_with_project?
 
rescue_from Encoding::CompatibilityError do |exception|
log_exception(exception)
Loading
Loading
@@ -420,6 +420,13 @@ def redirect_to_home_page_url?
current_user.nil? && root_path == request.path
end
 
def can_collaborate_with_project?(project = nil)
project ||= @project
can?(current_user, :push_code, project) ||
(current_user && current_user.already_forked?(project))
end
private
 
def set_default_sort
Loading
Loading
Loading
Loading
@@ -13,17 +13,11 @@ def create_commit(service, success_path:, failure_path:, failure_view: nil, succ
result = service.new(@tree_edit_project, current_user, commit_params).execute
 
if result[:status] == :success
flash[:notice] = success_notice || "Your changes have been successfully committed."
if create_merge_request?
success_path = new_merge_request_path
target = different_project? ? "project" : "branch"
flash[:notice] << " You can now submit a merge request to get this change into the original #{target}."
end
update_flash_notice(success_notice)
 
respond_to do |format|
format.html { redirect_to success_path }
format.json { render json: { message: "success", filePath: success_path } }
format.html { redirect_to final_success_path(success_path) }
format.json { render json: { message: "success", filePath: final_success_path(success_path) } }
end
else
flash[:alert] = result[:message]
Loading
Loading
@@ -41,14 +35,32 @@ def create_commit(service, success_path:, failure_path:, failure_view: nil, succ
end
 
def authorize_edit_tree!
return if can?(current_user, :push_code, project)
return if current_user && current_user.already_forked?(project)
return if can_collaborate_with_project?
 
access_denied!
end
 
private
 
def update_flash_notice(success_notice)
flash[:notice] = success_notice || "Your changes have been successfully committed."
if create_merge_request?
if merge_request_exists?
flash[:notice] = nil
else
target = different_project? ? "project" : "branch"
flash[:notice] << " You can now submit a merge request to get this change into the original #{target}."
end
end
end
def final_success_path(success_path)
return success_path unless create_merge_request?
merge_request_exists? ? existing_merge_request_path : new_merge_request_path
end
def new_merge_request_path
new_namespace_project_merge_request_path(
@mr_source_project.namespace,
Loading
Loading
@@ -62,6 +74,19 @@ def new_merge_request_path
)
end
 
def existing_merge_request_path
namespace_project_merge_request_path(@mr_target_project.namespace, @mr_target_project, @merge_request)
end
def merge_request_exists?
return @merge_request if defined?(@merge_request)
@merge_request = @mr_target_project.merge_requests.opened.find_by(
source_branch: @mr_source_branch,
target_branch: @mr_target_branch
)
end
def different_project?
@mr_source_project != @mr_target_project
end
Loading
Loading
@@ -75,7 +100,7 @@ def create_merge_request?
end
 
def set_commit_variables
@mr_source_branch = @target_branch
@mr_source_branch ||= @target_branch
 
if can?(current_user, :push_code, @project)
# Edit file in this project
Loading
Loading
@@ -89,7 +114,7 @@ def set_commit_variables
else
# Merge request to this project
@mr_target_project = @project
@mr_target_branch = @ref
@mr_target_branch ||= @ref
end
else
# Edit file in fork
Loading
Loading
@@ -97,7 +122,7 @@ def set_commit_variables
# Merge request from fork to this project
@mr_source_project = @tree_edit_project
@mr_target_project = @project
@mr_target_branch = @ref
@mr_target_branch ||= @ref
end
end
end
Loading
Loading
@@ -56,6 +56,12 @@ def status
render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha)
end
 
def erase
@build.erase(erased_by: current_user)
redirect_to namespace_project_build_path(project.namespace, project, @build),
notice: "Build has been sucessfully erased!"
end
private
 
def build
Loading
Loading
Loading
Loading
@@ -2,6 +2,8 @@
#
# Not to be confused with CommitsController, plural.
class Projects::CommitController < Projects::ApplicationController
include CreatesCommit
# Authorize
before_action :require_non_empty_project
before_action :authorize_download_code!, except: [:cancel_builds, :retry_builds]
Loading
Loading
@@ -9,6 +11,7 @@ class Projects::CommitController < Projects::ApplicationController
before_action :authorize_read_commit_status!, only: [:builds]
before_action :commit
before_action :define_show_vars, only: [:show, :builds]
before_action :authorize_edit_tree!, only: [:revert]
 
def show
apply_diff_view_cookie!
Loading
Loading
@@ -55,8 +58,37 @@ def branches
render layout: false
end
 
def revert
assign_revert_commit_vars
return render_404 if @target_branch.blank?
create_commit(Commits::RevertService, success_notice: "The #{revert_type_title} has been successfully reverted.",
success_path: successful_revert_path, failure_path: failed_revert_path)
end
private
 
def revert_type_title
@commit.merged_merge_request ? 'merge request' : 'commit'
end
def successful_revert_path
return referenced_merge_request_url if @commit.merged_merge_request
namespace_project_commits_url(@project.namespace, @project, @target_branch)
end
def failed_revert_path
return referenced_merge_request_url if @commit.merged_merge_request
namespace_project_commit_url(@project.namespace, @project, params[:id])
end
def referenced_merge_request_url
namespace_project_merge_request_url(@project.namespace, @project, @commit.merged_merge_request)
end
def commit
@commit ||= @project.commit(params[:id])
end
Loading
Loading
@@ -79,4 +111,16 @@ def define_show_vars
 
@statuses = ci_commit.statuses if ci_commit
end
def assign_revert_commit_vars
@commit = project.commit(params[:id])
@target_branch = params[:target_branch]
@mr_source_branch = @commit.revert_branch_name
@mr_target_branch = @target_branch
@commit_params = {
commit: @commit,
revert_type_title: revert_type_title,
create_merge_request: params[:create_merge_request].present? || different_project?
}
end
end
Loading
Loading
@@ -35,6 +35,7 @@ def show
@issues = @milestone.issues
@users = @milestone.participants.uniq
@merge_requests = @milestone.merge_requests
@labels = @milestone.labels
end
 
def create
Loading
Loading
Loading
Loading
@@ -123,6 +123,37 @@ def link_to_browse_code(project, commit)
)
end
 
def revert_commit_link(commit, continue_to_path, btn_class: nil)
return unless current_user
tooltip = "Revert this #{revert_commit_type(commit)} in a new merge request"
if can_collaborate_with_project?
content_tag :span, 'data-toggle' => 'modal', 'data-target' => '#modal-revert-commit' do
link_to 'Revert', '#modal-revert-commit', 'data-toggle' => 'tooltip', title: tooltip, class: "btn btn-default btn-grouped btn-#{btn_class}"
end
elsif can?(current_user, :fork_project, @project)
continue_params = {
to: continue_to_path,
notice: edit_in_new_fork_notice + ' Try to revert this commit again.',
notice_now: edit_in_new_fork_notice_now
}
fork_path = namespace_project_forks_path(@project.namespace, @project,
namespace_key: current_user.namespace.id,
continue: continue_params)
link_to 'Revert', fork_path, class: 'btn btn-grouped btn-close', method: :post, 'data-toggle' => 'tooltip', title: tooltip
end
end
def revert_commit_type(commit)
if commit.merged_merge_request
'merge request'
else
'commit'
end
end
protected
 
# Private: Returns a link to a person. If the person has a matching user and
Loading
Loading
Loading
Loading
@@ -56,8 +56,7 @@ def can_edit_tree?(project = nil, ref = nil)
 
return false unless on_top_of_branch?(project, ref)
 
can?(current_user, :push_code, project) ||
(current_user && current_user.already_forked?(project))
can_collaborate_with_project?(project)
end
 
def tree_edit_branch(project = @project, ref = @ref)
Loading
Loading
Loading
Loading
@@ -31,15 +31,19 @@
# artifacts_file :text
# gl_project_id :integer
# artifacts_metadata :text
# erased_by_id :integer
# erased_at :datetime
#
 
module Ci
class Build < CommitStatus
include Gitlab::Application.routes.url_helpers
LAZY_ATTRIBUTES = ['trace']
 
belongs_to :runner, class_name: 'Ci::Runner'
belongs_to :trigger_request, class_name: 'Ci::TriggerRequest'
belongs_to :erased_by, class_name: 'User'
 
serialize :options
 
Loading
Loading
@@ -116,10 +120,6 @@ def retry(build)
end
end
 
def ignored?
failed? && allow_failure?
end
def retryable?
project.builds_enabled? && commands.present?
end
Loading
Loading
@@ -203,6 +203,10 @@ def extract_coverage(text, regex)
end
end
 
def has_trace?
raw_trace.present?
end
def raw_trace
if File.file?(path_to_trace)
File.read(path_to_trace)
Loading
Loading
@@ -360,6 +364,33 @@ def artifacts_metadata_entry(path, **options)
Gitlab::Ci::Build::Artifacts::Metadata.new(artifacts_metadata.path, path, **options).to_entry
end
 
def erase(opts = {})
return false unless erasable?
remove_artifacts_file!
remove_artifacts_metadata!
erase_trace!
update_erased!(opts[:erased_by])
end
def erasable?
complete? && (artifacts? || has_trace?)
end
def erased?
!self.erased_at.nil?
end
private
def erase_trace!
self.trace = nil
end
def update_erased!(user = nil)
self.update(erased_by: user, erased_at: Time.now)
end
private
 
def yaml_variables
Loading
Loading
Loading
Loading
@@ -215,6 +215,44 @@ def status
ci_commit.try(:status) || :not_found
end
 
def revert_branch_name
"revert-#{short_id}"
end
def revert_description
if merged_merge_request
"This reverts merge request #{merged_merge_request.to_reference}"
else
"This reverts commit #{sha}"
end
end
def revert_message
%Q{Revert "#{title}"\n\n#{revert_description}}
end
def reverts_commit?(commit)
description.include?(commit.revert_description)
end
def merge_commit?
parents.size > 1
end
def merged_merge_request
return @merged_merge_request if defined?(@merged_merge_request)
@merged_merge_request = project.merge_requests.find_by(merge_commit_sha: id) if merge_commit?
end
def has_been_reverted?(current_user = nil, noteable = self)
Gitlab::ReferenceExtractor.lazily do
noteable.notes.system.flat_map do |note|
note.all_references(current_user).commits
end
end.any? { |commit_ref| commit_ref.reverts_commit?(self) }
end
private
 
def repo_changes
Loading
Loading
Loading
Loading
@@ -113,6 +113,10 @@ def complete?
canceled? || success? || failed?
end
 
def ignored?
failed? && allow_failure?
end
def duration
if started_at && finished_at
finished_at - started_at
Loading
Loading
Loading
Loading
@@ -85,6 +85,10 @@ def open_issues_count
issues.opened.count
end
 
def closed_issues_count
issues.closed.count
end
def template?
template
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment