Commit 1b449ba0 authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'master' into 19703-direct-link-pipelines

* master: (32 commits)
  Update CHANGELOG.md for 8.13.10
  Update CHANGELOG.md for 8.14.5
  Add Wiki import to BB importer
  Make CI badge hitboxes better match container
  Move admin broadcast messages spinach feature to rspec
  Move Admin Appearance spinach feature to rspec
  Fix MR issue to do with merge user
  Check if selected object is valid before passing to calback
  Fix for missing service when importing from EE to CE
  Fix tests because now we don't convert values
  Spaces for literal hash
  updated spec
  Keep the value type for YAML variables
  Test if expanded_environment_name could expand var
  Fix duplicated build token problem and added relevant spec
  Just implement it in the block
  Move admin labels spinach test to rspec
  Bring back "notification-dropdown" class for styling and use "js-notification-dropdown" for JavaScript
  Fix 500 error for invalid path when visiting blame page
  Add sentence casing, fix groups page buttons, fix dark gray variable
  ...
parents 34e317d2 d1d1e7c6
...@@ -2,6 +2,21 @@ ...@@ -2,6 +2,21 @@
documentation](doc/development/changelog.md) for instructions on adding your own documentation](doc/development/changelog.md) for instructions on adding your own
entry. entry.
## 8.14.5 (2016-12-14)
- Moved Leave Project and Leave Group buttons to access_request_buttons from the settings dropdown. !7600
- fix display hook error message. !7775 (basyura)
- Remove wrong '.builds-feature' class from the MR settings fieldset. !7930
- Avoid escaping relative links in Markdown twice. !7940 (winniehell)
- API: Memoize the current_user so that sudo can work properly. !8017
- Displays milestone remaining days only when it's present.
- Allow branch names with dots on API endpoint.
- Issue#visible_to_user moved to IssuesFinder to prevent accidental use.
- Shows group members in project members list.
- Encode input when migrating ProcessCommitWorker jobs to prevent migration errors.
- Fixed timeago re-rendering every timeago.
- Fix missing Note access checks by moving Note#search to updated NoteFinder.
## 8.14.4 (2016-12-08) ## 8.14.4 (2016-12-08)
- Fix diff view permalink highlighting. !7090 - Fix diff view permalink highlighting. !7090
...@@ -264,6 +279,13 @@ entry. ...@@ -264,6 +279,13 @@ entry.
- Fix "Without projects" filter. !6611 (Ben Bodenmiller) - Fix "Without projects" filter. !6611 (Ben Bodenmiller)
- Fix 404 when visit /projects page - Fix 404 when visit /projects page
## 8.13.10 (2016-12-14)
- API: Memoize the current_user so that sudo can work properly. !8017
- Filter `authentication_token`, `incoming_email_token` and `runners_token` parameters.
- Issue#visible_to_user moved to IssuesFinder to prevent accidental use.
- Fix missing Note access checks by moving Note#search to updated NoteFinder.
## 8.13.9 (2016-12-08) ## 8.13.9 (2016-12-08)
- Reenables /user API request to return private-token if user is admin and request is made with sudo. !7615 - Reenables /user API request to return private-token if user is admin and request is made with sudo. !7615
......
...@@ -343,16 +343,18 @@ ...@@ -343,16 +343,18 @@
selector = ".dropdown-page-one .dropdown-content a"; selector = ".dropdown-page-one .dropdown-content a";
} }
this.dropdown.on("click", selector, function(e) { this.dropdown.on("click", selector, function(e) {
var $el, selected; var $el, selected, selectedObj, isMarking;
$el = $(this); $el = $(this);
selected = self.rowClicked($el); selected = self.rowClicked($el);
selectedObj = selected ? selected[0] : null;
isMarking = selected ? selected[1] : null;
if (self.options.clicked) { if (self.options.clicked) {
self.options.clicked(selected[0], $el, e, selected[1]); self.options.clicked(selectedObj, $el, e, isMarking);
} }
// Update label right after all modifications in dropdown has been done // Update label right after all modifications in dropdown has been done
if (self.options.toggleLabel) { if (self.options.toggleLabel) {
self.updateLabel(selected[0], $el, self); self.updateLabel(selectedObj, $el, self);
} }
$el.trigger('blur'); $el.trigger('blur');
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
}); });
$(document).off('ajax:success', '.notification-form').on('ajax:success', '.notification-form', function(e, data) { $(document).off('ajax:success', '.notification-form').on('ajax:success', '.notification-form', function(e, data) {
if (data.saved) { if (data.saved) {
return $(e.currentTarget).closest('.notification-dropdown').replaceWith(data.html); return $(e.currentTarget).closest('.js-notification-dropdown').replaceWith(data.html);
} else { } else {
return new Flash('Failed to save new settings', 'alert'); return new Flash('Failed to save new settings', 'alert');
} }
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
} }
// Display Star and Fork buttons without counters on mobile. // Display Star and Fork buttons without counters on mobile.
.project-action-buttons { .project-repo-buttons {
display: block; display: block;
.count-buttons .btn { .count-buttons .btn {
......
...@@ -24,6 +24,7 @@ $gray-lightest: #fdfdfd; ...@@ -24,6 +24,7 @@ $gray-lightest: #fdfdfd;
$gray-light: #fafafa; $gray-light: #fafafa;
$gray-lighter: #f9f9f9; $gray-lighter: #f9f9f9;
$gray-normal: #f5f5f5; $gray-normal: #f5f5f5;
$gray-dark: darken($gray-light, $darken-dark-factor);
$gray-darker: #eee; $gray-darker: #eee;
$gray-darkest: #c4c4c4; $gray-darkest: #c4c4c4;
......
...@@ -27,12 +27,6 @@ ...@@ -27,12 +27,6 @@
} }
} }
.group-buttons {
.notification-dropdown {
display: inline-block;
}
}
.groups-header { .groups-header {
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
.nav-links { .nav-links {
......
...@@ -429,7 +429,7 @@ ...@@ -429,7 +429,7 @@
width: 21px; width: 21px;
height: 25px; height: 25px;
position: absolute; position: absolute;
top: -32px; top: -31px;
border-top: 2px solid $border-color; border-top: 2px solid $border-color;
} }
...@@ -457,15 +457,13 @@ ...@@ -457,15 +457,13 @@
} }
.build { .build {
border: 1px solid $border-color;
border-radius: 30px;
background-color: $white-light;
position: relative; position: relative;
padding: 8px 4px 9px 10px;
width: 186px; width: 186px;
margin-bottom: 10px; margin-bottom: 10px;
white-space: normal; white-space: normal;
color: $gl-text-color-light;
<<<<<<< HEAD
.dropdown-menu-toggle { .dropdown-menu-toggle {
background-color: transparent; background-color: transparent;
...@@ -491,20 +489,27 @@ ...@@ -491,20 +489,27 @@
&:hover { &:hover {
background-color: $stage-hover-bg; background-color: $stage-hover-bg;
border: 1px solid $stage-hover-border; border: 1px solid $stage-hover-border;
=======
a, > .build-content {
.dropdown-counter-badge, display: inline-block;
.dropdown-menu-toggle { padding: 8px 10px 9px;
color: $gl-text-color; width: 100%;
} border: 1px solid $border-color;
border-radius: 30px;
.grouped-pipeline-dropdown a { background-color: $white-light;
color: $gl-text-color-light; >>>>>>> master
&:hover { &:hover {
background-color: $stage-hover-bg;
border: 1px solid $stage-hover-border;
color: $gl-text-color; color: $gl-text-color;
} }
} }
> .ci-action-icon-container {
position: absolute;
right: 4px;
top: 5px;
} }
.ci-status-icon { .ci-status-icon {
...@@ -601,10 +606,19 @@ ...@@ -601,10 +606,19 @@
// Position in the pipeline graph // Position in the pipeline graph
.grouped-pipeline-dropdown { .grouped-pipeline-dropdown {
<<<<<<< HEAD
right: -206px; right: -206px;
top: -11px; top: -11px;
} }
} }
=======
padding: 0;
width: 191px;
left: auto;
right: -195px;
top: -4px;
box-shadow: 0 1px 5px $black-transparent;
>>>>>>> master
.dropdown-counter-badge { .dropdown-counter-badge {
float: right; float: right;
...@@ -630,10 +644,53 @@ ...@@ -630,10 +644,53 @@
} }
} }
<<<<<<< HEAD
ul { ul {
max-height: 245px; max-height: 245px;
overflow: auto; overflow: auto;
margin: 5px 0; margin: 5px 0;
=======
.dropdown-build {
color: $gl-text-color-light;
.build-content {
width: 100%;
}
.ci-action-icon-container {
font-size: 11px;
position: absolute;
right: 4px;
i {
width: 25px;
height: 25px;
font-size: 11px;
margin-top: 0;
&::before {
top: 1px;
left: 1px;
}
}
}
&:hover {
background-color: $stage-hover-bg;
border-radius: 3px;
color: $gl-text-color;
}
.stage {
max-width: 100px;
width: 100px;
}
.ci-status-icon svg {
height: 18px;
width: 18px;
}
>>>>>>> master
li { li {
padding-top: 2px; padding-top: 2px;
...@@ -659,9 +716,6 @@ ...@@ -659,9 +716,6 @@
// Action Icons // Action Icons
.ci-action-icon-container .ci-action-icon-wrapper { .ci-action-icon-container .ci-action-icon-wrapper {
float: right;
margin-top: -4px;
i { i {
color: $border-color; color: $border-color;
border-radius: 100%; border-radius: 100%;
......
...@@ -145,8 +145,6 @@ ...@@ -145,8 +145,6 @@
.project-repo-buttons, .project-repo-buttons,
.group-buttons { .group-buttons {
margin-top: 15px;
.btn { .btn {
@include btn-gray; @include btn-gray;
padding: 3px 10px; padding: 3px 10px;
...@@ -175,11 +173,9 @@ ...@@ -175,11 +173,9 @@
} }
} }
.download-button, .project-action-button {
.dropdown-toggle, margin: 15px 5px 0;
.notification-dropdown, vertical-align: top;
.project-dropdown {
margin-left: 10px;
} }
.notification-dropdown .dropdown-menu { .notification-dropdown .dropdown-menu {
...@@ -195,13 +191,15 @@ ...@@ -195,13 +191,15 @@
.count-buttons { .count-buttons {
display: inline-block; display: inline-block;
vertical-align: top; vertical-align: top;
margin-top: 15px;
} }
.project-clone-holder { .project-clone-holder {
display: inline-block; display: inline-block;
margin: 15px 5px 0 0;
input { input {
height: 29px; height: 28px;
} }
} }
...@@ -255,7 +253,7 @@ ...@@ -255,7 +253,7 @@
line-height: 13px; line-height: 13px;
padding: $gl-vert-padding $gl-padding; padding: $gl-vert-padding $gl-padding;
letter-spacing: .4px; letter-spacing: .4px;
padding: 7px 14px; padding: 6px 14px;
text-align: center; text-align: center;
vertical-align: middle; vertical-align: middle;
touch-action: manipulation; touch-action: manipulation;
...@@ -492,6 +490,7 @@ a.deploy-project-label { ...@@ -492,6 +490,7 @@ a.deploy-project-label {
.project-stats { .project-stats {
font-size: 0; font-size: 0;
text-align: center;
border-bottom: 1px solid $border-color; border-bottom: 1px solid $border-color;
.nav { .nav {
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
position: relative; position: relative;
z-index: 2; z-index: 2;
.download-button { .project-action-button {
margin-left: $btn-side-margin; margin-left: $btn-side-margin;
} }
} }
...@@ -8,6 +8,9 @@ class Projects::BlameController < Projects::ApplicationController ...@@ -8,6 +8,9 @@ class Projects::BlameController < Projects::ApplicationController
def show def show
@blob = @repository.blob_at(@commit.id, @path) @blob = @repository.blob_at(@commit.id, @path)
return render_404 unless @blob
@blame_groups = Gitlab::Blame.new(@blob, @commit).groups @blame_groups = Gitlab::Blame.new(@blob, @commit).groups
end end
end end
...@@ -18,7 +18,7 @@ module Ci ...@@ -18,7 +18,7 @@ module Ci
end end
serialize :options serialize :options
serialize :yaml_variables serialize :yaml_variables, Gitlab::Serialize::Ci::Variables
validates :coverage, numericality: true, allow_blank: true validates :coverage, numericality: true, allow_blank: true
validates_presence_of :ref validates_presence_of :ref
......
...@@ -97,7 +97,7 @@ class MergeRequest < ActiveRecord::Base ...@@ -97,7 +97,7 @@ class MergeRequest < ActiveRecord::Base
validates :source_branch, presence: true validates :source_branch, presence: true
validates :target_project, presence: true validates :target_project, presence: true
validates :target_branch, presence: true validates :target_branch, presence: true
validates :merge_user, presence: true, if: :merge_when_build_succeeds? validates :merge_user, presence: true, if: :merge_when_build_succeeds?, unless: :importing?
validate :validate_branches, unless: [:allow_broken, :importing?, :closed_without_fork?] validate :validate_branches, unless: [:allow_broken, :importing?, :closed_without_fork?]
validate :validate_fork, unless: :closed_without_fork? validate :validate_fork, unless: :closed_without_fork?
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
- klass = "ci-status-icon ci-status-icon-#{status.group}" - klass = "ci-status-icon ci-status-icon-#{status.group}"
- if status.has_details? - if status.has_details?
= link_to status.details_path, data: { toggle: 'tooltip', title: "#{subject.name} - #{status.label}" } do = link_to status.details_path, class: 'build-content' do
%span{ class: klass }= custom_icon(status.icon) %span{ class: klass }= custom_icon(status.icon)
.ci-status-text= subject.name .ci-status-text{ 'data-toggle' => 'tooltip', 'data-title' => "#{subject.name} - #{status.label}" }= subject.name
- else - else
.build-content
%span{ class: klass }= custom_icon(status.icon) %span{ class: klass }= custom_icon(status.icon)
.ci-status-text= subject.name .ci-status-text{ 'data-toggle' => 'tooltip', 'data-title' => "#{subject.name} - #{status.label}" }= subject.name
- if status.has_action? - if status.has_action?
= link_to status.action_path, method: status.action_method, = link_to status.action_path, method: status.action_method,
......
...@@ -18,11 +18,19 @@ ...@@ -18,11 +18,19 @@
= link_to project_path(forked_from_project) do = link_to project_path(forked_from_project) do
= forked_from_project.namespace.try(:name) = forked_from_project.namespace.try(:name)
.project-repo-buttons.project-action-buttons .project-repo-buttons
.count-buttons .count-buttons
= render 'projects/buttons/star' = render 'projects/buttons/star'
= render 'projects/buttons/fork' = render 'projects/buttons/fork'
%span.hidden-xs
- if @project.feature_available?(:repository, current_user) - if @project.feature_available?(:repository, current_user)
.project-clone-holder .project-clone-holder
= render "shared/clone_panel" = render "shared/clone_panel"
- if current_user && can?(current_user, :download_code, @project)
= render 'projects/buttons/download', project: @project, ref: @ref
= render 'projects/buttons/dropdown'
= render 'shared/notifications/button', notification_setting: @notification_setting
= render 'projects/buttons/koding'
= render 'shared/members/access_request_buttons', source: @project
- if !project.empty_repo? && can?(current_user, :download_code, project) - if !project.empty_repo? && can?(current_user, :download_code, project)
.dropdown.inline.download-button .project-action-button.dropdown.inline
%button.btn{ 'data-toggle' => 'dropdown' } %button.btn{ 'data-toggle' => 'dropdown' }
= icon('download') = icon('download')
= icon("caret-down") = icon("caret-down")
......
- if current_user - if current_user
.dropdown.inline .project-action-button.dropdown.inline
%a.btn.dropdown-toggle{href: '#', "data-toggle" => "dropdown"} %a.btn.dropdown-toggle{href: '#', "data-toggle" => "dropdown"}
= icon('plus') = icon('plus')
= icon("caret-down") = icon("caret-down")
......
- if koding_enabled? && current_user && can_push_branch?(@project, @project.default_branch) - if koding_enabled? && current_user && @repository.koding_yml && can_push_branch?(@project, @project.default_branch)
- if @repository.koding_yml = link_to koding_project_url(@project), class: 'btn project-action-button inline', target: '_blank' do
= link_to koding_project_url(@project), class: 'btn', target: '_blank' do
Run in IDE (Koding) Run in IDE (Koding)
- else
= link_to add_koding_stack_path(@project), class: 'btn' do
Set Up Koding
...@@ -64,20 +64,11 @@ ...@@ -64,20 +64,11 @@
- unless @repository.gitlab_ci_yml - unless @repository.gitlab_ci_yml
%li.missing %li.missing
= link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do = link_to add_special_file_path(@project, file_name: '.gitlab-ci.yml') do
Set Up CI Set up CI
- if koding_enabled? && @repository.koding_yml.blank?
%li.project-repo-buttons.right %li.missing
.project-right-buttons = link_to 'Set up Koding', add_koding_stack_path(@project)
- if current_user
= render 'shared/members/access_request_buttons', source: @project
= render "projects/buttons/koding"
.btn-group.project-repo-btn-group
= render 'projects/buttons/download', project: @project, ref: @ref
= render 'projects/buttons/dropdown'
.pull-right
= render 'shared/notifications/button', notification_setting: @notification_setting
- if @repository.commit - if @repository.commit
.project-last-commit{ class: container_class } .project-last-commit{ class: container_class }
= render 'projects/last_commit', commit: @repository.commit, ref: current_ref, project: @project = render 'projects/last_commit', commit: @repository.commit, ref: current_ref, project: @project
......
...@@ -10,12 +10,11 @@ ...@@ -10,12 +10,11 @@
- status_groups.each do |group_name, grouped_statuses| - status_groups.each do |group_name, grouped_statuses|
- if grouped_statuses.one? - if grouped_statuses.one?
- status = grouped_statuses.first - status = grouped_statuses.first
%li.build %li.build{ 'id' => "ci-badge-#{group_name}" }
.curve .curve
.build-content
= render 'ci/status/graph_badge', subject: status = render 'ci/status/graph_badge', subject: status
- else - else
%li.build %li.build{ 'id' => "ci-badge-#{group_name}" }
.curve .curve
.dropdown.inline.build-content
= render 'projects/stage/in_stage_group', name: group_name, subject: grouped_statuses = render 'projects/stage/in_stage_group', name: group_name, subject: grouped_statuses
- group_status = CommitStatus.where(id: subject).status - group_status = CommitStatus.where(id: subject).status
%button.dropdown-menu-toggle.has-tooltip{ type: 'button', data: { toggle: 'dropdown', title: "#{name} - #{group_status}" } } %button.dropdown-menu-toggle.build-content.has-tooltip{ type: 'button', data: { toggle: 'dropdown'} }
%span{class: "ci-status-icon ci-status-icon-#{group_status}"} %span{class: "ci-status-icon ci-status-icon-#{group_status}"}
= ci_icon_for_status(group_status) = ci_icon_for_status(group_status)
%span.ci-status-text %span.ci-status-text{ 'data-toggle' => 'tooltip', 'data-title' => "#{name} - #{group_status}" }
= name = name
%span.dropdown-counter-badge= subject.size %span.dropdown-counter-badge= subject.size
.dropdown-menu.grouped-pipeline-dropdown .dropdown-menu.grouped-pipeline-dropdown
......
- model_name = source.model_name.to_s.downcase - model_name = source.model_name.to_s.downcase
- if can?(current_user, :"destroy_#{model_name}_member", source.members.find_by(user_id: current_user.id)) .project-action-button.inline
- if can?(current_user, :"destroy_#{model_name}_member", source.members.find_by(user_id: current_user.id))
= link_to "Leave #{model_name}", polymorphic_path([:leave, source, :members]), = link_to "Leave #{model_name}", polymorphic_path([:leave, source, :members]),
method: :delete, method: :delete,
data: { confirm: leave_confirmation_message(source) }, data: { confirm: leave_confirmation_message(source) },
class: 'btn' class: 'btn'
- elsif requester = source.requesters.find_by(user_id: current_user.id) - elsif requester = source.requesters.find_by(user_id: current_user.id)
= link_to 'Withdraw Access Request', polymorphic_path([:leave, source, :members]), = link_to 'Withdraw Access Request', polymorphic_path([:leave, source, :members]),
method: :delete, method: :delete,
data: { confirm: remove_member_message(requester) }, data: { confirm: remove_member_message(requester) },
class: 'btn' class: 'btn'
- elsif source.request_access_enabled && can?(current_user, :request_access, source) - elsif source.request_access_enabled && can?(current_user, :request_access, source)
= link_to 'Request Access', polymorphic_path([:request_access, source, :members]), = link_to 'Request Access', polymorphic_path([:request_access, source, :members]),
method: :post, method: :post,
class: 'btn' class: 'btn'
- if notification_setting - if notification_setting
.dropdown.notification-dropdown .js-notification-dropdown.notification-dropdown.project-action-button.dropdown.inline
= form_for notification_setting, remote: true, html: { class: "inline notification-form" } do |f| = form_for notification_setting, remote: true, html: { class: "inline notification-form" } do |f|
= hidden_setting_source_input(notification_setting) = hidden_setting_source_input(notification_setting)
= f.hidden_field :level, class: "notification_setting_level" = f.hidden_field :level, class: "notification_setting_level"
......
---
title: Moved Leave Project and Leave Group buttons to access_request_buttons from
the settings dropdown
merge_request: 7600
author:
---
title: Remove wrong '.builds-feature' class from the MR settings fieldset
merge_request: 7930
author:
---
title: Fix blame 500 error on invalid path.
merge_request: 25761
author: Jeff Stubler
--- ---
title: Shows group members in project members list title: Fix Import/Export duplicated builds error
merge_request: merge_request:
author: author:
---
title: Fix missing service error importing from EE to CE
merge_request: 8144
author:
--- ---
title: Allow branch names with dots on API endpoint title: Fix Import/Export merge requests error while importing
merge_request: merge_request:
author: author:
---
title: Displays milestone remaining days only when it's present
merge_request:
author:
---
title: Convert CI YAML variables keys into strings
merge_request: 8088
author:
---
title: "fix display hook error message"
merge_request: 7775
author: basyura
---
title: Add LDAP Rake task to rename a provider
merge_request: 2181
author:
---
title: Move all action buttons to project header
merge_request:
author:
--- ---
title: Fixed timeago re-rendering every timeago title: Make CI badge hitboxes match parent
merge_request: merge_request:
author: author:
---
title: Avoid escaping relative links in Markdown twice
merge_request: 7940
author: winniehell
...@@ -74,24 +74,5 @@ Example output: ...@@ -74,24 +74,5 @@ Example output:
The LDAP check Rake task will test the bind_dn and password credentials The LDAP check Rake task will test the bind_dn and password credentials
(if configured) and will list a sample of LDAP users. This task is also (if configured) and will list a sample of LDAP users. This task is also
executed as part of the `gitlab:check` task, but can run independently executed as part of the `gitlab:check` task, but can run independently.
using the command below. See [LDAP Rake Tasks - LDAP Check](ldap.md#check) for details.
**Omnibus Installation**
```
sudo gitlab-rake gitlab:ldap:check
```
**Source Installation**
```bash
sudo -u git -H bundle exec rake gitlab:ldap:check RAILS_ENV=production
```
By default, the task will return a sample of 100 LDAP users. Change this
limit by passing a number to the check task:
```bash
rake gitlab:ldap:check[50]
```
# LDAP Rake Tasks
## Check
The LDAP check Rake task will test the `bind_dn` and `password` credentials
(if configured) and will list a sample of LDAP users. This task is also
executed as part of the `gitlab:check` task, but can run independently
using the command below.
**Omnibus Installation**
```
sudo gitlab-rake gitlab:ldap:check
```
**Source Installation**
```bash
sudo -u git -H bundle exec rake gitlab:ldap:check RAILS_ENV=production
```
------
By default, the task will return a sample of 100 LDAP users. Change this
limit by passing a number to the check task:
```bash
rake gitlab:ldap:check[50]
```
## Rename a provider
If you change the LDAP server ID in `gitlab.yml` or `gitlab.rb` you will need
to update all user identities or users will be unable to sign in. Input the
old and new provider and this task will update all matching identities in the
database.
`old_provider` and `new_provider` are derived from the prefix `ldap` plus the
LDAP server ID from the configuration file. For example, in `gitlab.yml` or
`gitlab.rb` you may see LDAP configuration like this:
```yaml
main:
label: 'LDAP'
host: '_your_ldap_server'
port: 389
uid: 'sAMAccountName'
...
```
`main` is the LDAP server ID. Together, the unique provider is `ldapmain`.
> **Warning**: If you input an incorrect new provider users will be unable
to sign in. If this happens, run the task again with the incorrect provider
as the `old_provider` and the correct provider as the `new_provider`.
**Omnibus Installation**
```bash
sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider]
```
**Source Installation**
```bash
bundle exec rake gitlab:ldap:rename_provider[old_provider,new_provider] RAILS_ENV=production
```
### Example
Consider beginning with the default server ID `main` (full provider `ldapmain`).
If we change `main` to `mycompany`, the `new_provider` is `ldapmycompany`.
To rename all user identities run the following command:
```bash
sudo gitlab-rake gitlab:ldap:rename_provider[ldapmain,ldapmycompany]
```
Example output:
```
100 users with provider 'ldapmain' will be updated to 'ldapmycompany'.
If the new provider is incorrect, users will be unable to sign in.
Do you want to continue (yes/no)? yes
User identities were successfully updated
```
### Other options
If you do not specify an `old_provider` and `new_provider` you will be prompted
for them:
**Omnibus Installation**
```bash
sudo gitlab-rake gitlab:ldap:rename_provider
```
**Source Installation**
```bash
bundle exec rake gitlab:ldap:rename_provider RAILS_ENV=production
```
**Example output:**
```
What is the old provider? Ex. 'ldapmain': ldapmain
What is the new provider? Ex. 'ldapcustom': ldapmycompany
```
------
This tasks also accepts the `force` environment variable which will skip the
confirmation dialog:
```bash
sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] force=yes
```
...@@ -5,7 +5,7 @@ Bitbucket.org account. ...@@ -5,7 +5,7 @@ Bitbucket.org account.
## Overview ## Overview
You can set up Bitbucket.org as an OAuth provider so that you can use your You can set up Bitbucket.org as an OAuth2 provider so that you can use your
credentials to authenticate into GitLab or import your projects from credentials to authenticate into GitLab or import your projects from
Bitbucket.org. Bitbucket.org.
...@@ -50,6 +50,7 @@ you to use. ...@@ -50,6 +50,7 @@ you to use.
Repositories: Read Repositories: Read
Pull Requests: Read Pull Requests: Read
Issues: Read Issues: Read
Wiki: Read and Write
``` ```
![Bitbucket OAuth settings page](img/bitbucket_oauth_settings_page.png) ![Bitbucket OAuth settings page](img/bitbucket_oauth_settings_page.png)
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
- [Check](check.md) - [Check](check.md)
- [Cleanup](cleanup.md) - [Cleanup](cleanup.md)
- [Features](features.md) - [Features](features.md)
- [Maintenance](maintenance.md) and self-checks - [LDAP Maintenance](../administration/raketasks/ldap.md)
- [General Maintenance](maintenance.md) and self-checks
- [User management](user_management.md) - [User management](user_management.md)
- [Webhooks](web_hooks.md) - [Webhooks](web_hooks.md)
- [Import](import.md) of git repositories in bulk - [Import](import.md) of git repositories in bulk
......
...@@ -72,7 +72,7 @@ sudo -u git -H git checkout 8-15-stable-ee ...@@ -72,7 +72,7 @@ sudo -u git -H git checkout 8-15-stable-ee
```bash ```bash
cd /home/git/gitlab-shell cd /home/git/gitlab-shell
sudo -u git -H git fetch --all --tags sudo -u git -H git fetch --all --tags
sudo -u git -H git checkout v4.1.0 sudo -u git -H git checkout v4.1.1
``` ```
### 6. Update gitlab-workhorse ### 6. Update gitlab-workhorse
......
...@@ -17,6 +17,7 @@ to enable this if not already. ...@@ -17,6 +17,7 @@ to enable this if not already.
- the pull requests (GitLab 8.4+) - the pull requests (GitLab 8.4+)
- the pull request comments (GitLab 8.15+) - the pull request comments (GitLab 8.15+)
- the milestones (GitLab 8.15+) - the milestones (GitLab 8.15+)
- the wiki (GitLab 8.15+)
- References to pull requests and issues are preserved (GitLab 8.7+) - References to pull requests and issues are preserved (GitLab 8.7+)
- Repository public access is retained. If a repository is private in Bitbucket - Repository public access is retained. If a repository is private in Bitbucket
it will be created as private in GitLab as well. it will be created as private in GitLab as well.
......
Feature: Admin Appearance
Scenario: Create new appearance
Given I sign in as an admin
And I visit admin appearance page
When submit form with new appearance
Then I should be redirected to admin appearance page
And I should see newly created appearance
Scenario: Preview appearance
Given application has custom appearance
And I sign in as an admin
When I visit admin appearance page
And I click preview button
Then I should see a customized appearance
Scenario: Custom sign-in page
Given application has custom appearance
When I visit login page
Then I should see a customized appearance
Scenario: Appearance logo
Given application has custom appearance
And I sign in as an admin
And I visit admin appearance page
When I attach a logo
Then I should see a logo
And I remove the logo
Then I should see logo removed
Scenario: Header logos
Given application has custom appearance
And I sign in as an admin
And I visit admin appearance page
When I attach header logos
Then I should see header logos
And I remove the header logos
Then I should see header logos removed
@admin
Feature: Admin Broadcast Messages
Background:
Given I sign in as an admin
And application already has a broadcast message
And I visit admin messages page
Scenario: See broadcast messages list
Then I should see all broadcast messages
Scenario: Create a customized broadcast message
When submit form with new customized broadcast message
Then I should be redirected to admin messages page
And I should see newly created broadcast message
Then I visit dashboard page
And I should see a customized broadcast message
Scenario: Edit an existing broadcast message
When I edit an existing broadcast message
And I change the broadcast message text
Then I should be redirected to admin messages page
And I should see the updated broadcast message
Scenario: Remove an existing broadcast message
When I remove an existing broadcast message
Then I should be redirected to admin messages page
And I should not see the removed broadcast message
@javascript
Scenario: Live preview a customized broadcast message
When I visit admin messages page
And I enter a broadcast message with Markdown
Then I should see a live preview of the rendered broadcast message
Feature: Admin Issues Labels
Background:
Given I sign in as an admin
And I have labels: "bug", "feature", "enhancement"
Given I visit admin labels page
Scenario: I should see labels list
Then I should see label 'bug'
And I should see label 'feature'
Scenario: I create new label
Given I submit new label 'support'
Then I should see label 'support'
Scenario: I edit label
Given I visit 'bug' label edit page
When I change label 'bug' to 'fix'
Then I should not see label 'bug'
Then I should see label 'fix'
Scenario: I remove label
When I remove label 'bug'
Then I should not see label 'bug'
@javascript
Scenario: I delete all labels
When I delete all labels
Then I should see labels help message
Scenario: I create a label with invalid color
Given I visit admin new label page
When I submit new label with invalid color
Then I should see label color error message
Scenario: I create a label that already exists
Given I visit admin new label page
When I submit new label 'bug'
Then I should see label exist error message
class Spinach::Features::AdminIssuesLabels < Spinach::FeatureSteps
include SharedAuthentication
include SharedProject
include SharedPaths
step 'I visit \'bug\' label edit page' do
visit edit_admin_label_path(bug_label)
end
step 'I visit admin new label page' do
visit new_admin_label_path
end
step 'I visit admin labels page' do
visit admin_labels_path
end
step 'I remove label \'bug\'' do
page.within "#label_#{bug_label.id}" do
click_link 'Delete'
end
end
step 'I have labels: "bug", "feature", "enhancement"' do
["bug", "feature", "enhancement"].each do |title|
Label.create(title: title, template: true)
end
end
step 'I delete all labels' do
page.within '.labels' do
page.all('.btn-remove').each do |remove|
remove.click
sleep 0.05
end
end
end
step 'I should see labels help message' do
page.within '.labels' do
expect(page).to have_content 'There are no labels yet'
end
end
step 'I submit new label \'support\'' do
visit new_admin_label_path
fill_in 'Title', with: 'support'
fill_in 'Background color', with: '#F95610'
click_button 'Save'
end
step 'I submit new label \'bug\'' do
visit new_admin_label_path
fill_in 'Title', with: 'bug'
fill_in 'Background color', with: '#F95610'
click_button 'Save'
end
step 'I submit new label with invalid color' do
visit new_admin_label_path
fill_in 'Title', with: 'support'
fill_in 'Background color', with: '#12'
click_button 'Save'
end
step 'I should see label exist error message' do
page.within '.label-form' do
expect(page).to have_content 'Title has already been taken'
end
end
step 'I should see label color error message' do
page.within '.label-form' do
expect(page).to have_content 'Color must be a valid color code'
end
end
step 'I should see label \'feature\'' do
page.within '.manage-labels-list' do
expect(page).to have_content 'feature'
end
end
step 'I should see label \'bug\'' do
page.within '.manage-labels-list' do
expect(page).to have_content 'bug'
end
end
step 'I should not see label \'bug\'' do
page.within '.manage-labels-list' do
expect(page).not_to have_content 'bug'
end
end
step 'I should see label \'support\'' do
page.within '.manage-labels-list' do
expect(page).to have_content 'support'
end
end
step 'I change label \'bug\' to \'fix\'' do
fill_in 'Title', with: 'fix'
fill_in 'Background color', with: '#F15610'
click_button 'Save'
end
step 'I should see label \'fix\'' do
page.within '.manage-labels-list' do
expect(page).to have_content 'fix'
end
end
def bug_label
Label.templates.find_or_create_by(title: 'bug')
end
end
...@@ -195,10 +195,6 @@ module SharedPaths ...@@ -195,10 +195,6 @@ module SharedPaths
visit admin_groups_path visit admin_groups_path
end end
step 'I visit admin appearance page' do
visit admin_appearances_path
end
step 'I visit admin teams page' do step 'I visit admin teams page' do
visit admin_teams_path visit admin_teams_path
end end
......
...@@ -51,6 +51,10 @@ module Bitbucket ...@@ -51,6 +51,10 @@ module Bitbucket
raw['scm'] == 'git' raw['scm'] == 'git'
end end
def has_wiki?
raw['has_wiki']
end
def visibility_level def visibility_level
if raw['is_private'] if raw['is_private']
Gitlab::VisibilityLevel::PRIVATE Gitlab::VisibilityLevel::PRIVATE
......
...@@ -118,7 +118,7 @@ module Ci ...@@ -118,7 +118,7 @@ module Ci
.merge(job_variables(name)) .merge(job_variables(name))
variables.map do |key, value| variables.map do |key, value|
{ key: key, value: value, public: true } { key: key.to_s, value: value, public: true }
end end
end end
......
module Gitlab module Gitlab
module BitbucketImport module BitbucketImport
class Importer class Importer
include Gitlab::ShellAdapter
LABELS = [{ title: 'bug', color: '#FF0000' }, LABELS = [{ title: 'bug', color: '#FF0000' },
{ title: 'enhancement', color: '#428BCA' }, { title: 'enhancement', color: '#428BCA' },
{ title: 'proposal', color: '#69D100' }, { title: 'proposal', color: '#69D100' },
...@@ -18,6 +20,7 @@ module Gitlab ...@@ -18,6 +20,7 @@ module Gitlab
end end
def execute def execute
import_wiki
import_issues import_issues
import_pull_requests import_pull_requests
handle_errors handle_errors
...@@ -55,6 +58,16 @@ module Gitlab ...@@ -55,6 +58,16 @@ module Gitlab
@repo ||= client.repo(project.import_source) @repo ||= client.repo(project.import_source)
end end
def import_wiki
return if project.wiki.repository_exists?
path_with_namespace = "#{project.path_with_namespace}.wiki"
import_url = project.import_url.sub(/\.git\z/, ".git/wiki")
gitlab_shell.import_repository(project.repository_storage_path, path_with_namespace, import_url)
rescue StandardError => e
errors << { type: :wiki, errors: e.message }
end
def import_issues def import_issues
return unless repo.issues_enabled? return unless repo.issues_enabled?
......
...@@ -22,9 +22,16 @@ module Gitlab ...@@ -22,9 +22,16 @@ module Gitlab
import_type: 'bitbucket', import_type: 'bitbucket',
import_source: repo.full_name, import_source: repo.full_name,
import_url: repo.clone_url(session_data[:token]), import_url: repo.clone_url(session_data[:token]),
import_data: { credentials: session_data } import_data: { credentials: session_data },
skip_wiki: skip_wiki
).execute ).execute
end end
private
def skip_wiki
repo.has_wiki?
end
end end
end end
end end
...@@ -120,7 +120,7 @@ module Gitlab ...@@ -120,7 +120,7 @@ module Gitlab
members_mapper: members_mapper, members_mapper: members_mapper,
user: @user, user: @user,
project_id: restored_project.id) project_id: restored_project.id)
end end.compact
relation_hash_list.is_a?(Array) ? relation_array : relation_array.first relation_hash_list.is_a?(Array) ? relation_array : relation_array.first
end end
......
...@@ -14,7 +14,7 @@ module Gitlab ...@@ -14,7 +14,7 @@ module Gitlab
priorities: :label_priorities, priorities: :label_priorities,
label: :project_label }.freeze label: :project_label }.freeze
USER_REFERENCES = %w[author_id assignee_id updated_by_id user_id created_by_id].freeze USER_REFERENCES = %w[author_id assignee_id updated_by_id user_id created_by_id merge_user_id].freeze
PROJECT_REFERENCES = %w[project_id source_project_id gl_project_id target_project_id].freeze PROJECT_REFERENCES = %w[project_id source_project_id gl_project_id target_project_id].freeze
...@@ -40,6 +40,8 @@ module Gitlab ...@@ -40,6 +40,8 @@ module Gitlab
# the relation_hash, updating references with new object IDs, mapping users using # the relation_hash, updating references with new object IDs, mapping users using
# the "members_mapper" object, also updating notes if required. # the "members_mapper" object, also updating notes if required.
def create def create
return nil if unknown_service?
setup_models setup_models
generate_imported_object generate_imported_object
...@@ -99,6 +101,8 @@ module Gitlab ...@@ -99,6 +101,8 @@ module Gitlab
def generate_imported_object def generate_imported_object
if BUILD_MODELS.include?(@relation_name) # call #trace= method after assigning the other attributes if BUILD_MODELS.include?(@relation_name) # call #trace= method after assigning the other attributes
trace = @relation_hash.delete('trace') trace = @relation_hash.delete('trace')
@relation_hash.delete('token')
imported_object do |object| imported_object do |object|
object.trace = trace object.trace = trace
object.commit_id = nil object.commit_id = nil
...@@ -215,6 +219,11 @@ module Gitlab ...@@ -215,6 +219,11 @@ module Gitlab
existing_object existing_object
end end
end end
def unknown_service?
@relation_name == :services && parsed_relation_hash['type'] &&
!Object.const_defined?(parsed_relation_hash['type'])
end
end end
end end
end end
module Gitlab
module Serialize
module Ci
# This serializer could make sure our YAML variables' keys and values
# are always strings. This is more for legacy build data because
# from now on we convert them into strings before saving to database.
module Variables
extend self
def load(string)
return unless string
object = YAML.safe_load(string, [Symbol])
object.map do |variable|
variable[:key] = variable[:key].to_s
variable
end
end
def dump(object)
YAML.dump(object)
end
end
end
end
end
namespace :gitlab do
namespace :ldap do
desc 'GitLab | LDAP | Rename provider'
task :rename_provider, [:old_provider, :new_provider] => :environment do |_, args|
old_provider = args[:old_provider] ||
prompt('What is the old provider? Ex. \'ldapmain\': '.color(:blue))
new_provider = args[:new_provider] ||
prompt('What is the new provider ID? Ex. \'ldapcustom\': '.color(:blue))
puts '' # Add some separation in the output
identities = Identity.where(provider: old_provider)
identity_count = identities.count
if identities.empty?
puts "Found no user identities with '#{old_provider}' provider."
puts 'Please check the provider name and try again.'
exit 1
end
plural_id_count = ActionController::Base.helpers.pluralize(identity_count, 'user')
unless ENV['force'] == 'yes'
puts "#{plural_id_count} with provider '#{old_provider}' will be updated to '#{new_provider}'"
puts 'If the new provider is incorrect, users will be unable to sign in'
ask_to_continue
puts ''
end
updated_count = identities.update_all(provider: new_provider)
if updated_count == identity_count
puts 'User identities were successfully updated'.color(:green)
else
plural_updated_count = ActionController::Base.helpers.pluralize(updated_count, 'user')
puts 'Some user identities could not be updated'.color(:red)
puts "Successfully updated #{plural_updated_count} out of #{plural_id_count} total"
end
end
end
end
...@@ -25,5 +25,10 @@ describe Projects::BlameController do ...@@ -25,5 +25,10 @@ describe Projects::BlameController do
let(:id) { 'master/files/ruby/popen.rb' } let(:id) { 'master/files/ruby/popen.rb' }
it { is_expected.to respond_with(:success) } it { is_expected.to respond_with(:success) }
end end
context "invalid file" do
let(:id) { 'master/files/ruby/missing_file.rb'}
it { expect(response).to have_http_status(404) }
end
end end
end end
...@@ -22,7 +22,7 @@ FactoryGirl.define do ...@@ -22,7 +22,7 @@ FactoryGirl.define do
yaml_variables do yaml_variables do
[ [
{ key: :DB_NAME, value: 'postgres', public: true } { key: 'DB_NAME', value: 'postgres', public: true }
] ]
end end
......
class Spinach::Features::AdminAppearance < Spinach::FeatureSteps require 'spec_helper'
include SharedAuthentication
include SharedPaths feature 'Admin Appearance', feature: true do
let!(:appearance) { create(:appearance) }
scenario 'Create new appearance' do
login_as :admin
visit admin_appearances_path
step 'submit form with new appearance' do
fill_in 'appearance_title', with: 'MyCompany' fill_in 'appearance_title', with: 'MyCompany'
fill_in 'appearance_description', with: 'dev server' fill_in 'appearance_description', with: 'dev server'
click_button 'Save' click_button 'Save'
end
step 'I should be redirected to admin appearance page' do
expect(current_path).to eq admin_appearances_path expect(current_path).to eq admin_appearances_path
expect(page).to have_content 'Appearance settings' expect(page).to have_content 'Appearance settings'
end
step 'I should see newly created appearance' do
expect(page).to have_field('appearance_title', with: 'MyCompany') expect(page).to have_field('appearance_title', with: 'MyCompany')
expect(page).to have_field('appearance_description', with: 'dev server') expect(page).to have_field('appearance_description', with: 'dev server')
expect(page).to have_content 'Last edit' expect(page).to have_content 'Last edit'
end end
step 'I click preview button' do scenario 'Preview appearance' do
login_as :admin
visit admin_appearances_path
click_link "Preview" click_link "Preview"
end
step 'application has custom appearance' do expect_page_has_custom_appearance(appearance)
create(:appearance)
end end
step 'I should see a customized appearance' do scenario 'Custom sign-in page' do
expect(page).to have_content appearance.title visit new_user_session_path
expect(page).to have_content appearance.description expect_page_has_custom_appearance(appearance)
end end
step 'I attach a logo' do scenario 'Appearance logo' do
attach_file(:appearance_logo, Rails.root.join('spec', 'fixtures', 'dk.png')) login_as :admin
click_button 'Save' visit admin_appearances_path
end
step 'I attach header logos' do attach_file(:appearance_logo, logo_fixture)
attach_file(:appearance_header_logo, Rails.root.join('spec', 'fixtures', 'dk.png'))
click_button 'Save' click_button 'Save'
end expect(page).to have_css(logo_selector)
step 'I should see a logo' do click_link 'Remove logo'
expect(page).to have_xpath('//img[@src="/uploads/appearance/logo/1/dk.png"]') expect(page).not_to have_css(logo_selector)
end end
step 'I should see header logos' do scenario 'Header logos' do
expect(page).to have_xpath('//img[@src="/uploads/appearance/header_logo/1/dk.png"]') login_as :admin
end visit admin_appearances_path
step 'I remove the logo' do attach_file(:appearance_header_logo, logo_fixture)
click_link 'Remove logo' click_button 'Save'
end expect(page).to have_css(header_logo_selector)
step 'I remove the header logos' do
click_link 'Remove header logo' click_link 'Remove header logo'
expect(page).not_to have_css(header_logo_selector)
end
def expect_page_has_custom_appearance(appearance)
expect(page).to have_content appearance.title
expect(page).to have_content appearance.description
end end
step 'I should see logo removed' do def logo_selector
expect(page).not_to have_xpath('//img[@src="/uploads/appearance/logo/1/gitlab_logo.png"]') '//img[@src^="/uploads/appearance/logo"]'
end end
step 'I should see header logos removed' do def header_logo_selector
expect(page).not_to have_xpath('//img[@src="/uploads/appearance/header_logo/1/header_logo_light.png"]') '//img[@src^="/uploads/appearance/header_logo"]'
end end
def appearance def logo_fixture
Appearance.last Rails.root.join('spec', 'fixtures', 'dk.png')
end end
end end
class Spinach::Features::AdminBroadcastMessages < Spinach::FeatureSteps require 'spec_helper'
include SharedAuthentication
include SharedPaths
step 'application already has a broadcast message' do feature 'Admin Broadcast Messages', feature: true do
FactoryGirl.create(:broadcast_message, :expired, message: "Migration to new server") before do
login_as :admin
create(:broadcast_message, :expired, message: 'Migration to new server')
visit admin_broadcast_messages_path
end end
step 'I should see all broadcast messages' do scenario 'See broadcast messages list' do
expect(page).to have_content "Migration to new server" expect(page).to have_content 'Migration to new server'
end end
step 'I should be redirected to admin messages page' do scenario 'Create a customized broadcast message' do
expect(current_path).to eq admin_broadcast_messages_path
end
step 'I should see newly created broadcast message' do
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
end
step 'submit form with new customized broadcast message' do
fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**' fill_in 'broadcast_message_message', with: 'Application update from **4:00 CST to 5:00 CST**'
fill_in 'broadcast_message_color', with: '#f2dede' fill_in 'broadcast_message_color', with: '#f2dede'
fill_in 'broadcast_message_font', with: '#b94a48' fill_in 'broadcast_message_font', with: '#b94a48'
select Date.today.next_year.year, from: "broadcast_message_ends_at_1i" select Date.today.next_year.year, from: 'broadcast_message_ends_at_1i'
click_button "Add broadcast message" click_button 'Add broadcast message'
end
step 'I should see a customized broadcast message' do expect(current_path).to eq admin_broadcast_messages_path
expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST' expect(page).to have_content 'Application update from 4:00 CST to 5:00 CST'
expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST' expect(page).to have_selector 'strong', text: '4:00 CST to 5:00 CST'
expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"]) expect(page).to have_selector %(div[style="background-color: #f2dede; color: #b94a48"])
end end
step 'I edit an existing broadcast message' do scenario 'Edit an existing broadcast message' do
click_link 'Edit' click_link 'Edit'
end
step 'I change the broadcast message text' do
fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW' fill_in 'broadcast_message_message', with: 'Application update RIGHT NOW'
click_button 'Update broadcast message' click_button 'Update broadcast message'
end
step 'I should see the updated broadcast message' do expect(current_path).to eq admin_broadcast_messages_path
expect(page).to have_content "Application update RIGHT NOW" expect(page).to have_content 'Application update RIGHT NOW'
end end
step 'I remove an existing broadcast message' do scenario 'Remove an existing broadcast message' do
click_link 'Remove' click_link 'Remove'
end
step 'I should not see the removed broadcast message' do expect(current_path).to eq admin_broadcast_messages_path
expect(page).not_to have_content 'Migration to new server' expect(page).not_to have_content 'Migration to new server'
end end
step 'I enter a broadcast message with Markdown' do scenario 'Live preview a customized broadcast message', js: true do
fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:" fill_in 'broadcast_message_message', with: "Live **Markdown** previews. :tada:"
end
step 'I should see a live preview of the rendered broadcast message' do
page.within('.broadcast-message-preview') do page.within('.broadcast-message-preview') do
expect(page).to have_selector('strong', text: 'Markdown') expect(page).to have_selector('strong', text: 'Markdown')
expect(page).to have_selector('img.emoji') expect(page).to have_selector('img.emoji')
......
require 'spec_helper'
RSpec.describe 'admin issues labels' do
include WaitForAjax
let!(:bug_label) { Label.create(title: 'bug', template: true) }
let!(:feature_label) { Label.create(title: 'feature', template: true) }
before do
login_as :admin
end
describe 'list' do
before do
visit admin_labels_path
end
it 'renders labels list' do
page.within '.manage-labels-list' do
expect(page).to have_content('bug')
expect(page).to have_content('feature')
end
end
it 'deletes label' do
page.within "#label_#{bug_label.id}" do
click_link 'Delete'
end
page.within '.manage-labels-list' do
expect(page).not_to have_content('bug')
end
end
it 'deletes all labels', js: true do
page.within '.labels' do
page.all('.btn-remove').each do |remove|
wait_for_ajax
remove.click
end
end
page.within '.manage-labels-list' do
expect(page).not_to have_content('bug')
expect(page).not_to have_content('feature_label')
end
end
end
describe 'create' do
before do
visit new_admin_label_path
end
it 'creates new label' do
fill_in 'Title', with: 'support'
fill_in 'Background color', with: '#F95610'
click_button 'Save'
page.within '.manage-labels-list' do
expect(page).to have_content('support')
end
end
it 'does not creates label with invalid color' do
fill_in 'Title', with: 'support'
fill_in 'Background color', with: '#12'
click_button 'Save'
page.within '.label-form' do
expect(page).to have_content('Color must be a valid color code')
end
end
it 'does not creates label if label already exists' do
fill_in 'Title', with: 'bug'
fill_in 'Background color', with: '#F95610'
click_button 'Save'
page.within '.label-form' do
expect(page).to have_content 'Title has already been taken'
end
end
end
describe 'edit' do
it 'changes bug label' do
visit edit_admin_label_path(bug_label)
fill_in 'Title', with: 'fix'
fill_in 'Background color', with: '#F15610'
click_button 'Save'
page.within '.manage-labels-list' do
expect(page).to have_content('fix')
end
end
end
end
...@@ -19,7 +19,7 @@ describe "Pipelines", feature: true, js: true do ...@@ -19,7 +19,7 @@ describe "Pipelines", feature: true, js: true do
@success = create(:ci_build, :success, pipeline: pipeline, stage: 'build', name: 'build') @success = create(:ci_build, :success, pipeline: pipeline, stage: 'build', name: 'build')
@failed = create(:ci_build, :failed, pipeline: pipeline, stage: 'test', name: 'test', commands: 'test') @failed = create(:ci_build, :failed, pipeline: pipeline, stage: 'test', name: 'test', commands: 'test')
@running = create(:ci_build, :running, pipeline: pipeline, stage: 'deploy', name: 'deploy') @running = create(:ci_build, :running, pipeline: pipeline, stage: 'deploy', name: 'deploy')
@manual = create(:ci_build, :manual, pipeline: pipeline, stage: 'deploy', name: 'manual build') @manual = create(:ci_build, :manual, pipeline: pipeline, stage: 'deploy', name: 'manual-build')
@external = create(:generic_commit_status, status: 'success', pipeline: pipeline, name: 'jenkins', stage: 'external') @external = create(:generic_commit_status, status: 'success', pipeline: pipeline, name: 'jenkins', stage: 'external')
end end
...@@ -41,37 +41,34 @@ describe "Pipelines", feature: true, js: true do ...@@ -41,37 +41,34 @@ describe "Pipelines", feature: true, js: true do
describe 'pipeline graph' do describe 'pipeline graph' do
context 'when pipeline has running builds' do context 'when pipeline has running builds' do
it 'shows a running icon and a cancel action for the running build' do it 'shows a running icon and a cancel action for the running build' do
page.within('a[data-title="deploy - running"]') do page.within('#ci-badge-deploy') do
expect(page).to have_selector('.ci-status-icon-running') expect(page).to have_selector('.ci-status-icon-running')
expect(page).to have_content('deploy')
end
page.within('a[data-title="deploy - running"] + .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-ban') expect(page).to have_selector('.ci-action-icon-container .fa-ban')
expect(page).to have_content('deploy')
end end
end end
it 'should be possible to cancel the running build' do it 'should be possible to cancel the running build' do
find('a[data-title="deploy - running"] + .ci-action-icon-container').trigger('click') find('#ci-badge-deploy .ci-action-icon-container').trigger('click')
expect(page).not_to have_content('Cancel running') expect(page).not_to have_content('Cancel running')
end end
end end
context 'when pipeline has successful builds' do context 'when pipeline has successful builds' do
it 'shows the success icon and a retry action for the successfull build' do it 'shows the success icon and a retry action for the successful build' do
page.within('a[data-title="build - passed"]') do page.within('#ci-badge-build') do
expect(page).to have_selector('.ci-status-icon-success') expect(page).to have_selector('.ci-status-icon-success')
expect(page).to have_content('build') expect(page).to have_content('build')
end end
page.within('a[data-title="build - passed"] + .ci-action-icon-container') do page.within('#ci-badge-build .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-refresh') expect(page).to have_selector('.ci-action-icon-container .fa-refresh')
end end
end end
it 'should be possible to retry the success build' do it 'should be possible to retry the success build' do
find('a[data-title="build - passed"] + .ci-action-icon-container').trigger('click') find('#ci-badge-build .ci-action-icon-container').trigger('click')
expect(page).not_to have_content('Retry build') expect(page).not_to have_content('Retry build')
end end
...@@ -79,18 +76,18 @@ describe "Pipelines", feature: true, js: true do ...@@ -79,18 +76,18 @@ describe "Pipelines", feature: true, js: true do
context 'when pipeline has failed builds' do context 'when pipeline has failed builds' do
it 'shows the failed icon and a retry action for the failed build' do it 'shows the failed icon and a retry action for the failed build' do
page.within('a[data-title="test - failed"]') do page.within('#ci-badge-test') do
expect(page).to have_selector('.ci-status-icon-failed') expect(page).to have_selector('.ci-status-icon-failed')
expect(page).to have_content('test') expect(page).to have_content('test')
end end
page.within('a[data-title="test - failed"] + .ci-action-icon-container') do page.within('#ci-badge-test .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-refresh') expect(page).to have_selector('.ci-action-icon-container .fa-refresh')
end end
end end
it 'should be possible to retry the failed build' do it 'should be possible to retry the failed build' do
find('a[data-title="test - failed"] + .ci-action-icon-container').trigger('click') find('#ci-badge-test .ci-action-icon-container').trigger('click')
expect(page).not_to have_content('Retry build') expect(page).not_to have_content('Retry build')
end end
...@@ -98,18 +95,18 @@ describe "Pipelines", feature: true, js: true do ...@@ -98,18 +95,18 @@ describe "Pipelines", feature: true, js: true do
context 'when pipeline has manual builds' do context 'when pipeline has manual builds' do
it 'shows the skipped icon and a play action for the manual build' do it 'shows the skipped icon and a play action for the manual build' do
page.within('a[data-title="manual build - manual play action"]') do page.within('#ci-badge-manual-build') do
expect(page).to have_selector('.ci-status-icon-manual') expect(page).to have_selector('.ci-status-icon-manual')
expect(page).to have_content('manual') expect(page).to have_content('manual')
end end
page.within('a[data-title="manual build - manual play action"] + .ci-action-icon-container') do page.within('#ci-badge-manual-build .ci-action-icon-container') do
expect(page).to have_selector('.ci-action-icon-container .fa-play') expect(page).to have_selector('.ci-action-icon-container .fa-play')
end end
end end
it 'should be possible to play the manual build' do it 'should be possible to play the manual build' do
find('a[data-title="manual build - manual play action"] + .ci-action-icon-container').trigger('click') find('#ci-badge-manual-build .ci-action-icon-container').trigger('click')
expect(page).not_to have_content('Play build') expect(page).not_to have_content('Play build')
end end
...@@ -167,7 +164,7 @@ describe "Pipelines", feature: true, js: true do ...@@ -167,7 +164,7 @@ describe "Pipelines", feature: true, js: true do
@success = create(:ci_build, :success, pipeline: pipeline, stage: 'build', name: 'build') @success = create(:ci_build, :success, pipeline: pipeline, stage: 'build', name: 'build')
@failed = create(:ci_build, :failed, pipeline: pipeline, stage: 'test', name: 'test', commands: 'test') @failed = create(:ci_build, :failed, pipeline: pipeline, stage: 'test', name: 'test', commands: 'test')
@running = create(:ci_build, :running, pipeline: pipeline, stage: 'deploy', name: 'deploy') @running = create(:ci_build, :running, pipeline: pipeline, stage: 'deploy', name: 'deploy')
@manual = create(:ci_build, :manual, pipeline: pipeline, stage: 'deploy', name: 'manual build') @manual = create(:ci_build, :manual, pipeline: pipeline, stage: 'deploy', name: 'manual-build')
@external = create(:generic_commit_status, status: 'success', pipeline: pipeline, name: 'jenkins', stage: 'external') @external = create(:generic_commit_status, status: 'success', pipeline: pipeline, name: 'jenkins', stage: 'external')
end end
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
%ul %ul
%li.build %li.build
.curve .curve
.build-content
%a %a
%svg %svg
.ci-status-text .ci-status-text
......
require 'spec_helper'
describe Bitbucket::Representation::Repo do
describe '#has_wiki?' do
it { expect(described_class.new({ 'has_wiki' => false }).has_wiki?).to be_falsey }
it { expect(described_class.new({ 'has_wiki' => true }).has_wiki?).to be_truthy }
end
describe '#name' do
it { expect(described_class.new({ 'name' => 'test' }).name).to eq('test') }
end
describe '#valid?' do
it { expect(described_class.new({ 'scm' => 'hg' }).valid?).to be_falsey }
it { expect(described_class.new({ 'scm' => 'git' }).valid?).to be_truthy }
end
describe '#full_name' do
it { expect(described_class.new({ 'full_name' => 'test_full' }).full_name).to eq('test_full') }
end
describe '#description' do
it { expect(described_class.new({ 'description' => 'desc' }).description).to eq('desc') }
end
describe '#issues_enabled?' do
it { expect(described_class.new({ 'has_issues' => false }).issues_enabled?).to be_falsey }
it { expect(described_class.new({ 'has_issues' => true }).issues_enabled?).to be_truthy }
end
describe '#owner_and_slug' do
it { expect(described_class.new({ 'full_name' => 'ben/test' }).owner_and_slug).to eq(['ben', 'test']) }
end
describe '#owner' do
it { expect(described_class.new({ 'full_name' => 'ben/test' }).owner).to eq('ben') }
end
describe '#slug' do
it { expect(described_class.new({ 'full_name' => 'ben/test' }).slug).to eq('test') }
end
describe '#clone_url' do
it 'builds url' do
data = { 'links' => { 'clone' => [ { 'name' => 'https', 'href' => 'https://bibucket.org/test/test.git' }] } }
expect(described_class.new(data).clone_url('abc')).to eq('https://x-token-auth:abc@bibucket.org/test/test.git')
end
end
end
...@@ -483,7 +483,7 @@ module Ci ...@@ -483,7 +483,7 @@ module Ci
context 'when global variables are defined' do context 'when global variables are defined' do
let(:variables) do let(:variables) do
{ VAR1: 'value1', VAR2: 'value2' } { 'VAR1' => 'value1', 'VAR2' => 'value2' }
end end
let(:config) do let(:config) do
{ {
...@@ -495,18 +495,18 @@ module Ci ...@@ -495,18 +495,18 @@ module Ci
it 'returns global variables' do it 'returns global variables' do
expect(subject).to contain_exactly( expect(subject).to contain_exactly(
{ key: :VAR1, value: 'value1', public: true }, { key: 'VAR1', value: 'value1', public: true },
{ key: :VAR2, value: 'value2', public: true } { key: 'VAR2', value: 'value2', public: true }
) )
end end
end end
context 'when job and global variables are defined' do context 'when job and global variables are defined' do
let(:global_variables) do let(:global_variables) do
{ VAR1: 'global1', VAR3: 'global3' } { 'VAR1' => 'global1', 'VAR3' => 'global3' }
end end
let(:job_variables) do let(:job_variables) do
{ VAR1: 'value1', VAR2: 'value2' } { 'VAR1' => 'value1', 'VAR2' => 'value2' }
end end
let(:config) do let(:config) do
{ {
...@@ -518,9 +518,9 @@ module Ci ...@@ -518,9 +518,9 @@ module Ci
it 'returns all unique variables' do it 'returns all unique variables' do
expect(subject).to contain_exactly( expect(subject).to contain_exactly(
{ key: :VAR3, value: 'global3', public: true }, { key: 'VAR3', value: 'global3', public: true },
{ key: :VAR1, value: 'value1', public: true }, { key: 'VAR1', value: 'value1', public: true },
{ key: :VAR2, value: 'value2', public: true } { key: 'VAR2', value: 'value2', public: true }
) )
end end
end end
...@@ -535,13 +535,13 @@ module Ci ...@@ -535,13 +535,13 @@ module Ci
context 'when syntax is correct' do context 'when syntax is correct' do
let(:variables) do let(:variables) do
{ VAR1: 'value1', VAR2: 'value2' } { 'VAR1' => 'value1', 'VAR2' => 'value2' }
end end
it 'returns job variables' do it 'returns job variables' do
expect(subject).to contain_exactly( expect(subject).to contain_exactly(
{ key: :VAR1, value: 'value1', public: true }, { key: 'VAR1', value: 'value1', public: true },
{ key: :VAR2, value: 'value2', public: true } { key: 'VAR2', value: 'value2', public: true }
) )
end end
end end
...@@ -549,7 +549,7 @@ module Ci ...@@ -549,7 +549,7 @@ module Ci
context 'when syntax is incorrect' do context 'when syntax is incorrect' do
context 'when variables defined but invalid' do context 'when variables defined but invalid' do
let(:variables) do let(:variables) do
[ :VAR1, 'value1', :VAR2, 'value2' ] [ 'VAR1', 'value1', 'VAR2', 'value2' ]
end end
it 'raises error' do it 'raises error' do
......
...@@ -69,6 +69,9 @@ describe Gitlab::BitbucketImport::Importer, lib: true do ...@@ -69,6 +69,9 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
context 'issues statuses' do context 'issues statuses' do
before do before do
# HACK: Bitbucket::Representation.const_get('Issue') seems to return ::Issue without this
Bitbucket::Representation::Issue.new({})
stub_request( stub_request(
:get, :get,
"https://api.bitbucket.org/2.0/repositories/#{project_identifier}" "https://api.bitbucket.org/2.0/repositories/#{project_identifier}"
...@@ -108,13 +111,16 @@ describe Gitlab::BitbucketImport::Importer, lib: true do ...@@ -108,13 +111,16 @@ describe Gitlab::BitbucketImport::Importer, lib: true do
body: {}.to_json) body: {}.to_json)
end end
it 'map statuses to open or closed' do it 'maps statuses to open or closed' do
# HACK: Bitbucket::Representation.const_get('Issue') seems to return ::Issue without this
Bitbucket::Representation::Issue.new({})
importer.execute importer.execute
expect(project.issues.where(state: "closed").size).to eq(5) expect(project.issues.where(state: "closed").size).to eq(5)
expect(project.issues.where(state: "opened").size).to eq(2) expect(project.issues.where(state: "opened").size).to eq(2)
end end
it 'calls import_wiki' do
expect(importer).to receive(:import_wiki)
importer.execute
end
end end
end end
...@@ -11,7 +11,8 @@ describe Gitlab::BitbucketImport::ProjectCreator, lib: true do ...@@ -11,7 +11,8 @@ describe Gitlab::BitbucketImport::ProjectCreator, lib: true do
owner: "asd", owner: "asd",
full_name: 'Vim repo', full_name: 'Vim repo',
visibility_level: Gitlab::VisibilityLevel::PRIVATE, visibility_level: Gitlab::VisibilityLevel::PRIVATE,
clone_url: 'ssh://git@bitbucket.org/asd/vim.git') clone_url: 'ssh://git@bitbucket.org/asd/vim.git',
has_wiki?: false)
end end
let(:namespace){ create(:group, owner: user) } let(:namespace){ create(:group, owner: user) }
......
...@@ -2517,7 +2517,7 @@ ...@@ -2517,7 +2517,7 @@
"merge_params": { "merge_params": {
"force_remove_source_branch": null "force_remove_source_branch": null
}, },
"merge_when_build_succeeds": false, "merge_when_build_succeeds": true,
"merge_user_id": null, "merge_user_id": null,
"merge_commit_sha": null, "merge_commit_sha": null,
"deleted_at": null, "deleted_at": null,
...@@ -6548,7 +6548,9 @@ ...@@ -6548,7 +6548,9 @@
"url": null "url": null
}, },
"erased_by_id": null, "erased_by_id": null,
"erased_at": null "erased_at": null,
"type": "Ci::Build",
"token": "abcd"
}, },
{ {
"id": 72, "id": 72,
...@@ -7409,6 +7411,28 @@ ...@@ -7409,6 +7411,28 @@
"category": "common", "category": "common",
"default": false, "default": false,
"wiki_page_events": true "wiki_page_events": true
},
{
"id": 101,
"title": "JenkinsDeprecated",
"project_id": 5,
"created_at": "2016-06-14T15:01:51.031Z",
"updated_at": "2016-06-14T15:01:51.031Z",
"active": false,
"properties": {
},
"template": false,
"push_events": true,
"issues_events": true,
"merge_requests_events": true,
"tag_push_events": true,
"note_events": true,
"build_events": true,
"category": "common",
"default": false,
"wiki_page_events": true,
"type": "JenkinsDeprecatedService"
} }
], ],
"hooks": [ "hooks": [
......
...@@ -189,6 +189,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do ...@@ -189,6 +189,14 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
end end
end end
end end
context 'when there is an existing build with build token' do
it 'restores project json correctly' do
create(:ci_build, token: 'abcd')
expect(restored_project_json).to be true
end
end
end end
end end
end end
require 'spec_helper'
describe Gitlab::Serialize::Ci::Variables do
subject do
described_class.load(described_class.dump(object))
end
let(:object) do
[{ key: :key, value: 'value', public: true },
{ key: 'wee', value: 1, public: false }]
end
it 'converts keys into strings' do
is_expected.to eq([
{ key: 'key', value: 'value', public: true },
{ key: 'wee', value: 1, public: false }])
end
end
...@@ -458,7 +458,7 @@ describe Ci::Build, models: true do ...@@ -458,7 +458,7 @@ describe Ci::Build, models: true do
}) })
end end
let(:variables) do let(:variables) do
[{ key: :KEY, value: 'value', public: true }] [{ key: 'KEY', value: 'value', public: true }]
end end
it { is_expected.to eq(predefined_variables + variables) } it { is_expected.to eq(predefined_variables + variables) }
...@@ -1306,11 +1306,25 @@ describe Ci::Build, models: true do ...@@ -1306,11 +1306,25 @@ describe Ci::Build, models: true do
describe '#expanded_environment_name' do describe '#expanded_environment_name' do
subject { build.expanded_environment_name } subject { build.expanded_environment_name }
context 'when environment uses variables' do context 'when environment uses $CI_BUILD_REF_NAME' do
let(:build) { create(:ci_build, ref: 'master', environment: 'review/$CI_BUILD_REF_NAME') } let(:build) do
create(:ci_build,
ref: 'master',
environment: 'review/$CI_BUILD_REF_NAME')
end
it { is_expected.to eq('review/master') } it { is_expected.to eq('review/master') }
end end
context 'when environment uses yaml_variables containing symbol keys' do
let(:build) do
create(:ci_build,
yaml_variables: [{ key: :APP_HOST, value: 'host' }],
environment: 'review/$APP_HOST')
end
it { is_expected.to eq('review/host') }
end
end end
describe '#detailed_status' do describe '#detailed_status' do
......
require 'rake_helper'
describe 'gitlab:ldap:rename_provider rake task' do
it 'completes without error' do
Rake.application.rake_require 'tasks/gitlab/ldap'
stub_warn_user_is_not_gitlab
ENV['force'] = 'yes'
create(:identity) # Necessary to prevent `exit 1` from the task.
run_rake_task('gitlab:ldap:rename_provider', 'ldapmain', 'ldapfoo')
end
end
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