Commit 95ef8f97 authored by Marin Jankovski's avatar Marin Jankovski

Merge remote-tracking branch 'ce/master'

Conflicts:
	VERSION
	doc/install/installation.md
	doc/integration/README.md
	doc/integration/external-issue-tracker.md
	lib/gitlab/markdown.rb
	spec/lib/gitlab/ldap/ldap_access_spec.rb
parents b3f8a03c f420ae4b
...@@ -11,7 +11,13 @@ v 6.9.0 ...@@ -11,7 +11,13 @@ v 6.9.0
- Improve issue and merge request mobile UI (Drew Blessing) - Improve issue and merge request mobile UI (Drew Blessing)
- Document how to convert a backup to PostgreSQL - Document how to convert a backup to PostgreSQL
- Fix locale bug in backup manager - Fix locale bug in backup manager
- Fix can not automerge when MR description is too long
- Fix wiki backup skip bug - Fix wiki backup skip bug
- Two Step MR creation process
- Remove unwanted files from satellite working directory with git clean -fdx
- Accept merge request via API (sponsored by O'Reilly Media)
- Add more access checks during API calls
- Block SSH access for 'disabled' Active Directory users
v 6.8.1 v 6.8.1
- Bump required gitlab-shell version to 1.9.3 - Bump required gitlab-shell version to 1.9.3
......
...@@ -162,7 +162,7 @@ GEM ...@@ -162,7 +162,7 @@ GEM
multi_json multi_json
gitlab-grack (2.0.0.pre) gitlab-grack (2.0.0.pre)
rack (~> 1.5.1) rack (~> 1.5.1)
gitlab-grit (2.6.6) gitlab-grit (2.6.7)
charlock_holmes (~> 0.6) charlock_holmes (~> 0.6)
diff-lcs (~> 1.1) diff-lcs (~> 1.1)
mime-types (~> 1.15) mime-types (~> 1.15)
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
### Canonical source ### Canonical source
* The source of GitLab Communinity Edition is [hosted on GitLab Cloud](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible. * The source of GitLab Community Edition is [hosted on GitLab.com](https://gitlab.com/gitlab-org/gitlab-ce/) and there are mirrors to make [contributing](CONTRIBUTING.md) as easy as possible.
### Code status ### Code status
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
* [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq)
* [![PullReview stats](https://www.pullreview.com/gitlab/gitlab-org/gitlab-ce/badges/master.svg?)](https://www.pullreview.com/gitlab.gitlab.com/gitlab-org/gitlab-ce/reviews/master)
### Resources ### Resources
* [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/). * [GitLab.com](https://www.gitlab.com/) includes information about [subscriptions](https://www.gitlab.com/subscription/), [consultancy](https://www.gitlab.com/consultancy/), the [community](https://www.gitlab.com/community/) and the [hosted GitLab Cloud](https://www.gitlab.com/cloud/).
...@@ -33,7 +35,7 @@ ...@@ -33,7 +35,7 @@
* [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab. * [GitLab CI](https://www.gitlab.com/gitlab-ci/) is a continuous integration (CI) server that is easy to integrate with GitLab.
* Unofficial third-party [iPhone app](http://gitlabcontrol.com/), [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) for GitLab. * Unofficial third-party [iPhone app](http://gitlabcontrol.com/), [Android app](https://play.google.com/store/apps/details?id=com.bd.gitlab&hl=en) and [command line client](https://github.com/drewblessing/gitlab-cli) and [Ruby API wrapper](https://github.com/NARKOZ/gitlab) for GitLab.
### Requirements ### Requirements
...@@ -61,6 +63,8 @@ ...@@ -61,6 +63,8 @@
* [BitNami one-click installers](http://bitnami.com/stack/gitlab) This package contains both GitLab and GitLab CI. It is available as installer, virtual machine or for cloud hosting providers (Amazon Web Services/Azure/etc.). * [BitNami one-click installers](http://bitnami.com/stack/gitlab) This package contains both GitLab and GitLab CI. It is available as installer, virtual machine or for cloud hosting providers (Amazon Web Services/Azure/etc.).
* [Cloud 66 deployment and management](http://blog.cloud66.com/installing-gitlab-ubuntu/) Use Cloud 66 to deploy GitLab to your own server or any cloud (eg. DigitalOcean, AWS, Rackspace, GCE) and then manage it with database backups, scaling and more.
#### Unofficial installation methods #### Unofficial installation methods
* [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/) repository with unofficial guides for using GitLab with different software (operating systems, webservers, etc.) than the official version. * [GitLab recipes](https://gitlab.com/gitlab-org/gitlab-recipes/) repository with unofficial guides for using GitLab with different software (operating systems, webservers, etc.) than the official version.
......
6.9.0.pre-ee 6.9.0.rc1-ee
...@@ -55,7 +55,7 @@ class Notes ...@@ -55,7 +55,7 @@ class Notes
@notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea' @notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea'
$(document).on('keypress', @notes_forms, (e)-> $(document).on('keypress', @notes_forms, (e)->
if event.keyCode == 10 || (event.ctrlKey && event.keyCode == 13) if e.keyCode == 10 || (e.ctrlKey && e.keyCode == 13)
$(@).parents('form').submit() $(@).parents('form').submit()
) )
......
...@@ -11,14 +11,11 @@ ...@@ -11,14 +11,11 @@
} }
.file-title { .file-title {
background: #DDD; background: #EEE;
border-bottom: 1px solid #CCC; border-bottom: 1px solid #CCC;
text-shadow: 0 1px 1px #fff; text-shadow: 0 1px 1px #fff;
margin: 0; margin: 0;
font-weight: normal;
font-weight: bold;
text-align: left; text-align: left;
color: $style_color;
padding: 9px 10px; padding: 9px 10px;
.options { .options {
...@@ -31,12 +28,15 @@ ...@@ -31,12 +28,15 @@
} }
.file_name { .file_name {
color: $style_color; font-weight: bold;
padding-left: 3px;
font-size: 14px; font-size: 14px;
text-shadow: 0 1px 1px #fff;
small { small {
color: #999; color: #888;
font-size: 13px; font-size: 13px;
font-weight: normal;
padding-left: 10px;
} }
} }
} }
......
...@@ -75,3 +75,26 @@ label { ...@@ -75,3 +75,26 @@ label {
width: 200px; width: 200px;
} }
} }
.commit-message-container {
background-color: $body-bg;
position: relative;
font-family: $monospace_font;
$left: 12px;
.max-width-marker {
color: rgba(0, 0, 0, 0.0);
font-family: inherit;
left: $left;
height: 100%;
border-right: 1px solid mix($input-border, white);
position: absolute;
z-index: 1;
}
> textarea {
background-color: rgba(0, 0, 0, 0.0);
font-family: inherit;
padding-left: $left;
position: relative;
z-index: 2;
}
}
...@@ -15,39 +15,39 @@ ...@@ -15,39 +15,39 @@
@include box-shadow(0 1px 1px rgba(0, 0, 0, 0.05)); @include box-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
&.issue-box-closed { &.issue-box-closed {
border-color: #DA4E49; border-color: $border_danger;
.state { .state {
background-color: #f2dede; background-color: $bg_light_danger;
border-color: #ebccd1; border-color: $border_danger;
color: #a94442; color: $color_danger;
.state-label { .state-label {
background: #DA4E49; background-color: $bg_danger;
color: #FFF; color: #FFF;
} }
} }
} }
&.issue-box-merged { &.issue-box-merged {
border-color: #31708f; border-color: $border_primary;
.state { .state {
background-color: #d9edf7; background-color: $bg_light_primary;
border-color: #bce8f1; border-color: $border_primary;
color: #31708f; color: $color_primary;
.state-label { .state-label {
background: #31708f; background-color: $bg_primary;
color: #FFF; color: #FFF;
} }
} }
} }
&.issue-box-open { &.issue-box-open {
border-color: #4A4; border-color: $border_success;
.state { .state {
background-color: #dff0d8; background-color: $bg_light_success;
border-color: #d6e9c6; border-color: $border_success;
color: #3c763d; color: $color_success;
.state-label { .state-label {
background: #4A4; background-color: $bg_success;
color: #FFF; color: #FFF;
} }
} }
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
@mixin header-font { @mixin header-font {
color: $style_color; color: $style_color;
text-shadow: 0 1px 1px #FFF;
font-size: 16px; font-size: 16px;
line-height: 44px; line-height: 44px;
font-weight: normal; font-weight: normal;
......
...@@ -8,6 +8,31 @@ $bg_style_color: #2299BB; ...@@ -8,6 +8,31 @@ $bg_style_color: #2299BB;
$list-group-active-bg: $bg_style_color; $list-group-active-bg: $bg_style_color;
$hover: #D9EDF7; $hover: #D9EDF7;
/*
* Success colors (green)
*/
$border_success: #4cae4c;
$bg_success: #5cb85c;
$bg_light_success: #dff0d8;
$color_success: #3c763d;
/*
* Danger colors (red)
*/
$border_danger: #d43f3a;
$bg_danger: #d9534f;
$bg_light_danger: #f2dede;
$color_danger: #a94442;
/*
* Primary colors (blue)
*/
$border_primary: #358ebd;
$bg_primary: #429bca;
$bg_light_primary: #d9edf7;
$color_primary: #31708f;
/** /**
* Commit Diff Colors * Commit Diff Colors
*/ */
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
.diff-header { .diff-header {
@extend .clearfix; @extend .clearfix;
background: #DDD; background: #EEE;
border-bottom: 1px solid #CCC; border-bottom: 1px solid #CCC;
padding: 5px 5px 5px 10px; padding: 5px 5px 5px 10px;
color: #555; color: #555;
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
border: none; border: none;
background: #EEE; background: #F5F5F5;
color: #666; color: #666;
padding: 0px 5px; padding: 0px 5px;
border-right: 1px solid #ccc; border-right: 1px solid #ccc;
...@@ -295,15 +295,9 @@ ...@@ -295,15 +295,9 @@
} //.view.onion-skin } //.view.onion-skin
} }
.view-modes{ .view-modes{
padding: 10px; padding: 10px;
text-align: center; text-align: center;
background: #EEE;
background-image: -webkit-gradient(linear, 0 0, 0 30, color-stop(0.066, #eee), to(#dfdfdf));
background-image: -webkit-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -moz-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -ms-linear-gradient(#eee 6.6%, #dfdfdf);
background-image: -o-linear-gradient(#eee 6.6%, #dfdfdf);
ul, li{ ul, li{
list-style: none; list-style: none;
......
...@@ -14,7 +14,6 @@ header { ...@@ -14,7 +14,6 @@ header {
.nav > li > a { .nav > li > a {
color: $style_color; color: $style_color;
text-shadow: 0 1px 0 #fff;
font-size: 14px; font-size: 14px;
line-height: 32px; line-height: 32px;
padding: 6px 10px; padding: 6px 10px;
...@@ -190,7 +189,6 @@ header { ...@@ -190,7 +189,6 @@ header {
.nav > li > a { .nav > li > a {
color: #AAA; color: #AAA;
text-shadow: 0 1px 0 #444;
&:hover, &:focus, &:active { &:hover, &:focus, &:active {
background: none; background: none;
...@@ -224,7 +222,6 @@ header { ...@@ -224,7 +222,6 @@ header {
background: image-url('logo-white.png') no-repeat center center; background: image-url('logo-white.png') no-repeat center center;
background-size: 32px; background-size: 32px;
color: #fff; color: #fff;
text-shadow: 0 1px 1px #444;
} }
} }
} }
...@@ -236,7 +233,6 @@ header { ...@@ -236,7 +233,6 @@ header {
} }
} }
color: #fff; color: #fff;
text-shadow: 0 1px 1px #444;
} }
} }
......
...@@ -73,6 +73,10 @@ ...@@ -73,6 +73,10 @@
.merge-request-info { .merge-request-info {
color: #999; color: #999;
.merge-request-labels {
display: inline-block;
}
} }
} }
} }
...@@ -111,3 +115,7 @@ ...@@ -111,3 +115,7 @@
} }
} }
} }
.merge-request-show-labels .label {
padding: 6px 10px;
}
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
} }
&.modern { &.modern {
background: #345; background: #009871;
} }
&.gray { &.gray {
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
} }
&.violet { &.violet {
background: #547; background: #548;
} }
} }
} }
......
...@@ -151,3 +151,5 @@ ...@@ -151,3 +151,5 @@
} }
} }
} }
#modal-remove-blob > .modal-dialog { width: 850px; }
...@@ -16,28 +16,28 @@ ...@@ -16,28 +16,28 @@
@extend .header-dark; @extend .header-dark;
&.navbar-gitlab { &.navbar-gitlab {
.navbar-inner { .navbar-inner {
background: #547; background: #548;
border-bottom: 1px solid #435; border-bottom: 1px solid #436;
.app_logo, .navbar-toggle { .app_logo, .navbar-toggle {
&:hover { &:hover {
background-color: #435; background-color: #436;
} }
} }
.separator { .separator {
background: #435; background: #436;
border-left: 1px solid #658; border-left: 1px solid #659;
} }
.nav > li > a { .nav > li > a {
color: #98B; color: #98C;
} }
.search-input { .search-input {
border-color: #98B; border-color: #98C;
} }
} }
} }
} }
.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus { .nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
background: #769; background: #659;
} }
} }
...@@ -16,24 +16,28 @@ ...@@ -16,24 +16,28 @@
@extend .header-dark; @extend .header-dark;
&.navbar-gitlab { &.navbar-gitlab {
.navbar-inner { .navbar-inner {
background: #345; background: #00AC7E;
border-bottom: 1px solid #234; border-bottom: 1px solid #00AC7E;
.app_logo, .navbar-toggle { .app_logo, .navbar-toggle {
&:hover { &:hover {
background-color: #234; background-color: #009C6E;
} }
} }
.separator { .separator {
background: #234; background: #009C6F;
border-left: 1px solid #456; border-left: 1px solid #10BC8E;
} }
.nav > li > a { .nav > li > a {
color: #89A; color: #ADC;
} }
.search-input { .search-input {
border-color: #89A; border-color: #7fd5be;
} }
} }
} }
} }
.nav-pills > li.active > a, .nav-pills > li.active > a:hover, .nav-pills > li.active > a:focus {
background: #00AC7E;
}
} }
...@@ -117,6 +117,11 @@ class ApplicationController < ActionController::Base ...@@ -117,6 +117,11 @@ class ApplicationController < ActionController::Base
return access_denied! unless can?(current_user, :push_code, project) return access_denied! unless can?(current_user, :push_code, project)
end end
def authorize_labels!
# Labels should be accessible for issues and/or merge requests
authorize_read_issue! || authorize_read_merge_request!
end
def access_denied! def access_denied!
render "errors/access_denied", layout: "errors", status: 404 render "errors/access_denied", layout: "errors", status: 404
end end
......
...@@ -70,7 +70,7 @@ class GroupsController < ApplicationController ...@@ -70,7 +70,7 @@ class GroupsController < ApplicationController
@members = group.users_groups @members = group.users_groups
if params[:search].present? if params[:search].present?
users = group.users.search(params[:search]) users = group.users.search(params[:search]).to_a
@members = @members.where(user_id: users) @members = @members.where(user_id: users)
end end
......
class Projects::LabelsController < Projects::ApplicationController class Projects::LabelsController < Projects::ApplicationController
before_filter :module_enabled before_filter :module_enabled
# Allow read any issue before_filter :authorize_labels!
before_filter :authorize_read_issue!
respond_to :js, :html respond_to :js, :html
...@@ -13,12 +12,18 @@ class Projects::LabelsController < Projects::ApplicationController ...@@ -13,12 +12,18 @@ class Projects::LabelsController < Projects::ApplicationController
def generate def generate
Gitlab::IssuesLabels.generate(@project) Gitlab::IssuesLabels.generate(@project)
if params[:redirect] == 'issues'
redirect_to project_issues_path(@project) redirect_to project_issues_path(@project)
elsif params[:redirect] == 'merge_requests'
redirect_to project_merge_requests_path(@project)
end
end end
protected protected
def module_enabled def module_enabled
return render_404 unless @project.issues_enabled unless @project.issues_enabled || @project.merge_requests_enabled
return render_404
end
end end
end end
...@@ -4,6 +4,7 @@ module Emails ...@@ -4,6 +4,7 @@ module Emails
@issue = Issue.find(issue_id) @issue = Issue.find(issue_id)
@project = @issue.project @project = @issue.project
@target_url = project_issue_url(@project, @issue) @target_url = project_issue_url(@project, @issue)
set_message_id("issue_#{issue_id}")
mail(from: sender(@issue.author_id), mail(from: sender(@issue.author_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@issue.title} (##{@issue.iid})")) subject: subject("#{@issue.title} (##{@issue.iid})"))
...@@ -14,6 +15,7 @@ module Emails ...@@ -14,6 +15,7 @@ module Emails
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
@project = @issue.project @project = @issue.project
@target_url = project_issue_url(@project, @issue) @target_url = project_issue_url(@project, @issue)
set_reference("issue_#{issue_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@issue.title} (##{@issue.iid})")) subject: subject("#{@issue.title} (##{@issue.iid})"))
...@@ -24,6 +26,7 @@ module Emails ...@@ -24,6 +26,7 @@ module Emails
@project = @issue.project @project = @issue.project
@updated_by = User.find updated_by_user_id @updated_by = User.find updated_by_user_id
@target_url = project_issue_url(@project, @issue) @target_url = project_issue_url(@project, @issue)
set_reference("issue_#{issue_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@issue.title} (##{@issue.iid})")) subject: subject("#{@issue.title} (##{@issue.iid})"))
...@@ -35,6 +38,7 @@ module Emails ...@@ -35,6 +38,7 @@ module Emails
@project = @issue.project @project = @issue.project
@updated_by = User.find updated_by_user_id @updated_by = User.find updated_by_user_id
@target_url = project_issue_url(@project, @issue) @target_url = project_issue_url(@project, @issue)
set_reference("issue_#{issue_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@issue.title} (##{@issue.iid})")) subject: subject("#{@issue.title} (##{@issue.iid})"))
......
...@@ -4,6 +4,7 @@ module Emails ...@@ -4,6 +4,7 @@ module Emails
@merge_request = MergeRequest.find(merge_request_id) @merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project @project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request) @target_url = project_merge_request_url(@project, @merge_request)
set_message_id("merge_request_#{merge_request_id}")
mail(from: sender(@merge_request.author_id), mail(from: sender(@merge_request.author_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
...@@ -14,6 +15,7 @@ module Emails ...@@ -14,6 +15,7 @@ module Emails
@previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id @previous_assignee = User.find_by(id: previous_assignee_id) if previous_assignee_id
@project = @merge_request.project @project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request) @target_url = project_merge_request_url(@project, @merge_request)
set_reference("merge_request_#{merge_request_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
...@@ -24,6 +26,7 @@ module Emails ...@@ -24,6 +26,7 @@ module Emails
@updated_by = User.find updated_by_user_id @updated_by = User.find updated_by_user_id
@project = @merge_request.project @project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request) @target_url = project_merge_request_url(@project, @merge_request)
set_reference("merge_request_#{merge_request_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
...@@ -33,6 +36,7 @@ module Emails ...@@ -33,6 +36,7 @@ module Emails
@merge_request = MergeRequest.find(merge_request_id) @merge_request = MergeRequest.find(merge_request_id)
@project = @merge_request.project @project = @merge_request.project
@target_url = project_merge_request_url(@project, @merge_request) @target_url = project_merge_request_url(@project, @merge_request)
set_reference("merge_request_#{merge_request_id}")
mail(from: sender(updated_by_user_id), mail(from: sender(updated_by_user_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
......
...@@ -15,6 +15,7 @@ module Emails ...@@ -15,6 +15,7 @@ module Emails
@issue = @note.noteable @issue = @note.noteable
@project = @note.project @project = @note.project
@target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}") @target_url = project_issue_url(@project, @issue, anchor: "note_#{@note.id}")
set_reference("issue_#{@issue.id}")
mail(from: sender(@note.author_id), mail(from: sender(@note.author_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@issue.title} (##{@issue.iid})")) subject: subject("#{@issue.title} (##{@issue.iid})"))
...@@ -25,6 +26,7 @@ module Emails ...@@ -25,6 +26,7 @@ module Emails
@merge_request = @note.noteable @merge_request = @note.noteable
@project = @note.project @project = @note.project
@target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}") @target_url = project_merge_request_url(@project, @merge_request, anchor: "note_#{@note.id}")
set_reference("merge_request_#{@merge_request.id}")
mail(from: sender(@note.author_id), mail(from: sender(@note.author_id),
to: recipient(recipient_id), to: recipient(recipient_id),
subject: subject("#{@merge_request.title} (##{@merge_request.iid})")) subject: subject("#{@merge_request.title} (##{@merge_request.iid})"))
......
...@@ -53,6 +53,22 @@ class Notify < ActionMailer::Base ...@@ -53,6 +53,22 @@ class Notify < ActionMailer::Base
end end
end end
# Set the Message-ID header field
#
# local_part - The local part of the message ID
#
def set_message_id(local_part)
headers["Message-ID"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>"
end
# Set the References header field
#
# local_part - The local part of the referenced message ID
#
def set_reference(local_part)
headers["References"] = "<#{local_part}@#{Gitlab.config.gitlab.host}>"
end
# Formats arguments into a String suitable for use as an email subject # Formats arguments into a String suitable for use as an email subject
# #
# extra - Extra Strings to be inserted into the subject # extra - Extra Strings to be inserted into the subject
......
...@@ -36,7 +36,9 @@ class MergeRequest < ActiveRecord::Base ...@@ -36,7 +36,9 @@ class MergeRequest < ActiveRecord::Base
delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil delegate :commits, :diffs, :last_commit, :last_commit_short_sha, to: :merge_request_diff, prefix: nil
attr_accessible :title, :assignee_id, :source_project_id, :source_branch, :target_project_id, :target_branch, :milestone_id, :state_event, :description attr_accessible :title, :assignee_id, :source_project_id, :source_branch,
:target_project_id, :target_branch, :milestone_id,
:state_event, :description, :label_list
attr_accessor :should_remove_source_branch attr_accessor :should_remove_source_branch
...@@ -44,6 +46,9 @@ class MergeRequest < ActiveRecord::Base ...@@ -44,6 +46,9 @@ class MergeRequest < ActiveRecord::Base
# It allows us to close or modify broken merge requests # It allows us to close or modify broken merge requests
attr_accessor :allow_broken attr_accessor :allow_broken
ActsAsTaggableOn.strict_case_match = true
acts_as_taggable_on :labels
state_machine :state, initial: :opened do state_machine :state, initial: :opened do
event :close do event :close do
transition [:reopened, :opened] => :closed transition [:reopened, :opened] => :closed
......
...@@ -292,8 +292,11 @@ class Project < ActiveRecord::Base ...@@ -292,8 +292,11 @@ class Project < ActiveRecord::Base
self.id self.id
end end
# Tags are shared by issues and merge requests
def issues_labels def issues_labels
@issues_labels ||= (issues_default_labels + issues.tags_on(:labels)).uniq.sort_by(&:name) @issues_labels ||= (issues_default_labels +
merge_requests.tags_on(:labels) +
issues.tags_on(:labels)).uniq.sort_by(&:name)
end end
def issue_exists?(issue_id) def issue_exists?(issue_id)
......
...@@ -31,7 +31,8 @@ class SystemHooksService ...@@ -31,7 +31,8 @@ class SystemHooksService
path_with_namespace: model.path_with_namespace, path_with_namespace: model.path_with_namespace,
project_id: model.id, project_id: model.id,
owner_name: owner.name, owner_name: owner.name,
owner_email: owner.respond_to?(:email) ? owner.email : nil owner_email: owner.respond_to?(:email) ? owner.email : nil,
project_visibility: Project.visibility_levels.key(model.visibility_level_field).downcase
}) })
when User when User
data.merge!({ data.merge!({
...@@ -46,7 +47,8 @@ class SystemHooksService ...@@ -46,7 +47,8 @@ class SystemHooksService
project_id: model.project_id, project_id: model.project_id,
user_name: model.user.name, user_name: model.user.name,
user_email: model.user.email, user_email: model.user.email,
project_access: model.human_access project_access: model.human_access,
project_visibility: Project.visibility_levels.key(model.project.visibility_level_field).downcase
}) })
end end
end end
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
= form_for [:admin, @user], html: { class: 'form-horizontal' } do |f| = form_for [:admin, @user], html: { class: 'form-horizontal' } do |f|
-if @user.errors.any? -if @user.errors.any?
#error_explanation #error_explanation
%ul.unstyled.alert.alert-danger .alert.alert-danger
- @user.errors.full_messages.each do |msg| - @user.errors.full_messages.each do |msg|
%li= msg %p= msg
%fieldset %fieldset
%legend Account %legend Account
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
- note = event.target - note = event.target
- if note.attachment.url - if note.attachment.url
- if note.attachment.image? - if note.attachment.image?
= link_to note.attachment.url, target: '_blank' do = link_to note.attachment.secure_url, target: '_blank' do
= image_tag note.attachment.url, class: 'note-image-attach' = image_tag note.attachment.secure_url, class: 'note-image-attach'
- else - else
= link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do = link_to note.attachment.secure_url, target: "_blank", class: 'note-file-attach' do
%i.icon-paper-clip %i.icon-paper-clip
......
.dashboard .dashboard
.activities.col-md-8.hidden-sm .activities.col-md-8.hidden-sm.hidden-xs
- if current_user - if current_user
= render "events/event_last_push", event: @last_push = render "events/event_last_push", event: @last_push
= link_to dashboard_path, class: 'btn btn-tiny' do = link_to dashboard_path, class: 'btn btn-tiny' do
......
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
- else - else
= link_to title, '#' = link_to title, '#'
%ul.blob-commit-info.bs-callout.bs-callout-info %ul.blob-commit-info.bs-callout.bs-callout-info.hidden-xs
- blob_commit = @repository.last_commit_for_path(@commit.id, @blob.path) - blob_commit = @repository.last_commit_for_path(@commit.id, @blob.path)
= render blob_commit, project: @project = render blob_commit, project: @project
%div#tree-content-holder.tree-content-holder %div#tree-content-holder.tree-content-holder
.file-holder .file-holder
.file-title .file-title.clearfix
%i.icon-file %i.icon-file
%span.file_name %span.file_name
= blob.name = blob.name
%small= number_to_human_size blob.size %small= number_to_human_size blob.size
%span.options= render "actions" %span.options.hidden-xs= render "actions"
- if blob.text? - if blob.text?
= render "text", blob: blob = render "text", blob: blob
- elsif blob.image? - elsif blob.image?
......
...@@ -14,7 +14,8 @@ ...@@ -14,7 +14,8 @@
= label_tag 'commit_message', class: "control-label" do = label_tag 'commit_message', class: "control-label" do
Commit message Commit message
.col-sm-10 .col-sm-10
= text_area_tag 'commit_message', params[:commit_message], placeholder: "Removed this file because...", required: true, rows: 3, class: 'form-control' = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message',
params[:commit_message], placeholder: "Removed this file because...", required: true, rows: 3, class: 'form-control')}
.form-group .form-group
.col-sm-2 .col-sm-2
.col-sm-10 .col-sm-10
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
= label_tag 'commit_message', class: "control-label" do = label_tag 'commit_message', class: "control-label" do
Commit message Commit message
.col-sm-10 .col-sm-10
= text_area_tag 'commit_message', '', placeholder: "Update #{@blob.name}", required: true, rows: 3, class: 'form-control' = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message', '',
placeholder: "Update #{@blob.name}", required: true, rows: 3, class: 'form-control')}
.form-actions .form-actions
= hidden_field_tag 'last_commit', @last_commit = hidden_field_tag 'last_commit', @last_commit
= hidden_field_tag 'content', '', id: "file-content" = hidden_field_tag 'content', '', id: "file-content"
......
= render "head" = render "head"
.row .row
.col-md-3 .col-md-3
= render 'shared/project_filter', project_entities_path: project_issues_path(@project), labels: true = render 'shared/project_filter', project_entities_path: project_issues_path(@project),
labels: true, redirect: 'issues'
.col-md-9.issues-holder .col-md-9.issues-holder
= render "issues" = render "issues"
...@@ -42,6 +42,15 @@ ...@@ -42,6 +42,15 @@
.col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'}) .col-sm-10= f.select(:milestone_id, milestone_options(@merge_request), { include_blank: "Select milestone" }, {class: 'select2'})
- if @merge_request.persisted? # Only allow labels on edit to avoid fork vs upstream repo labels issue
.form-group
= f.label :label_list, class: 'control-label' do
%i.icon-tag
Labels
.col-sm-10
= f.text_field :label_list, maxlength: 2000, class: "form-control"
%p.hint Separate labels with commas.
.form-actions .form-actions
- if @merge_request.new_record? - if @merge_request.new_record?
= f.submit 'Submit merge request', class: "btn btn-create" = f.submit 'Submit merge request', class: "btn btn-create"
...@@ -60,3 +69,32 @@ ...@@ -60,3 +69,32 @@
$('#merge_request_assignee_id').val("#{current_user.id}").trigger("change"); $('#merge_request_assignee_id').val("#{current_user.id}").trigger("change");
e.preventDefault(); e.preventDefault();
}); });
$("#merge_request_label_list")
.bind( "keydown", function( event ) {
if ( event.keyCode === $.ui.keyCode.TAB &&
$( this ).data( "autocomplete" ).menu.active ) {
event.preventDefault();
}
})
.bind("click", function(event) {
$(this).autocomplete("search", "");
})
.autocomplete({
minLength: 0,
source: function( request, response ) {
response( $.ui.autocomplete.filter(
#{raw labels_autocomplete_source}, extractLast( request.term ) ) );
},
focus: function() {
return false;
},
select: function(event, ui) {
var terms = split( this.value );
terms.pop();
terms.push( ui.item.value );
terms.push( "" );
this.value = terms.join( ", " );
return false;
}
});
...@@ -31,3 +31,9 @@ ...@@ -31,3 +31,9 @@
.pull-right .pull-right
%small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')} %small updated #{time_ago_with_tooltip(merge_request.updated_at, 'bottom', 'merge_request_updated_ago')}
.merge-request-labels
- merge_request.labels.each do |label|
%span{class: "label #{label_css_class(label.name)}"}
%i.icon-tag
= label.name
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
= render "projects/merge_requests/show/mr_box" = render "projects/merge_requests/show/mr_box"
= render "projects/merge_requests/show/state_widget" = render "projects/merge_requests/show/state_widget"
= render "projects/merge_requests/show/commits" = render "projects/merge_requests/show/commits"
= render "projects/merge_requests/show/participants"
- if @commits.present? - if @commits.present?
%ul.nav.nav-tabs %ul.nav.nav-tabs
......
...@@ -8,7 +8,8 @@ ...@@ -8,7 +8,8 @@
%hr %hr
.row .row
.col-md-3 .col-md-3
= render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project) = render 'shared/project_filter', project_entities_path: project_merge_requests_path(@project),
labels: true, redirect: 'merge_requests'
.col-md-9 .col-md-9
.mr-filters.append-bottom-10 .mr-filters.append-bottom-10
.dropdown.inline .dropdown.inline
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
- if @show_merge_controls - if @show_merge_controls
.automerge_widget.can_be_merged.hide .automerge_widget.can_be_merged.hide
.clearfix .clearfix
= form_for [:automerge, @project, @merge_request], remote: true, method: :get do |f| = form_for [:automerge, @project, @merge_request], remote: true, method: :post do |f|
%h4 %h4
You can accept this request automatically. You can accept this request automatically.
%div %div
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
= link_to "click here", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal" = link_to "click here", "#modal_merge_info", class: "how_to_merge_link vlink", title: "How To Merge", "data-toggle" => "modal"
for instructions. for instructions.
.js-toggle-container .js-toggle-container
%p %p
If you want to modify merge commit message - If you want to modify merge commit message -
...@@ -31,7 +30,8 @@ ...@@ -31,7 +30,8 @@
.form-group .form-group
= label_tag :merge_commit_message, "Commit message", class: 'control-label' = label_tag :merge_commit_message, "Commit message", class: 'control-label'
.col-sm-10 .col-sm-10
= text_area_tag :merge_commit_message, @merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true = render 'shared/commit_message_container', {textarea: text_area_tag(:merge_commit_message,
@merge_request.merge_commit_message, class: "form-control js-gfm-input", rows: 14, required: true)}
%p.hint %p.hint
The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines. The recommended maximum line length is 52 characters for the first line and 72 characters for all following lines.
......
.participants
%cite.cgray #{@merge_request.participants.count} participants
- @merge_request.participants.each do |participant|
= link_to_member(@project, participant, name: false, size: 24)
.merge-request-show-labels.pull-right
- @merge_request.labels.each do |label|
%span{class: "label #{label_css_class(label.name)}"}
%i.icon-tag
= label.name
&nbsp;
= render "projects/issues/head" = render "projects/issues/head"
%h3.page-title %h3.page-title
Milestone ##{@milestone.iid} Milestone ##{@milestone.iid}
%small
= @milestone.expires_at
.pull-right .pull-right
- if can?(current_user, :admin_milestone, @project) - if can?(current_user, :admin_milestone, @project)
= link_to edit_project_milestone_path(@project, @milestone), class: "btn btn-grouped" do = link_to edit_project_milestone_path(@project, @milestone), class: "btn btn-grouped" do
...@@ -23,14 +21,16 @@ ...@@ -23,14 +21,16 @@
.issue-box{ class: issue_box_class(@milestone) } .issue-box{ class: issue_box_class(@milestone) }
.state .state.clearfix
%span.state-label .state-label.col-sm-2.col-xs-12
- if @milestone.closed? - if @milestone.closed?
Closed Closed
- elsif @milestone.expired? - elsif @milestone.expired?
Expired Expired
- else - else
Open Open
%span.creator.col-sm-9.col-xs-12
= @milestone.expires_at
%h4.title %h4.title
= gfm escape_once(@milestone.title) = gfm escape_once(@milestone.title)
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
= label_tag 'commit_message', class: "control-label" do = label_tag 'commit_message', class: "control-label" do
Commit message Commit message
.col-sm-10 .col-sm-10
= text_area_tag 'commit_message', params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control' = render 'shared/commit_message_container', {textarea: text_area_tag('commit_message',
params[:commit_message], placeholder: "Added new file", required: true, rows: 3, class: 'form-control')}
.file-holder .file-holder
.file-title .file-title
......
...@@ -54,8 +54,8 @@ ...@@ -54,8 +54,8 @@
- if note.attachment.url - if note.attachment.url
.note-attachment .note-attachment
- if note.attachment.image? - if note.attachment.image?
= link_to note.attachment.url, target: '_blank' do = link_to note.attachment.secure_url, target: '_blank' do
= image_tag note.attachment.url, class: 'note-image-attach' = image_tag note.attachment.secure_url, class: 'note-image-attach'
.attachment.pull-right .attachment.pull-right
= link_to note.attachment.secure_url, target: "_blank" do = link_to note.attachment.secure_url, target: "_blank" do
%i.icon-paper-clip %i.icon-paper-clip
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
= render 'shared/event_filter' = render 'shared/event_filter'
.content_list .content_list
= spinner = spinner
.col-md-3.project-side.hidden-sm .col-md-3.project-side.hidden-sm.hidden-xs
.clearfix .clearfix
- if @project.archived? - if @project.archived?
.alert.alert-warning .alert.alert-warning
......
= form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f| = form_for [@project, @page], method: @page.persisted? ? :put : :post, html: { class: 'form-horizontal' } do |f|
-if @page.errors.any? -if @page.errors.any?
#error_explanation #error_explanation
%h2= "#{pluralize(@page.errors.count, "error")} prohibited this wiki from being saved:" .alert.alert-danger
%ul
- @page.errors.full_messages.each do |msg| - @page.errors.full_messages.each do |msg|
%li= msg %p= msg
= f.hidden_field :title, value: @page.title = f.hidden_field :title, value: @page.title
.form-group .form-group
......
.commit-message-container
.max-width-marker
-# When the `ch` CSS length unit becomes widely supported `http://www.quirksmode.org/css/units-values` remove this workaround.
= 'a' * 72
= textarea
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
.light-well .light-well
Add first label to your issues Add first label to your issues
%br %br
or #{link_to 'generate', generate_project_labels_path(@project), method: :post} default set of labels or #{link_to 'generate', generate_project_labels_path(@project, redirect: redirect), method: :post} default set of labels
%fieldset %fieldset
- if %w(state scope milestone_id assignee_id label_name).select { |k| params[k].present? }.any? - if %w(state scope milestone_id assignee_id label_name).select { |k| params[k].present? }.any?
......
...@@ -66,13 +66,16 @@ module Gitlab ...@@ -66,13 +66,16 @@ module Gitlab
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
# Relative url support
# Uncomment and customize the last line to run in a non-root path # Uncomment and customize the last line to run in a non-root path
# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. # WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this.
# Note that four settings need to be changed for this to work. # Note that following settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab" # 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab # 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" # 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab" # 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"
# 5) In lib/support/nginx/gitlab : do not use asset gzipping, remove block starting with "location ~ ^/(assets)/"
#
# To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production # To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
# #
# config.relative_url_root = "/gitlab" # config.relative_url_root = "/gitlab"
......
...@@ -24,15 +24,8 @@ production: &base ...@@ -24,15 +24,8 @@ production: &base
# Otherwise, ssh host will be set to the `host:` value above # Otherwise, ssh host will be set to the `host:` value above
# ssh_host: ssh.host_example.com # ssh_host: ssh.host_example.com
# Uncomment and customize the last line to run in a non-root path # WARNING: See config/application.rb under "Relative url support" for the list of
# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. # other files that need to be changed for relative url support
# Note that four settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"
# To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
#
# relative_url_root: /gitlab # relative_url_root: /gitlab
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git') # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
...@@ -40,10 +33,10 @@ production: &base ...@@ -40,10 +33,10 @@ production: &base
## Email settings ## Email settings
# Email address used in the "From" field in mails sent by GitLab # Email address used in the "From" field in mails sent by GitLab
email_from: gitlab@localhost email_from: example@example.com
# Email address of your support contact (default: same as email_from) # Email address of your support contact (default: same as email_from)
support_email: support@localhost support_email: support@example.com
## User settings ## User settings
default_projects_limit: 10 default_projects_limit: 10
......
...@@ -287,7 +287,7 @@ Gitlab::Application.routes.draw do ...@@ -287,7 +287,7 @@ Gitlab::Application.routes.draw do
resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do resources :merge_requests, constraints: {id: /\d+/}, except: [:destroy] do
member do member do
get :diffs get :diffs
get :automerge post :automerge
get :automerge_check get :automerge_check
get :ci_status get :ci_status
end end
......
...@@ -8,14 +8,8 @@ ...@@ -8,14 +8,8 @@
# See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete # See http://unicorn.bogomips.org/Unicorn/Configurator.html for complete
# documentation. # documentation.
# Uncomment and customize the last line to run in a non-root path # WARNING: See config/application.rb under "Relative url support" for the list of
# WARNING: We recommend creating a FQDN to host GitLab in a root path instead of this. # other files that need to be changed for relative url support
# Note that four settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
# 4) In ../gitlab-shell/config.yml: gitlab_url: "http://127.0.0.1/gitlab"
# To update the path, run: sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production
# #
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab" # ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
+ [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python + [python-gitlab](https://github.com/Itxaka/python-gitlab) - Python
+ [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java + [java-gitlab-api](https://github.com/timols/java-gitlab-api) - Java
+ [node-gitlab](https://github.com/moul/node-gitlab) - Node.js + [node-gitlab](https://github.com/moul/node-gitlab) - Node.js
+ [NGitLab](https://github.com/Scooletz/NGitLab) - .NET
## Introduction ## Introduction
......
# Adding deploy keys to multiple projects
If you want to easily add the same deploy key to multiple projects in the same group, this can be achieved quite easily with the API.
First, find the ID of the projects you're interested in, by either listing all projects:
```
curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/projects
```
Or finding the id of a group and then listing all projects in that group:
```
curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/groups
# For group 1234:
curl --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/groups/1234
```
With those IDs, add the same deploy key to all:
```
for project_id in 321 456 987; do
curl -X POST --data '{"title": "my key", "key": "ssh-rsa AAAA..."}' --header 'PRIVATE-TOKEN: abcdef' https://gitlab.com/api/v3/projects/${project_id}/keys
done
```
...@@ -189,6 +189,54 @@ Parameters: ...@@ -189,6 +189,54 @@ Parameters:
``` ```
## Accept MR
Merge changes submitted with MR usign this API.
If merge success you get 200 OK.
If it has some conflicts and can not be merged - you get 405 and error message 'Branch cannot be merged'
If merge request is already merged or closed - you get 405 and error message 'Method Not Allowed'
If you dont have permissions to accept this merge request - you get 401
```
PUT /projects/:id/merge_request/:merge_request_id/merge
```
Parameters:
+ `id` (required) - The ID of a project
+ `merge_request_id` (required) - ID of MR
+ `merge_commit_message` (optional) - Custom merge commit message
```json
{
"id": 1,
"target_branch": "master",
"source_branch": "test1",
"project_id": 3,
"title": "test1",
"state": "merged",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1,
"username": "admin",
"email": "admin@local.host",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
},
"assignee": {
"id": 1,
"username": "admin",
"email": "admin@local.host",
"name": "Administrator",
"state": "active",
"created_at": "2012-04-29T08:46:00Z"
}
}
```
## Post comment to MR ## Post comment to MR
Adds a comment to a merge request. Adds a comment to a merge request.
......
...@@ -43,7 +43,8 @@ GET /projects ...@@ -43,7 +43,8 @@ GET /projects
"owner_id": 1, "owner_id": 1,
"path": "diaspora", "path": "diaspora",
"updated_at": "2013-09-30T13: 46: 02Z" "updated_at": "2013-09-30T13: 46: 02Z"
} },
"archived": false
}, },
{ {
"id": 6, "id": 6,
...@@ -78,7 +79,8 @@ GET /projects ...@@ -78,7 +79,8 @@ GET /projects
"owner_id": 1, "owner_id": 1,
"path": "brightbox", "path": "brightbox",
"updated_at": "2013-09-30T13:46:02Z" "updated_at": "2013-09-30T13:46:02Z"
} },
"archived": false
} }
] ]
``` ```
...@@ -157,7 +159,8 @@ Parameters: ...@@ -157,7 +159,8 @@ Parameters:
"access_level": 50, "access_level": 50,
"notification_level": 3 "notification_level": 3
} }
} },
"archived": false
} }
``` ```
......
...@@ -101,8 +101,8 @@ Remove the old Ruby 1.8 if present ...@@ -101,8 +101,8 @@ Remove the old Ruby 1.8 if present
Download Ruby and compile it: Download Ruby and compile it:
mkdir /tmp/ruby && cd /tmp/ruby mkdir /tmp/ruby && cd /tmp/ruby
curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p481.tar.gz | tar xz
cd ruby-2.0.0-p353 cd ruby-2.0.0-p481
./configure --disable-install-rdoc ./configure --disable-install-rdoc
make make
sudo make install sudo make install
...@@ -150,13 +150,13 @@ NOTE: because we need to make use of extensions you need at least pgsql 9.1. ...@@ -150,13 +150,13 @@ NOTE: because we need to make use of extensions you need at least pgsql 9.1.
## Clone the Source ## Clone the Source
# Clone GitLab repository # Clone GitLab repository
sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-8-stable-ee gitlab sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-ce.git -b 6-9-stable-ee gitlab
# Go to gitlab dir # Go to gitlab dir
cd /home/git/gitlab cd /home/git/gitlab
**Note:** **Note:**
You can change `6-8-stable-ee` to `master` if you want the *bleeding edge* version, but never install master on a production server! You can change `6-9-stable-ee` to `master` if you want the *bleeding edge* version, but never install master on a production server!
## Configure it ## Configure it
...@@ -201,7 +201,7 @@ You can change `6-8-stable-ee` to `master` if you want the *bleeding edge* versi ...@@ -201,7 +201,7 @@ You can change `6-8-stable-ee` to `master` if you want the *bleeding edge* versi
# Configure Git global settings for git user, useful when editing via web # Configure Git global settings for git user, useful when editing via web
# Edit user.email according to what is set in gitlab.yml # Edit user.email according to what is set in gitlab.yml
sudo -u git -H git config --global user.name "GitLab" sudo -u git -H git config --global user.name "GitLab"
sudo -u git -H git config --global user.email "gitlab@localhost" sudo -u git -H git config --global user.email "example@example.com"
sudo -u git -H git config --global core.autocrlf input sudo -u git -H git config --global core.autocrlf input
**Important Note:** **Important Note:**
...@@ -244,15 +244,6 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. ...@@ -244,15 +244,6 @@ that were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2.
# Or if you use MySQL (note, the option says "without ... postgres") # Or if you use MySQL (note, the option says "without ... postgres")
sudo -u git -H bundle install --deployment --without development test postgres aws sudo -u git -H bundle install --deployment --without development test postgres aws
## Initialize Database and Activate Advanced Features
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
# Type 'yes' to create the database tables.
# When done you see 'Administrator account created:'
## Install GitLab shell ## Install GitLab shell
GitLab Shell is an ssh access and repository management software developed specially for GitLab. GitLab Shell is an ssh access and repository management software developed specially for GitLab.
...@@ -261,11 +252,20 @@ GitLab Shell is an ssh access and repository management software developed speci ...@@ -261,11 +252,20 @@ GitLab Shell is an ssh access and repository management software developed speci
cd /home/git/gitlab cd /home/git/gitlab
# Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed):
sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.3] REDIS_URL=redis://localhost:6379 RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:shell:install[v1.9.4] REDIS_URL=redis://localhost:6379 RAILS_ENV=production
# By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows: # By default, the gitlab-shell config is generated from your main gitlab config. You can review (and modify) it as follows:
sudo -u git -H editor /home/git/gitlab-shell/config.yml sudo -u git -H editor /home/git/gitlab-shell/config.yml
## Initialize Database and Activate Advanced Features
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
# Type 'yes' to create the database tables.
# When done you see 'Administrator account created:'
## Install Init Script ## Install Init Script
Download the init script (will be /etc/init.d/gitlab): Download the init script (will be /etc/init.d/gitlab):
......
...@@ -53,7 +53,7 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab ...@@ -53,7 +53,7 @@ We love [JRuby](http://jruby.org/) and [Rubinius](http://rubini.us/)) but GitLab
## Memory ## Memory
- 512MB is the abolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this - 512MB is the absolute minimum, you need 256MB of swap, you can configure only one slow unicorn worker, only ssh access will work, we do not recommend this
- 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates using swap space) - 1GB supports up to 100 users (with individual repositories under 250MB, otherwise git memory usage necessitates using swap space)
- **2GB** is the **recommended** memory size and supports up to 500 users - **2GB** is the **recommended** memory size and supports up to 500 users
- 4GB supports up to 2,000 users - 4GB supports up to 2,000 users
...@@ -82,6 +82,6 @@ If you want to run the database separately, the **recommended** database size is ...@@ -82,6 +82,6 @@ If you want to run the database separately, the **recommended** database size is
- Chrome (Latest stable version) - Chrome (Latest stable version)
- Firefox (Latest released version) - Firefox (Latest released version)
- Safari 7+ (Know problem: required fields in html5 do not work) - Safari 7+ (known problem: required fields in html5 do not work)
- Opera (Latest released version) - Opera (Latest released version)
- IE 10+ - IE 10+
...@@ -24,9 +24,9 @@ Version: 5.1.0.beta2 ...@@ -24,9 +24,9 @@ Version: 5.1.0.beta2
Revision: 4da8b37 Revision: 4da8b37
Directory: /home/git/gitlab Directory: /home/git/gitlab
DB Adapter: mysql2 DB Adapter: mysql2
URL: http://localhost URL: http://example.com
HTTP Clone URL: http://localhost/some-project.git HTTP Clone URL: http://example.com/some-project.git
SSH Clone URL: git@localhost:some-project.git SSH Clone URL: git@example.com:some-project.git
Using LDAP: no Using LDAP: no
Using Omniauth: no Using Omniauth: no
......
# Things to do when creating new monthly minor or major release # Monthly Release
NOTE: This is a guide for GitLab developers. If you are trying to install GitLab see the latest stable [installation guide](install/installation.md) and if you are trying to upgrade, see the [upgrade guides](update). NOTE: This is a guide for GitLab developers.
## Install guide up to date? # **15th - Code Freeze & Release Manager**
* References correct GitLab branch `x-x-stable` and correct GitLab shell tag? ### **1. Stop merging in code, except for important bugfixes**
## Make upgrade guide ### **2. Release Manager**
### From x.x to x.x A release manager is selected that coordinates the entire release of this version. The release manager has to make sure all the steps below are done and delegated where necessary. This person should also make sure this document is kept up to date and issues are created and updated.
#### 0. Any major changes? Database updates? Web server change? File structure changes? # **18th - Releasing RC1**
The RC1 release comes with the task to update the installation and upgrade docs. Be mindful that there might already be merge requests for this on GitLab or GitHub.
### **1. Create an issue for RC1 release**
### **2. Update the installation guide**
1. Check if it references the correct branch `x-x-stable` (doesn't exist yet, but that is okay)
2. Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782)
3. Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794)
4. There might be other changes. Ask around.
### **3. Create an update guide**
It's best to copy paste the previous guide and make changes where necessary. The typical steps are listed below with any points you should specifically look at.
#### 0. Any major changes?
List any major changes here, so the user is aware of them before starting to upgrade. For instance:
- Database updates
- Web server changes
- File structure changes
#### 1. Make backup #### 1. Make backup
...@@ -17,9 +38,9 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab ...@@ -17,9 +38,9 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab
#### 3. Do users need to update dependencies like `git`? #### 3. Do users need to update dependencies like `git`?
- Check the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) - Check if the [GitLab Shell version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L782) changed since the last release.
- Check the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) - Check if the [Git version](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/lib/tasks/gitlab/check.rake#L794) changed since the last release.
#### 4. Get latest code #### 4. Get latest code
...@@ -29,7 +50,7 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab ...@@ -29,7 +50,7 @@ NOTE: This is a guide for GitLab developers. If you are trying to install GitLab
#### 7. Any config files updated since last release? #### 7. Any config files updated since last release?
Check if any of these changed since last release (~22nd of last month depending on when last release branch was created): Check if any of these changed since last release:
* https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab * https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/nginx/gitlab
* https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example * https://gitlab.com/gitlab-org/gitlab-shell/commits/master/config.yml.example
...@@ -40,13 +61,14 @@ Check if any of these changed since last release (~22nd of last month depending ...@@ -40,13 +61,14 @@ Check if any of these changed since last release (~22nd of last month depending
#### 8. Need to update init script? #### 8. Need to update init script?
Check if changed since last release (~22nd of last month depending on when last release branch was created): https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab Check if the init.d/gitlab script changed since last release: https://gitlab.com/gitlab-org/gitlab-ce/commits/master/lib/support/init.d/gitlab
#### 9. Start application #### 9. Start application
#### 10. Check application status #### 10. Check application status
## Make sure the code quality indicatiors are good ### **4. Code quality indicatiors**
Make sure the code quality indicators are green / good.
* [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch) * [![build status](http://ci.gitlab.org/projects/1/status.png?ref=master)](http://ci.gitlab.org/projects/1?ref=master) on ci.gitlab.org (master branch)
...@@ -58,49 +80,88 @@ Check if changed since last release (~22nd of last month depending on when last ...@@ -58,49 +80,88 @@ Check if changed since last release (~22nd of last month depending on when last
* [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq) * [![Coverage Status](https://coveralls.io/repos/gitlabhq/gitlabhq/badge.png?branch=master)](https://coveralls.io/r/gitlabhq/gitlabhq)
## Release Schedule ### **5. Set VERSION**
After making the release branch new commits are cherry-picked from master. When the release gets closer we get more selective what is cherry-picked. The days of the month are approximately as follows: Set VERSION tot x.x.0.rc1
* 1-7th: Official merge window (see contributing guide).
* 8-14th: Work on bugfixes, sponsored features and GitLab EE. ### **6. Tag**
* 15th: Code freeze
- Stop merging into master, except essential bugfixes Create an annotated tag that points to the version change commit.
- Select a Release Manager ```
* 18th: Release Candidate 1 git tag -a vx.x.0.rc1 -m 'Version x.x.0.rc1'
- Set VERSION to x.x.0.rc1 ```
- Create annotated tag x.x.0.rc1
- Push the changes to GitLab.com, dev.gitlab.com, GitHub ### **7. Tweet**
- Tweet about the release
- Create a new branch on cloud for rc1 Tweet about the RC release:
- Deploy the new branch on Cloud after tests pass
* 20st: Optional release candidate 2 (x.x.0.rc2, only if rc1 had problems) > GitLab x.x.x.rc1 is out. This is a release candidate intended for testing only. Please let us know if you find regressions.
* 22nd: Release
- Create x-x-stable branch and push to the repositories ### **8. Update Cloud**
- QA
- Fix anything coming out of the QA Merge the RC1 code into Cloud. Once the build is green, deploy in the morning.
- Set VERSION to x.x.0
- Create annotated tag x.x.0 It is important to do this as soon as possible, so we can catch any errors before we release the full version.
- Push VERSION + Tag to master, merge into x-x-stable
- Publish blog for new release
- Tweet to blog (see below)
* 22th: release GitLab EE
* 23nd: optional patch releases (x.x.1, x.x.2, etc., only if there are serious problems)
* 25th: release GitLab CI
# Write a blog post
* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code.
* Select and thank the the Most Valuable Person (MVP) of this release.
* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible.
# Tweet # **22nd - Release CE and EE**
Send out a tweet to share the good news with the world. For a major/minor release, list the features in short and link to the blog post. For GitLab EE, append -ee to the branches and tags.
For a RC, make sure to explain what a RC is. `x-x-stable-ee`
`v.x.x.0-ee`
### **1. Create x-x-stable branch and push to the repositories**
```
git checkout master
git pull
git checkout -b x-x-stable
git push <remote> x-x-stable
```
### **2. Build the Omnibus packages**
[Follow this guide](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md)
### **3. QA**
Use the omnibus packages to test using [this guide](https://dev.gitlab.org/gitlab/gitlab-ee/blob/master/doc/release/manual_testing.md)
### **4. Fix anything coming out of the QA**
### **5. Set VERSION to x.x.0**
### **6. Create annotated tag vx.x.0**
```
git tag -a vx.x.0 -m 'Version x.x.0'
```
### **7. Push VERSION + Tag to master, merge into x-x-stable**
```
git push origin master
```
Next, merge the VERSION into the x-x-stable branch.
### **8. Push to remotes**
For GitLab CE, push to dev, GitLab.com and GitHub.
For GitLab EE, push to the subscribers repo.
NOTE: You might not have the rights to push to master on dev. Ask Dmitriy.
### **9. Publish blog for new release**
* Mention what GitLab is on the second line: GitLab is open source software to collaborate on code.
* Select and thank the the Most Valuable Person (MVP) of this release.
* Add a note if there are security fixes: This release fixes an important security issue and we advise everyone to upgrade as soon as possible.
A patch release tweet should specify the fixes it brings and link to the corresponding blog post. ### **10. Tweet to blog**
Send out a tweet to share the good news with the world. List the features in short and link to the blog post.
# **23rd - Optional Patch Release**
# **25th - Release GitLab CI**
...@@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ...@@ -16,6 +16,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"path": "stormcloud", "path": "stormcloud",
"path_with_namespace": "jsmith/stormcloud", "path_with_namespace": "jsmith/stormcloud",
"project_id": 74, "project_id": 74,
"project_visibility": "private",
} }
``` ```
...@@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ...@@ -31,6 +32,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"path": "underscore", "path": "underscore",
"path_with_namespace": "jsmith/underscore", "path_with_namespace": "jsmith/underscore",
"project_id": 73, "project_id": 73,
"project_visibility": "internal",
} }
``` ```
...@@ -46,6 +48,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ...@@ -46,6 +48,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"project_path": "storecloud", "project_path": "storecloud",
"user_email": "johnsmith@gmail.com", "user_email": "johnsmith@gmail.com",
"user_name": "John Smith", "user_name": "John Smith",
"project_visibility": "private",
} }
``` ```
...@@ -61,6 +64,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser ...@@ -61,6 +64,7 @@ System hooks can be used, e.g. for logging or changing information in a LDAP ser
"project_path": "storecloud", "project_path": "storecloud",
"user_email": "johnsmith@gmail.com", "user_email": "johnsmith@gmail.com",
"user_name": "John Smith", "user_name": "John Smith",
"project_visibility": "private",
} }
``` ```
......
...@@ -64,6 +64,10 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ...@@ -64,6 +64,10 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
# Update the logrotate configuration (keep logs for 90 days instead of 52 weeks) # Update the logrotate configuration (keep logs for 90 days instead of 52 weeks)
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
# Compress existing .log.1 files because we turned off delaycompress in logrotate
sudo -u git -H gzip /home/git/gitlab/log/*.log.1
sudo -u git -H gzip /home/git/gitlab-shell/gitlab-shell.log.1
# Close access to gitlab-satellites for others # Close access to gitlab-satellites for others
sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites
``` ```
......
...@@ -64,9 +64,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS ...@@ -64,9 +64,6 @@ sudo -u git -H bundle exec rake assets:clean assets:precompile cache:clear RAILS
sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab
sudo chmod +x /etc/init.d/gitlab sudo chmod +x /etc/init.d/gitlab
# Update the logrotate configuration (keep logs for 90 days instead of 52 weeks)
sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab
# Close access to gitlab-satellites for others # Close access to gitlab-satellites for others
sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites
``` ```
......
# From 6.8 to 6.9
### 0. Backup
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production
```
### 1. Stop server
```bash
sudo service gitlab stop
```
### 2. Get latest code
```bash
cd /home/git/gitlab
sudo -u git -H git fetch --all
```
For Gitlab Community Edition:
```bash
sudo -u git -H git checkout 6-9-stable
```
OR
For GitLab Enterprise Edition:
```bash
sudo -u git -H git checkout 6-9-stable-ee
```
### 3. Update gitlab-shell (and its config)
```bash
cd /home/git/gitlab-shell
sudo -u git -H git fetch
sudo -u git -H git checkout v1.9.4
```
### 4. Install libs, migrations, etc.
```bash
cd /home/git/gitlab
# MySQL installations (note: the line below states '--without ... postgres')
sudo -u git -H bundle install --without development test postgres --deployment
# PostgreSQL installations (note: the line below states '--without ... mysql')
sudo -u git -H bundle install --without development test mysql --deployment
```
### 5. Update config files
#### New configuration options for gitlab.yml
There are new configuration options available for gitlab.yml. View them with the command below and apply them to your current gitlab.yml if desired.
```
git diff 6-8-stable:config/gitlab.yml.example 6-9-stable:config/gitlab.yml.example
```
### 6. Start application
sudo service gitlab start
sudo service nginx restart
### 7. Check application status
Check if GitLab and its environment are configured correctly:
sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
To make sure you didn't miss anything run a more thorough check with:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
If all items are green, then congratulations upgrade is complete!
## Things went south? Revert to previous version (6.8)
### 1. Revert the code to the previous version
Follow the [`upgrade guide from 6.7 to 6.8`](6.7-to-6.8.md), except for the database migration
(The backup is already migrated to the previous version)
### 2. Restore from the backup:
```bash
cd /home/git/gitlab
sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production
```
If you have more than one backup *.tar file(s) please add `BACKUP=timestamp_of_backup` to the command above.
# Migrating GitLab from MySQL to Postgres # Migrating GitLab from MySQL to Postgres
If you are replacing MySQL with Postgres while keeping GitLab on the same If you are replacing MySQL with Postgres while keeping GitLab on the same
server all you need to do is to export from MySQL and import into Postgres as server all you need to do is to export from MySQL, import into Postgres and
described below. If you are also moving GitLab to another server, or if you are rebuild the indexes as described below. If you are also moving GitLab to
switching to omnibus-gitlab, you may want to use a GitLab backup file. The another server, or if you are switching to omnibus-gitlab, you may want to use
second part of this documents explains the procedure to do this. a GitLab backup file. The second part of this documents explains the procedure
to do this.
## Export from MySQL and import into Postgres ## Export from MySQL and import into Postgres
...@@ -15,15 +16,41 @@ sudo service gitlab stop ...@@ -15,15 +16,41 @@ sudo service gitlab stop
# Update /home/git/gitlab/config/database.yml # Update /home/git/gitlab/config/database.yml
git clone https://github.com/lanyrd/mysql-postgresql-converter.git git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
cd mysql-postgresql-converter cd mysql-postgresql-converter
mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production mysqldump --compatible=postgresql --default-character-set=utf8 -r databasename.mysql -u root gitlabhq_production
python db_converter.py databasename.mysql databasename.psql python db_converter.py databasename.mysql databasename.psql
psql -f databasename.psql -d gitlabhq_production psql -f databasename.psql -d gitlabhq_production
# Rebuild indexes (see below)
sudo service gitlab start sudo service gitlab start
``` ```
## Rebuild indexes
The lanyrd database converter script does not preserve all indexes, so we have
to recreate them ourselves after migrating from MySQL. It is not necessary to
shut down GitLab for this process.
```
# Clone the database converter on your Postgres-backed GitLab server
cd /tmp
git clone https://github.com/gitlabhq/mysql-postgresql-converter.git
# Stash changes to db/schema.rb to make sure we can find the right index statements
cd /home/git/gitlab
sudo -u git -H git stash
# Generate the `CREATE INDEX CONCURRENTLY` statements based on schema.rb
cd /tmp/mysql-to-postgresql-converter
ruby index_create_statements.rb /home/git/gitlab/db/schema.rb > index_create_statements.psql
# Execute the SQL statements against the GitLab database
sudo -u git psql -f index_create_statements.psql -d gitlabhq_production
```
## Converting a GitLab backup file from MySQL to Postgres ## Converting a GitLab backup file from MySQL to Postgres
GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using GitLab backup files (<timestamp>_gitlab_backup.tar) contain a SQL dump. Using
...@@ -64,5 +91,6 @@ sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_produc ...@@ -64,5 +91,6 @@ sudo -u git -H python mysql-postgresql-converter/db_converter.py gitlabhq_produc
sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql sudo -u git -H tar rf TIMESTAMP_gitlab_backup.tar db/database.sql
# Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab installation. # Done! TIMESTAMP_gitlab_backup.tar can now be restored into a Postgres GitLab
# installation. Remember to recreate the indexes after the import.
``` ```
# Updating Ruby from source # Updating Ruby from source
This guide explains how to update Ruby in case you installed it from source according to the instructions in https://gitlab.com/gitlab-org/gitlab-ce/blob/masterdoc/install/installation.md#2-ruby . This guide explains how to update Ruby in case you installed it from source according to the [instructions](../install/installation.md#2-ruby).
### 1. Look for Ruby versions ### 1. Look for Ruby versions
This guide will only update `/usr/local/bin/ruby`. You can see which Ruby binaries are installed on your system by running: This guide will only update `/usr/local/bin/ruby`. You can see which Ruby binaries are installed on your system by running:
...@@ -36,7 +36,7 @@ sudo gem install bundler ...@@ -36,7 +36,7 @@ sudo gem install bundler
``` ```
### 5. Reinstall GitLab gem bundle ### 5. Reinstall GitLab gem bundle
Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](https://gitlab.com/gitlab-org/gitlab-ce/blob/masterdoc/install/installation.md#install-gems). Just to be sure we will reinstall the gems used by GitLab. Note that the `bundle install` command [depends on your choice of database](../install/installation.md#install-gems).
```bash ```bash
cd /home/git/gitlab cd /home/git/gitlab
......
...@@ -25,16 +25,16 @@ Triggered when you push to the repository except when pushing tags. ...@@ -25,16 +25,16 @@ Triggered when you push to the repository except when pushing tags.
"project_id": 15, "project_id": 15,
"repository": { "repository": {
"name": "Diaspora", "name": "Diaspora",
"url": "git@localhost:diaspora.git", "url": "git@example.com:diaspora.git",
"description": "", "description": "",
"homepage": "http://localhost/diaspora" "homepage": "http://example.com/diaspora"
}, },
"commits": [ "commits": [
{ {
"id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "id": "b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
"message": "Update Catalan translation to e38cb41.", "message": "Update Catalan translation to e38cb41.",
"timestamp": "2011-12-12T14:27:31+02:00", "timestamp": "2011-12-12T14:27:31+02:00",
"url": "http://localhost/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327", "url": "http://example.com/diaspora/commits/b6568db1bc1dcd7f8b4d5a946b0b91f9dacd7327",
"author": { "author": {
"name": "Jordi Mallach", "name": "Jordi Mallach",
"email": "jordi@softcatala.org" "email": "jordi@softcatala.org"
...@@ -44,7 +44,7 @@ Triggered when you push to the repository except when pushing tags. ...@@ -44,7 +44,7 @@ Triggered when you push to the repository except when pushing tags.
"id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "id": "da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"message": "fixed readme", "message": "fixed readme",
"timestamp": "2012-01-03T23:36:29+02:00", "timestamp": "2012-01-03T23:36:29+02:00",
"url": "http://localhost/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7", "url": "http://example.com/diaspora/commits/da1560886d4f094c3e6c9ef40349f7d38b5d27d7",
"author": { "author": {
"name": "GitLab dev user", "name": "GitLab dev user",
"email": "gitlabdev@dv6700.(none)" "email": "gitlabdev@dv6700.(none)"
...@@ -112,3 +112,34 @@ Triggered when a new merge request is created or an existing merge request was u ...@@ -112,3 +112,34 @@ Triggered when a new merge request is created or an existing merge request was u
} }
} }
``` ```
#### Example webhook receiver
If you want to see GitLab's webhooks in action for testing purposes you can use
a simple echo script running in a console session.
Save the following file as `print_http_body.rb`.
```ruby
require 'webrick'
server = WEBrick::HTTPServer.new(Port: ARGV.first)
server.mount_proc '/' do |req, res|
puts req.body
end
trap 'INT' do server.shutdown end
server.start
```
Pick an unused port (e.g. 8000) and start the script: `ruby print_http_body.rb
8000`. Then add your server as a webhook receiver in GitLab as
`http://my.host:8000/`.
When you press 'Test Hook' in GitLab, you should see something like this in the console.
```
{"before":"077a85dd266e6f3573ef7e9ef8ce3343ad659c4e","after":"95cd4a99e93bc4bbabacfa2cd10e6725b1403c60",<SNIP>}
example.com - - [14/May/2014:07:45:26 EDT] "POST / HTTP/1.1" 200 0
- -> /
```
...@@ -113,3 +113,10 @@ Feature: Groups ...@@ -113,3 +113,10 @@ Feature: Groups
Then I should see user "John Doe" in team list Then I should see user "John Doe" in team list
Then I should see user "Mary Jane" in team list Then I should see user "Mary Jane" in team list
Then I should not see the "Remove User From Group" button for "Mary Jane" Then I should not see the "Remove User From Group" button for "Mary Jane"
Scenario: Search member by name
Given "Mary Jane" is guest of group "Guest"
And I visit group "Guest" members page
When I search for 'Mary' member
Then I should see user "Mary Jane" in team list
Then I should not see user "John Doe" in team list
...@@ -168,6 +168,13 @@ class Groups < Spinach::FeatureSteps ...@@ -168,6 +168,13 @@ class Groups < Spinach::FeatureSteps
# poltergeist always confirms popups. # poltergeist always confirms popups.
end end
step 'I search for \'Mary\' member' do
within '.member-search-form' do
fill_in 'search', with: 'Mary'
click_button 'Search'
end
end
protected protected
def assigned_to_me key def assigned_to_me key
......
...@@ -43,6 +43,7 @@ module API ...@@ -43,6 +43,7 @@ module API
class Project < Grape::Entity class Project < Grape::Entity
expose :id, :description, :default_branch expose :id, :description, :default_branch
expose :public?, as: :public expose :public?, as: :public
expose :archived?, as: :archived
expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url expose :visibility_level, :ssh_url_to_repo, :http_url_to_repo, :web_url
expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group } expose :owner, using: Entities::UserBasic, unless: ->(project, options) { project.group }
expose :name, :name_with_namespace expose :name, :name_with_namespace
...@@ -135,6 +136,7 @@ module API ...@@ -135,6 +136,7 @@ module API
expose :target_branch, :source_branch, :upvotes, :downvotes expose :target_branch, :source_branch, :upvotes, :downvotes
expose :author, :assignee, using: Entities::UserBasic expose :author, :assignee, using: Entities::UserBasic
expose :source_project_id, :target_project_id expose :source_project_id, :target_project_id
expose :label_list, as: :labels
end end
class SSHKey < Grape::Entity class SSHKey < Grape::Entity
......
...@@ -8,6 +8,11 @@ module API ...@@ -8,6 +8,11 @@ module API
def current_user def current_user
private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s private_token = (params[PRIVATE_TOKEN_PARAM] || env[PRIVATE_TOKEN_HEADER]).to_s
@current_user ||= User.find_by(authentication_token: private_token) @current_user ||= User.find_by(authentication_token: private_token)
unless @current_user && Gitlab::UserAccess.allowed?(@current_user)
return nil
end
identifier = sudo_identifier() identifier = sudo_identifier()
# If the sudo is the current user do nothing # If the sudo is the current user do nothing
......
...@@ -67,6 +67,7 @@ module API ...@@ -67,6 +67,7 @@ module API
# assignee_id - Assignee user ID # assignee_id - Assignee user ID
# title (required) - Title of MR # title (required) - Title of MR
# description - Description of MR # description - Description of MR
# labels (optional) - Labels for MR as a comma-separated list
# #
# Example: # Example:
# POST /projects/:id/merge_requests # POST /projects/:id/merge_requests
...@@ -75,6 +76,7 @@ module API ...@@ -75,6 +76,7 @@ module API
authorize! :write_merge_request, user_project authorize! :write_merge_request, user_project
required_attributes! [:source_branch, :target_branch, :title] required_attributes! [:source_branch, :target_branch, :title]
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description] attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
attrs[:label_list] = params[:labels] if params[:labels].present?
merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute
if merge_request.valid? if merge_request.valid?
...@@ -95,11 +97,13 @@ module API ...@@ -95,11 +97,13 @@ module API
# title - Title of MR # title - Title of MR
# state_event - Status of MR. (close|reopen|merge) # state_event - Status of MR. (close|reopen|merge)
# description - Description of MR # description - Description of MR
# labels (optional) - Labels for a MR as a comma-separated list
# Example: # Example:
# PUT /projects/:id/merge_request/:merge_request_id # PUT /projects/:id/merge_request/:merge_request_id
# #
put ":id/merge_request/:merge_request_id" do put ":id/merge_request/:merge_request_id" do
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description] attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description]
attrs[:label_list] = params[:labels] if params[:labels].present?
merge_request = user_project.merge_requests.find(params[:merge_request_id]) merge_request = user_project.merge_requests.find(params[:merge_request_id])
authorize! :modify_merge_request, merge_request authorize! :modify_merge_request, merge_request
merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request) merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request)
...@@ -111,6 +115,49 @@ module API ...@@ -111,6 +115,49 @@ module API
end end
end end
# Merge MR
#
# Parameters:
# id (required) - The ID of a project
# merge_request_id (required) - ID of MR
# merge_commit_message (optional) - Custom merge commit message
# Example:
# PUT /projects/:id/merge_request/:merge_request_id/merge
#
put ":id/merge_request/:merge_request_id/merge" do
merge_request = user_project.merge_requests.find(params[:merge_request_id])
action = if user_project.protected_branch?(merge_request.target_branch)
:push_code_to_protected_branches
else
:push_code
end
if can?(current_user, action, user_project)
if merge_request.unchecked?
merge_request.check_if_can_be_merged
end
if merge_request.open?
if merge_request.can_be_merged?
merge_request.automerge!(current_user, params[:merge_commit_message] || merge_request.merge_commit_message)
present merge_request, with: Entities::MergeRequest
else
render_api_error!('Branch cannot be merged', 405)
end
else
# Merge request can not be merged
# because it is already closed/merged
not_allowed!
end
else
# Merge request can not be merged
# because user dont have permissions to push into target branch
unauthorized!
end
end
# Get a merge request's comments # Get a merge request's comments
# #
# Parameters: # Parameters:
......
...@@ -89,18 +89,7 @@ module Gitlab ...@@ -89,18 +89,7 @@ module Gitlab
private private
def user_allowed?(user) def user_allowed?(user)
return false if user.blocked? Gitlab::UserAccess.allowed?(user)
if Gitlab.config.ldap.enabled
if user.ldap_user?
# Check if LDAP user exists and match LDAP user_filter
unless Gitlab::LDAP::Access.new.allowed?(user)
return false
end
end
end
true
end end
end end
end end
...@@ -20,7 +20,11 @@ module Gitlab ...@@ -20,7 +20,11 @@ module Gitlab
end end
def allowed?(user) def allowed?(user)
!!Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter) if Gitlab::LDAP::Person.find_by_dn(user.extern_uid, adapter)
!Gitlab::LDAP::Person.active_directory_disabled?(user.extern_uid, adapter)
else
false
end
rescue rescue
false false
end end
......
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
module Gitlab module Gitlab
module LDAP module LDAP
class Person class Person
# Active Directory-specific LDAP filter that checks if bit 2 of the
# userAccountControl attribute is set.
# Source: http://ctogonewild.com/2009/09/03/bitmask-searches-in-ldap/
AD_USER_DISABLED = Net::LDAP::Filter.ex("userAccountControl:1.2.840.113556.1.4.803", "2")
def self.find_by_uid(uid, adapter=nil) def self.find_by_uid(uid, adapter=nil)
adapter ||= Gitlab::LDAP::Adapter.new adapter ||= Gitlab::LDAP::Adapter.new
adapter.user(Gitlab.config.ldap.uid, uid) adapter.user(Gitlab.config.ldap.uid, uid)
...@@ -17,6 +22,11 @@ module Gitlab ...@@ -17,6 +22,11 @@ module Gitlab
adapter.user('dn', dn) adapter.user('dn', dn)
end end
def self.active_directory_disabled?(dn, adapter=nil)
adapter ||= Gitlab::LDAP::Adapter.new
adapter.dn_matches_filter?(dn, AD_USER_DISABLED)
end
def initialize(entry) def initialize(entry)
Rails.logger.debug { "Instantiating #{self.class.name} with LDIF:\n#{entry.to_ldif}" } Rails.logger.debug { "Instantiating #{self.class.name} with LDIF:\n#{entry.to_ldif}" }
@entry = entry @entry = entry
......
...@@ -34,9 +34,11 @@ module Gitlab ...@@ -34,9 +34,11 @@ module Gitlab
# In this case we generate temporary email and force user to fill it later # In this case we generate temporary email and force user to fill it later
if user.email.blank? if user.email.blank?
user.generate_tmp_oauth_email user.generate_tmp_oauth_email
else elsif provider != "ldap"
# Google oauth returns email but dont return nickname # Google oauth returns email but dont return nickname
# So we use part of email as username for new user # So we use part of email as username for new user
# For LDAP, username is already set to the user's
# uid/userid/sAMAccountName.
user.username = email.match(/^[^@]*/)[0] user.username = email.match(/^[^@]*/)[0]
end end
......
module Gitlab
module UserAccess
def self.allowed?(user)
return false if user.blocked?
if Gitlab.config.ldap.enabled
if user.ldap_user?
# Check if LDAP user exists and match LDAP user_filter
Gitlab::LDAP::Access.open do |adapter|
return false unless adapter.allowed?(user)
end
end
end
true
end
end
end
...@@ -59,6 +59,9 @@ server { ...@@ -59,6 +59,9 @@ server {
} }
# Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression # Enable gzip compression as per rails guide: http://guides.rubyonrails.org/asset_pipeline.html#gzip-compression
# WARNING: If you are using relative urls do remove the block below
# See config/application.rb under "Relative url support" for the list of
# other files that need to be changed for relative url support
location ~ ^/(assets)/ { location ~ ^/(assets)/ {
root /home/git/gitlab/public; root /home/git/gitlab/public;
gzip_static on; # to serve pre-gzipped version gzip_static on; # to serve pre-gzipped version
......
...@@ -58,4 +58,30 @@ describe Gitlab::LDAP::Access do ...@@ -58,4 +58,30 @@ describe Gitlab::LDAP::Access do
updated.should == true updated.should == true
end end
end end
describe :allowed? do
subject { access.allowed?(user) }
context 'when the user cannot be found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: nil) }
it { should be_false }
end
context 'when the user is found' do
before { Gitlab::LDAP::Person.stub(find_by_dn: :ldap_user) }
context 'and the Active Directory disabled flag is set' do
before { Gitlab::LDAP::Person.stub(active_directory_disabled?: true) }
it { should be_false }
end
context 'and the Active Directory disabled flag is not set' do
before { Gitlab::LDAP::Person.stub(active_directory_disabled?: false) }
it { should be_true }
end
end
end
end end
...@@ -161,6 +161,10 @@ describe Notify do ...@@ -161,6 +161,10 @@ describe Notify do
it 'contains a link to the new issue' do it 'contains a link to the new issue' do
should have_body_text /#{project_issue_path project, issue}/ should have_body_text /#{project_issue_path project, issue}/
end end
it 'has the correct message-id set' do
should have_header 'Message-ID', "<issue_#{issue.id}@#{Gitlab.config.gitlab.host}>"
end
end end
describe 'that are new with a description' do describe 'that are new with a description' do
...@@ -197,6 +201,10 @@ describe Notify do ...@@ -197,6 +201,10 @@ describe Notify do
it 'contains a link to the issue' do it 'contains a link to the issue' do
should have_body_text /#{project_issue_path project, issue}/ should have_body_text /#{project_issue_path project, issue}/
end end
it 'has the correct reference set' do
should have_header 'References', "<issue_#{issue.id}@#{Gitlab.config.gitlab.host}>"
end
end end
describe 'status changed' do describe 'status changed' do
...@@ -224,6 +232,10 @@ describe Notify do ...@@ -224,6 +232,10 @@ describe Notify do
it 'contains a link to the issue' do it 'contains a link to the issue' do
should have_body_text /#{project_issue_path project, issue}/ should have_body_text /#{project_issue_path project, issue}/
end end
it 'has the correct reference set' do
should have_header 'References', "<issue_#{issue.id}@#{Gitlab.config.gitlab.host}>"
end
end end
end end
...@@ -253,6 +265,10 @@ describe Notify do ...@@ -253,6 +265,10 @@ describe Notify do
it 'contains the target branch for the merge request' do it 'contains the target branch for the merge request' do
should have_body_text /#{merge_request.target_branch}/ should have_body_text /#{merge_request.target_branch}/
end end
it 'has the correct message-id set' do
should have_header 'Message-ID', "<merge_request_#{merge_request.id}@#{Gitlab.config.gitlab.host}>"
end
end end
describe 'that are new with a description' do describe 'that are new with a description' do
...@@ -313,6 +329,10 @@ describe Notify do ...@@ -313,6 +329,10 @@ describe Notify do
it 'contains a link to the merge request' do it 'contains a link to the merge request' do
should have_body_text /#{project_merge_request_path project, merge_request}/ should have_body_text /#{project_merge_request_path project, merge_request}/
end end
it 'has the correct reference set' do
should have_header 'References', "<merge_request_#{merge_request.id}@#{Gitlab.config.gitlab.host}>"
end
end end
end end
end end
......
...@@ -39,6 +39,17 @@ describe API, api: true do ...@@ -39,6 +39,17 @@ describe API, api: true do
end end
describe ".current_user" do describe ".current_user" do
it "should return nil for an invalid token" do
env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = 'invalid token'
current_user.should be_nil
end
it "should return nil for a user without access" do
env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token
Gitlab::UserAccess.stub(allowed?: false)
current_user.should be_nil
end
it "should leave user as is when sudo not specified" do it "should leave user as is when sudo not specified" do
env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token env[API::APIHelpers::PRIVATE_TOKEN_HEADER] = user.private_token
current_user.should == user current_user.should == user
......
...@@ -183,11 +183,33 @@ describe API::API, api: true do ...@@ -183,11 +183,33 @@ describe API::API, api: true do
end end
end end
describe "PUT /projects/:id/merge_request/:merge_request_id to merge MR" do describe "PUT /projects/:id/merge_request/:merge_request_id/merge" do
it "should return merge_request" do it "should return merge_request in case of success" do
put api("/projects/#{project.id}/merge_request/#{merge_request.id}", user), state_event: "merge" MergeRequest.any_instance.stub(can_be_merged?: true, automerge!: true)
put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user)
response.status.should == 200 response.status.should == 200
json_response['state'].should == 'merged' end
it "should return 405 if branch can't be merged" do
MergeRequest.any_instance.stub(can_be_merged?: false)
put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user)
response.status.should == 405
json_response['message'].should == 'Branch cannot be merged'
end
it "should return 405 if merge_request is not open" do
merge_request.close
put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user)
response.status.should == 405
json_response['message'].should == 'Method Not Allowed'
end
it "should return 401 if user has no permissions to merge" do
user2 = create(:user)
project.team << [user2, :reporter]
put api("/projects/#{project.id}/merge_request/#{merge_request.id}/merge", user2)
response.status.should == 401
json_response['message'].should == '401 Unauthorized'
end end
end end
......
...@@ -14,6 +14,12 @@ describe API::API, api: true do ...@@ -14,6 +14,12 @@ describe API::API, api: true do
let(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) } let(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) }
let(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) } let(:users_project2) { create(:users_project, user: user3, project: project, project_access: UsersProject::DEVELOPER) }
let(:issue_with_labels) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") } let(:issue_with_labels) { create(:issue, author: user, assignee: user, project: project, :label_list => "label1, label2") }
let(:merge_request_with_labels) do
create(:merge_request, :simple, author: user, assignee: user,
source_project: project, target_project: project, title: 'Test',
label_list: 'label3, label4')
end
describe "GET /projects" do describe "GET /projects" do
before { project } before { project }
...@@ -665,10 +671,11 @@ describe API::API, api: true do ...@@ -665,10 +671,11 @@ describe API::API, api: true do
end end
end end
describe "GET /projects/:id/labels" do describe 'GET /projects/:id/labels' do
context 'with an issue' do
before { issue_with_labels } before { issue_with_labels }
it "should return project labels" do it 'should return project labels' do
get api("/projects/#{project.id}/labels", user) get api("/projects/#{project.id}/labels", user)
response.status.should == 200 response.status.should == 200
json_response.should be_an Array json_response.should be_an Array
...@@ -676,4 +683,33 @@ describe API::API, api: true do ...@@ -676,4 +683,33 @@ describe API::API, api: true do
json_response.last['name'].should == issue_with_labels.labels.last.name json_response.last['name'].should == issue_with_labels.labels.last.name
end end
end end
context 'with a merge request' do
before { merge_request_with_labels }
it 'should return project labels' do
get api("/projects/#{project.id}/labels", user)
response.status.should == 200
json_response.should be_an Array
json_response.first['name'].should == merge_request_with_labels.labels.first.name
json_response.last['name'].should == merge_request_with_labels.labels.last.name
end
end
context 'with an issue and a merge request' do
before do
issue_with_labels
merge_request_with_labels
end
it 'should return project labels from both' do
get api("/projects/#{project.id}/labels", user)
response.status.should == 200
json_response.should be_an Array
all_labels = issue_with_labels.labels.map(&:name).to_a
.concat(merge_request_with_labels.labels.map(&:name).to_a)
json_response.map { |e| e['name'] }.should =~ all_labels
end
end
end
end end
...@@ -213,7 +213,7 @@ describe Projects::RefsController, "routing" do ...@@ -213,7 +213,7 @@ describe Projects::RefsController, "routing" do
end end
# diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) projects/merge_requests#diffs # diffs_project_merge_request GET /:project_id/merge_requests/:id/diffs(.:format) projects/merge_requests#diffs
# automerge_project_merge_request GET /:project_id/merge_requests/:id/automerge(.:format) projects/merge_requests#automerge # automerge_project_merge_request POST /:project_id/merge_requests/:id/automerge(.:format) projects/merge_requests#automerge
# automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) projects/merge_requests#automerge_check # automerge_check_project_merge_request GET /:project_id/merge_requests/:id/automerge_check(.:format) projects/merge_requests#automerge_check
# branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) projects/merge_requests#branch_from # branch_from_project_merge_requests GET /:project_id/merge_requests/branch_from(.:format) projects/merge_requests#branch_from
# branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) projects/merge_requests#branch_to # branch_to_project_merge_requests GET /:project_id/merge_requests/branch_to(.:format) projects/merge_requests#branch_to
...@@ -230,7 +230,10 @@ describe Projects::MergeRequestsController, "routing" do ...@@ -230,7 +230,10 @@ describe Projects::MergeRequestsController, "routing" do
end end
it "to #automerge" do it "to #automerge" do
get("/gitlab/gitlabhq/merge_requests/1/automerge").should route_to('projects/merge_requests#automerge', project_id: 'gitlab/gitlabhq', id: '1') post('/gitlab/gitlabhq/merge_requests/1/automerge').should route_to(
'projects/merge_requests#automerge',
project_id: 'gitlab/gitlabhq', id: '1'
)
end end
it "to #automerge_check" do it "to #automerge_check" do
......
...@@ -8,10 +8,10 @@ describe SystemHooksService do ...@@ -8,10 +8,10 @@ describe SystemHooksService do
context 'event data' do context 'event data' do
it { event_data(user, :create).should include(:event_name, :name, :created_at, :email, :user_id) } it { event_data(user, :create).should include(:event_name, :name, :created_at, :email, :user_id) }
it { event_data(user, :destroy).should include(:event_name, :name, :created_at, :email, :user_id) } it { event_data(user, :destroy).should include(:event_name, :name, :created_at, :email, :user_id) }
it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) } it { event_data(project, :create).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email) } it { event_data(project, :destroy).should include(:event_name, :name, :created_at, :path, :project_id, :owner_name, :owner_email, :project_visibility) }
it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) } it { event_data(users_project, :create).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) }
it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access) } it { event_data(users_project, :destroy).should include(:event_name, :created_at, :project_name, :project_path, :project_id, :user_name, :user_email, :project_access, :project_visibility) }
end end
context 'event names' do context 'event names' 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