Commit f3e95aae authored by Douwe Maan's avatar Douwe Maan

Merge branch 'master' into 'web-hooks-log-pagination'

# Conflicts:
#   db/schema.rb
parents f3008907 acc6e3a0
...@@ -285,7 +285,8 @@ review-docs-deploy-manual: ...@@ -285,7 +285,8 @@ review-docs-deploy-manual:
- ./$SCRIPT_NAME deploy - ./$SCRIPT_NAME deploy
when: manual when: manual
only: only:
- branches - branches@gitlab-org/gitlab-ce
- branches@gitlab-org/gitlab-ee
<<: *except-docs-and-qa <<: *except-docs-and-qa
# Always trigger a docs build in gitlab-docs only on docs-only branches. # Always trigger a docs build in gitlab-docs only on docs-only branches.
...@@ -298,6 +299,8 @@ review-docs-deploy: ...@@ -298,6 +299,8 @@ review-docs-deploy:
- ./$SCRIPT_NAME deploy - ./$SCRIPT_NAME deploy
only: only:
- /(^docs[\/-].*|.*-docs$)/ - /(^docs[\/-].*|.*-docs$)/
- branches@gitlab-org/gitlab-ce
- branches@gitlab-org/gitlab-ee
<<: *except-qa <<: *except-qa
# Cleanup remote environment of gitlab-docs # Cleanup remote environment of gitlab-docs
......
...@@ -39,6 +39,7 @@ Set the title to: `[Security] Description of the original issue` ...@@ -39,6 +39,7 @@ Set the title to: `[Security] Description of the original issue`
- [ ] Add the nickname of the external user who found the issue (and/or HackerOne profile) to the Thanks row in the [details section](#details) - [ ] Add the nickname of the external user who found the issue (and/or HackerOne profile) to the Thanks row in the [details section](#details)
### Summary ### Summary
#### Links #### Links
| Description | Link | | Description | Link |
......
Add a description of your merge request here. Merge requests without an adequate Add a description of your merge request here. Merge requests without an adequate
description will not be reviewed until one is added. description will not be reviewed until one is added.
## Database Checklist ## Database checklist
When adding migrations: When adding migrations:
...@@ -31,7 +31,7 @@ When removing columns, tables, indexes or other structures: ...@@ -31,7 +31,7 @@ When removing columns, tables, indexes or other structures:
- [ ] Removed these in a post-deployment migration - [ ] Removed these in a post-deployment migration
- [ ] Made sure the application no longer uses (or ignores) these structures - [ ] Made sure the application no longer uses (or ignores) these structures
## General Checklist ## General checklist
- [ ] [Changelog entry](https://docs.gitlab.com/ee/development/changelog.html) added, if necessary - [ ] [Changelog entry](https://docs.gitlab.com/ee/development/changelog.html) added, if necessary
- [ ] [Documentation created/updated](https://docs.gitlab.com/ee/development/doc_styleguide.html) - [ ] [Documentation created/updated](https://docs.gitlab.com/ee/development/doc_styleguide.html)
......
...@@ -35,7 +35,7 @@ We're hiring developers, support people, and production engineers all the time, ...@@ -35,7 +35,7 @@ We're hiring developers, support people, and production engineers all the time,
There are two editions of GitLab: There are two editions of GitLab:
- GitLab Community Edition (CE) is available freely under the MIT Expat license. - GitLab Community Edition (CE) is available freely under the MIT Expat license.
- GitLab Enterprise Edition (EE) includes [extra features](https://about.gitlab.com/products/#compare-options) that are more useful for organizations with more than 100 users. To use EE and get official support please [become a subscriber](https://about.gitlab.com/products/). - GitLab Enterprise Edition (EE) includes [extra features](https://about.gitlab.com/pricing/#compare-options) that are more useful for organizations with more than 100 users. To use EE and get official support please [become a subscriber](https://about.gitlab.com/pricing/).
## Website ## Website
......
...@@ -12,7 +12,7 @@ export const defaultAutocompleteConfig = { ...@@ -12,7 +12,7 @@ export const defaultAutocompleteConfig = {
members: true, members: true,
issues: true, issues: true,
mergeRequests: true, mergeRequests: true,
epics: false, epics: true,
milestones: true, milestones: true,
labels: true, labels: true,
}; };
...@@ -493,6 +493,7 @@ GfmAutoComplete.atTypeMap = { ...@@ -493,6 +493,7 @@ GfmAutoComplete.atTypeMap = {
'@': 'members', '@': 'members',
'#': 'issues', '#': 'issues',
'!': 'mergeRequests', '!': 'mergeRequests',
'&': 'epics',
'~': 'labels', '~': 'labels',
'%': 'milestones', '%': 'milestones',
'/': 'commands', '/': 'commands',
......
...@@ -9,6 +9,13 @@ export default class GLForm { ...@@ -9,6 +9,13 @@ export default class GLForm {
this.form = form; this.form = form;
this.textarea = this.form.find('textarea.js-gfm-input'); this.textarea = this.form.find('textarea.js-gfm-input');
this.enableGFM = Object.assign({}, GFMConfig.defaultAutocompleteConfig, enableGFM); this.enableGFM = Object.assign({}, GFMConfig.defaultAutocompleteConfig, enableGFM);
// Disable autocomplete for keywords which do not have dataSources available
const dataSources = (gl.GfmAutoComplete && gl.GfmAutoComplete.dataSources) || {};
Object.keys(this.enableGFM).forEach(item => {
if (item !== 'emojis') {
this.enableGFM[item] = !!dataSources[item];
}
});
// Before we start, we should clean up any previous data for this form // Before we start, we should clean up any previous data for this form
this.destroy(); this.destroy();
// Setup the form // Setup the form
......
...@@ -8,6 +8,7 @@ export default () => { ...@@ -8,6 +8,7 @@ export default () => {
members: false, members: false,
issues: false, issues: false,
mergeRequests: false, mergeRequests: false,
epics: false,
milestones: false, milestones: false,
labels: false, labels: false,
}); });
......
...@@ -8,10 +8,11 @@ export default (initGFM = true) => { ...@@ -8,10 +8,11 @@ export default (initGFM = true) => {
new DueDateSelectors(); // eslint-disable-line no-new new DueDateSelectors(); // eslint-disable-line no-new
// eslint-disable-next-line no-new // eslint-disable-next-line no-new
new GLForm($('.milestone-form'), { new GLForm($('.milestone-form'), {
emojis: initGFM, emojis: true,
members: initGFM, members: initGFM,
issues: initGFM, issues: initGFM,
mergeRequests: initGFM, mergeRequests: initGFM,
epics: initGFM,
milestones: initGFM, milestones: initGFM,
labels: initGFM, labels: initGFM,
}); });
......
<script> <script>
import Icon from '~/vue_shared/components/icon.vue';
import timeagoMixin from '../../vue_shared/mixins/timeago'; import timeagoMixin from '../../vue_shared/mixins/timeago';
import tooltip from '../../vue_shared/directives/tooltip'; import tooltip from '../../vue_shared/directives/tooltip';
import LoadingButton from '../../vue_shared/components/loading_button.vue'; import LoadingButton from '../../vue_shared/components/loading_button.vue';
...@@ -14,6 +15,7 @@ export default { ...@@ -14,6 +15,7 @@ export default {
LoadingButton, LoadingButton,
MemoryUsage, MemoryUsage,
StatusIcon, StatusIcon,
Icon,
}, },
directives: { directives: {
tooltip, tooltip,
...@@ -110,11 +112,10 @@ export default { ...@@ -110,11 +112,10 @@ export default {
class="deploy-link js-deploy-url" class="deploy-link js-deploy-url"
> >
{{ deployment.external_url_formatted }} {{ deployment.external_url_formatted }}
<i <icon
class="fa fa-external-link" :size="16"
aria-hidden="true" name="external-link"
> />
</i>
</a> </a>
</template> </template>
<span <span
......
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
members: this.enableAutocomplete, members: this.enableAutocomplete,
issues: this.enableAutocomplete, issues: this.enableAutocomplete,
mergeRequests: this.enableAutocomplete, mergeRequests: this.enableAutocomplete,
epics: this.enableAutocomplete,
milestones: this.enableAutocomplete, milestones: this.enableAutocomplete,
labels: this.enableAutocomplete, labels: this.enableAutocomplete,
}); });
......
...@@ -68,8 +68,7 @@ ...@@ -68,8 +68,7 @@
} }
.nav-sidebar { .nav-sidebar {
transition: width $sidebar-transition-duration, transition: width $sidebar-transition-duration, left $sidebar-transition-duration;
left $sidebar-transition-duration;
position: fixed; position: fixed;
z-index: 400; z-index: 400;
width: $contextual-sidebar-width; width: $contextual-sidebar-width;
...@@ -77,12 +76,12 @@ ...@@ -77,12 +76,12 @@
bottom: 0; bottom: 0;
left: 0; left: 0;
background-color: $gray-light; background-color: $gray-light;
box-shadow: inset -2px 0 0 $border-color; box-shadow: inset -1px 0 0 $border-color;
transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0);
&:not(.sidebar-collapsed-desktop) { &:not(.sidebar-collapsed-desktop) {
@media (min-width: map-get($grid-breakpoints, sm)) and (max-width: map-get($grid-breakpoints, sm)) { @media (min-width: map-get($grid-breakpoints, sm)) and (max-width: map-get($grid-breakpoints, sm)) {
box-shadow: inset -2px 0 0 $border-color, box-shadow: inset -1px 0 0 $border-color,
2px 1px 3px $dropdown-shadow-color; 2px 1px 3px $dropdown-shadow-color;
} }
} }
...@@ -214,7 +213,7 @@ ...@@ -214,7 +213,7 @@
> li { > li {
> a { > a {
@include media-breakpoint-up(sm) { @include media-breakpoint-up(sm) {
margin-right: 2px; margin-right: 1px;
} }
&:hover { &:hover {
...@@ -224,7 +223,7 @@ ...@@ -224,7 +223,7 @@
&.is-showing-fly-out { &.is-showing-fly-out {
> a { > a {
margin-right: 2px; margin-right: 1px;
} }
.sidebar-sub-level-items { .sidebar-sub-level-items {
...@@ -317,14 +316,14 @@ ...@@ -317,14 +316,14 @@
.toggle-sidebar-button, .toggle-sidebar-button,
.close-nav-button { .close-nav-button {
width: $contextual-sidebar-width - 2px; width: $contextual-sidebar-width - 1px;
transition: width $sidebar-transition-duration; transition: width $sidebar-transition-duration;
position: fixed; position: fixed;
bottom: 0; bottom: 0;
padding: $gl-padding; padding: $gl-padding;
background-color: $gray-light; background-color: $gray-light;
border: 0; border: 0;
border-top: 2px solid $border-color; border-top: 1px solid $border-color;
color: $gl-text-color-secondary; color: $gl-text-color-secondary;
display: flex; display: flex;
align-items: center; align-items: center;
...@@ -379,7 +378,7 @@ ...@@ -379,7 +378,7 @@
.toggle-sidebar-button { .toggle-sidebar-button {
padding: 16px; padding: 16px;
width: $contextual-sidebar-collapsed-width - 2px; width: $contextual-sidebar-collapsed-width - 1px;
.collapse-text, .collapse-text,
.icon-angle-double-left { .icon-angle-double-left {
......
...@@ -261,12 +261,16 @@ ...@@ -261,12 +261,16 @@
vertical-align: baseline; vertical-align: baseline;
} }
a.autodevops-badge { a {
color: $white-light; color: $gl-text-color;
}
a.autodevops-link { &.autodevops-badge {
color: $gl-link-color; color: $white-light;
}
&.autodevops-link {
color: $gl-link-color;
}
} }
.commit-row-description { .commit-row-description {
......
...@@ -737,6 +737,10 @@ ...@@ -737,6 +737,10 @@
> *:not(:last-child) { > *:not(:last-child) {
margin-right: .3em; margin-right: .3em;
} }
svg {
vertical-align: text-top;
}
} }
.deploy-link { .deploy-link {
......
...@@ -93,7 +93,7 @@ class Projects::LfsApiController < Projects::GitHttpClientController ...@@ -93,7 +93,7 @@ class Projects::LfsApiController < Projects::GitHttpClientController
end end
def lfs_check_batch_operation! def lfs_check_batch_operation!
if upload_request? && Gitlab::Database.read_only? if batch_operation_disallowed?
render( render(
json: { json: {
message: lfs_read_only_message message: lfs_read_only_message
...@@ -104,6 +104,11 @@ class Projects::LfsApiController < Projects::GitHttpClientController ...@@ -104,6 +104,11 @@ class Projects::LfsApiController < Projects::GitHttpClientController
end end
end end
# Overridden in EE
def batch_operation_disallowed?
upload_request? && Gitlab::Database.read_only?
end
# Overridden in EE # Overridden in EE
def lfs_read_only_message def lfs_read_only_message
_('You cannot write to this read-only GitLab instance.') _('You cannot write to this read-only GitLab instance.')
......
...@@ -148,6 +148,7 @@ module NotesHelper ...@@ -148,6 +148,7 @@ module NotesHelper
members: autocomplete, members: autocomplete,
issues: autocomplete, issues: autocomplete,
mergeRequests: autocomplete, mergeRequests: autocomplete,
epics: autocomplete,
milestones: autocomplete, milestones: autocomplete,
labels: autocomplete labels: autocomplete
} }
......
...@@ -128,14 +128,9 @@ class MergeRequest < ActiveRecord::Base ...@@ -128,14 +128,9 @@ class MergeRequest < ActiveRecord::Base
end end
after_transition unchecked: :cannot_be_merged do |merge_request, transition| after_transition unchecked: :cannot_be_merged do |merge_request, transition|
begin if merge_request.notify_conflict?
if merge_request.notify_conflict? NotificationService.new.merge_request_unmergeable(merge_request)
NotificationService.new.merge_request_unmergeable(merge_request) TodoService.new.merge_request_became_unmergeable(merge_request)
TodoService.new.merge_request_became_unmergeable(merge_request)
end
rescue Gitlab::Git::CommandError
# Checking mergeability can trigger exception, e.g. non-utf8
# We ignore this type of errors.
end end
end end
...@@ -707,7 +702,14 @@ class MergeRequest < ActiveRecord::Base ...@@ -707,7 +702,14 @@ class MergeRequest < ActiveRecord::Base
end end
def notify_conflict? def notify_conflict?
(opened? || locked?) && !project.repository.can_be_merged?(diff_head_sha, target_branch) (opened? || locked?) &&
has_commits? &&
!branch_missing? &&
!project.repository.can_be_merged?(diff_head_sha, target_branch)
rescue Gitlab::Git::CommandError
# Checking mergeability can trigger exception, e.g. non-utf8
# We ignore this type of errors.
false
end end
def related_notes def related_notes
......
...@@ -67,11 +67,11 @@ class BambooService < CiService ...@@ -67,11 +67,11 @@ class BambooService < CiService
def execute(data) def execute(data)
return unless supported_events.include?(data[:object_kind]) return unless supported_events.include?(data[:object_kind])
get_path("updateAndBuild.action?buildKey=#{build_key}") get_path("updateAndBuild.action", { buildKey: build_key })
end end
def calculate_reactive_cache(sha, ref) def calculate_reactive_cache(sha, ref)
response = get_path("rest/api/latest/result?label=#{sha}") response = get_path("rest/api/latest/result/byChangeset/#{sha}")
{ build_page: read_build_page(response), commit_status: read_commit_status(response) } { build_page: read_build_page(response), commit_status: read_commit_status(response) }
end end
...@@ -113,18 +113,20 @@ class BambooService < CiService ...@@ -113,18 +113,20 @@ class BambooService < CiService
URI.join("#{bamboo_url}/", path).to_s URI.join("#{bamboo_url}/", path).to_s
end end
def get_path(path) def get_path(path, query_params = {})
url = build_url(path) url = build_url(path)
if username.blank? && password.blank? if username.blank? && password.blank?
Gitlab::HTTP.get(url, verify: false) Gitlab::HTTP.get(url, verify: false, query: query_params)
else else
url << '&os_authType=basic' query_params[:os_authType] = 'basic'
Gitlab::HTTP.get(url, verify: false, Gitlab::HTTP.get(url,
basic_auth: { verify: false,
username: username, query: query_params,
password: password basic_auth: {
}) username: username,
password: password
})
end end
end end
end end
...@@ -244,7 +244,7 @@ class User < ActiveRecord::Base ...@@ -244,7 +244,7 @@ class User < ActiveRecord::Base
scope :blocked, -> { with_states(:blocked, :ldap_blocked) } scope :blocked, -> { with_states(:blocked, :ldap_blocked) }
scope :external, -> { where(external: true) } scope :external, -> { where(external: true) }
scope :active, -> { with_state(:active).non_internal } scope :active, -> { with_state(:active).non_internal }
scope :without_projects, -> { where('id NOT IN (SELECT DISTINCT(user_id) FROM members WHERE user_id IS NOT NULL AND requested_at IS NULL)') } scope :without_projects, -> { joins('LEFT JOIN project_authorizations ON users.id = project_authorizations.user_id').where(project_authorizations: { user_id: nil }) }
scope :todo_authors, ->(user_id, state) { where(id: Todo.where(user_id: user_id, state: state).select(:author_id)) } scope :todo_authors, ->(user_id, state) { where(id: Todo.where(user_id: user_id, state: state).select(:author_id)) }
scope :order_recent_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'DESC')) } scope :order_recent_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'DESC')) }
scope :order_oldest_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'ASC')) } scope :order_oldest_sign_in, -> { reorder(Gitlab::Database.nulls_last_order('current_sign_in_at', 'ASC')) }
......
...@@ -27,6 +27,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ...@@ -27,6 +27,7 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
def statistics_buttons(show_auto_devops_callout:) def statistics_buttons(show_auto_devops_callout:)
[ [
readme_anchor_data,
changelog_anchor_data, changelog_anchor_data,
license_anchor_data, license_anchor_data,
contribution_guide_anchor_data, contribution_guide_anchor_data,
...@@ -212,11 +213,11 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated ...@@ -212,11 +213,11 @@ class ProjectPresenter < Gitlab::View::Presenter::Delegated
end end
def readme_anchor_data def readme_anchor_data
if current_user && can_current_user_push_to_default_branch? && repository.readme.blank? if current_user && can_current_user_push_to_default_branch? && repository.readme.nil?
OpenStruct.new(enabled: false, OpenStruct.new(enabled: false,
label: _('Add Readme'), label: _('Add Readme'),
link: add_readme_path) link: add_readme_path)
elsif repository.readme.present? elsif repository.readme
OpenStruct.new(enabled: true, OpenStruct.new(enabled: true,
label: _('Readme'), label: _('Readme'),
link: default_view != 'readme' ? readme_path : '#readme') link: default_view != 'readme' ? readme_path : '#readme')
......
...@@ -35,7 +35,7 @@ class BuildDetailsEntity < JobEntity ...@@ -35,7 +35,7 @@ class BuildDetailsEntity < JobEntity
def build_failed_issue_options def build_failed_issue_options
{ title: "Job Failed ##{build.id}", { title: "Job Failed ##{build.id}",
description: "Job [##{build.id}](#{project_job_path(project, build)}) failed for #{build.sha}:\n" } description: "Job [##{build.id}](#{project_job_url(project, build)}) failed for #{build.sha}:\n" }
end end
def current_user def current_user
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"v-if" => "!list.preset && list.id" } "v-if" => "!list.preset && list.id" }
%button.board-delete.has-tooltip.float-right{ type: "button", title: _("Delete list"), "aria-label" => _("Delete list"), data: { placement: "bottom" }, "@click.stop" => "deleteBoard" } %button.board-delete.has-tooltip.float-right{ type: "button", title: _("Delete list"), "aria-label" => _("Delete list"), data: { placement: "bottom" }, "@click.stop" => "deleteBoard" }
= icon("trash") = icon("trash")
.issue-count-badge.clearfix{ "v-if" => 'list.type !== "blank"' } .issue-count-badge.clearfix{ "v-if" => 'list.type !== "blank" && list.type !== "promotion"' }
%span.issue-count-badge-count.float-left{ ":class" => '{ "has-btn": list.type !== "closed" && !disabled }' } %span.issue-count-badge-count.float-left{ ":class" => '{ "has-btn": list.type !== "closed" && !disabled }' }
{{ list.issuesSize }} {{ list.issuesSize }}
- if can?(current_user, :admin_list, current_board_parent) - if can?(current_user, :admin_list, current_board_parent)
...@@ -43,8 +43,7 @@ ...@@ -43,8 +43,7 @@
"title" => _("New issue"), "title" => _("New issue"),
data: { placement: "top", container: "body" } } data: { placement: "top", container: "body" } }
= icon("plus", class: "js-no-trigger-collapse") = icon("plus", class: "js-no-trigger-collapse")
%board-list{ "v-if" => 'list.type !== "blank" && list.type !== "promotion"',
%board-list{ "v-if" => 'list.type !== "blank"',
":list" => "list", ":list" => "list",
":issues" => "list.issues", ":issues" => "list.issues",
":loading" => "list.loading", ":loading" => "list.loading",
...@@ -55,3 +54,4 @@ ...@@ -55,3 +54,4 @@
"ref" => "board-list" } "ref" => "board-list" }
- if can?(current_user, :admin_list, current_board_parent) - if can?(current_user, :admin_list, current_board_parent)
%board-blank-state{ "v-if" => 'list.id == "blank"' } %board-blank-state{ "v-if" => 'list.id == "blank"' }
= render_if_exists 'shared/boards/board_promotion_state'
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
{{ issue.title }} {{ issue.title }}
%br/ %br/
%span %span
= render_if_exists "shared/boards/components/sidebar/issue_project_path"
= precede "#" do = precede "#" do
{{ issue.iid }} {{ issue.iid }}
%a.gutter-toggle.float-right{ role: "button", %a.gutter-toggle.float-right{ role: "button",
...@@ -17,9 +18,11 @@ ...@@ -17,9 +18,11 @@
= custom_icon("icon_close", size: 15) = custom_icon("icon_close", size: 15)
.js-issuable-update .js-issuable-update
= render "shared/boards/components/sidebar/assignee" = render "shared/boards/components/sidebar/assignee"
= render_if_exists "shared/boards/components/sidebar/epic"
= render "shared/boards/components/sidebar/milestone" = render "shared/boards/components/sidebar/milestone"
= render "shared/boards/components/sidebar/due_date" = render "shared/boards/components/sidebar/due_date"
= render "shared/boards/components/sidebar/labels" = render "shared/boards/components/sidebar/labels"
= render_if_exists "shared/boards/components/sidebar/weight"
= render "shared/boards/components/sidebar/notifications" = render "shared/boards/components/sidebar/notifications"
%remove-btn{ ":issue" => "issue", %remove-btn{ ":issue" => "issue",
":issue-update" => "issue.sidebarInfoEndpoint", ":issue-update" => "issue.sidebarInfoEndpoint",
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
%div{ class: div_class } %div{ class: div_class }
= form.text_field :title, required: true, maxlength: 255, autofocus: true, = form.text_field :title, required: true, maxlength: 255, autofocus: true,
autocomplete: 'off', class: 'form-control pad qa-issuable-form-title' autocomplete: 'off', class: 'form-control pad qa-issuable-form-title', placeholder: _('Title')
- if issuable.respond_to?(:work_in_progress?) - if issuable.respond_to?(:work_in_progress?)
%p.form-text.text-muted %p.form-text.text-muted
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
- cronjob:ci_archive_traces_cron - cronjob:ci_archive_traces_cron
- cronjob:trending_projects - cronjob:trending_projects
- cronjob:issue_due_scheduler - cronjob:issue_due_scheduler
- cronjob:prune_web_hook_logs
- gcp_cluster:cluster_install_app - gcp_cluster:cluster_install_app
- gcp_cluster:cluster_provision - gcp_cluster:cluster_provision
......
# frozen_string_literal: true
# Worker that deletes a fixed number of outdated rows from the "web_hook_logs"
# table.
class PruneWebHookLogsWorker
include ApplicationWorker
include CronjobQueue
# The maximum number of rows to remove in a single job.
DELETE_LIMIT = 50_000
def perform
# MySQL doesn't allow "DELETE FROM ... WHERE id IN ( ... )" if the inner
# query refers to the same table. To work around this we wrap the IN body in
# another sub query.
WebHookLog
.where(
'id IN (SELECT id FROM (?) ids_to_remove)',
WebHookLog
.select(:id)
.where('created_at < ?', 90.days.ago.beginning_of_day)
.limit(DELETE_LIMIT)
)
.delete_all
end
end
---
title: Use monospaced font for MR diff commit link ref on GFM
merge_request:
author:
type: other
---
title: Fix link to job when creating a new issue from a failed job
merge_request: 20328
author:
type: fixed
---
title: Add readme button to non-empty project page
merge_request: 20104
author:
type: fixed
---
title: Fix merge request page rendering error when its target/source branch is missing
merge_request: 20280
author:
type: fixed
---
title: Add title placeholder for new issues
merge_request: 20271
author: George Tsiolis
type: changed
---
title: Improve performance of listing users without projects
merge_request:
author:
type: performance
---
title: Fix merge request diffs when created with gitaly_diff_between enabled
merge_request:
author:
type: fixed
---
title: Updated last commit link color
merge_request: 20234
author: Constance Okoghenun
type: fixed
---
title: Don't show context button for diffs of deleted files.
merge_request:
author:
type: fixed
---
title: Prune web hook logs older than 90 days
merge_request:
author:
type: added
---
title: Fix Bamboo CI status not showing for branch plans
merge_request:
author:
type: fixed
---
title: Update external link icon in merge request widget
merge_request: 20154
author: George Tsiolis
type: changed
# See https://github.com/jnicklas/carrierwave#using-amazon-s3
# for more options
# If you change this file in a Merge Request, please also create
# a Merge Request on https://gitlab.com/gitlab-org/omnibus-gitlab/merge_requests
#
production:
access_key_id: AKIA1111111111111UA
secret_access_key: secret
bucket: mygitlab.production.us
region: us-east-1
development:
access_key_id: AKIA1111111111111UA
secret_access_key: secret
bucket: mygitlab.development.us
region: us-east-1
test:
access_key_id: AKIA1111111111111UA
secret_access_key: secret
bucket: mygitlab.test.us
region: us-east-1
...@@ -338,6 +338,10 @@ Settings.cron_jobs['issue_due_scheduler_worker'] ||= Settingslogic.new({}) ...@@ -338,6 +338,10 @@ Settings.cron_jobs['issue_due_scheduler_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['issue_due_scheduler_worker']['cron'] ||= '50 00 * * *' Settings.cron_jobs['issue_due_scheduler_worker']['cron'] ||= '50 00 * * *'
Settings.cron_jobs['issue_due_scheduler_worker']['job_class'] = 'IssueDueSchedulerWorker' Settings.cron_jobs['issue_due_scheduler_worker']['job_class'] = 'IssueDueSchedulerWorker'
Settings.cron_jobs['prune_web_hook_logs_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['prune_web_hook_logs_worker']['cron'] ||= '0 */1 * * *'
Settings.cron_jobs['prune_web_hook_logs_worker']['job_class'] = 'PruneWebHookLogsWorker'
# #
# Sidekiq # Sidekiq
# #
......
CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/
aws_file = Rails.root.join('config', 'aws.yml')
if File.exist?(aws_file)
AWS_CONFIG = YAML.load(File.read(aws_file))[Rails.env]
CarrierWave.configure do |config|
config.fog_provider = 'fog/aws'
config.fog_credentials = {
provider: 'AWS', # required
aws_access_key_id: AWS_CONFIG['access_key_id'], # required
aws_secret_access_key: AWS_CONFIG['secret_access_key'], # required
region: AWS_CONFIG['region'], # optional, defaults to 'us-east-1'
}
# required
config.fog_directory = AWS_CONFIG['bucket']
# optional, defaults to true
config.fog_public = false
# optional, defaults to {}
config.fog_attributes = { 'Cache-Control' => 'max-age=315576000' }
# optional time (in seconds) that authenticated urls will be valid.
# when fog_public is false and provider is AWS or Google, defaults to 600
config.fog_authenticated_url_expiration = 1 << 29
end
end
require './spec/support/sidekiq' require './spec/support/sidekiq'
def create_group_with_parents(user, full_path)
parent_path = nil
group = nil
until full_path.blank?
path, _, full_path = full_path.partition('/')
if parent_path
parent = Group.find_by_full_path(parent_path)
parent_path += '/'
parent_path += path
group = Groups::CreateService.new(user, path: path, parent_id: parent.id).execute
else
parent_path = path
group = Group.find_by_full_path(parent_path) ||
Groups::CreateService.new(user, path: path).execute
end
end
group
end
Sidekiq::Testing.inline! do Sidekiq::Testing.inline! do
Gitlab::Seeder.quiet do Gitlab::Seeder.quiet do
flag = 'SEED_NESTED_GROUPS' flag = 'SEED_NESTED_GROUPS'
...@@ -48,7 +23,8 @@ Sidekiq::Testing.inline! do ...@@ -48,7 +23,8 @@ Sidekiq::Testing.inline! do
full_path = url.sub('https://android.googlesource.com/', '') full_path = url.sub('https://android.googlesource.com/', '')
full_path = full_path.sub(/\.git\z/, '') full_path = full_path.sub(/\.git\z/, '')
full_path, _, project_path = full_path.rpartition('/') full_path, _, project_path = full_path.rpartition('/')
group = Group.find_by_full_path(full_path) || create_group_with_parents(user, full_path) group = Group.find_by_full_path(full_path) ||
Groups::NestedCreateService.new(user, group_path: full_path).execute
params = { params = {
import_url: url, import_url: url,
......
class EnqueueDeleteDiffFilesWorkers < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
class MergeRequestDiff < ActiveRecord::Base
self.table_name = 'merge_request_diffs'
belongs_to :merge_request
include EachBatch
end
DOWNTIME = false
BATCH_SIZE = 1000
MIGRATION = 'DeleteDiffFiles'
DELAY_INTERVAL = 8.minutes
TMP_INDEX = 'tmp_partial_diff_id_with_files_index'.freeze
disable_ddl_transaction!
def up
# We add temporary index, to make iteration over batches more performant.
# Conditional here is to avoid the need of doing that in a separate
# migration file to make this operation idempotent.
#
unless index_exists_by_name?(:merge_request_diffs, TMP_INDEX)
add_concurrent_index(:merge_request_diffs, :id, where: "(state NOT IN ('without_files', 'empty'))", name: TMP_INDEX)
end
diffs_with_files = MergeRequestDiff.where.not(state: ['without_files', 'empty'])
# explain (analyze, buffers) example for the iteration:
#
# Index Only Scan using tmp_index_20013 on merge_request_diffs (cost=0.43..1630.19 rows=60567 width=4) (actual time=0.047..9.572 rows=56976 loops=1)
# Index Cond: ((id >= 764586) AND (id < 835298))
# Heap Fetches: 8
# Buffers: shared hit=18188
# Planning time: 0.752 ms
# Execution time: 12.430 ms
#
diffs_with_files.each_batch(of: BATCH_SIZE) do |relation, outer_index|
ids = relation.pluck(:id)
ids.each_with_index do |diff_id, inner_index|
# This will give some space between batches of workers.
interval = DELAY_INTERVAL * outer_index + inner_index.minutes
# A single `merge_request_diff` can be associated with way too many
# `merge_request_diff_files`. It's better to avoid batching these and
# schedule one at a time.
#
# Considering roughly 6M jobs, this should take ~30 days to process all
# of them.
#
BackgroundMigrationWorker.perform_in(interval, MIGRATION, [diff_id])
end
end
# We remove temporary index, because it is not required during standard
# operations and runtime.
#
remove_concurrent_index_by_name(:merge_request_diffs, TMP_INDEX)
end
def down
if index_exists_by_name?(:merge_request_diffs, TMP_INDEX)
remove_concurrent_index_by_name(:merge_request_diffs, TMP_INDEX)
end
end
end
class AddPartialIndexToProjectsForLastRepositoryCheckAt < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
INDEX_NAME = "index_projects_on_last_repository_check_at"
def up
add_concurrent_index(:projects, :last_repository_check_at, where: "last_repository_check_at IS NOT NULL", name: INDEX_NAME)
end
def down
remove_concurrent_index(:projects, :last_repository_check_at, where: "last_repository_check_at IS NOT NULL", name: INDEX_NAME)
end
end
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180628124813) do ActiveRecord::Schema.define(version: 20180629191052) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
...@@ -1646,6 +1646,7 @@ ActiveRecord::Schema.define(version: 20180628124813) do ...@@ -1646,6 +1646,7 @@ ActiveRecord::Schema.define(version: 20180628124813) do
add_index "projects", ["description"], name: "index_projects_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} add_index "projects", ["description"], name: "index_projects_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"}
add_index "projects", ["id"], name: "index_projects_on_id_partial_for_visibility", unique: true, where: "(visibility_level = ANY (ARRAY[10, 20]))", using: :btree add_index "projects", ["id"], name: "index_projects_on_id_partial_for_visibility", unique: true, where: "(visibility_level = ANY (ARRAY[10, 20]))", using: :btree
add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree
add_index "projects", ["last_repository_check_at"], name: "index_projects_on_last_repository_check_at", where: "(last_repository_check_at IS NOT NULL)", using: :btree
add_index "projects", ["last_repository_check_failed"], name: "index_projects_on_last_repository_check_failed", using: :btree add_index "projects", ["last_repository_check_failed"], name: "index_projects_on_last_repository_check_failed", using: :btree
add_index "projects", ["last_repository_updated_at"], name: "index_projects_on_last_repository_updated_at", using: :btree add_index "projects", ["last_repository_updated_at"], name: "index_projects_on_last_repository_updated_at", using: :btree
add_index "projects", ["name"], name: "index_projects_on_name_trigram", using: :gin, opclasses: {"name"=>"gin_trgm_ops"} add_index "projects", ["name"], name: "index_projects_on_name_trigram", using: :gin, opclasses: {"name"=>"gin_trgm_ops"}
......
...@@ -228,7 +228,7 @@ straight away. ...@@ -228,7 +228,7 @@ straight away.
### GitLab self-hosted ### GitLab self-hosted
With GitLab self-hosted, you deploy your own GitLab instance on-premises or on a private cloud of your choice. GitLab self-hosted is available for [free and with paid subscriptions](https://about.gitlab.com/products/): Core, Starter, Premium, and Ultimate. With GitLab self-hosted, you deploy your own GitLab instance on-premises or on a private cloud of your choice. GitLab self-hosted is available for [free and with paid subscriptions](https://about.gitlab.com/pricing/): Core, Starter, Premium, and Ultimate.
Every feature available in Core is also available in Starter, Premium, and Ultimate. Every feature available in Core is also available in Starter, Premium, and Ultimate.
Starter features are also available in Premium and Ultimate, and Premium features are also Starter features are also available in Premium and Ultimate, and Premium features are also
......
...@@ -11,7 +11,7 @@ Regular users don't have access to GitLab administration tools and settings. ...@@ -11,7 +11,7 @@ Regular users don't have access to GitLab administration tools and settings.
GitLab has two product distributions: the open source GitLab has two product distributions: the open source
[GitLab Community Edition (CE)](https://gitlab.com/gitlab-org/gitlab-ce), [GitLab Community Edition (CE)](https://gitlab.com/gitlab-org/gitlab-ce),
and the open core [GitLab Enterprise Edition (EE)](https://gitlab.com/gitlab-org/gitlab-ee), and the open core [GitLab Enterprise Edition (EE)](https://gitlab.com/gitlab-org/gitlab-ee),
available through [different subscriptions](https://about.gitlab.com/products/). available through [different subscriptions](https://about.gitlab.com/pricing/).
You can [install GitLab CE or GitLab EE](https://about.gitlab.com/installation/ce-or-ee/), You can [install GitLab CE or GitLab EE](https://about.gitlab.com/installation/ce-or-ee/),
but the features you'll have access to depend on the subscription you choose but the features you'll have access to depend on the subscription you choose
......
...@@ -91,9 +91,9 @@ _The artifacts are stored by default in ...@@ -91,9 +91,9 @@ _The artifacts are stored by default in
- [Introduced][ee-1762] in [GitLab Premium][eep] 9.4. - [Introduced][ee-1762] in [GitLab Premium][eep] 9.4.
- Since version 9.5, artifacts are [browsable], when object storage is enabled. - Since version 9.5, artifacts are [browsable], when object storage is enabled.
9.4 lacks this feature. 9.4 lacks this feature.
> Available in [GitLab Premium](https://about.gitlab.com/products/) and > Available in [GitLab Premium](https://about.gitlab.com/pricing/) and
[GitLab.com Silver](https://about.gitlab.com/gitlab-com/). [GitLab.com Silver](https://about.gitlab.com/gitlab-com/).
> Since version 10.6, available in [GitLab CE](https://about.gitlab.com/products/) > Since version 10.6, available in [GitLab CE](https://about.gitlab.com/pricing/)
> Since version 11.0, we support direct_upload to S3. > Since version 11.0, we support direct_upload to S3.
If you don't want to use the local disk where GitLab is installed to store the If you don't want to use the local disk where GitLab is installed to store the
......
This diff is collapsed.
...@@ -46,4 +46,4 @@ configuration to reflect that change. ...@@ -46,4 +46,4 @@ configuration to reflect that change.
[cli]: https://github.com/codeclimate/codeclimate [cli]: https://github.com/codeclimate/codeclimate
[dind]: ../docker/using_docker_build.md#use-docker-in-docker-executor [dind]: ../docker/using_docker_build.md#use-docker-in-docker-executor
[ee]: https://about.gitlab.com/products/ [ee]: https://about.gitlab.com/pricing/
...@@ -63,4 +63,4 @@ are still maintained they have been deprecated with GitLab 11.0 and may be remov ...@@ -63,4 +63,4 @@ are still maintained they have been deprecated with GitLab 11.0 and may be remov
in next major release, GitLab 12.0. You are advised to update your current `.gitlab-ci.yml` in next major release, GitLab 12.0. You are advised to update your current `.gitlab-ci.yml`
configuration to reflect that change. configuration to reflect that change.
[ee]: https://about.gitlab.com/products/ [ee]: https://about.gitlab.com/pricing/
...@@ -60,4 +60,4 @@ so, the CI job must be named `dast` and the artifact path must be ...@@ -60,4 +60,4 @@ so, the CI job must be named `dast` and the artifact path must be
`gl-dast-report.json`. `gl-dast-report.json`.
[Learn more about DAST results shown in merge requests](https://docs.gitlab.com/ee/user/project/merge_requests/dast.html). [Learn more about DAST results shown in merge requests](https://docs.gitlab.com/ee/user/project/merge_requests/dast.html).
[ee]: https://about.gitlab.com/products/ [ee]: https://about.gitlab.com/pricing/
...@@ -219,7 +219,7 @@ removed with one of the future versions of GitLab. You are advised to ...@@ -219,7 +219,7 @@ removed with one of the future versions of GitLab. You are advised to
[ee-2017]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2017 [ee-2017]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2017
[ci-229]: https://gitlab.com/gitlab-org/gitlab-ci/merge_requests/229 [ci-229]: https://gitlab.com/gitlab-org/gitlab-ci/merge_requests/229
[ee]: https://about.gitlab.com/products/ [ee]: https://about.gitlab.com/pricing/
[variables]: ../variables/README.md [variables]: ../variables/README.md
[predef]: ../variables/README.md#predefined-variables-environment-variables [predef]: ../variables/README.md#predefined-variables-environment-variables
[registry]: ../../user/project/container_registry.md [registry]: ../../user/project/container_registry.md
...@@ -553,7 +553,7 @@ Below you can find supported syntax reference: ...@@ -553,7 +553,7 @@ Below you can find supported syntax reference:
`/pattern/i` to make a pattern case-insensitive. `/pattern/i` to make a pattern case-insensitive.
[ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI variables" [ce-13784]: https://gitlab.com/gitlab-org/gitlab-ce/issues/13784 "Simple protection of CI variables"
[eep]: https://about.gitlab.com/products/ "Available only in GitLab Premium" [eep]: https://about.gitlab.com/pricing/ "Available only in GitLab Premium"
[envs]: ../environments.md [envs]: ../environments.md
[protected branches]: ../../user/project/protected_branches.md [protected branches]: ../../user/project/protected_branches.md
[protected tags]: ../../user/project/protected_tags.md [protected tags]: ../../user/project/protected_tags.md
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
## Software delivery ## Software delivery
There are two software distributions of GitLab: the open source [Community Edition](https://gitlab.com/gitlab-org/gitlab-ce/) (CE), and the open core [Enterprise Edition](https://gitlab.com/gitlab-org/gitlab-ee/) (EE). GitLab is available under [different subscriptions](https://about.gitlab.com/products/). There are two software distributions of GitLab: the open source [Community Edition](https://gitlab.com/gitlab-org/gitlab-ce/) (CE), and the open core [Enterprise Edition](https://gitlab.com/gitlab-org/gitlab-ee/) (EE). GitLab is available under [different subscriptions](https://about.gitlab.com/pricing/).
New versions of GitLab are released in stable branches and the master branch is for bleeding edge development. New versions of GitLab are released in stable branches and the master branch is for bleeding edge development.
......
...@@ -174,6 +174,8 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript. ...@@ -174,6 +174,8 @@ For example use `%{created_at}` in Ruby but `%{createdAt}` in JavaScript.
# => When size == 2: 'There are 2 mice.' # => When size == 2: 'There are 2 mice.'
``` ```
Avoid using `%d` or count variables in sigular strings. This allows more natural translation in some languages.
- In JavaScript: - In JavaScript:
```js ```js
......
...@@ -192,7 +192,7 @@ Portions of this page are modifications based on work created and shared by the ...@@ -192,7 +192,7 @@ Portions of this page are modifications based on work created and shared by the
[material design]: https://material.io/guidelines/ [material design]: https://material.io/guidelines/
[features]: https://about.gitlab.com/features/ "GitLab features page" [features]: https://about.gitlab.com/features/ "GitLab features page"
[products]: https://about.gitlab.com/products/ "GitLab products page" [products]: https://about.gitlab.com/pricing/ "GitLab products page"
[serial comma]: https://en.wikipedia.org/wiki/Serial_comma "“Serial comma” in Wikipedia" [serial comma]: https://en.wikipedia.org/wiki/Serial_comma "“Serial comma” in Wikipedia"
[android project]: http://source.android.com/ [android project]: http://source.android.com/
[creative commons]: http://creativecommons.org/licenses/by/2.5/ [creative commons]: http://creativecommons.org/licenses/by/2.5/
...@@ -71,7 +71,7 @@ For most installations, only two parameters are required: ...@@ -71,7 +71,7 @@ For most installations, only two parameters are required:
Other common configuration options: Other common configuration options:
- `baseIP`: the desired [external IP address](#external-ip-recommended) - `baseIP`: the desired [external IP address](#external-ip-recommended)
- `gitlab`: Choose the [desired edition](https://about.gitlab.com/products), either `ee` or `ce`. `ce` is the default. - `gitlab`: Choose the [desired edition](https://about.gitlab.com/pricing), either `ee` or `ce`. `ce` is the default.
- `gitlabEELicense`: For Enterprise Edition, the [license](https://docs.gitlab.com/ee/user/admin_area/license.html) can be installed directly via the Chart - `gitlabEELicense`: For Enterprise Edition, the [license](https://docs.gitlab.com/ee/user/admin_area/license.html) can be installed directly via the Chart
- `provider`: Optimizes the deployment for a cloud provider. The default is `gke` for [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/), with `acs` also supported for the [Azure Container Service](https://azure.microsoft.com/en-us/services/container-service/). - `provider`: Optimizes the deployment for a cloud provider. The default is `gke` for [Google Kubernetes Engine](https://cloud.google.com/kubernetes-engine/), with `acs` also supported for the [Azure Container Service](https://azure.microsoft.com/en-us/services/container-service/).
......
...@@ -91,7 +91,7 @@ To make full use of Auto DevOps, you will need: ...@@ -91,7 +91,7 @@ To make full use of Auto DevOps, you will need:
for the entire GitLab instance, or [specific Runners](../../ci/runners/README.md#registering-a-specific-runner) for the entire GitLab instance, or [specific Runners](../../ci/runners/README.md#registering-a-specific-runner)
that are assigned to specific projects. that are assigned to specific projects.
1. **Base domain** (needed for Auto Review Apps and Auto Deploy) - You will need 1. **Base domain** (needed for Auto Review Apps and Auto Deploy) - You will need
a domain configured with wildcard DNS which is gonna be used by all of your a domain configured with wildcard DNS which is going to be used by all of your
Auto DevOps applications. [Read the specifics](#auto-devops-base-domain). Auto DevOps applications. [Read the specifics](#auto-devops-base-domain).
1. **Kubernetes** (needed for Auto Review Apps, Auto Deploy, and Auto Monitoring) - 1. **Kubernetes** (needed for Auto Review Apps, Auto Deploy, and Auto Monitoring) -
To enable deployments, you will need Kubernetes 1.5+. You need a [Kubernetes cluster][kubernetes-clusters] To enable deployments, you will need Kubernetes 1.5+. You need a [Kubernetes cluster][kubernetes-clusters]
...@@ -840,5 +840,5 @@ curl --data "value=true" --header "PRIVATE-TOKEN: personal_access_token" https:/ ...@@ -840,5 +840,5 @@ curl --data "value=true" --header "PRIVATE-TOKEN: personal_access_token" https:/
[postgresql]: https://www.postgresql.org/ [postgresql]: https://www.postgresql.org/
[Auto DevOps template]: https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml [Auto DevOps template]: https://gitlab.com/gitlab-org/gitlab-ci-yml/blob/master/Auto-DevOps.gitlab-ci.yml
[GitLab Omnibus Helm Chart]: ../../install/kubernetes/gitlab_omnibus.md [GitLab Omnibus Helm Chart]: ../../install/kubernetes/gitlab_omnibus.md
[ee]: https://about.gitlab.com/products/ [ee]: https://about.gitlab.com/pricing/
[ce-19507]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19507 [ce-19507]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/19507
...@@ -7,7 +7,7 @@ description: 'Read through the GitLab User documentation to learn how to use, co ...@@ -7,7 +7,7 @@ description: 'Read through the GitLab User documentation to learn how to use, co
Welcome to GitLab! We're glad to have you here! Welcome to GitLab! We're glad to have you here!
As a GitLab user you'll have access to all the features As a GitLab user you'll have access to all the features
your [subscription](https://about.gitlab.com/products/) your [subscription](https://about.gitlab.com/pricing/)
includes, except [GitLab administrator](../README.md#administrator-documentation) includes, except [GitLab administrator](../README.md#administrator-documentation)
settings, unless you have admin privileges to install, configure, settings, unless you have admin privileges to install, configure,
and upgrade your GitLab instance. and upgrade your GitLab instance.
......
...@@ -313,4 +313,4 @@ Read through the documentation on [LDAP users permissions](https://docs.gitlab.c ...@@ -313,4 +313,4 @@ Read through the documentation on [LDAP users permissions](https://docs.gitlab.c
[ce-18994]: https://gitlab.com/gitlab-org/gitlab-ce/issues/18994 [ce-18994]: https://gitlab.com/gitlab-org/gitlab-ce/issues/18994
[new-mod]: project/new_ci_build_permissions_model.md [new-mod]: project/new_ci_build_permissions_model.md
[ee-998]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/998 [ee-998]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/998
[eep]: https://about.gitlab.com/products/ [eep]: https://about.gitlab.com/pricing/
...@@ -406,5 +406,5 @@ the deployment variables above, ensuring any pods you create are labelled with ...@@ -406,5 +406,5 @@ the deployment variables above, ensuring any pods you create are labelled with
- [Connecting and deploying to an Amazon EKS cluster](eks_and_gitlab/index.md) - [Connecting and deploying to an Amazon EKS cluster](eks_and_gitlab/index.md)
[permissions]: ../../permissions.md [permissions]: ../../permissions.md
[ee]: https://about.gitlab.com/products/ [ee]: https://about.gitlab.com/pricing/
[Auto DevOps]: ../../../topics/autodevops/index.md [Auto DevOps]: ../../../topics/autodevops/index.md
...@@ -41,8 +41,11 @@ service in GitLab. ...@@ -41,8 +41,11 @@ service in GitLab.
1. Click 'Atlassian Bamboo CI' 1. Click 'Atlassian Bamboo CI'
1. Select the 'Active' checkbox. 1. Select the 'Active' checkbox.
1. Enter the base URL of your Bamboo server. 'https://bamboo.example.com' 1. Enter the base URL of your Bamboo server. 'https://bamboo.example.com'
1. Enter the build key from your Bamboo build plan. Build keys are a short, 1. Enter the build key from your Bamboo build plan. Build keys are typically made
all capital letter, identifier that is unique. It will be something like PR-BLD up from the Project Key and Plan Key that are set on project/plan creation and
separated with a dash (`-`), for example **PROJ-PLAN**. This is a short, all
uppercase identifier that is unique. When viewing a plan within Bamboo, the
build key is also shown in the browser URL, for example `https://bamboo.example.com/browse/PROJ-PLAN`.
1. If necessary, enter username and password for a Bamboo user that has 1. If necessary, enter username and password for a Bamboo user that has
access to trigger the build plan. Leave these fields blank if you do not require access to trigger the build plan. Leave these fields blank if you do not require
authentication. authentication.
......
...@@ -6,6 +6,10 @@ Starting from GitLab 8.5: ...@@ -6,6 +6,10 @@ Starting from GitLab 8.5:
- the `project.ssh_url` key is deprecated in favor of the `project.git_ssh_url` key - the `project.ssh_url` key is deprecated in favor of the `project.git_ssh_url` key
- the `project.http_url` key is deprecated in favor of the `project.git_http_url` key - the `project.http_url` key is deprecated in favor of the `project.git_http_url` key
>**Note:**
Starting from GitLab 11.1, the logs of web hooks are automatically removed after
one month.
Project webhooks allow you to trigger a URL if for example new code is pushed or Project webhooks allow you to trigger a URL if for example new code is pushed or
a new issue is created. You can configure webhooks to listen for specific events a new issue is created. You can configure webhooks to listen for specific events
like pushes, issues or merge requests. GitLab will send a POST request with data like pushes, issues or merge requests. GitLab will send a POST request with data
...@@ -54,11 +58,11 @@ Below are described the supported events. ...@@ -54,11 +58,11 @@ Below are described the supported events.
Triggered when you push to the repository except when pushing tags. Triggered when you push to the repository except when pushing tags.
> **Note:** When more than 20 commits are pushed at once, the `commits` web hook > **Note:** When more than 20 commits are pushed at once, the `commits` web hook
attribute will only contain the first 20 for performance reasons. Loading attribute will only contain the first 20 for performance reasons. Loading
detailed commit data is expensive. Note that despite only 20 commits being detailed commit data is expensive. Note that despite only 20 commits being
present in the `commits` attribute, the `total_commits_count` attribute will present in the `commits` attribute, the `total_commits_count` attribute will
contain the actual total. contain the actual total.
**Request header**: **Request header**:
...@@ -1149,11 +1153,11 @@ From this page, you can repeat delivery with the same data by clicking `Resend R ...@@ -1149,11 +1153,11 @@ From this page, you can repeat delivery with the same data by clicking `Resend R
When GitLab sends a webhook it expects a response in 10 seconds (set default value). If it does not receive one, it'll retry the webhook. When GitLab sends a webhook it expects a response in 10 seconds (set default value). If it does not receive one, it'll retry the webhook.
If the endpoint doesn't send its HTTP response within those 10 seconds, GitLab may decide the hook failed and retry it. If the endpoint doesn't send its HTTP response within those 10 seconds, GitLab may decide the hook failed and retry it.
If you are receiving multiple requests, you can try increasing the default value to wait for the HTTP response after sending the webhook If you are receiving multiple requests, you can try increasing the default value to wait for the HTTP response after sending the webhook
by uncommenting or adding the following setting to your `/etc/gitlab/gitlab.rb`: by uncommenting or adding the following setting to your `/etc/gitlab/gitlab.rb`:
``` ```
gitlab_rails['webhook_timeout'] = 10 gitlab_rails['webhook_timeout'] = 10
``` ```
## Example webhook receiver ## Example webhook receiver
......
...@@ -70,7 +70,7 @@ beginning of the development lifecycle until deployed to production ...@@ -70,7 +70,7 @@ beginning of the development lifecycle until deployed to production
### Use cases for Multiple Issue Boards ### Use cases for Multiple Issue Boards
With [Multiple Issue Boards](#multiple-issue-boards), available only in With [Multiple Issue Boards](#multiple-issue-boards), available only in
[GitLab Enterprise Edition](https://about.gitlab.com/products/), [GitLab Enterprise Edition](https://about.gitlab.com/pricing/),
each team can have their own board to organize their workflow individually. each team can have their own board to organize their workflow individually.
#### Scrum team #### Scrum team
......
...@@ -8,7 +8,7 @@ It allows you, your team, and your collaborators to share ...@@ -8,7 +8,7 @@ It allows you, your team, and your collaborators to share
and discuss proposals before and while implementing them. and discuss proposals before and while implementing them.
GitLab Issues and the GitLab Issue Tracker are available in all GitLab Issues and the GitLab Issue Tracker are available in all
[GitLab Products](https://about.gitlab.com/products/) as [GitLab Products](https://about.gitlab.com/pricing/) as
part of the [GitLab Workflow](https://about.gitlab.com/2016/10/25/gitlab-workflow-an-overview/). part of the [GitLab Workflow](https://about.gitlab.com/2016/10/25/gitlab-workflow-an-overview/).
## Use cases ## Use cases
...@@ -35,7 +35,7 @@ your project public, open to collaboration. ...@@ -35,7 +35,7 @@ your project public, open to collaboration.
### Streamline collaboration ### Streamline collaboration
With [Multiple Assignees for Issues](https://docs.gitlab.com/ee/user/project/issues/multiple_assignees_for_issues.html), With [Multiple Assignees for Issues](https://docs.gitlab.com/ee/user/project/issues/multiple_assignees_for_issues.html),
available in [GitLab Starter](https://about.gitlab.com/products/) available in [GitLab Starter](https://about.gitlab.com/pricing/)
you can streamline collaboration and allow shared responsibilities to be clearly displayed. you can streamline collaboration and allow shared responsibilities to be clearly displayed.
All assignees are shown across your workflows and receive notifications (as they All assignees are shown across your workflows and receive notifications (as they
would as single assignees), simplifying communication and ownership. would as single assignees), simplifying communication and ownership.
...@@ -139,7 +139,7 @@ Find GitLab Issue Boards by navigating to your **Project's Dashboard** > **Issue ...@@ -139,7 +139,7 @@ Find GitLab Issue Boards by navigating to your **Project's Dashboard** > **Issue
Read through the documentation for [Issue Boards](../issue_board.md) Read through the documentation for [Issue Boards](../issue_board.md)
to find out more about this feature. to find out more about this feature.
With [GitLab Starter](https://about.gitlab.com/products/), you can also With [GitLab Starter](https://about.gitlab.com/pricing/), you can also
create various boards per project with [Multiple Issue Boards](https://docs.gitlab.com/ee/user/project/issue_board.html#multiple-issue-boards). create various boards per project with [Multiple Issue Boards](https://docs.gitlab.com/ee/user/project/issue_board.html#multiple-issue-boards).
### External Issue Tracker ### External Issue Tracker
......
...@@ -47,7 +47,7 @@ Often multiple people likely work on the same issue together, ...@@ -47,7 +47,7 @@ Often multiple people likely work on the same issue together,
which can especially be difficult to track in large teams which can especially be difficult to track in large teams
where there is shared ownership of an issue. where there is shared ownership of an issue.
In [GitLab Starter](https://about.gitlab.com/products/), you can also In [GitLab Starter](https://about.gitlab.com/pricing/), you can also
select multiple assignees to an issue. select multiple assignees to an issue.
Learn more on the [Multiple Assignees documentation](https://docs.gitlab.com/ee/user/project/issues/multiple_assignees_for_issues.html). Learn more on the [Multiple Assignees documentation](https://docs.gitlab.com/ee/user/project/issues/multiple_assignees_for_issues.html).
......
...@@ -325,4 +325,4 @@ git checkout origin/merge-requests/1 ...@@ -325,4 +325,4 @@ git checkout origin/merge-requests/1
``` ```
[protected branches]: ../protected_branches.md [protected branches]: ../protected_branches.md
[ee]: https://about.gitlab.com/products/ "GitLab Enterprise Edition" [ee]: https://about.gitlab.com/pricing/ "GitLab Enterprise Edition"
...@@ -82,7 +82,7 @@ your implementation with your team. ...@@ -82,7 +82,7 @@ your implementation with your team.
You can live preview changes submitted to a new branch with You can live preview changes submitted to a new branch with
[Review Apps](../../../ci/review_apps/index.md). [Review Apps](../../../ci/review_apps/index.md).
With [GitLab Starter](https://about.gitlab.com/products/), you can also request With [GitLab Starter](https://about.gitlab.com/pricing/), you can also request
[approval](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html) from your managers. [approval](https://docs.gitlab.com/ee/user/project/merge_requests/merge_request_approvals.html) from your managers.
To create, delete, and [branches](branches/index.md) via GitLab's UI: To create, delete, and [branches](branches/index.md) via GitLab's UI:
...@@ -165,12 +165,12 @@ Find it under your project's **Repository > Compare**. ...@@ -165,12 +165,12 @@ Find it under your project's **Repository > Compare**.
## Locked files ## Locked files
> Available in [GitLab Premium](https://about.gitlab.com/products/). > Available in [GitLab Premium](https://about.gitlab.com/pricing/).
Lock your files to prevent any conflicting changes. Lock your files to prevent any conflicting changes.
[File Locking](https://docs.gitlab.com/ee/user/project/file_lock.html) is available only in [File Locking](https://docs.gitlab.com/ee/user/project/file_lock.html) is available only in
[GitLab Premium](https://about.gitlab.com/products/). [GitLab Premium](https://about.gitlab.com/pricing/).
## Repository's API ## Repository's API
......
...@@ -42,7 +42,7 @@ Set up your project's merge request settings: ...@@ -42,7 +42,7 @@ Set up your project's merge request settings:
### Service Desk ### Service Desk
Enable [Service Desk](https://docs.gitlab.com/ee/user/project/service_desk.html) for your project to offer customer support. Service Desk is available in [GitLab Premium](https://about.gitlab.com/products/). Enable [Service Desk](https://docs.gitlab.com/ee/user/project/service_desk.html) for your project to offer customer support. Service Desk is available in [GitLab Premium](https://about.gitlab.com/pricing/).
### Export project ### Export project
......
...@@ -236,5 +236,5 @@ See more information in [!19581](https://gitlab.com/gitlab-org/gitlab-ce/merge_r ...@@ -236,5 +236,5 @@ See more information in [!19581](https://gitlab.com/gitlab-org/gitlab-ce/merge_r
[reconfigure gitlab]: ../../administration/restart_gitlab.md#omnibus-gitlab-reconfigure "How to reconfigure Omnibus GitLab" [reconfigure gitlab]: ../../administration/restart_gitlab.md#omnibus-gitlab-reconfigure "How to reconfigure Omnibus GitLab"
[restart gitlab]: ../../administration/restart_gitlab.md#installations-from-source "How to restart GitLab" [restart gitlab]: ../../administration/restart_gitlab.md#installations-from-source "How to restart GitLab"
[eep]: https://about.gitlab.com/products/ "GitLab Premium" [eep]: https://about.gitlab.com/pricing/ "GitLab Premium"
[ee-2760]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2760 [ee-2760]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/2760
...@@ -3,10 +3,6 @@ module Banzai ...@@ -3,10 +3,6 @@ module Banzai
# HTML filter that replaces :emoji: and unicode with images. # HTML filter that replaces :emoji: and unicode with images.
# #
# Based on HTML::Pipeline::EmojiFilter # Based on HTML::Pipeline::EmojiFilter
#
# Context options:
# :asset_root
# :asset_host
class EmojiFilter < HTML::Pipeline::Filter class EmojiFilter < HTML::Pipeline::Filter
IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set
......
...@@ -25,7 +25,10 @@ module Banzai ...@@ -25,7 +25,10 @@ module Banzai
extras = super extras = super
if commit_ref = object_link_commit_ref(object, matches) if commit_ref = object_link_commit_ref(object, matches)
return extras.unshift(commit_ref) klass = reference_class(:commit, tooltip: false)
commit_ref_tag = %(<span class="#{klass}">#{commit_ref}</span>)
return extras.unshift(commit_ref_tag)
end end
path = matches[:path] if matches.names.include?("path") path = matches[:path] if matches.names.include?("path")
......
...@@ -65,8 +65,12 @@ module Banzai ...@@ -65,8 +65,12 @@ module Banzai
context[:skip_project_check] context[:skip_project_check]
end end
def reference_class(type) def reference_class(type, tooltip: true)
"gfm gfm-#{type} has-tooltip" gfm_klass = "gfm gfm-#{type}"
return gfm_klass unless tooltip
"#{gfm_klass} has-tooltip"
end end
# Ensure that a :project key exists in context # Ensure that a :project key exists in context
......
...@@ -250,7 +250,7 @@ module Gitlab ...@@ -250,7 +250,7 @@ module Gitlab
last_line = lines.last last_line = lines.last
if last_line.new_pos < total_blob_lines(blob) if last_line.new_pos < total_blob_lines(blob) && !deleted_file?
match_line = Gitlab::Diff::Line.new("", 'match', nil, last_line.old_pos, last_line.new_pos) match_line = Gitlab::Diff::Line.new("", 'match', nil, last_line.old_pos, last_line.new_pos)
lines.push(match_line) lines.push(match_line)
end end
......
This diff is collapsed.
...@@ -368,7 +368,7 @@ module Gitlab ...@@ -368,7 +368,7 @@ module Gitlab
def call_commit_diff(request_params, options = {}) def call_commit_diff(request_params, options = {})
request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false) request_params[:ignore_whitespace_change] = options.fetch(:ignore_whitespace_change, false)
request_params[:enforce_limits] = options.fetch(:limits, true) request_params[:enforce_limits] = options.fetch(:limits, true)
request_params[:collapse_diffs] = request_params[:enforce_limits] || !options.fetch(:expanded, true) request_params[:collapse_diffs] = !options.fetch(:expanded, true)
request_params.merge!(Gitlab::Git::DiffCollection.collection_limits(options).to_h) request_params.merge!(Gitlab::Git::DiffCollection.collection_limits(options).to_h)
request = Gitaly::CommitDiffRequest.new(request_params) request = Gitaly::CommitDiffRequest.new(request_params)
......
...@@ -64,6 +64,8 @@ module Gitlab ...@@ -64,6 +64,8 @@ module Gitlab
target_commit = Gitlab::Git::Commit.decorate(@repository, branch.target_commit) target_commit = Gitlab::Git::Commit.decorate(@repository, branch.target_commit)
Gitlab::Git::Branch.new(@repository, branch.name, target_commit.id, target_commit) Gitlab::Git::Branch.new(@repository, branch.name, target_commit.id, target_commit)
rescue GRPC::FailedPrecondition => ex
raise Gitlab::Git::Repository::InvalidRef, ex
end end
def user_delete_branch(branch_name, user) def user_delete_branch(branch_name, user)
...@@ -133,6 +135,8 @@ module Gitlab ...@@ -133,6 +135,8 @@ module Gitlab
request request
).branch_update ).branch_update
Gitlab::Git::OperationService::BranchUpdate.from_gitaly(branch_update) Gitlab::Git::OperationService::BranchUpdate.from_gitaly(branch_update)
rescue GRPC::FailedPrecondition => e
raise Gitlab::Git::CommitError, e
end end
def user_cherry_pick(user:, commit:, branch_name:, message:, start_branch_name:, start_repository:) def user_cherry_pick(user:, commit:, branch_name:, message:, start_branch_name:, start_repository:)
......
...@@ -4,8 +4,18 @@ module Gitlab ...@@ -4,8 +4,18 @@ module Gitlab
class Controller class Controller
DISALLOWED_METHODS = %w(POST PATCH PUT DELETE).freeze DISALLOWED_METHODS = %w(POST PATCH PUT DELETE).freeze
APPLICATION_JSON = 'application/json'.freeze APPLICATION_JSON = 'application/json'.freeze
APPLICATION_JSON_TYPES = %W{#{APPLICATION_JSON} application/vnd.git-lfs+json}.freeze
ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'.freeze ERROR_MESSAGE = 'You cannot perform write operations on a read-only instance'.freeze
WHITELISTED_GIT_ROUTES = {
'projects/git_http' => %w{git_upload_pack git_receive_pack}
}.freeze
WHITELISTED_GIT_LFS_ROUTES = {
'projects/lfs_api' => %w{batch},
'projects/lfs_locks_api' => %w{verify create unlock}
}.freeze
def initialize(app, env) def initialize(app, env)
@app = app @app = app
@env = env @env = env
...@@ -36,7 +46,7 @@ module Gitlab ...@@ -36,7 +46,7 @@ module Gitlab
end end
def json_request? def json_request?
request.media_type == APPLICATION_JSON APPLICATION_JSON_TYPES.include?(request.media_type)
end end
def rack_flash def rack_flash
...@@ -63,22 +73,27 @@ module Gitlab ...@@ -63,22 +73,27 @@ module Gitlab
grack_route || ReadOnly.internal_routes.any? { |path| request.path.include?(path) } || lfs_route || sidekiq_route grack_route || ReadOnly.internal_routes.any? { |path| request.path.include?(path) } || lfs_route || sidekiq_route
end end
def sidekiq_route
request.path.start_with?('/admin/sidekiq')
end
def grack_route def grack_route
# Calling route_hash may be expensive. Only do it if we think there's a possible match # Calling route_hash may be expensive. Only do it if we think there's a possible match
return false unless request.path.end_with?('.git/git-upload-pack') return false unless
request.path.end_with?('.git/git-upload-pack', '.git/git-receive-pack')
route_hash[:controller] == 'projects/git_http' && route_hash[:action] == 'git_upload_pack' WHITELISTED_GIT_ROUTES[route_hash[:controller]]&.include?(route_hash[:action])
end end
def lfs_route def lfs_route
# Calling route_hash may be expensive. Only do it if we think there's a possible match # Calling route_hash may be expensive. Only do it if we think there's a possible match
return false unless request.path.end_with?('/info/lfs/objects/batch') unless request.path.end_with?('/info/lfs/objects/batch',
'/info/lfs/locks', '/info/lfs/locks/verify') ||
%r{/info/lfs/locks/\d+/unlock\z}.match?(request.path)
return false
end
WHITELISTED_GIT_LFS_ROUTES[route_hash[:controller]]&.include?(route_hash[:action])
end
route_hash[:controller] == 'projects/lfs_api' && route_hash[:action] == 'batch' def sidekiq_route
request.path.start_with?('/admin/sidekiq')
end end
end end
end end
......
...@@ -17,6 +17,9 @@ describe "User creates issue" do ...@@ -17,6 +17,9 @@ describe "User creates issue" do
expect(page).to have_no_content("Assign to") expect(page).to have_no_content("Assign to")
.and have_no_content("Labels") .and have_no_content("Labels")
.and have_no_content("Milestone") .and have_no_content("Milestone")
expect(page.find('#issue_title')['placeholder']).to eq 'Title'
expect(page.find('#issue_description')['placeholder']).to eq 'Write a comment or drag your files here…'
end end
issue_title = "500 error on profile" issue_title = "500 error on profile"
......
...@@ -165,7 +165,7 @@ feature 'Jobs', :clean_gitlab_redis_shared_state do ...@@ -165,7 +165,7 @@ feature 'Jobs', :clean_gitlab_redis_shared_state do
it 'links to issues/new with the title and description filled in' do it 'links to issues/new with the title and description filled in' do
button_title = "Job Failed ##{job.id}" button_title = "Job Failed ##{job.id}"
job_url = project_job_path(project, job) job_url = project_job_url(project, job, host: page.server.host, port: page.server.port)
options = { issue: { title: button_title, description: "Job [##{job.id}](#{job_url}) failed for #{job.sha}:\n" } } options = { issue: { title: button_title, description: "Job [##{job.id}](#{job_url}) failed for #{job.sha}:\n" } }
href = new_project_issue_path(project, options) href = new_project_issue_path(project, options)
......
...@@ -9,9 +9,9 @@ feature 'Creating a new project milestone', :js do ...@@ -9,9 +9,9 @@ feature 'Creating a new project milestone', :js do
visit new_project_milestone_path(project) visit new_project_milestone_path(project)
end end
it 'description has autocomplete' do it 'description has emoji autocomplete' do
find('#milestone_description').native.send_keys('') find('#milestone_description').native.send_keys('')
fill_in 'milestone_description', with: '@' fill_in 'milestone_description', with: ':'
expect(page).to have_selector('.atwho-view') expect(page).to have_selector('.atwho-view')
end end
......
...@@ -5,6 +5,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -5,6 +5,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
# see spec/features/projects/files/project_owner_creates_license_file_spec.rb # see spec/features/projects/files/project_owner_creates_license_file_spec.rb
# see spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb # see spec/features/projects/files/project_owner_sees_link_to_create_license_file_in_empty_project_spec.rb
include FakeBlobHelpers
let(:user) { create(:user) } let(:user) { create(:user) }
describe 'empty project' do describe 'empty project' do
...@@ -141,11 +143,57 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -141,11 +143,57 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
allow_any_instance_of(AutoDevopsHelper).to receive(:show_auto_devops_callout?).and_return(false) allow_any_instance_of(AutoDevopsHelper).to receive(:show_auto_devops_callout?).and_return(false)
project.add_master(user) project.add_master(user)
sign_in(user) sign_in(user)
end
visit project_path(project) context 'Readme button' do
before do
allow(Project).to receive(:find_by_full_path)
.with(project.full_path, follow_redirects: true)
.and_return(project)
end
context 'when the project has a populated Readme' do
it 'show the "Readme" anchor' do
visit project_path(project)
expect(project.repository.readme).not_to be_nil
page.within('.project-stats') do
expect(page).not_to have_link('Add Readme', href: presenter.add_readme_path)
expect(page).to have_link('Readme', href: presenter.readme_path)
end
end
context 'when the project has an empty Readme' do
it 'show the "Readme" anchor' do
allow(project.repository).to receive(:readme).and_return(fake_blob(path: 'README.md', data: '', size: 0))
visit project_path(project)
page.within('.project-stats') do
expect(page).not_to have_link('Add Readme', href: presenter.add_readme_path)
expect(page).to have_link('Readme', href: presenter.readme_path)
end
end
end
end
context 'when the project does not have a Readme' do
it 'shows the "Add Readme" button' do
allow(project.repository).to receive(:readme).and_return(nil)
visit project_path(project)
page.within('.project-stats') do
expect(page).to have_link('Add Readme', href: presenter.add_readme_path)
end
end
end
end end
it 'no "Add Changelog" button if the project already has a changelog' do it 'no "Add Changelog" button if the project already has a changelog' do
visit project_path(project)
expect(project.repository.changelog).not_to be_nil expect(project.repository.changelog).not_to be_nil
page.within('.project-stats') do page.within('.project-stats') do
...@@ -154,6 +202,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -154,6 +202,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end end
it 'no "Add License" button if the project already has a license' do it 'no "Add License" button if the project already has a license' do
visit project_path(project)
expect(project.repository.license_blob).not_to be_nil expect(project.repository.license_blob).not_to be_nil
page.within('.project-stats') do page.within('.project-stats') do
...@@ -162,6 +212,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -162,6 +212,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
end end
it 'no "Add Contribution guide" button if the project already has a contribution guide' do it 'no "Add Contribution guide" button if the project already has a contribution guide' do
visit project_path(project)
expect(project.repository.contribution_guide).not_to be_nil expect(project.repository.contribution_guide).not_to be_nil
page.within('.project-stats') do page.within('.project-stats') do
...@@ -171,6 +223,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -171,6 +223,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
describe 'GitLab CI configuration button' do describe 'GitLab CI configuration button' do
it '"Set up CI/CD" button linked to new file populated for a .gitlab-ci.yml' do it '"Set up CI/CD" button linked to new file populated for a .gitlab-ci.yml' do
visit project_path(project)
expect(project.repository.gitlab_ci_yml).to be_nil expect(project.repository.gitlab_ci_yml).to be_nil
page.within('.project-stats') do page.within('.project-stats') do
...@@ -211,6 +265,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -211,6 +265,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
describe 'Auto DevOps button' do describe 'Auto DevOps button' do
it '"Enable Auto DevOps" button linked to settings page' do it '"Enable Auto DevOps" button linked to settings page' do
visit project_path(project)
page.within('.project-stats') do page.within('.project-stats') do
expect(page).to have_link('Enable Auto DevOps', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings')) expect(page).to have_link('Enable Auto DevOps', href: project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
end end
...@@ -263,6 +319,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do ...@@ -263,6 +319,8 @@ describe 'Projects > Show > User sees setup shortcut buttons' do
describe 'Kubernetes cluster button' do describe 'Kubernetes cluster button' do
it '"Add Kubernetes cluster" button linked to clusters page' do it '"Add Kubernetes cluster" button linked to clusters page' do
visit project_path(project)
page.within('.project-stats') do page.within('.project-stats') do
expect(page).to have_link('Add Kubernetes cluster', href: new_project_cluster_path(project)) expect(page).to have_link('Add Kubernetes cluster', href: new_project_cluster_path(project))
end end
......
...@@ -242,7 +242,7 @@ describe "User creates wiki page" do ...@@ -242,7 +242,7 @@ describe "User creates wiki page" do
end end
end end
it "shows the autocompletion dropdown" do it "shows the emoji autocompletion dropdown" do
click_link("New page") click_link("New page")
page.within("#modal-new-wiki") do page.within("#modal-new-wiki") do
...@@ -254,7 +254,7 @@ describe "User creates wiki page" do ...@@ -254,7 +254,7 @@ describe "User creates wiki page" do
page.within(".wiki-form") do page.within(".wiki-form") do
find("#wiki_content").native.send_keys("") find("#wiki_content").native.send_keys("")
fill_in(:wiki_content, with: "@") fill_in(:wiki_content, with: ":")
end end
expect(page).to have_selector(".atwho-view") expect(page).to have_selector(".atwho-view")
......
...@@ -96,11 +96,11 @@ describe 'User updates wiki page' do ...@@ -96,11 +96,11 @@ describe 'User updates wiki page' do
expect(find('textarea#wiki_content').value).to eq('') expect(find('textarea#wiki_content').value).to eq('')
end end
it 'shows the autocompletion dropdown', :js do it 'shows the emoji autocompletion dropdown', :js do
click_link('Edit') click_link('Edit')
find('#wiki_content').native.send_keys('') find('#wiki_content').native.send_keys('')
fill_in(:wiki_content, with: '@') fill_in(:wiki_content, with: ':')
expect(page).to have_selector('.atwho-view') expect(page).to have_selector('.atwho-view')
end end
......
...@@ -75,9 +75,9 @@ feature 'Master creates tag' do ...@@ -75,9 +75,9 @@ feature 'Master creates tag' do
visit new_project_tag_path(project) visit new_project_tag_path(project)
end end
it 'description has autocomplete', :js do it 'description has emoji autocomplete', :js do
find('#release_description').native.send_keys('') find('#release_description').native.send_keys('')
fill_in 'release_description', with: '@' fill_in 'release_description', with: ':'
expect(page).to have_selector('.atwho-view') expect(page).to have_selector('.atwho-view')
end end
......
...@@ -35,30 +35,15 @@ feature 'Master deletes tag' do ...@@ -35,30 +35,15 @@ feature 'Master deletes tag' do
end end
context 'when pre-receive hook fails', :js do context 'when pre-receive hook fails', :js do
context 'when Gitaly operation_user_delete_tag feature is enabled' do before do
before do allow_any_instance_of(Gitlab::GitalyClient::OperationService).to receive(:rm_tag)
allow_any_instance_of(Gitlab::GitalyClient::OperationService).to receive(:rm_tag) .and_raise(Gitlab::Git::PreReceiveError, 'Do not delete tags')
.and_raise(Gitlab::Git::PreReceiveError, 'Do not delete tags')
end
scenario 'shows the error message' do
delete_first_tag
expect(page).to have_content('Do not delete tags')
end
end end
context 'when Gitaly operation_user_delete_tag feature is disabled', :skip_gitaly_mock do scenario 'shows the error message' do
before do delete_first_tag
allow_any_instance_of(Gitlab::Git::HooksService).to receive(:execute)
.and_raise(Gitlab::Git::PreReceiveError, 'Do not delete tags')
end
scenario 'shows the error message' do
delete_first_tag
expect(page).to have_content('Do not delete tags') expect(page).to have_content('Do not delete tags')
end
end end
end end
......
...@@ -25,13 +25,13 @@ feature 'Master updates tag' do ...@@ -25,13 +25,13 @@ feature 'Master updates tag' do
expect(page).to have_content 'Awesome release notes' expect(page).to have_content 'Awesome release notes'
end end
scenario 'description has autocomplete', :js do scenario 'description has emoji autocomplete', :js do
page.within(first('.content-list .controls')) do page.within(first('.content-list .controls')) do
click_link 'Edit release notes' click_link 'Edit release notes'
end end
find('#release_description').native.send_keys('') find('#release_description').native.send_keys('')
fill_in 'release_description', with: '@' fill_in 'release_description', with: ':'
expect(page).to have_selector('.atwho-view') expect(page).to have_selector('.atwho-view')
end end
......
...@@ -210,6 +210,13 @@ describe Banzai::Filter::MergeRequestReferenceFilter do ...@@ -210,6 +210,13 @@ describe Banzai::Filter::MergeRequestReferenceFilter do
.to eq reference .to eq reference
end end
it 'commit ref tag is valid' do
doc = reference_filter("See #{reference}")
commit_ref_tag = doc.css('a').first.css('span.gfm.gfm-commit')
expect(commit_ref_tag.text).to eq(commit.short_id)
end
it 'has valid text' do it 'has valid text' do
doc = reference_filter("See #{reference}") doc = reference_filter("See #{reference}")
......
require 'spec_helper' require 'spec_helper'
describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, schema: 20180619121030 do describe Gitlab::BackgroundMigration::DeleteDiffFiles, :migration, schema: 20180626125654 do
describe '#perform' do describe '#perform' do
context 'when diff files can be deleted' do context 'when diff files can be deleted' do
let(:merge_request) { create(:merge_request, :merged) } let(:merge_request) { create(:merge_request, :merged) }
......
...@@ -26,6 +26,21 @@ describe Gitlab::Diff::File do ...@@ -26,6 +26,21 @@ describe Gitlab::Diff::File do
end end
end end
describe '#diff_lines_for_serializer' do
it 'includes bottom match line if not in the end' do
expect(diff_file.diff_lines_for_serializer.last.type).to eq('match')
end
context 'when deleted' do
let(:commit) { project.commit('d59c60028b053793cecfb4022de34602e1a9218e') }
let(:diff_file) { commit.diffs.diff_file_with_old_path('files/js/commit.js.coffee') }
it 'does not include bottom match line' do
expect(diff_file.diff_lines_for_serializer.last.type).not_to eq('match')
end
end
end
describe '#mode_changed?' do describe '#mode_changed?' do
it { expect(diff_file.mode_changed?).to be_falsey } it { expect(diff_file.mode_changed?).to be_falsey }
end end
......
...@@ -1971,21 +1971,15 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -1971,21 +1971,15 @@ describe Gitlab::Git::Repository, seed_helper: true do
end end
end end
context 'with gitaly' do it "calls Gitaly's OperationService" do
it "calls Gitaly's OperationService" do expect_any_instance_of(Gitlab::GitalyClient::OperationService)
expect_any_instance_of(Gitlab::GitalyClient::OperationService) .to receive(:user_ff_branch).with(user, source_sha, target_branch)
.to receive(:user_ff_branch).with(user, source_sha, target_branch) .and_return(nil)
.and_return(nil)
subject subject
end
it_behaves_like '#ff_merge'
end end
context 'without gitaly', :skip_gitaly_mock do it_behaves_like '#ff_merge'
it_behaves_like '#ff_merge'
end
end end
describe '#delete_all_refs_except' do describe '#delete_all_refs_except' do
...@@ -2308,92 +2302,95 @@ describe Gitlab::Git::Repository, seed_helper: true do ...@@ -2308,92 +2302,95 @@ describe Gitlab::Git::Repository, seed_helper: true do
expect { subject }.to raise_error(Gitlab::Git::CommandError, 'error') expect { subject }.to raise_error(Gitlab::Git::CommandError, 'error')
end end
end end
end
describe '#squash' do describe '#squash' do
let(:squash_id) { '1' } let(:squash_id) { '1' }
let(:branch_name) { 'fix' } let(:branch_name) { 'fix' }
let(:start_sha) { '4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6' } let(:start_sha) { '4b4918a572fa86f9771e5ba40fbd48e1eb03e2c6' }
let(:end_sha) { '12d65c8dd2b2676fa3ac47d955accc085a37a9c1' } let(:end_sha) { '12d65c8dd2b2676fa3ac47d955accc085a37a9c1' }
subject do subject do
opts = { opts = {
branch: branch_name, branch: branch_name,
start_sha: start_sha, start_sha: start_sha,
end_sha: end_sha, end_sha: end_sha,
author: user, author: user,
message: 'Squash commit message' message: 'Squash commit message'
} }
repository.squash(user, squash_id, opts) repository.squash(user, squash_id, opts)
end
# Should be ported to gitaly-ruby rspec suite https://gitlab.com/gitlab-org/gitaly/issues/1234
skip 'sparse checkout' do
let(:expected_files) { %w(files files/js files/js/application.js) }
it 'checks out only the files in the diff' do
allow(repository).to receive(:with_worktree).and_wrap_original do |m, *args|
m.call(*args) do
worktree_path = args[0]
files_pattern = File.join(worktree_path, '**', '*')
expected = expected_files.map do |path|
File.expand_path(path, worktree_path)
end
expect(Dir[files_pattern]).to eq(expected)
end
end
subject
end end
context 'sparse checkout', :skip_gitaly_mock do context 'when the diff contains a rename' do
let(:expected_files) { %w(files files/js files/js/application.js) } let(:repo) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged }
let(:end_sha) { new_commit_move_file(repo).oid }
it 'checks out only the files in the diff' do after do
# Erase our commits so other tests get the original repo
repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged
repo.references.update('refs/heads/master', SeedRepo::LastCommit::ID)
end
it 'does not include the renamed file in the sparse checkout' do
allow(repository).to receive(:with_worktree).and_wrap_original do |m, *args| allow(repository).to receive(:with_worktree).and_wrap_original do |m, *args|
m.call(*args) do m.call(*args) do
worktree_path = args[0] worktree_path = args[0]
files_pattern = File.join(worktree_path, '**', '*') files_pattern = File.join(worktree_path, '**', '*')
expected = expected_files.map do |path|
File.expand_path(path, worktree_path)
end
expect(Dir[files_pattern]).to eq(expected) expect(Dir[files_pattern]).not_to include('CHANGELOG')
expect(Dir[files_pattern]).not_to include('encoding/CHANGELOG')
end end
end end
subject subject
end end
context 'when the diff contains a rename' do
let(:repo) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged }
let(:end_sha) { new_commit_move_file(repo).oid }
after do
# Erase our commits so other tests get the original repo
repo = Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '').rugged
repo.references.update('refs/heads/master', SeedRepo::LastCommit::ID)
end
it 'does not include the renamed file in the sparse checkout' do
allow(repository).to receive(:with_worktree).and_wrap_original do |m, *args|
m.call(*args) do
worktree_path = args[0]
files_pattern = File.join(worktree_path, '**', '*')
expect(Dir[files_pattern]).not_to include('CHANGELOG')
expect(Dir[files_pattern]).not_to include('encoding/CHANGELOG')
end
end
subject
end
end
end end
end
context 'with an ASCII-8BIT diff', :skip_gitaly_mock do # Should be ported to gitaly-ruby rspec suite https://gitlab.com/gitlab-org/gitaly/issues/1234
let(:diff) { "diff --git a/README.md b/README.md\nindex faaf198..43c5edf 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,4 +1,4 @@\n-testme\n+✓ testme\n ======\n \n Sample repo for testing gitlab features\n" } skip 'with an ASCII-8BIT diff' do
let(:diff) { "diff --git a/README.md b/README.md\nindex faaf198..43c5edf 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,4 +1,4 @@\n-testme\n+✓ testme\n ======\n \n Sample repo for testing gitlab features\n" }
it 'applies a ASCII-8BIT diff' do it 'applies a ASCII-8BIT diff' do
allow(repository).to receive(:run_git!).and_call_original allow(repository).to receive(:run_git!).and_call_original
allow(repository).to receive(:run_git!).with(%W(diff --binary #{start_sha}...#{end_sha})).and_return(diff.force_encoding('ASCII-8BIT')) allow(repository).to receive(:run_git!).with(%W(diff --binary #{start_sha}...#{end_sha})).and_return(diff.force_encoding('ASCII-8BIT'))
expect(subject).to match(/\h{40}/) expect(subject).to match(/\h{40}/)
end
end end
end
context 'with trailing whitespace in an invalid patch', :skip_gitaly_mock do # Should be ported to gitaly-ruby rspec suite https://gitlab.com/gitlab-org/gitaly/issues/1234
let(:diff) { "diff --git a/README.md b/README.md\nindex faaf198..43c5edf 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,4 +1,4 @@\n-testme\n+ \n ====== \n \n Sample repo for testing gitlab features\n" } skip 'with trailing whitespace in an invalid patch' do
let(:diff) { "diff --git a/README.md b/README.md\nindex faaf198..43c5edf 100644\n--- a/README.md\n+++ b/README.md\n@@ -1,4 +1,4 @@\n-testme\n+ \n ====== \n \n Sample repo for testing gitlab features\n" }
it 'does not include whitespace warnings in the error' do it 'does not include whitespace warnings in the error' do
allow(repository).to receive(:run_git!).and_call_original allow(repository).to receive(:run_git!).and_call_original
allow(repository).to receive(:run_git!).with(%W(diff --binary #{start_sha}...#{end_sha})).and_return(diff.force_encoding('ASCII-8BIT')) allow(repository).to receive(:run_git!).with(%W(diff --binary #{start_sha}...#{end_sha})).and_return(diff.force_encoding('ASCII-8BIT'))
expect { subject }.to raise_error do |error| expect { subject }.to raise_error do |error|
expect(error).to be_a(described_class::GitError) expect(error).to be_a(described_class::GitError)
expect(error.message).not_to include('trailing whitespace') expect(error.message).not_to include('trailing whitespace')
end
end end
end end
end end
......
...@@ -17,7 +17,7 @@ describe Gitlab::GitalyClient::CommitService do ...@@ -17,7 +17,7 @@ describe Gitlab::GitalyClient::CommitService do
repository: repository_message, repository: repository_message,
left_commit_id: 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660', left_commit_id: 'cfe32cf61b73a0d5e9f13e774abde7ff789b1660',
right_commit_id: commit.id, right_commit_id: commit.id,
collapse_diffs: true, collapse_diffs: false,
enforce_limits: true, enforce_limits: true,
**Gitlab::Git::DiffCollection.collection_limits.to_h **Gitlab::Git::DiffCollection.collection_limits.to_h
) )
...@@ -35,7 +35,7 @@ describe Gitlab::GitalyClient::CommitService do ...@@ -35,7 +35,7 @@ describe Gitlab::GitalyClient::CommitService do
repository: repository_message, repository: repository_message,
left_commit_id: Gitlab::Git::EMPTY_TREE_ID, left_commit_id: Gitlab::Git::EMPTY_TREE_ID,
right_commit_id: initial_commit.id, right_commit_id: initial_commit.id,
collapse_diffs: true, collapse_diffs: false,
enforce_limits: true, enforce_limits: true,
**Gitlab::Git::DiffCollection.collection_limits.to_h **Gitlab::Git::DiffCollection.collection_limits.to_h
) )
......
...@@ -2,6 +2,7 @@ require 'spec_helper' ...@@ -2,6 +2,7 @@ require 'spec_helper'
describe Gitlab::Middleware::ReadOnly do describe Gitlab::Middleware::ReadOnly do
include Rack::Test::Methods include Rack::Test::Methods
using RSpec::Parameterized::TableSyntax
RSpec::Matchers.define :be_a_redirect do RSpec::Matchers.define :be_a_redirect do
match do |response| match do |response|
...@@ -117,39 +118,41 @@ describe Gitlab::Middleware::ReadOnly do ...@@ -117,39 +118,41 @@ describe Gitlab::Middleware::ReadOnly do
context 'whitelisted requests' do context 'whitelisted requests' do
it 'expects a POST internal request to be allowed' do it 'expects a POST internal request to be allowed' do
expect(Rails.application.routes).not_to receive(:recognize_path) expect(Rails.application.routes).not_to receive(:recognize_path)
response = request.post("/api/#{API::API.version}/internal") response = request.post("/api/#{API::API.version}/internal")
expect(response).not_to be_a_redirect expect(response).not_to be_a_redirect
expect(subject).not_to disallow_request expect(subject).not_to disallow_request
end end
it 'expects a POST LFS request to batch URL to be allowed' do it 'expects requests to sidekiq admin to be allowed' do
expect(Rails.application.routes).to receive(:recognize_path).and_call_original response = request.post('/admin/sidekiq')
response = request.post('/root/rouge.git/info/lfs/objects/batch')
expect(response).not_to be_a_redirect expect(response).not_to be_a_redirect
expect(subject).not_to disallow_request expect(subject).not_to disallow_request
end
it 'expects a POST request to git-upload-pack URL to be allowed' do response = request.get('/admin/sidekiq')
expect(Rails.application.routes).to receive(:recognize_path).and_call_original
response = request.post('/root/rouge.git/git-upload-pack')
expect(response).not_to be_a_redirect expect(response).not_to be_a_redirect
expect(subject).not_to disallow_request expect(subject).not_to disallow_request
end end
it 'expects requests to sidekiq admin to be allowed' do where(:description, :path) do
response = request.post('/admin/sidekiq') 'LFS request to batch' | '/root/rouge.git/info/lfs/objects/batch'
'LFS request to locks verify' | '/root/rouge.git/info/lfs/locks/verify'
expect(response).not_to be_a_redirect 'LFS request to locks create' | '/root/rouge.git/info/lfs/locks'
expect(subject).not_to disallow_request 'LFS request to locks unlock' | '/root/rouge.git/info/lfs/locks/1/unlock'
'request to git-upload-pack' | '/root/rouge.git/git-upload-pack'
'request to git-receive-pack' | '/root/rouge.git/git-receive-pack'
end
response = request.get('/admin/sidekiq') with_them do
it "expects a POST #{description} URL to be allowed" do
expect(Rails.application.routes).to receive(:recognize_path).and_call_original
response = request.post(path)
expect(response).not_to be_a_redirect expect(response).not_to be_a_redirect
expect(subject).not_to disallow_request expect(subject).not_to disallow_request
end
end end
end end
end end
......
require 'spec_helper'
require Rails.root.join('db', 'post_migrate', '20180619121030_enqueue_delete_diff_files_workers.rb')
describe EnqueueDeleteDiffFilesWorkers, :migration, :sidekiq do
let(:merge_request_diffs) { table(:merge_request_diffs) }
let(:merge_requests) { table(:merge_requests) }
let(:namespaces) { table(:namespaces) }
let(:projects) { table(:projects) }
before do
stub_const("#{described_class.name}::BATCH_SIZE", 2)
namespaces.create!(id: 1, name: 'gitlab', path: 'gitlab')
projects.create!(id: 1, namespace_id: 1, name: 'gitlab', path: 'gitlab')
merge_requests.create!(id: 1, target_project_id: 1, source_project_id: 1, target_branch: 'feature', source_branch: 'master', state: 'merged')
merge_request_diffs.create!(id: 1, merge_request_id: 1, state: 'collected')
merge_request_diffs.create!(id: 2, merge_request_id: 1, state: 'without_files')
merge_request_diffs.create!(id: 3, merge_request_id: 1, state: 'collected')
merge_request_diffs.create!(id: 4, merge_request_id: 1, state: 'collected')
merge_request_diffs.create!(id: 5, merge_request_id: 1, state: 'empty')
merge_request_diffs.create!(id: 6, merge_request_id: 1, state: 'collected')
merge_requests.update(1, latest_merge_request_diff_id: 6)
end
it 'correctly schedules diff file deletion workers' do
Sidekiq::Testing.fake! do
Timecop.freeze do
migrate!
# 1st batch
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(8.minutes, 1)
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(9.minutes, 3)
# 2nd batch
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(16.minutes, 4)
expect(described_class::MIGRATION).to be_scheduled_delayed_migration(17.minutes, 6)
expect(BackgroundMigrationWorker.jobs.size).to eq(4)
end
end
end
it 'migrates the data' do
expect { migrate! }.to change { merge_request_diffs.where(state: 'without_files').count }
.from(1).to(4)
end
end
...@@ -153,6 +153,13 @@ describe MergeRequestDiff do ...@@ -153,6 +153,13 @@ describe MergeRequestDiff do
expect(mr_diff.empty?).to be_truthy expect(mr_diff.empty?).to be_truthy
end end
it 'expands collapsed diffs before saving' do
mr_diff = create(:merge_request, source_branch: 'expand-collapse-lines', target_branch: 'master').merge_request_diff
diff_file = mr_diff.merge_request_diff_files.find_by(new_path: 'expand-collapse/file-5.txt')
expect(diff_file.diff).not_to be_empty
end
it 'saves binary diffs correctly' do it 'saves binary diffs correctly' do
path = 'files/images/icn-time-tracking.pdf' path = 'files/images/icn-time-tracking.pdf'
mr_diff = create(:merge_request, source_branch: 'add-pdf-text-binary', target_branch: 'master').merge_request_diff mr_diff = create(:merge_request, source_branch: 'add-pdf-text-binary', target_branch: 'master').merge_request_diff
......
...@@ -2190,6 +2190,22 @@ describe MergeRequest do ...@@ -2190,6 +2190,22 @@ describe MergeRequest do
end end
end end
end end
context 'source branch is missing' do
subject { create(:merge_request, :invalid, :opened, merge_status: :unchecked, target_branch: 'master') }
before do
allow(subject.project.repository).to receive(:can_be_merged?).and_call_original
end
it 'does not raise error' do
expect(notification_service).not_to receive(:merge_request_unmergeable)
expect(todo_service).not_to receive(:merge_request_became_unmergeable)
expect { subject.mark_as_unmergeable }.not_to raise_error
expect(subject.cannot_be_merged?).to eq(true)
end
end
end end
describe 'check_state?' do describe 'check_state?' do
......
...@@ -120,6 +120,14 @@ describe BambooService, :use_clean_rails_memory_store_caching do ...@@ -120,6 +120,14 @@ describe BambooService, :use_clean_rails_memory_store_caching do
end end
end end
describe '#execute' do
it 'runs update and build action' do
stub_update_and_build_request
subject.execute(Gitlab::DataBuilder::Push::SAMPLE_DATA)
end
end
describe '#build_page' do describe '#build_page' do
it 'returns the contents of the reactive cache' do it 'returns the contents of the reactive cache' do
stub_reactive_cache(service, { build_page: 'foo' }, 'sha', 'ref') stub_reactive_cache(service, { build_page: 'foo' }, 'sha', 'ref')
...@@ -216,10 +224,20 @@ describe BambooService, :use_clean_rails_memory_store_caching do ...@@ -216,10 +224,20 @@ describe BambooService, :use_clean_rails_memory_store_caching do
end end
end end
def stub_update_and_build_request(status: 200, body: nil)
bamboo_full_url = 'http://gitlab.com/bamboo/updateAndBuild.action?buildKey=foo&os_authType=basic'
stub_bamboo_request(bamboo_full_url, status, body)
end
def stub_request(status: 200, body: nil) def stub_request(status: 200, body: nil)
bamboo_full_url = 'http://gitlab.com/bamboo/rest/api/latest/result?label=123&os_authType=basic' bamboo_full_url = 'http://gitlab.com/bamboo/rest/api/latest/result/byChangeset/123?os_authType=basic'
stub_bamboo_request(bamboo_full_url, status, body)
end
WebMock.stub_request(:get, bamboo_full_url).to_return( def stub_bamboo_request(url, status, body)
WebMock.stub_request(:get, url).to_return(
status: status, status: status,
headers: { 'Content-Type' => 'application/json' }, headers: { 'Content-Type' => 'application/json' },
body: body body: body
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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