summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG3
-rw-r--r--app/assets/stylesheets/base/mixins.scss4
-rw-r--r--app/assets/stylesheets/generic/header.scss8
-rw-r--r--app/assets/stylesheets/pages/projects.scss12
-rw-r--r--app/helpers/diff_helper.rb19
-rw-r--r--app/helpers/events_helper.rb12
-rw-r--r--app/services/git_push_service.rb4
-rw-r--r--app/views/projects/_aside.html.haml13
-rw-r--r--app/views/projects/_section.html.haml9
-rw-r--r--app/views/projects/diffs/_diffs.html.haml8
-rw-r--r--app/views/projects/diffs/_warning.html.haml2
-rw-r--r--app/views/projects/merge_requests/_new_compare.html.haml7
-rw-r--r--app/views/projects/merge_requests/_new_submit.html.haml77
-rw-r--r--app/views/shared/_clone_panel.html.haml36
-rw-r--r--doc/install/installation.md6
-rw-r--r--doc/release/master.md29
-rw-r--r--doc/release/patch.md3
-rw-r--r--doc/update/upgrader.md2
-rw-r--r--docker/README.md157
-rw-r--r--docker/app/Dockerfile (renamed from docker/Dockerfile)0
-rwxr-xr-xdocker/app/assets/wrapper (renamed from docker/assets/wrapper)0
-rw-r--r--docker/single/Dockerfile35
-rwxr-xr-xdocker/single/assets/wrapper16
-rw-r--r--docker/single/marathon.json14
-rw-r--r--docker/troubleshooting.md10
-rw-r--r--features/steps/project/forked_merge_requests.rb2
-rw-r--r--features/steps/project/merge_requests.rb2
-rw-r--r--spec/features/markdown_spec.rb17
-rw-r--r--spec/fixtures/markdown.md.erb8
-rw-r--r--spec/helpers/diff_helper_spec.rb54
-rw-r--r--spec/services/git_push_service_spec.rb15
31 files changed, 401 insertions, 183 deletions
diff --git a/CHANGELOG b/CHANGELOG
index c7fb49dc183..77d5f07eb5c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 7.11.0 (unreleased)
+ - Make the first branch pushed to an empty repository the default HEAD (Stan Hu)
- Make Reply-To config apply to change e-mail confirmation and other Devise notifications (Stan Hu)
- Add application setting to restrict user signups to e-mail domains (Stan Hu)
- Don't allow a merge request to be merged when its title starts with "WIP".
@@ -21,6 +22,8 @@ v 7.11.0 (unreleased)
- Fix bug causing `@whatever` inside an issue's first code block to be picked up as a user mention.
- Fix bug causing `@whatever` inside an inline code snippet (backtick-style) to be picked up as a user mention.
- When use change branches link at MR form - save source branch selection instead of target one
+ - Improve handling of large diffs
+ -
- Show Atom feed buttons everywhere where applicable.
- Add project activity atom feed.
- Don't crash when an MR from a fork has a cross-reference comment from the target project on one of its commits.
diff --git a/app/assets/stylesheets/base/mixins.scss b/app/assets/stylesheets/base/mixins.scss
index b8b163a42b2..a0794e7825a 100644
--- a/app/assets/stylesheets/base/mixins.scss
+++ b/app/assets/stylesheets/base/mixins.scss
@@ -21,6 +21,10 @@
@include border-radius($radius 0 0 $radius)
}
+@mixin border-radius-right($radius) {
+ @include border-radius(0 0 $radius $radius)
+}
+
@mixin linear-gradient($from, $to) {
background-image: -webkit-gradient(linear, 0 0, 0 100%, from($from), to($to));
background-image: -webkit-linear-gradient($from, $to);
diff --git a/app/assets/stylesheets/generic/header.scss b/app/assets/stylesheets/generic/header.scss
index df1553d8594..fcd62373bfd 100644
--- a/app/assets/stylesheets/generic/header.scss
+++ b/app/assets/stylesheets/generic/header.scss
@@ -15,7 +15,7 @@ header {
padding: 0;
background: #FFF;
- border-bottom: 1px solid #DDD;
+ border-bottom: 1px solid #EEE;
filter: none;
.title {
@@ -25,13 +25,13 @@ header {
margin-left: 25px;
font-size: 18px;
line-height: 44px;
- font-weight: normal;
- color: #555;
+ font-weight: bold;
+ color: #444;
@include str-truncated(37%);
a {
- color: #555;
+ color: #444;
&:hover {
text-decoration: underline;
}
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index afa8aa24ee4..5a8d4665294 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -102,6 +102,15 @@
.input-group-addon {
background: #FAFAFA;
+
+ &.git-protocols {
+ padding: 0;
+ border: none;
+
+ .input-group-btn:last-child > .btn {
+ @include border-radius-right(0);
+ }
+ }
}
}
@@ -201,9 +210,12 @@ ul.nav.nav-projects-tabs {
}
.well {
+ padding: 14px;
+
h4 {
font-weight: normal;
margin: 0;
+ color: #555;
}
.nav-pills a {
diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb
index 162778ade58..1b10795bb7b 100644
--- a/app/helpers/diff_helper.rb
+++ b/app/helpers/diff_helper.rb
@@ -7,14 +7,23 @@ module DiffHelper
end
end
- def safe_diff_files(diffs)
- diffs.first(allowed_diff_size).map do |diff|
- Gitlab::Diff::File.new(diff)
+ def allowed_diff_lines
+ if diff_hard_limit_enabled?
+ Commit::DIFF_HARD_LIMIT_LINES
+ else
+ Commit::DIFF_SAFE_LINES
end
end
- def show_diff_size_warning?(diffs)
- diffs.size > allowed_diff_size
+ def safe_diff_files(diffs)
+ lines = 0
+ safe_files = []
+ diffs.first(allowed_diff_size).each do |diff|
+ lines += diff.diff.lines.count
+ break if lines > allowed_diff_lines
+ safe_files << Gitlab::Diff::File.new(diff)
+ end
+ safe_files
end
def diff_hard_limit_enabled?
diff --git a/app/helpers/events_helper.rb b/app/helpers/events_helper.rb
index c9fd0f0362b..18c75a8726b 100644
--- a/app/helpers/events_helper.rb
+++ b/app/helpers/events_helper.rb
@@ -25,12 +25,16 @@ module EventsHelper
def event_filter_link(key, tooltip)
key = key.to_s
- active = if @event_filter.active? key
- 'active'
- end
+ active = 'active' if @event_filter.active?(key)
+ link_opts = {
+ class: 'event_filter_link',
+ id: "#{key}_event_filter",
+ title: "Filter by #{tooltip.downcase}",
+ data: { toggle: 'tooltip', placement: 'top' }
+ }
content_tag :li, class: "filter_icon #{active}" do
- link_to request.path, class: 'has_tooltip event_filter_link', id: "#{key}_event_filter", 'data-original-title' => 'Filter by ' + tooltip.downcase do
+ link_to request.path, link_opts do
icon(icon_for_event[key]) + content_tag(:span, ' ' + tooltip)
end
end
diff --git a/app/services/git_push_service.rb b/app/services/git_push_service.rb
index 1b889e0da8b..bdf36af02fd 100644
--- a/app/services/git_push_service.rb
+++ b/app/services/git_push_service.rb
@@ -31,6 +31,10 @@ class GitPushService
# Initial push to the default branch. Take the full history of that branch as "newly pushed".
@push_commits = project.repository.commits(newrev)
+ # Ensure HEAD points to the default branch in case it is not master
+ branch_name = Gitlab::Git.ref_name(ref)
+ project.change_head(branch_name)
+
# Set protection on the default branch if configured
if (current_application_settings.default_branch_protection != PROTECTION_NONE)
developers_can_push = current_application_settings.default_branch_protection == PROTECTION_DEV_CAN_PUSH ? true : false
diff --git a/app/views/projects/_aside.html.haml b/app/views/projects/_aside.html.haml
index 1a7ab74c93a..1865b5be8c6 100644
--- a/app/views/projects/_aside.html.haml
+++ b/app/views/projects/_aside.html.haml
@@ -39,6 +39,11 @@
= link_to url_for_new_issue(@project, only_path: true), title: "New Issue", class: 'btn btn-sm' do
%i.fa.fa-fw.fa-exclamation-circle
New issue
+ - if can? current_user, :write_merge_request, @project
+ &nbsp;
+ = link_to new_namespace_project_merge_request_path(@project.namespace, @project), class: "btn btn-sm", title: "New Merge Request" do
+ %i.fa.fa-plus
+ New Merge Request
@@ -51,10 +56,10 @@
- if @project.forked_from_project
.well
- %i.fa.fa-code-fork.project-fork-icon
- Forked from:
- %br
- = link_to @project.forked_from_project.name_with_namespace, project_path(@project.forked_from_project)
+ %h4
+ Forked from
+ .pull-right
+ = link_to @project.forked_from_project.namespace.try(:name), project_path(@project.forked_from_project)
- if version = @repository.version
diff --git a/app/views/projects/_section.html.haml b/app/views/projects/_section.html.haml
index e6b04c5a34d..0b7f4cb780a 100644
--- a/app/views/projects/_section.html.haml
+++ b/app/views/projects/_section.html.haml
@@ -26,9 +26,10 @@
- if readme = @repository.readme
.tab-pane#tab-readme
%article.readme-holder#README
- = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)) do
- %h4.readme-file-title
- %i.fa.fa-file
- = readme.name
+ .clearfix
+ %small.pull-right
+ = link_to namespace_project_blob_path(@project.namespace, @project, tree_join(@repository.root_ref, readme.name)), class: 'light' do
+ %i.fa.fa-file
+ = readme.name
.wiki
= render_readme(readme)
diff --git a/app/views/projects/diffs/_diffs.html.haml b/app/views/projects/diffs/_diffs.html.haml
index b49aee504fe..ec8974c5475 100644
--- a/app/views/projects/diffs/_diffs.html.haml
+++ b/app/views/projects/diffs/_diffs.html.haml
@@ -5,11 +5,13 @@
= parallel_diff_btn
= render 'projects/diffs/stats', diffs: diffs
-- if show_diff_size_warning?(diffs)
- = render 'projects/diffs/warning', diffs: diffs
+- diff_files = safe_diff_files(diffs)
+
+- if diff_files.count < diffs.size
+ = render 'projects/diffs/warning', diffs: diffs, shown_files_count: diff_files.count
.files
- - safe_diff_files(diffs).each_with_index do |diff_file, index|
+ - diff_files.each_with_index do |diff_file, index|
= render 'projects/diffs/file', diff_file: diff_file, i: index, project: project
- if @diff_timeout
diff --git a/app/views/projects/diffs/_warning.html.haml b/app/views/projects/diffs/_warning.html.haml
index 47abbba2eb2..bd0b7376ba7 100644
--- a/app/views/projects/diffs/_warning.html.haml
+++ b/app/views/projects/diffs/_warning.html.haml
@@ -14,6 +14,6 @@
= link_to "Email patch", merge_request_path(@merge_request, format: :patch), class: "btn btn-warning btn-sm"
%p
To preserve performance only
- %strong #{allowed_diff_size} of #{diffs.size}
+ %strong #{shown_files_count} of #{diffs.size}
files are displayed.
diff --git a/app/views/projects/merge_requests/_new_compare.html.haml b/app/views/projects/merge_requests/_new_compare.html.haml
index 17e76059fdb..e611b23bca6 100644
--- a/app/views/projects/merge_requests/_new_compare.html.haml
+++ b/app/views/projects/merge_requests/_new_compare.html.haml
@@ -1,5 +1,4 @@
-%h3.page-title Compare branches for new Merge Request
-%hr
+%p.lead Compare branches for new Merge Request
= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], url: new_namespace_project_merge_request_path(@project.namespace, @project), method: :get, html: { class: "merge-request-form form-inline" } do |f|
.hide.alert.alert-danger.mr-compare-errors
@@ -52,8 +51,8 @@
are the same.
- %hr
- = f.submit 'Compare branches', class: "btn btn-primary mr-compare-btn"
+ %div
+ = f.submit 'Compare branches', class: "btn btn-new mr-compare-btn"
:javascript
var source_branch = $("#merge_request_source_branch")
diff --git a/app/views/projects/merge_requests/_new_submit.html.haml b/app/views/projects/merge_requests/_new_submit.html.haml
index 6dc883ba22b..24a9563dd4d 100644
--- a/app/views/projects/merge_requests/_new_submit.html.haml
+++ b/app/views/projects/merge_requests/_new_submit.html.haml
@@ -8,77 +8,14 @@
%span.pull-right
= link_to 'Change branches', mr_change_branches_path(@merge_request)
-
-= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: "merge-request-form form-horizontal gfm-form" } do |f|
+%hr
+= form_for [@project.namespace.becomes(Namespace), @project, @merge_request], html: { class: 'merge-request-form form-horizontal gfm-form' } do |f|
.merge-request-form-info
- .form-group
- = f.label :title, class: 'control-label' do
- %strong Title *
- .col-sm-10
- = f.text_field :title, maxlength: 255, autofocus: true, class: 'form-control pad js-gfm-input', required: true
- .form-group.issuable-description
- = f.label :description, 'Description', class: 'control-label'
- .col-sm-10
- = render layout: 'projects/md_preview', locals: { preview_class: "wiki" } do
- = render 'projects/zen', f: f, attr: :description, classes: 'description form-control'
-
- .col-sm-12-hint
- .pull-left
- Parsed with
- #{link_to 'Gitlab Flavored Markdown', help_page_path('markdown', 'markdown'), target: '_blank'}.
- .pull-right
- Attach files by dragging &amp; dropping
- or #{link_to 'selecting them', '#', class: 'markdown-selector'}.
-
- .clearfix
- .error-alert
- %hr
- .form-group
- .issue-assignee
- = f.label :assignee_id, class: 'control-label' do
- %i.fa.fa-user
- Assign to
- .col-sm-10
- = users_select_tag('merge_request[assignee_id]', placeholder: 'Select a user', class: 'custom-form-control', selected: @merge_request.assignee_id, project_id: @merge_request.target_project_id)
- &nbsp;
- = link_to 'Assign to me', '#', class: 'btn assign-to-me-link'
- .form-group
- .issue-milestone
- = f.label :milestone_id, class: 'control-label' do
- %i.fa.fa-clock-o
- Milestone
- .col-sm-10
- - if milestone_options(@merge_request).present?
- = f.select(:milestone_id, milestone_options(@merge_request), {include_blank: 'Select milestone'}, {class: 'select2'})
- - else
- %span.light No open milestones available.
- &nbsp;
- - if can? current_user, :admin_milestone, @merge_request.target_project
- = link_to 'Create new milestone', new_namespace_project_milestone_path(@merge_request.target_project.namespace, @merge_request.target_project), target: :blank
- .form-group
- = f.label :label_ids, class: 'control-label' do
- %i.fa.fa-tag
- Labels
- .col-sm-10
- - if @merge_request.target_project.labels.any?
- = f.collection_select :label_ids, @merge_request.target_project.labels.all, :id, :name, {selected: @merge_request.label_ids}, multiple: true, class: 'select2'
- - else
- %span.light No labels yet.
- &nbsp;
- - if can? current_user, :admin_label, @merge_request.target_project
- = link_to 'Create new label', new_namespace_project_label_path(@merge_request.target_project.namespace, @merge_request.target_project), target: :blank
-
- .form-actions
- - if guide_url = contribution_guide_url(@target_project)
- %p
- Please review the
- %strong #{link_to 'guidelines for contribution', guide_url}
- to this repository.
- = f.hidden_field :source_project_id
- = f.hidden_field :source_branch
- = f.hidden_field :target_project_id
- = f.hidden_field :target_branch
- = f.submit 'Submit merge request', class: 'btn btn-create'
+ = render 'projects/issuable_form', f: f, issuable: @merge_request
+ = f.hidden_field :source_project_id
+ = f.hidden_field :source_branch
+ = f.hidden_field :target_project_id
+ = f.hidden_field :target_branch
.mr-compare.merge-request
%ul.nav.nav-tabs.merge-request-tabs
diff --git a/app/views/shared/_clone_panel.html.haml b/app/views/shared/_clone_panel.html.haml
index 96357cac592..60bb76e898a 100644
--- a/app/views/shared/_clone_panel.html.haml
+++ b/app/views/shared/_clone_panel.html.haml
@@ -1,23 +1,23 @@
- project = project || @project
.git-clone-holder.input-group
- .input-group-btn
- %button{ |
- :type => 'button', |
- class: "btn #{ 'active' if default_clone_protocol == 'ssh' }#{ ' has_tooltip' if current_user && current_user.require_ssh_key? }", |
- :"data-clone" => project.ssh_url_to_repo, |
- :"data-title" => "Add an SSH key to your profile<br> to pull or push via SSH",
- :"data-html" => "true",
- :"data-container" => "body"}
- SSH
- %button{ |
- :type => 'button', |
- class: "btn #{ 'active' if default_clone_protocol == 'http' }#{ ' has_tooltip' if current_user && current_user.require_password? }", |
- :"data-clone" => project.http_url_to_repo, |
- :"data-title" => "Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}",
- :"data-html" => "true",
- :"data-container" => "body"}
- = gitlab_config.protocol.upcase
- = text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control", readonly: true
+ .input-group-addon.git-protocols
+ .input-group-btn
+ %button{ |
+ class: "btn btn-sm #{ 'active' if default_clone_protocol == 'ssh' }#{ ' has_tooltip' if current_user && current_user.require_ssh_key? }", |
+ :"data-clone" => project.ssh_url_to_repo, |
+ :"data-title" => "Add an SSH key to your profile<br> to pull or push via SSH",
+ :"data-html" => "true",
+ :"data-container" => "body"}
+ SSH
+ .input-group-btn
+ %button{ |
+ class: "btn btn-sm #{ 'active' if default_clone_protocol == 'http' }#{ ' has_tooltip' if current_user && current_user.require_password? }", |
+ :"data-clone" => project.http_url_to_repo, |
+ :"data-title" => "Set a password on your account<br> to pull or push via #{gitlab_config.protocol.upcase}",
+ :"data-html" => "true",
+ :"data-container" => "body"}
+ = gitlab_config.protocol.upcase
+ = text_field_tag :project_clone, default_url_to_repo(project), class: "js-select-on-focus form-control input-sm", readonly: true
- if project.kind_of?(Project)
.input-group-addon
.visibility-level-label.has_tooltip{'data-title' => "#{visibility_level_label(project.visibility_level)} project" }
diff --git a/doc/install/installation.md b/doc/install/installation.md
index a61a40ebd16..ca25eaea799 100644
--- a/doc/install/installation.md
+++ b/doc/install/installation.md
@@ -4,6 +4,12 @@
Since an installation from source is a lot of work and error prone we strongly recommend the fast and reliable [Omnibus package installation](https://about.gitlab.com/downloads/) (deb/rpm).
+One reason the Omnibus package is more reliable is its use of Runit to restart any of the GitLab processes in case one crashes.
+On heavily used GitLab instances the memory usage of the Sidekiq background worker will grow over time.
+Omnibus packages solve this by [letting the Sidekiq terminate gracefully](http://doc.gitlab.com/ce/operations/sidekiq_memory_killer.html) if it uses too much memory.
+After this termination Runit will detect Sidekiq is not running and will start it.
+Since installations from source don't have Runit, Sidekiq can't be terminated and its memory usage will grow over time.
+
## Select Version to Install
Make sure you view [this installation guide](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.md) from the tag (version) of GitLab you would like to install.
diff --git a/doc/release/master.md b/doc/release/master.md
index 19070b46a0d..9163e652003 100644
--- a/doc/release/master.md
+++ b/doc/release/master.md
@@ -31,3 +31,32 @@ git remote add gl git@gitlab.com:gitlab-org/gitlab-ce.git
gpa
```
+# Yanking packages from packages.gitlab.com
+
+In case something went wrong with the release and there is a need to remove the packages you can yank the packages by following the
+procedure described in [package cloud documentation](https://packagecloud.io/docs#yank_pkg).
+
+You need to have:
+
+1. `package_cloud` gem installed (sudo gem install package_cloud)
+1. Email and password for packages.gitlab.com
+1. Make sure that you are supplying the url to packages.gitlab.com (default is packagecloud.io)
+
+Example of yanking a package:
+
+```bash
+package_cloud yank --url https://packages.gitlab.com gitlab/gitlab-ce/el/6 gitlab-ce-7.10.2~omnibus-1.x86_64.rpm
+```
+
+If you are attempting this for the first time the output will look something like:
+
+```bash
+Looking for repository at gitlab/gitlab-ce... No config file exists at /Users/marin/.packagecloud. Login to create one.
+Email:
+marin@gitlab.com
+Password:
+
+Got your token. Writing a config file to /Users/marin/.packagecloud... success!
+success!
+Attempting to yank package at gitlab/gitlab-ce/el/6/gitlab-ce-7.10.2~omnibus-1.x86_64.rpm...done!
+```
diff --git a/doc/release/patch.md b/doc/release/patch.md
index 4c7b471785f..a569bb3da8d 100644
--- a/doc/release/patch.md
+++ b/doc/release/patch.md
@@ -44,7 +44,7 @@ Create release tag and push to remotes:
bundle exec rake release["x.x.x"]
```
-### Release
+## Release
1. [Build new packages with the latest version](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/release.md)
1. Apply the patch to GitLab.com and the private GitLab development server
@@ -53,3 +53,4 @@ bundle exec rake release["x.x.x"]
1. Send tweets about the release from `@gitlab`, tweet should include the most important feature that the release is addressing and link to the blog post
1. Note in the 'GitLab X.X regressions' issue that the patch was published (CE only)
1. [Create new AMIs](https://dev.gitlab.org/gitlab/AMI/blob/master/README.md)
+1. Create a new patch release issue for the next potential release \ No newline at end of file
diff --git a/doc/update/upgrader.md b/doc/update/upgrader.md
index 2cca46c86a3..d23534d58b6 100644
--- a/doc/update/upgrader.md
+++ b/doc/update/upgrader.md
@@ -73,4 +73,4 @@ cd /home/git/gitlab; \
sudo service gitlab start; \
sudo service nginx restart; \
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
-```
+``` \ No newline at end of file
diff --git a/docker/README.md b/docker/README.md
index a54739ae3d3..2e533ae9dd5 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -1,64 +1,118 @@
-What is GitLab?
-===============
+# GitLab Docker images
-GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. It has LDAP/AD integration, handles 25,000 users on a single server but can also run on a highly available active/active cluster. A subscription gives you access to our support team and to GitLab Enterprise Edition that contains extra features aimed at larger organizations.
+## What is GitLab?
+GitLab offers git repository management, code reviews, issue tracking, activity feeds, wikis. It has LDAP/AD integration, handles 25,000 users on a single server but can also run on a highly available active/active cluster.
Learn more on [https://about.gitlab.com](https://about.gitlab.com)
+## After starting a container
-How to build and use images yourself
-======================
+After starting a container you can go to [http://localhost:8080/](http://localhost:8080/) or [http://192.168.59.103:8080/](http://192.168.59.103:8080/) if you use boot2docker.
-At this moment GitLab doesn't have official Docker images.
-There are unofficial images at the bottom of this document.
-But in this section we'll build our own.
-For convinience we will use suffix _xy where xy is current version of GitLab.
-Build your own based on the Omnibus packages with the following commands.
-Run these from the GitLab repo root directory.
-People using boot2docker should run it without sudo.
+It might take a while before the docker container is responding to queries.
+
+You can check the status with something like `sudo docker logs -f 7c10172d7705`.
+
+You can login to the web interface with username `root` and password `5iveL!fe`.
+
+Next time, you can just use docker start and stop to run the container.
+
+## How to build the docker images
+
+This guide will also let you know how to build docker images yourself.
+Please run all the commands from the GitLab repo root directory.
+People using boot2docker should run all the commands without sudo.
+
+## Choosing between the single and the app and data images
+
+Normally docker uses a single image for one applications.
+But GitLab stores repositories and uploads in the filesystem.
+This means that upgrades of a single image are hard.
+That is why we recommend using separate app and data images.
+We'll first describe how to use a single image.
+After that we'll describe how to use the app and data images.
+
+## Single image
+
+Get a published image from Dockerhub:
```bash
-sudo docker build --tag gitlab_data_image docker/data/
-sudo docker build --tag gitlab_app_image_xy docker/
+sudo docker pull sytse/gitlab-ce:7.10.1
```
-We assume using a data volume container, this will simplify migrations and backups.
-This empty container will exist to persist as volumes the 3 directories used by GitLab, so remember not to delete it.
+Run the image:
-The directories on data container are:
+```bash
+sudo docker run --detach --publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1
+```
-- `/var/opt/gitlab` for application data
-- `/var/log/gitlab` for logs
-- `/etc/gitlab` for configuration
+After this you can login to the web interface as explained above in 'After starting a container'.
+
+Build the image:
+
+```bash
+sudo docker build --tag sytse/gitlab-ce:7.10.1 docker/single/
+```
+
+Publish the image to Dockerhub:
+
+```bash
+sudo docker push sytse/gitlab-ce
+```
+
+Diagnosing commands:
+
+```bash
+sudo docker run -i -t sytse/gitlab-ce:7.10.1
+sudo docker run -ti -e TERM=linux --name gitlab-ce-troubleshoot --publish 8080:80 --publish 2222:22 sytse/gitlab-ce:7.10.1 bash /usr/local/bin/wrapper
+```
-Create the data container with:
+## App and data images
+
+### Get published images from Dockerhub
+
+```bash
+sudo docker pull sytse/gitlab-data
+sudo docker pull sytse/gitlab-app:7.10.1
+```
+
+### Run the images
```bash
-sudo docker run --name gitlab_data gitlab_data_image /bin/true
+sudo docker run --name gitlab-data sytse/gitlab-data /bin/true
+sudo docker run --detach --name gitlab_app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data sytse/gitlab-app:7.10.1
```
-After creating data container run GitLab container:
+After this you can login to the web interface as explained above in 'After starting a container'.
+
+### Build images
+
+Build your own based on the Omnibus packages with the following commands.
```bash
-sudo docker run --detach --name gitlab_app_xy --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_app_image_xy
+sudo docker build --tag gitlab-data docker/data/
+sudo docker build --tag gitlab-app:7.10.1 docker/app/
```
-It might take a while before the docker container is responding to queries. You can follow the configuration process with `sudo docker logs -f gitlab_app_xy`.
+After this run the images as described in the previous section.
+
+We assume using a data volume container, this will simplify migrations and backups.
+This empty container will exist to persist as volumes the 3 directories used by GitLab, so remember not to delete it.
-You can then go to [http://localhost:8080/](http://localhost:8080/) or [http://192.168.59.103:8080/](http://192.168.59.103:8080/) if you use boot2docker.
+The directories on data container are:
-You can login with username `root` and password `5iveL!fe`.
-Next time, you can just use `sudo docker start gitlab_app` and `sudo docker stop gitlab_app`.
+- `/var/opt/gitlab` for application data
+- `/var/log/gitlab` for logs
+- `/etc/gitlab` for configuration
-How to configure GitLab
-========================
+### Configure GitLab
-This container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`.
+These container uses the official Omnibus GitLab distribution, so all configuration is done in the unique configuration file `/etc/gitlab/gitlab.rb`.
To access GitLab configuration, you can start an interactive command line in a new container using the shared data volume container, you will be able to browse the 3 directories and use your favorite text editor:
```bash
-sudo docker run -ti -e TERM=linux --rm --volumes-from gitlab_data ubuntu
+sudo docker run -ti -e TERM=linux --rm --volumes-from gitlab-data ubuntu
vi /etc/gitlab/gitlab.rb
```
@@ -66,49 +120,36 @@ vi /etc/gitlab/gitlab.rb
You can find all available options in [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
-How to upgrade GitLab
-========================
+### Upgrade GitLab with app and data images
To updgrade GitLab to new versions, stop running container, create new docker image and container from that image.
-It Assumes that you're upgrading from 7.8 to 7.9 and you're in the updated GitLab repo root directory:
+It Assumes that you're upgrading from 7.8.1 to 7.10.1 and you're in the updated GitLab repo root directory:
```bash
-sudo docker stop gitlab_app_78
-sudo docker build --tag gitlab_app_image_79 docker/
-sudo docker run --detach --name gitlab_app_79 --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab_app_image_79
+sudo docker stop gitlab-app
+sudo docker rm gitlab-app
+sudo docker build --tag gitlab-app:7.10.1 docker/app/
+sudo docker run --detach --name gitlab-app --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data gitlab-app:7.10.1
```
-On the first run GitLab will reconfigure and update itself. If everything runs OK don't forget to cleanup old container and image:
+On the first run GitLab will reconfigure and update itself. If everything runs OK don't forget to cleanup the app image:
```bash
-sudo docker rm gitlab_app_78
-sudo docker rmi gitlab_app_image_78
+sudo docker rmi gitlab-app:7.8.1
```
-Troubleshooting
-=========================
-Please see the [troubleshooting](troubleshooting.md) file in this directory.
+### Publish images to Dockerhub
-
-Publish the images to Dockerhub
-=========================
Login to Dockerhub with `sudo docker login` and run the following (replace '7.9.2' with the version you're using and 'Sytse Sijbrandij' with your name):
```bash
-sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab_app_xy sytse/gitlab-ce:7.9.2
-sudo docker push sytse/gitlab-ce:7.9.2
+sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab-app:7.10.1 sytse/gitlab-app:7.10.1
+sudo docker push sytse/gitlab-app:7.10.1
sudo docker commit -m "Initial commit" -a "Sytse Sijbrandij" gitlab_data sytse/gitlab_data
sudo docker push sytse/gitlab_data
```
-Use images published to Dockerhub
-================================
-This examples uses the unofficial images made by GitLab CEO Sytse.
+## Troubleshooting
-```bash
-sudo docker pull sytse/gitlab_data
-sudo docker pull sytse/gitlab-ce:7.9.2
-sudo docker run --name gitlab_data_volume sytse/gitlab_data /bin/true
-sudo docker run --detach --name gitlab_app_7_9_2 --publish 8080:80 --publish 2222:22 --volumes-from gitlab_data_volume sytse/gitlab-ce:7.9.2
-```
+Please see the [troubleshooting](troubleshooting.md) file in this directory. \ No newline at end of file
diff --git a/docker/Dockerfile b/docker/app/Dockerfile
index df828a2a349..df828a2a349 100644
--- a/docker/Dockerfile
+++ b/docker/app/Dockerfile
diff --git a/docker/assets/wrapper b/docker/app/assets/wrapper
index 9e6e7a05903..9e6e7a05903 100755
--- a/docker/assets/wrapper
+++ b/docker/app/assets/wrapper
diff --git a/docker/single/Dockerfile b/docker/single/Dockerfile
new file mode 100644
index 00000000000..8cdc24cf045
--- /dev/null
+++ b/docker/single/Dockerfile
@@ -0,0 +1,35 @@
+FROM ubuntu:14.04
+MAINTAINER Sytse Sijbrandij
+
+# Install required packages
+RUN apt-get update
+ENV DEBIAN_FRONTEND noninteractive
+RUN apt-get install -yq --no-install-recommends \
+ ca-certificates \
+ openssh-server \
+ wget
+
+# Download & Install GitLab
+# If the Omnibus package version below is outdated please contribute a merge request to update it.
+# If you run GitLab Enterprise Edition point it to a location where you have downloaded it.
+RUN TMP_FILE=$(mktemp); \
+ wget -q -O $TMP_FILE https://downloads-packages.s3.amazonaws.com/ubuntu-14.04/gitlab-ce_7.10.1~omnibus.2-1_amd64.deb \
+ && dpkg -i $TMP_FILE \
+ && rm -f $TMP_FILE
+
+# Manage SSHD through runit
+RUN mkdir -p /opt/gitlab/sv/sshd/supervise \
+ && mkfifo /opt/gitlab/sv/sshd/supervise/ok \
+ && printf "#!/bin/sh\nexec 2>&1\numask 077\nexec /usr/sbin/sshd -D" > /opt/gitlab/sv/sshd/run \
+ && chmod a+x /opt/gitlab/sv/sshd/run \
+ && ln -s /opt/gitlab/sv/sshd /opt/gitlab/service \
+ && mkdir -p /var/run/sshd
+
+# Expose web & ssh
+EXPOSE 80 22
+
+# Copy assets
+COPY assets/wrapper /usr/local/bin/
+
+# Wrapper to handle signal, trigger runit and reconfigure GitLab
+CMD ["/usr/local/bin/wrapper"]
diff --git a/docker/single/assets/wrapper b/docker/single/assets/wrapper
new file mode 100755
index 00000000000..966b2cab4a1
--- /dev/null
+++ b/docker/single/assets/wrapper
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+function sigterm_handler() {
+ echo "SIGTERM signal received, try to gracefully shutdown all services..."
+ gitlab-ctl stop
+}
+
+trap "sigterm_handler; exit" TERM
+
+function entrypoint() {
+ /opt/gitlab/embedded/bin/runsvdir-start &
+ gitlab-ctl reconfigure # will also start everything
+ gitlab-ctl tail # tail all logs
+}
+
+entrypoint
diff --git a/docker/single/marathon.json b/docker/single/marathon.json
new file mode 100644
index 00000000000..d23c2b84e0e
--- /dev/null
+++ b/docker/single/marathon.json
@@ -0,0 +1,14 @@
+{
+ "id": "/gitlab",
+ "ports": [0,0],
+ "cpus": 2,
+ "mem": 2048.0,
+ "disk": 10240.0,
+ "container": {
+ "type": "DOCKER",
+ "docker": {
+ "network": "HOST",
+ "image": "sytse/gitlab-ce:7.10.1"
+ }
+ }
+} \ No newline at end of file
diff --git a/docker/troubleshooting.md b/docker/troubleshooting.md
index b1b70de5997..5827f2185db 100644
--- a/docker/troubleshooting.md
+++ b/docker/troubleshooting.md
@@ -61,3 +61,13 @@ head /proc/sys/kernel/shmmax /proc/sys/kernel/shmall
free -m
```
+
+# Cleanup
+
+Remove ALL docker containers and images (also non GitLab ones):
+
+```
+docker rm $(docker ps -a -q)
+docker rmi $(docker images -q)
+```
+
diff --git a/features/steps/project/forked_merge_requests.rb b/features/steps/project/forked_merge_requests.rb
index 63ad90e1241..94d21d28a0c 100644
--- a/features/steps/project/forked_merge_requests.rb
+++ b/features/steps/project/forked_merge_requests.rb
@@ -46,7 +46,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
end
step 'I submit the merge request' do
- click_button "Submit merge request"
+ click_button "Submit new merge request"
end
step 'I follow the target commit link' do
diff --git a/features/steps/project/merge_requests.rb b/features/steps/project/merge_requests.rb
index bb1f9f129c0..12d4d81159e 100644
--- a/features/steps/project/merge_requests.rb
+++ b/features/steps/project/merge_requests.rb
@@ -77,7 +77,7 @@ class Spinach::Features::ProjectMergeRequests < Spinach::FeatureSteps
select "feature", from: "merge_request_target_branch"
click_button "Compare branches"
fill_in "merge_request_title", with: "Wiki Feature"
- click_button "Submit merge request"
+ click_button "Submit new merge request"
end
step 'project "Shop" have "Bug NS-04" open merge request' do
diff --git a/spec/features/markdown_spec.rb b/spec/features/markdown_spec.rb
index 3528200e12b..57d01236505 100644
--- a/spec/features/markdown_spec.rb
+++ b/spec/features/markdown_spec.rb
@@ -62,7 +62,7 @@ describe 'GitLab Markdown' do
# Given a header ID, goes to that element's parent (the header), then to its
# second sibling (the body).
def get_section(id)
- @doc.at_css("##{id}").parent.next.next
+ @doc.at_css("##{id}").parent.next_element
end
# it 'writes to a file' do
@@ -161,6 +161,19 @@ describe 'GitLab Markdown' do
end
end
+ describe 'Edge Cases' do
+ it 'allows markup inside link elements' do
+ expect(@doc.at_css('a[href="#link-emphasis"]').to_html).
+ to eq %{<a href="#link-emphasis"><em>text</em></a>}
+
+ expect(@doc.at_css('a[href="#link-strong"]').to_html).
+ to eq %{<a href="#link-strong"><strong>text</strong></a>}
+
+ expect(@doc.at_css('a[href="#link-code"]').to_html).
+ to eq %{<a href="#link-code"><code>text</code></a>}
+ end
+ end
+
describe 'EmojiFilter' do
it 'parses Emoji' do
expect(@doc).to have_selector('img.emoji', count: 10)
@@ -176,7 +189,7 @@ describe 'GitLab Markdown' do
end
describe 'AutolinkFilter' do
- let(:list) { get_section('autolinkfilter').parent.search('ul') }
+ let(:list) { get_section('autolinkfilter').next_element }
def item(index)
list.at_css("li:nth-child(#{index})")
diff --git a/spec/fixtures/markdown.md.erb b/spec/fixtures/markdown.md.erb
index 0c140758557..6b79aad8f86 100644
--- a/spec/fixtures/markdown.md.erb
+++ b/spec/fixtures/markdown.md.erb
@@ -94,6 +94,14 @@ The problem with SanitizationFilter is that it can be too aggressive.
| `1 < 3 & 5` | 1 &lt; 3 &amp; 5 | 1 < 3 & 5 |
| `<foo>` | &lt;foo&gt; | <foo> |
+### Edge Cases
+
+Markdown should be usable inside a link. Let's try!
+
+- [_text_](#link-emphasis)
+- [**text**](#link-strong)
+- [`text`](#link-code)
+
### EmojiFilter
Because life would be :zzz: without Emoji, right? :rocket:
diff --git a/spec/helpers/diff_helper_spec.rb b/spec/helpers/diff_helper_spec.rb
index 95719b4b49f..dd4c1d645e2 100644
--- a/spec/helpers/diff_helper_spec.rb
+++ b/spec/helpers/diff_helper_spec.rb
@@ -5,7 +5,8 @@ describe DiffHelper do
let(:project) { create(:project) }
let(:commit) { project.commit(sample_commit.id) }
- let(:diff) { commit.diffs.first }
+ let(:diffs) { commit.diffs }
+ let(:diff) { diffs.first }
let(:diff_file) { Gitlab::Diff::File.new(diff) }
describe 'diff_hard_limit_enabled?' do
@@ -30,6 +31,57 @@ describe DiffHelper do
end
end
+ describe 'allowed_diff_lines' do
+ it 'should return hard limit for number of lines in a diff if force diff is true' do
+ allow(controller).to receive(:params) { { force_show_diff: true } }
+ expect(allowed_diff_lines).to eq(50000)
+ end
+
+ it 'should return safe limit for numbers of lines a diff if force diff is false' do
+ expect(allowed_diff_lines).to eq(5000)
+ end
+ end
+
+ describe 'safe_diff_files' do
+ it 'should return all files from a commit that is smaller than safe limits' do
+ expect(safe_diff_files(diffs).length).to eq(2)
+ end
+
+ it 'should return only the first file if the diff line count in the 2nd file takes the total beyond safe limits' do
+ diffs[1].diff.stub(lines: [""] * 4999) #simulate 4999 lines
+ expect(safe_diff_files(diffs).length).to eq(1)
+ end
+
+ it 'should return all files from a commit that is beyond safe limit for numbers of lines if force diff is true' do
+ allow(controller).to receive(:params) { { force_show_diff: true } }
+ diffs[1].diff.stub(lines: [""] * 4999) #simulate 4999 lines
+ expect(safe_diff_files(diffs).length).to eq(2)
+ end
+
+ it 'should return only the first file if the diff line count in the 2nd file takes the total beyond hard limits' do
+ allow(controller).to receive(:params) { { force_show_diff: true } }
+ diffs[1].diff.stub(lines: [""] * 49999) #simulate 49999 lines
+ expect(safe_diff_files(diffs).length).to eq(1)
+ end
+
+ it 'should return only a safe number of file diffs if a commit touches more files than the safe limits' do
+ large_diffs = diffs * 100 #simulate 200 diffs
+ expect(safe_diff_files(large_diffs).length).to eq(100)
+ end
+
+ it 'should return all file diffs if a commit touches more files than the safe limits but force diff is true' do
+ allow(controller).to receive(:params) { { force_show_diff: true } }
+ large_diffs = diffs * 100 #simulate 200 diffs
+ expect(safe_diff_files(large_diffs).length).to eq(200)
+ end
+
+ it 'should return a limited file diffs if a commit touches more files than the hard limits and force diff is true' do
+ allow(controller).to receive(:params) { { force_show_diff: true } }
+ very_large_diffs = diffs * 1000 #simulate 2000 diffs
+ expect(safe_diff_files(very_large_diffs).length).to eq(1000)
+ end
+ end
+
describe 'parallel_diff' do
it 'should return an array of arrays containing the parsed diff' do
expect(parallel_diff(diff_file, 0)).
diff --git a/spec/services/git_push_service_spec.rb b/spec/services/git_push_service_spec.rb
index af37e8319a4..e7558f28768 100644
--- a/spec/services/git_push_service_spec.rb
+++ b/spec/services/git_push_service_spec.rb
@@ -234,5 +234,18 @@ describe GitPushService do
expect(Issue.find(issue.id)).to be_opened
end
end
-end
+ describe "empty project" do
+ let(:project) { create(:project_empty_repo) }
+ let(:new_ref) { 'refs/heads/feature'}
+
+ before do
+ allow(project).to receive(:default_branch).and_return('feature')
+ expect(project).to receive(:change_head) { 'feature'}
+ end
+
+ it 'push to first branch updates HEAD' do
+ service.execute(project, user, @blankrev, @newrev, new_ref)
+ end
+ end
+end