Commit 0b9e04bb authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 07a680b2 d9823db2
...@@ -33,15 +33,17 @@ class BulkCreateIntegrationService ...@@ -33,15 +33,17 @@ class BulkCreateIntegrationService
klass.insert_all(items_to_insert, returning: [:id]) klass.insert_all(items_to_insert, returning: [:id])
end end
# rubocop: disable CodeReuse/ActiveRecord
def run_callbacks(batch) def run_callbacks(batch)
if integration.external_issue_tracker? if integration.external_issue_tracker?
batch.update_all(has_external_issue_tracker: true) Project.where(id: batch.select(:id)).update_all(has_external_issue_tracker: true)
end end
if integration.external_wiki? if integration.external_wiki?
batch.update_all(has_external_wiki: true) Project.where(id: batch.select(:id)).update_all(has_external_wiki: true)
end end
end end
# rubocop: enable CodeReuse/ActiveRecord
def service_hash def service_hash
if integration.template? if integration.template?
......
- add_to_breadcrumbs _("Groups"), admin_groups_path - add_to_breadcrumbs _("Groups"), admin_groups_path
- breadcrumb_title @group.name - breadcrumb_title @group.name
- page_title @group.name, _("Groups") - page_title @group.name, _("Groups")
- current_user_is_group_owner = @group && @group.has_owner?(current_user)
.js-remove-member-modal .js-remove-member-modal
%h3.page-title %h3.page-title
...@@ -116,7 +117,7 @@ ...@@ -116,7 +117,7 @@
= select_tag :access_level, options_for_select(@group.access_level_roles), class: "project-access-select select2" = select_tag :access_level, options_for_select(@group.access_level_roles), class: "project-access-select select2"
%hr %hr
= button_tag _('Add users to group'), class: "gl-button btn btn-success" = button_tag _('Add users to group'), class: "gl-button btn btn-success"
= render 'shared/members/requests', membership_source: @group, requesters: @requesters, force_mobile_view: true = render 'shared/members/requests', membership_source: @group, group: @group, requesters: @requesters, force_mobile_view: true
.card .card
.card-header .card-header
...@@ -127,6 +128,11 @@ ...@@ -127,6 +128,11 @@
= sprite_icon('pencil-square', css_class: 'gl-icon') = sprite_icon('pencil-square', css_class: 'gl-icon')
= _('Manage access') = _('Manage access')
%ul.content-list.group-users-list.content-list.members-list %ul.content-list.group-users-list.content-list.members-list
= render partial: 'shared/members/member', collection: @members, as: :member, locals: { show_controls: false } = render partial: 'shared/members/member',
collection: @members, as: :member,
locals: { membership_source: @group,
group: @group,
show_controls: false,
current_user_is_group_owner: current_user_is_group_owner }
.card-footer .card-footer
= paginate @members, param_name: 'members_page', theme: 'gitlab' = paginate @members, param_name: 'members_page', theme: 'gitlab'
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
- breadcrumb_title @project.full_name - breadcrumb_title @project.full_name
- page_title @project.full_name, _("Projects") - page_title @project.full_name, _("Projects")
- @content_class = "admin-projects" - @content_class = "admin-projects"
- current_user_is_group_owner = @group && @group.has_owner?(current_user)
.js-remove-member-modal .js-remove-member-modal
%h3.page-title %h3.page-title
...@@ -183,11 +184,16 @@ ...@@ -183,11 +184,16 @@
= sprite_icon('pencil-square', css_class: 'gl-icon') = sprite_icon('pencil-square', css_class: 'gl-icon')
= _('Manage access') = _('Manage access')
%ul.content-list.members-list %ul.content-list.members-list
= render partial: 'shared/members/member', collection: @group_members, as: :member, locals: { show_controls: false } = render partial: 'shared/members/member',
collection: @group_members, as: :member,
locals: { membership_source: @project,
group: @group,
show_controls: false,
current_user_is_group_owner: current_user_is_group_owner }
.card-footer .card-footer
= paginate @group_members, param_name: 'group_members_page', theme: 'gitlab' = paginate @group_members, param_name: 'group_members_page', theme: 'gitlab'
= render 'shared/members/requests', membership_source: @project, requesters: @requesters, force_mobile_view: true = render 'shared/members/requests', membership_source: @project, group: @group, requesters: @requesters, force_mobile_view: true
.card .card
.card-header .card-header
...@@ -199,6 +205,11 @@ ...@@ -199,6 +205,11 @@
= sprite_icon('pencil-square', css_class: 'gl-icon') = sprite_icon('pencil-square', css_class: 'gl-icon')
= _('Manage access') = _('Manage access')
%ul.content-list.project_members.members-list %ul.content-list.project_members.members-list
= render partial: 'shared/members/member', collection: @project_members, as: :member, locals: { show_controls: false } = render partial: 'shared/members/member',
collection: @project_members, as: :member,
locals: { membership_source: @project,
group: @group,
show_controls: false,
current_user_is_group_owner: current_user_is_group_owner }
.card-footer .card-footer
= paginate @project_members, param_name: 'project_members_page', theme: 'gitlab' = paginate @project_members, param_name: 'project_members_page', theme: 'gitlab'
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
- show_access_requests = can_manage_members && @requesters.exists? - show_access_requests = can_manage_members && @requesters.exists?
- invited_active = params[:search_invited].present? || params[:invited_members_page].present? - invited_active = params[:search_invited].present? || params[:invited_members_page].present?
- vue_members_list_enabled = Feature.enabled?(:vue_group_members_list, @group) - vue_members_list_enabled = Feature.enabled?(:vue_group_members_list, @group)
- current_user_is_group_owner = @group && @group.has_owner?(current_user)
- form_item_label_css_class = 'label-bold gl-mr-2 gl-mb-0 gl-py-2 align-self-md-center' - form_item_label_css_class = 'label-bold gl-mr-2 gl-mb-0 gl-py-2 align-self-md-center'
...@@ -71,7 +72,11 @@ ...@@ -71,7 +72,11 @@
.js-group-members-list{ data: group_members_list_data_attributes(@group, @members) } .js-group-members-list{ data: group_members_list_data_attributes(@group, @members) }
- else - else
%ul.content-list.members-list{ data: { qa_selector: 'members_list' } } %ul.content-list.members-list{ data: { qa_selector: 'members_list' } }
= render partial: 'shared/members/member', collection: @members, as: :member = render partial: 'shared/members/member',
collection: @members, as: :member,
locals: { membership_source: @group,
group: @group,
current_user_is_group_owner: current_user_is_group_owner }
= paginate @members, theme: 'gitlab', params: { invited_members_page: nil, search_invited: nil } = paginate @members, theme: 'gitlab', params: { invited_members_page: nil, search_invited: nil }
- if @group.shared_with_group_links.any? - if @group.shared_with_group_links.any?
#tab-groups.tab-pane #tab-groups.tab-pane
...@@ -97,7 +102,11 @@ ...@@ -97,7 +102,11 @@
.js-group-invited-members-list{ data: group_members_list_data_attributes(@group, @invited_members) } .js-group-invited-members-list{ data: group_members_list_data_attributes(@group, @invited_members) }
- else - else
%ul.content-list.members-list %ul.content-list.members-list
= render partial: 'shared/members/member', collection: @invited_members, as: :member = render partial: 'shared/members/member',
collection: @invited_members, as: :member,
locals: { membership_source: @group,
group: @group,
current_user_is_group_owner: current_user_is_group_owner }
= paginate @invited_members, param_name: 'invited_members_page', theme: 'gitlab', params: { page: nil } = paginate @invited_members, param_name: 'invited_members_page', theme: 'gitlab', params: { page: nil }
- if show_access_requests - if show_access_requests
#tab-access-requests.tab-pane #tab-access-requests.tab-pane
...@@ -109,4 +118,8 @@ ...@@ -109,4 +118,8 @@
.js-group-access-requests-list{ data: group_members_list_data_attributes(@group, @requesters) } .js-group-access-requests-list{ data: group_members_list_data_attributes(@group, @requesters) }
- else - else
%ul.content-list.members-list %ul.content-list.members-list
= render partial: 'shared/members/member', collection: @requesters, as: :member = render partial: 'shared/members/member',
collection: @requesters, as: :member,
locals: { membership_source: @group,
group: @group,
current_user_is_group_owner: current_user_is_group_owner }
- project = local_assigns.fetch(:project) - project = local_assigns.fetch(:project)
- members = local_assigns.fetch(:members) - members = local_assigns.fetch(:members)
- group = local_assigns.fetch(:group)
- current_user_is_group_owner = group && group.has_owner?(current_user)
.card .card
.card-header.flex-project-members-panel .card-header.flex-project-members-panel
...@@ -15,4 +17,8 @@ ...@@ -15,4 +17,8 @@
= label_tag :sort_by, _('Sort by'), class: 'col-form-label label-bold px-2' = label_tag :sort_by, _('Sort by'), class: 'col-form-label label-bold px-2'
= render 'shared/members/sort_dropdown' = render 'shared/members/sort_dropdown'
%ul.content-list.members-list{ data: { qa_selector: 'members_list' } } %ul.content-list.members-list{ data: { qa_selector: 'members_list' } }
= render partial: 'shared/members/member', collection: members, as: :member = render partial: 'shared/members/member',
collection: members, as: :member,
locals: { membership_source: project,
group: group,
current_user_is_group_owner: current_user_is_group_owner }
- page_title _("Members") - page_title _("Members")
- can_admin_project_members = can?(current_user, :admin_project_member, @project) - can_admin_project_members = can?(current_user, :admin_project_member, @project)
- group = @project.group
.js-remove-member-modal .js-remove-member-modal
.row.gl-mt-3 .row.gl-mt-3
...@@ -32,12 +33,12 @@ ...@@ -32,12 +33,12 @@
- elsif @project.allowed_to_share_with_group? - elsif @project.allowed_to_share_with_group?
.invite-group= render 'shared/members/invite_group', access_levels: ProjectGroupLink.access_options, default_access_level: ProjectGroupLink.default_access, submit_url: project_group_links_path(@project), group_link_field: 'link_group_id', group_access_field: 'link_group_access' .invite-group= render 'shared/members/invite_group', access_levels: ProjectGroupLink.access_options, default_access_level: ProjectGroupLink.default_access, submit_url: project_group_links_path(@project), group_link_field: 'link_group_id', group_access_field: 'link_group_access'
= render 'shared/members/requests', membership_source: @project, requesters: @requesters = render 'shared/members/requests', membership_source: @project, group: group, requesters: @requesters
.clearfix .clearfix
%h5.member.existing-title %h5.member.existing-title
= _("Existing members and groups") = _("Existing members and groups")
- if @group_links.any? - if @group_links.any?
= render 'projects/project_members/groups', group_links: @group_links = render 'projects/project_members/groups', group_links: @group_links
= render 'projects/project_members/team', project: @project, members: @project_members = render 'projects/project_members/team', project: @project, group: group, members: @project_members
= paginate @project_members, theme: "gitlab" = paginate @project_members, theme: "gitlab"
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- if issuable_mr > 0 - if issuable_mr > 0
%li.issuable-mr.gl-display-none.gl-display-sm-block.has-tooltip{ title: _('Related merge requests') } %li.issuable-mr.gl-display-none.gl-display-sm-block.has-tooltip{ title: _('Related merge requests') }
= image_tag('icon-merge-request-unmerged.svg', class: 'icon-merge-request-unmerged') = sprite_icon('merge-request', css_class: "gl-vertical-align-middle")
= issuable_mr = issuable_mr
- if upvotes > 0 - if upvotes > 0
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
- show_controls = local_assigns.fetch(:show_controls, true) - show_controls = local_assigns.fetch(:show_controls, true)
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false) - force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
- member = local_assigns.fetch(:member) - member = local_assigns.fetch(:member)
- current_user_is_group_owner = local_assigns.fetch(:current_user_is_group_owner, false)
- membership_source = local_assigns.fetch(:membership_source)
- group = local_assigns.fetch(:group)
- user = local_assigns.fetch(:user, member.user) - user = local_assigns.fetch(:user, member.user)
- source = member.source - source = member.source
- override = member.try(:override) - override = member.try(:override)
...@@ -25,13 +28,13 @@ ...@@ -25,13 +28,13 @@
= render 'shared/members/its_you_badge', user: user, current_user: current_user = render 'shared/members/its_you_badge', user: user, current_user: current_user
= render_if_exists 'shared/members/ee/license_badge', user: user, group: @group = render_if_exists 'shared/members/ee/license_badge', user: user, group: group, current_user_is_group_owner: current_user_is_group_owner
= render 'shared/members/blocked_badge', user: user = render 'shared/members/blocked_badge', user: user
= render 'shared/members/two_factor_auth_badge', user: user = render 'shared/members/two_factor_auth_badge', user: user
- if source.instance_of?(Group) && source != @group - if source.instance_of?(Group) && source != membership_source
· ·
= link_to source.full_name, source, class: "gl-display-inline-block inline-link" = link_to source.full_name, source, class: "gl-display-inline-block inline-link"
...@@ -57,10 +60,9 @@ ...@@ -57,10 +60,9 @@
= link_to member.created_by.name, user_path(member.created_by) = link_to member.created_by.name, user_path(member.created_by)
= time_ago_with_tooltip(member.created_at) = time_ago_with_tooltip(member.created_at)
- if show_roles - if show_roles
- current_resource = @project || @group
.controls.member-controls.align-items-center .controls.member-controls.align-items-center
= render_if_exists 'shared/members/ee/ldap_tag', can_override: member.can_override? = render_if_exists 'shared/members/ee/ldap_tag', can_override: member.can_override?
- if show_controls && member.source == current_resource - if show_controls && member.source == membership_source
- if member.can_resend_invite? - if member.can_resend_invite?
= link_to sprite_icon('paper-airplane'), polymorphic_path([:resend_invite, member]), = link_to sprite_icon('paper-airplane'), polymorphic_path([:resend_invite, member]),
...@@ -88,7 +90,7 @@ ...@@ -88,7 +90,7 @@
class: ("is-active" if member.access_level == role_id), class: ("is-active" if member.access_level == role_id),
data: { id: role_id, el_id: dom_id(member), qa_selector: "#{role.downcase}_access_level_link" } data: { id: role_id, el_id: dom_id(member), qa_selector: "#{role.downcase}_access_level_link" }
= render_if_exists 'shared/members/ee/revert_ldap_group_sync_option', = render_if_exists 'shared/members/ee/revert_ldap_group_sync_option',
group: @group, group: group,
member: member, member: member,
can_override: member.can_override? can_override: member.can_override?
.clearable-input.member-form-control{ class: [("d-sm-inline-block" unless force_mobile_view)] } .clearable-input.member-form-control{ class: [("d-sm-inline-block" unless force_mobile_view)] }
...@@ -125,8 +127,8 @@ ...@@ -125,8 +127,8 @@
= _("Delete") = _("Delete")
- unless force_mobile_view - unless force_mobile_view
= sprite_icon('remove', css_class: 'd-none d-sm-block gl-icon') = sprite_icon('remove', css_class: 'd-none d-sm-block gl-icon')
= render_if_exists 'shared/members/ee/override_member_buttons', group: @group, member: member, user: user, action: :edit, can_override: member.can_override? = render_if_exists 'shared/members/ee/override_member_buttons', group: group, member: member, user: user, action: :edit, can_override: member.can_override?
- else - else
%span.member-access-text.user-access-role= member.human_access %span.member-access-text.user-access-role= member.human_access
= render_if_exists 'shared/members/ee/override_member_buttons', group: @group, member: member, user: user, action: :confirm, can_override: member.can_override? = render_if_exists 'shared/members/ee/override_member_buttons', group: group, member: member, user: user, action: :confirm, can_override: member.can_override?
- membership_source = local_assigns.fetch(:membership_source) - membership_source = local_assigns.fetch(:membership_source)
- requesters = local_assigns.fetch(:requesters) - requesters = local_assigns.fetch(:requesters)
- force_mobile_view = local_assigns.fetch(:force_mobile_view, false) - force_mobile_view = local_assigns.fetch(:force_mobile_view, false)
- group = local_assigns.fetch(:group)
- current_user_is_group_owner = group && group.has_owner?(current_user)
- return if requesters.empty? - return if requesters.empty?
...@@ -10,4 +12,9 @@ ...@@ -10,4 +12,9 @@
%strong= membership_source.name %strong= membership_source.name
%span.badge.badge-pill= requesters.size %span.badge.badge-pill= requesters.size
%ul.content-list.members-list %ul.content-list.members-list
= render partial: 'shared/members/member', collection: requesters, as: :member, locals: { force_mobile_view: force_mobile_view } = render partial: 'shared/members/member',
collection: requesters, as: :member,
locals: { membership_source: membership_source,
group: group,
force_mobile_view: force_mobile_view,
current_user_is_group_owner: current_user_is_group_owner }
---
title: Updated list view MR icon
merge_request: 46059
author:
type: fixed
...@@ -45,6 +45,61 @@ To protect an environment: ...@@ -45,6 +45,61 @@ To protect an environment:
The protected environment will now appear in the list of protected environments. The protected environment will now appear in the list of protected environments.
### Use the API to protect an environment
Alternatively, you can use the API to protect an environment:
1. Use a project with a CI that creates an environment. For example:
```yaml
stages:
- test
- deploy
test:
stage: test
script:
- 'echo "Testing Application: ${CI_PROJECT_NAME}"'
production:
stage: deploy
when: manual
script:
- 'echo "Deploying to ${CI_ENVIRONMENT_NAME}"'
environment:
name: ${CI_JOB_NAME}
```
1. Use the UI to [create a new group](../../user/group/index.md#create-a-new-group).
For example, this group is called `protected-access-group` and has the group ID `9899826`. Note
that the rest of the examples in these steps use this group.
![Group Access](img/protected_access_group_v13_6.png)
1. Use the API to add a user to the group as a reporter:
```shell
$ curl --request POST --header "PRIVATE-TOKEN: xxxxxxxxxxxx" --data "user_id=3222377&access_level=20" "https://gitlab.com/api/v4/groups/9899826/members"
{"id":3222377,"name":"Sean Carroll","username":"sfcarroll","state":"active","avatar_url":"https://assets.gitlab-static.net/uploads/-/system/user/avatar/3222377/avatar.png","web_url":"https://gitlab.com/sfcarroll","access_level":20,"created_at":"2020-10-26T17:37:50.309Z","expires_at":null}
```
1. Use the API to add the group to the project as a reporter:
```shell
$ curl --request POST --header "PRIVATE-TOKEN: xxxxxxxxxxxx" --request POST "https://gitlab.com/api/v4/projects/22034114/share?group_id=9899826&group_access=20"
{"id":1233335,"project_id":22034114,"group_id":9899826,"group_access":20,"expires_at":null}
```
1. Use the API to add the group with protected environment access:
```shell
curl --header 'Content-Type: application/json' --request POST --data '{"name": "production", "deploy_access_levels": [{"group_id": 9899826}]}' --header "PRIVATE-TOKEN: xxxxxxxxxxx" "https://gitlab.com/api/v4/projects/22034114/protected_environments"
```
The group now has access and can be seen in the UI.
## Environment access by group membership ## Environment access by group membership
A user may be granted access to protected environments as part of A user may be granted access to protected environments as part of
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Adding a new Service Component to GitLab # Adding a new Service Component to GitLab
The GitLab product is made up of several service components that run as independent system processes in communication with each other. These services can be run on the same instance, or spread across different instances. A list of the existing components can be found in the [GitLab architecture overview](architecture.md). The GitLab product is made up of several service components that run as independent system processes in communication with each other. These services can be run on the same instance, or spread across different instances. A list of the existing components can be found in the [GitLab architecture overview](architecture.md).
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# API style guide # API style guide
This style guide recommends best practices for API development. This style guide recommends best practices for API development.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Application limits development # Application limits development
This document provides a development guide for contributors to add application This document provides a development guide for contributors to add application
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Application secrets # Application secrets
This page is a development guide for application secrets. This page is a development guide for application secrets.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Approval Rules **(STARTER)** # Approval Rules **(STARTER)**
This document explains the backend design and flow of all related functionality This document explains the backend design and flow of all related functionality
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab architecture overview # GitLab architecture overview
## Software delivery ## Software delivery
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Generating chaos in a test GitLab instance # Generating chaos in a test GitLab instance
As [Werner Vogels](https://twitter.com/Werner), the CTO at Amazon Web Services, famously put it, **Everything fails, all the time**. As [Werner Vogels](https://twitter.com/Werner), the CTO at Amazon Web Services, famously put it, **Everything fails, all the time**.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Code comments # Code comments
Whenever you add comment to the code that is expected to be addressed at any time Whenever you add comment to the code that is expected to be addressed at any time
......
---
stage: Create
group: Source Code
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Code Intelligence # Code Intelligence
> [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/1576) in GitLab 13.1. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/1576) in GitLab 13.1.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Creating enums # Creating enums
When creating a new enum, it should use the database type `SMALLINT`. When creating a new enum, it should use the database type `SMALLINT`.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Danger bot # Danger bot
The GitLab CI/CD pipeline includes a `danger-review` job that uses [Danger](https://github.com/danger/danger) The GitLab CI/CD pipeline includes a `danger-review` job that uses [Danger](https://github.com/danger/danger)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Setting Multiple Values # Setting Multiple Values
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32921) in GitLab 13.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/32921) in GitLab 13.5.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Delete existing migrations # Delete existing migrations
When removing existing migrations from the GitLab project, you have to take into account When removing existing migrations from the GitLab project, you have to take into account
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Deprecation guidelines # Deprecation guidelines
This page includes information about how and when to remove or make breaking This page includes information about how and when to remove or make breaking
......
--- ---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
description: "Learn how GitLab docs' global navigation works and how to add new items." description: "Learn how GitLab docs' global navigation works and how to add new items."
--- ---
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab Docs monthly release process # GitLab Docs monthly release process
When a new GitLab version is released on the 22nd, we need to create the respective When a new GitLab version is released on the 22nd, we need to create the respective
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Guidelines for implementing Enterprise Edition features # Guidelines for implementing Enterprise Edition features
- **Write the code and the tests.**: As with any code, EE features should have - **Write the code and the tests.**: As with any code, EE features should have
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Dealing with email in development # Dealing with email in development
## Ensuring compatibility with mailer Sidekiq jobs ## Ensuring compatibility with mailer Sidekiq jobs
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Experiment Guide # Experiment Guide
Experiments can be conducted by any GitLab team, most often the teams from the [Growth Sub-department](https://about.gitlab.com/handbook/engineering/development/growth/). Experiments are not tied to releases because they will primarily target GitLab.com. Experiments can be conducted by any GitLab team, most often the teams from the [Growth Sub-department](https://about.gitlab.com/handbook/engineering/development/growth/). Experiments are not tied to releases because they will primarily target GitLab.com.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Accessibility & Readability # Accessibility & Readability
## Resources ## Resources
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Architecture # Architecture
When you are developing a new feature that requires architectural design, or if When you are developing a new feature that requires architectural design, or if
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Axios # Axios
We use [Axios](https://github.com/axios/axios) to communicate with the server in Vue applications and most new code. We use [Axios](https://github.com/axios/axios) to communicate with the server in Vue applications and most new code.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Frontend dependencies # Frontend dependencies
## Package manager ## Package manager
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Design Patterns # Design Patterns
## Singletons ## Singletons
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Frontend Development Process # Frontend Development Process
You can find more about the organization of the frontend team in the [handbook](https://about.gitlab.com/handbook/engineering/frontend/). You can find more about the organization of the frontend team in the [handbook](https://about.gitlab.com/handbook/engineering/frontend/).
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# DropLab # DropLab
A generic dropdown for all of your custom dropdown needs. A generic dropdown for all of your custom dropdown needs.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Ajax # Ajax
`Ajax` is a droplab plugin that allows for retrieving and rendering list data from a server. `Ajax` is a droplab plugin that allows for retrieving and rendering list data from a server.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Filter # Filter
`Filter` is a plugin that allows for filtering data that has been added `Filter` is a plugin that allows for filtering data that has been added
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# InputSetter # InputSetter
`InputSetter` is a plugin that allows for updating DOM out of the scope of droplab when a list item is clicked. `InputSetter` is a plugin that allows for updating DOM out of the scope of droplab when a list item is clicked.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Emojis # Emojis
GitLab supports native Unicode emojis and falls back to image-based emojis selectively GitLab supports native Unicode emojis and falls back to image-based emojis selectively
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Frontend FAQ # Frontend FAQ
## Rules of Frontend FAQ ## Rules of Frontend FAQ
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Icons and SVG Illustrations # Icons and SVG Illustrations
We manage our own icon and illustration library in the [`gitlab-svgs`](https://gitlab.com/gitlab-org/gitlab-svgs) We manage our own icon and illustration library in the [`gitlab-svgs`](https://gitlab.com/gitlab-org/gitlab-svgs)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Frontend Development Guidelines # Frontend Development Guidelines
This document describes various guidelines to ensure consistency and quality This document describes various guidelines to ensure consistency and quality
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Implementing keyboard shortcuts # Implementing keyboard shortcuts
We use [Mousetrap](https://craig.is/killing/mice) to implement keyboard We use [Mousetrap](https://craig.is/killing/mice) to implement keyboard
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Performance # Performance
## Best Practices ## Best Practices
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Principles # Principles
These principles will ensure that your frontend contribution starts off in the right direction. These principles will ensure that your frontend contribution starts off in the right direction.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Security # Security
## Resources ## Resources
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# HTML style guide # HTML style guide
## Buttons ## Buttons
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab development style guides # GitLab development style guides
See below for the relevant style guides, guidelines, linting, and other information for developing GitLab. See below for the relevant style guides, guidelines, linting, and other information for developing GitLab.
......
--- ---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
disqus_identifier: 'https://docs.gitlab.com/ee/development/fe_guide/style_guide_js.html' disqus_identifier: 'https://docs.gitlab.com/ee/development/fe_guide/style_guide_js.html'
--- ---
......
--- ---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
disqus_identifier: 'https://docs.gitlab.com/ee/development/fe_guide/style_guide_scss.html' disqus_identifier: 'https://docs.gitlab.com/ee/development/fe_guide/style_guide_scss.html'
--- ---
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Vue.js style guide # Vue.js style guide
## Linting ## Linting
...@@ -400,6 +406,199 @@ Useful links: ...@@ -400,6 +406,199 @@ Useful links:
$('span').tooltip('_fixTitle'); $('span').tooltip('_fixTitle');
``` ```
## Vue testing
Over time, a number of programming patterns and style preferences have emerged in our efforts to effectively test Vue components.
The following guide describes some of these. **These are not strict guidelines**, but rather a collection of suggestions and
good practices that aim to provide insight into how we write Vue tests at GitLab.
### Mounting a component
Typically, when testing a Vue component, the component should be "re-mounted" in every test block.
To achieve this:
1. Create a mutable `wrapper` variable inside the top-level `describe` block.
1. Mount the component using [`mount`](https://vue-test-utils.vuejs.org/api/#mount)/[`shallowMount`](https://vue-test-utils.vuejs.org/api/#shallowMount).
1. Reassign the resulting [`Wrapper`](https://vue-test-utils.vuejs.org/api/wrapper/#wrapper) instance to our `wrapper` variable.
Creating a global, mutable wrapper provides a number of advantages, including the ability to:
- Define common functions for finding components/DOM elements:
```javascript
import MyComponent from '~/path/to/my_component.vue';
describe('MyComponent', () => {
let wrapper;
// this can now be reused across tests
const findMyComponent = wrapper.find(MyComponent);
// ...
})
```
- Use a `beforeEach` block to mount the component (see [the `createComponent` factory](#the-createcomponent-factory) for more information).
- Use an `afterEach` block to destroy the component, for example, `wrapper.destroy()`.
#### The `createComponent` factory
To avoid duplicating our mounting logic, it's useful to define a `createComponent` factory function
that we can reuse in each test block. This is a closure which should reassign our `wrapper` variable
to the result of [`mount`](https://vue-test-utils.vuejs.org/api/#mount) and [`shallowMount`](https://vue-test-utils.vuejs.org/api/#shallowMount):
```javascript
import MyComponent from '~/path/to/my_component.vue';
import { shallowMount } from '@vue/test-utils';
describe('MyComponent', () => {
// Initiate the "global" wrapper variable. This will be used throughout our test:
let wrapper;
// Define our `createComponent` factory:
function createComponent() {
// Mount component and reassign `wrapper`:
wrapper = shallowMount(MyComponent);
}
it('mounts', () => {
createComponent();
expect(wrapper.exists()).toBe(true);
});
it('`isLoading` prop defaults to `false`', () => {
createComponent();
expect(wrapper.props('isLoading')).toBe(false);
});
})
```
Similarly, we could further de-duplicate our test by calling `createComponent` in a `beforeEach` block:
```javascript
import MyComponent from '~/path/to/my_component.vue';
import { shallowMount } from '@vue/test-utils';
describe('MyComponent', () => {
// Initiate the "global" wrapper variable. This will be used throughout our test
let wrapper;
// define our `createComponent` factory
function createComponent() {
// mount component and reassign `wrapper`
wrapper = shallowMount(MyComponent);
}
beforeEach(() => {
createComponent();
});
it('mounts', () => {
expect(wrapper.exists()).toBe(true);
});
it('`isLoading` prop defaults to `false`', () => {
expect(wrapper.props('isLoading')).toBe(false);
});
})
```
#### `createComponent` best practices
1. Consider using a single (or a limited number of) object arguments over many arguments.
Defining single parameters for common data like `props` is okay,
but keep in mind our [JavaScript style guide](javascript.md#limit-number-of-parameters) and stay within the parameter number limit:
```javascript
// bad
function createComponent(data, props, methods, isLoading, mountFn) { }
// good
function createComponent({ data, props, methods, stubs, isLoading } = {}) { }
// good
function createComponent(props = {}, { data, methods, stubs, isLoading } = {}) { }
```
1. If you require both `mount` _and_ `shallowMount` within the same set of tests, it
can be useful define a `mountFn` parameter for the `createComponent` factory that accepts
the mounting function (`mount` or `shallowMount`) to be used to mount the component:
```javascript
import { shallowMount } from '@vue/test-utils';
function createComponent({ mountFn = shallowMount } = {}) { }
```
### Setting component state
1. Avoid using [`setProps`](https://vue-test-utils.vuejs.org/api/wrapper/#setprops) to set
component state wherever possible. Instead, set the component's
[`propsData`](https://vue-test-utils.vuejs.org/api/options.html#propsdata) when mounting the component:
```javascript
// bad
wrapper = shallowMount(MyComponent);
wrapper.setProps({
myProp: 'my cool prop'
});
// good
wrapper = shallowMount({ propsData: { myProp: 'my cool prop' } });
```
The exception here is when you wish to test component reactivity in some way.
For example, you may want to test the output of a component when after a particular watcher has executed.
Using `setProps` to test such behavior is okay.
### Accessing component state
1. When accessing props or attributes, prefer the `wrapper.props('myProp')` syntax over `wrapper.props().myProp`:
```javascript
// good
expect(wrapper.props().myProp).toBe(true);
expect(wrapper.attributes().myAttr).toBe(true);
// better
expect(wrapper.props('myProp').toBe(true);
expect(wrapper.attributes('myAttr')).toBe(true);
```
1. When asserting multiple props, check the deep equality of the `props()` object with [`toEqual`](https://jestjs.io/docs/en/expect#toequalvalue):
```javascript
// good
expect(wrapper.props('propA')).toBe('valueA');
expect(wrapper.props('propB')).toBe('valueB');
expect(wrapper.props('propC')).toBe('valueC');
// better
expect(wrapper.props()).toEqual({
propA: 'valueA',
propB: 'valueB',
propC: 'valueC',
});
```
1. If you are only interested in some of the props, you can use [`toMatchObject`](https://jestjs.io/docs/en/expect#tomatchobjectobject).
Prefer `toMatchObject` over [`expect.objectContaining`](https://jestjs.io/docs/en/expect#expectobjectcontainingobject):
```javascript
// good
expect(wrapper.props()).toEqual(expect.objectContaining({
propA: 'valueA',
propB: 'valueB',
}));
// better
expect(wrapper.props()).toMatchObject({
propA: 'valueA',
propB: 'valueB',
});
```
## The JavaScript/Vue Accord ## The JavaScript/Vue Accord
The goal of this accord is to make sure we are all on the same page. The goal of this accord is to make sure we are all on the same page.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Vue # Vue
To get started with Vue, read through [their documentation](https://vuejs.org/v2/guide/). To get started with Vue, read through [their documentation](https://vuejs.org/v2/guide/).
...@@ -182,10 +188,13 @@ Check this [page](vuex.md) for more details. ...@@ -182,10 +188,13 @@ Check this [page](vuex.md) for more details.
## Style guide ## Style guide
Please refer to the Vue section of our [style guide](style/vue.md) Please refer to the Vue section of our [style guide](style/vue.md)
for best practices while writing your Vue components and templates. for best practices while writing and testing your Vue components and templates.
## Testing Vue Components ## Testing Vue Components
Please refer to the [Vue testing style guide](style/vue.md#vue-testing)
for guidelines and best practices for testing your Vue components.
Each Vue component has a unique output. This output is always present in the render function. Each Vue component has a unique output. This output is always present in the render function.
Although we can test each method of a Vue component individually, our goal must be to test the output Although we can test each method of a Vue component individually, our goal must be to test the output
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Migration to Vue 3 # Migration to Vue 3
In order to prepare for the eventual migration to Vue 3.x, we should be wary about adding the following features to the codebase: In order to prepare for the eventual migration to Vue 3.x, we should be wary about adding the following features to the codebase:
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Vuex # Vuex
When there's a clear benefit to separating state management from components (e.g. due to state complexity) we recommend using [Vuex](https://vuex.vuejs.org) over any other Flux pattern. Otherwise, feel free to manage state within the components. When there's a clear benefit to separating state management from components (e.g. due to state complexity) we recommend using [Vuex](https://vuex.vuejs.org) over any other Flux pattern. Otherwise, feel free to manage state within the components.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Features inside the `.gitlab/` directory # Features inside the `.gitlab/` directory
We have implemented standard features that depend on configuration files in the `.gitlab/` directory. You can find `.gitlab/` in various GitLab repositories. We have implemented standard features that depend on configuration files in the `.gitlab/` directory. You can find `.gitlab/` in various GitLab repositories.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# File Storage in GitLab # File Storage in GitLab
We use the [CarrierWave](https://github.com/carrierwaveuploader/carrierwave) gem to handle file upload, store and retrieval. We use the [CarrierWave](https://github.com/carrierwaveuploader/carrierwave) gem to handle file upload, store and retrieval.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Foreign Keys & Associations # Foreign Keys & Associations
When adding an association to a model you must also add a foreign key. For When adding an association to a model you must also add a foreign key. For
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# `Gemfile` guidelines # `Gemfile` guidelines
When adding a new entry to `Gemfile` or upgrading an existing dependency pay When adding a new entry to `Gemfile` or upgrading an existing dependency pay
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Dependency Management in Go # Dependency Management in Go
Go takes an unusual approach to dependency management, in that it is Go takes an unusual approach to dependency management, in that it is
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Gotchas # Gotchas
The purpose of this guide is to document potential "gotchas" that contributors The purpose of this guide is to document potential "gotchas" that contributors
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GraphQL development guidelines # GraphQL development guidelines
This guide contains all the information to successfully contribute to GitLab's This guide contains all the information to successfully contribute to GitLab's
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GraphQL pagination # GraphQL pagination
## Types of pagination ## Types of pagination
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Hash Indexes # Hash Indexes
PostgreSQL supports hash indexes besides the regular B-tree PostgreSQL supports hash indexes besides the regular B-tree
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Internationalization for GitLab # Internationalization for GitLab
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10669) in GitLab 9.2. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/10669) in GitLab 9.2.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Translate GitLab to your language # Translate GitLab to your language
The text in GitLab's user interface is in American English by default. The text in GitLab's user interface is in American English by default.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Merging translations from CrowdIn # Merging translations from CrowdIn
CrowdIn automatically syncs the `gitlab.pot` file with the CrowdIn service, presenting CrowdIn automatically syncs the `gitlab.pot` file with the CrowdIn service, presenting
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Proofread Translations # Proofread Translations
Most translations are contributed, reviewed, and accepted by the community. We Most translations are contributed, reviewed, and accepted by the community. We
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Translating GitLab # Translating GitLab
For managing the translation process we use [CrowdIn](https://crowdin.com). For managing the translation process we use [CrowdIn](https://crowdin.com).
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Import/Export development documentation # Import/Export development documentation
Troubleshooting and general development guidelines and tips for the [Import/Export feature](../user/project/settings/import_export.md). Troubleshooting and general development guidelines and tips for the [Import/Export feature](../user/project/settings/import_export.md).
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Test Import Project # Test Import Project
For testing, we can import our own [GitLab CE](https://gitlab.com/gitlab-org/gitlab-foss/) project (named `gitlabhq` in this case) under a group named `qa-perf-testing`. Project tarballs that can be used for testing can be found over on the [performance-data](https://gitlab.com/gitlab-org/quality/performance-data) project. A different project could be used if required. For testing, we can import our own [GitLab CE](https://gitlab.com/gitlab-org/gitlab-foss/) project (named `gitlabhq` in this case) under a group named `qa-perf-testing`. Project tarballs that can be used for testing can be found over on the [performance-data](https://gitlab.com/gitlab-org/quality/performance-data) project. A different project could be used if required.
......
--- ---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
description: "Sometimes it is necessary to store large amounts of records at once, which can be inefficient description: "Sometimes it is necessary to store large amounts of records at once, which can be inefficient
when iterating collections and performing individual `save`s. With the arrival of `insert_all` when iterating collections and performing individual `save`s. With the arrival of `insert_all`
in Rails 6, which operates at the row level (that is, using `Hash`es), GitLab has added a set in Rails 6, which operates at the row level (that is, using `Hash`es), GitLab has added a set
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Setting up a development environment # Setting up a development environment
The following are required to install and test the app: The following are required to install and test the app:
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Developing against interacting components or features # Developing against interacting components or features
It's not uncommon that a single code change can reflect and interact with multiple parts of GitLab It's not uncommon that a single code change can reflect and interact with multiple parts of GitLab
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Iterating Tables In Batches # Iterating Tables In Batches
Rails provides a method called `in_batches` that can be used to iterate over Rails provides a method called `in_batches` that can be used to iterate over
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Licensed feature availability **(STARTER)** # Licensed feature availability **(STARTER)**
As of GitLab 9.4, we've been supporting a simplified version of licensed As of GitLab 9.4, we've been supporting a simplified version of licensed
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab Licensing and Compatibility # GitLab Licensing and Compatibility
[GitLab Community Edition](https://gitlab.com/gitlab-org/gitlab-foss/) (CE) is licensed [under the terms of the MIT License](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/LICENSE). [GitLab Enterprise Edition](https://gitlab.com/gitlab-org/gitlab/) (EE) is licensed under "[The GitLab Enterprise Edition (EE) license](https://gitlab.com/gitlab-org/gitlab/blob/master/LICENSE)" wherein there are more restrictions. [GitLab Community Edition](https://gitlab.com/gitlab-org/gitlab-foss/) (CE) is licensed [under the terms of the MIT License](https://gitlab.com/gitlab-org/gitlab-foss/blob/master/LICENSE). [GitLab Enterprise Edition](https://gitlab.com/gitlab-org/gitlab/) (EE) is licensed under "[The GitLab Enterprise Edition (EE) license](https://gitlab.com/gitlab-org/gitlab/blob/master/LICENSE)" wherein there are more restrictions.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Mass inserting Rails models # Mass inserting Rails models
Setting the environment variable [`MASS_INSERT=1`](rake_tasks.md#environment-variables) Setting the environment variable [`MASS_INSERT=1`](rake_tasks.md#environment-variables)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Merge Request Performance Guidelines # Merge Request Performance Guidelines
Each new introduced merge request **should be performant by default**. Each new introduced merge request **should be performant by default**.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Migration Style Guide # Migration Style Guide
When writing migrations for GitLab, you have to take into account that When writing migrations for GitLab, you have to take into account that
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Modules with instance variables could be considered harmful # Modules with instance variables could be considered harmful
## Background ## Background
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Database case study: Namespaces storage statistics # Database case study: Namespaces storage statistics
## Introduction ## Introduction
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Dependencies # Dependencies
## Adding Dependencies ## Adding Dependencies
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Accessibility # Accessibility
Using semantic HTML plays a key role when it comes to accessibility. Using semantic HTML plays a key role when it comes to accessibility.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Components # Components
## Graphs ## Graphs
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Development # Development
## [Components](components.md) ## [Components](components.md)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Performance # Performance
## Monitoring ## Monitoring
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Frontend Development Guidelines # Frontend Development Guidelines
This guide contains all the information to successfully contribute to GitLab's frontend. This guide contains all the information to successfully contribute to GitLab's frontend.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Dirty Submit # Dirty Submit
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/21115) in GitLab 11.3. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/21115) in GitLab 11.3.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Modules # Modules
- [DirtySubmit](dirty_submit.md) - [DirtySubmit](dirty_submit.md)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Merge request widget extensions # Merge request widget extensions
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44616) in GitLab 13.6. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/44616) in GitLab 13.6.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Tips # Tips
## Clearing production compiled assets ## Clearing production compiled assets
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Newlines style guide # Newlines style guide
This style guide recommends best practices for newlines in Ruby code. This style guide recommends best practices for newlines in Ruby code.
......
---
stage: Enablement
group: Distribution
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# What you should know about Omnibus packages # What you should know about Omnibus packages
Most users install GitLab using our Omnibus packages. As a developer it can be Most users install GitLab using our Omnibus packages. As a developer it can be
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Ordering Table Columns in PostgreSQL # Ordering Table Columns in PostgreSQL
For GitLab we require that columns of new tables are ordered to use the For GitLab we require that columns of new tables are ordered to use the
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Performance Guidelines # Performance Guidelines
This document describes various guidelines to follow to ensure good and This document describes various guidelines to follow to ensure good and
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab permissions guide # GitLab permissions guide
There are multiple types of permissions across GitLab, and when implementing There are multiple types of permissions across GitLab, and when implementing
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# `DeclarativePolicy` framework # `DeclarativePolicy` framework
The DeclarativePolicy framework is designed to assist in performance of policy checks, and to enable ease of extension for EE. The DSL code in `app/policies` is what `Ability.allowed?` uses to check whether a particular action is allowed on a subject. The DeclarativePolicy framework is designed to assist in performance of policy checks, and to enable ease of extension for EE. The DSL code in `app/policies` is what `Ability.allowed?` uses to check whether a particular action is allowed on a subject.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Polling with ETag caching # Polling with ETag caching
Polling for changes (repeatedly asking server if there are any new changes) Polling for changes (repeatedly asking server if there are any new changes)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Polymorphic Associations # Polymorphic Associations
**Summary:** always use separate tables instead of polymorphic associations. **Summary:** always use separate tables instead of polymorphic associations.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Post Deployment Migrations # Post Deployment Migrations
Post deployment migrations are regular Rails migrations that can optionally be Post deployment migrations are regular Rails migrations that can optionally be
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Profiling # Profiling
To make it easier to track down performance problems GitLab comes with a set of To make it easier to track down performance problems GitLab comes with a set of
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Projections # Projections
Projections are a way to define relations between files. Every file can have a Projections are a way to define relations between files. Every file can have a
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Pry debugging # Pry debugging
## Invoking pry debugging ## Invoking pry debugging
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Python Development Guidelines # Python Development Guidelines
GitLab requires Python as a dependency for [reStructuredText](https://docutils.sourceforge.io/rst.html) GitLab requires Python as a dependency for [reStructuredText](https://docutils.sourceforge.io/rst.html)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Query Count Limits # Query Count Limits
Each controller or API endpoint is allowed to execute up to 100 SQL queries and Each controller or API endpoint is allowed to execute up to 100 SQL queries and
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# QueryRecorder # QueryRecorder
QueryRecorder is a tool for detecting the [N+1 queries problem](https://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations) from tests. QueryRecorder is a tool for detecting the [N+1 queries problem](https://guides.rubyonrails.org/active_record_querying.html#eager-loading-associations) from tests.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Rails initializers # Rails initializers
By default, Rails loads Zeitwerk after the initializers in `config/initializers` are loaded. By default, Rails loads Zeitwerk after the initializers in `config/initializers` are loaded.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Rake tasks for developers # Rake tasks for developers
Rake tasks are available for developers and others contributing to GitLab. Rake tasks are available for developers and others contributing to GitLab.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# `ReactiveCaching` # `ReactiveCaching`
> This doc refers to <https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/concerns/reactive_caching.rb>. > This doc refers to <https://gitlab.com/gitlab-org/gitlab/blob/master/app/models/concerns/reactive_caching.rb>.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Redis guidelines # Redis guidelines
GitLab uses [Redis](https://redis.io) for the following distinct purposes: GitLab uses [Redis](https://redis.io) for the following distinct purposes:
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Refactoring guide # Refactoring guide
This document is a collection of techniques and best practices to consider while performing a refactor. This document is a collection of techniques and best practices to consider while performing a refactor.
......
--- ---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
description: 'An introduction to reference parsers and reference filters, and a guide to their implementation.' description: 'An introduction to reference parsers and reference filters, and a guide to their implementation.'
--- ---
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Renaming features # Renaming features
Sometimes the business asks to change the name of a feature. Broadly speaking, there are 2 approaches to that task. They basically trade between immediate effort and future complexity/bug risk: Sometimes the business asks to change the name of a feature. Broadly speaking, there are 2 approaches to that task. They basically trade between immediate effort and future complexity/bug risk:
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Guidelines for reusing abstractions # Guidelines for reusing abstractions
As GitLab has grown, different patterns emerged across the codebase. Service As GitLab has grown, different patterns emerged across the codebase. Service
......
---
redirect_to: 'feature_flags/index.md'
---
This document was moved to [another location](feature_flags/index.md). This document was moved to [another location](feature_flags/index.md).
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Routing # Routing
The GitLab backend is written primarily with Rails so it uses [Rails The GitLab backend is written primarily with Rails so it uses [Rails
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab scalability # GitLab scalability
This section describes the current architecture of GitLab as it relates to This section describes the current architecture of GitLab as it relates to
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Serializing Data # Serializing Data
**Summary:** don't store serialized data in the database, use separate columns **Summary:** don't store serialized data in the database, use separate columns
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab Developers Guide to service measurement # GitLab Developers Guide to service measurement
You can enable service measurement in order to debug any slow service's execution time, number of SQL calls, garbage collection stats, memory usage, etc. You can enable service measurement in order to debug any slow service's execution time, number of SQL calls, garbage collection stats, memory usage, etc.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Accessing session data # Accessing session data
Session data in GitLab is stored in Redis and can be accessed in a variety of ways. Session data in GitLab is stored in Redis and can be accessed in a variety of ways.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Storing SHA1 Hashes As Binary # Storing SHA1 Hashes As Binary
Storing SHA1 hashes as strings is not very space efficient. A SHA1 as a string Storing SHA1 hashes as strings is not very space efficient. A SHA1 as a string
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Shared files # Shared files
Historically, GitLab has been storing shared files in many different Historically, GitLab has been storing shared files in many different
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Guidelines for shell commands in the GitLab codebase # Guidelines for shell commands in the GitLab codebase
This document contains guidelines for working with processes and files in the GitLab codebase. This document contains guidelines for working with processes and files in the GitLab codebase.
......
# Sidekiq debugging ---
redirect_to: '../administration/troubleshooting/sidekiq.md'
---
## Log arguments to Sidekiq jobs This document was moved to [another location](../administration/troubleshooting/sidekiq.md).
This content has been moved to the
[Troubleshooting Sidekiq docs](../administration/troubleshooting/sidekiq.md).
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Sidekiq Style Guide # Sidekiq Style Guide
This document outlines various guidelines that should be followed when adding or This document outlines various guidelines that should be followed when adding or
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Single Table Inheritance # Single Table Inheritance
**Summary:** don't use Single Table Inheritance (STI), use separate tables **Summary:** don't use Single Table Inheritance (STI), use separate tables
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# SQL Query Guidelines # SQL Query Guidelines
This document describes various guidelines to follow when writing SQL queries, This document describes various guidelines to follow when writing SQL queries,
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Dynamic Element Validation # Dynamic Element Validation
We devised a solution to solve common test automation problems such as the dreaded `NoSuchElementException`. We devised a solution to solve common test automation problems such as the dreaded `NoSuchElementException`.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Environment selection # Environment selection
Some tests are designed to be run against specific environments or [pipelines](https://about.gitlab.com/handbook/engineering/quality/guidelines/debugging-qa-test-failures/#scheduled-qa-test-pipelines). Some tests are designed to be run against specific environments or [pipelines](https://about.gitlab.com/handbook/engineering/quality/guidelines/debugging-qa-test-failures/#scheduled-qa-test-pipelines).
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Testing with feature flags # Testing with feature flags
To run a specific test with a feature flag enabled you can use the `QA::Runtime::Feature` class to To run a specific test with a feature flag enabled you can use the `QA::Runtime::Feature` class to
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Flows in GitLab QA # Flows in GitLab QA
Flows are frequently used sequences of actions. They are a higher level Flows are frequently used sequences of actions. They are a higher level
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Page objects in GitLab QA # Page objects in GitLab QA
In GitLab QA we are using a known pattern, called _Page Objects_. In GitLab QA we are using a known pattern, called _Page Objects_.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Resource class in GitLab QA # Resource class in GitLab QA
Resources are primarily created using Browser UI steps, but can also Resources are primarily created using Browser UI steps, but can also
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# RSpec metadata for end-to-end tests # RSpec metadata for end-to-end tests
This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec-core/docs/metadata/user-defined-metadata) This is a partial list of the [RSpec metadata](https://relishapp.com/rspec/rspec-core/docs/metadata/user-defined-metadata)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Running tests that require special setup # Running tests that require special setup
## Jenkins spec ## Jenkins spec
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Style guide for writing end-to-end tests # Style guide for writing end-to-end tests
This document describes the conventions used at GitLab for writing End-to-end (E2E) tests using the GitLab QA project. This document describes the conventions used at GitLab for writing End-to-end (E2E) tests using the GitLab QA project.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Flaky tests # Flaky tests
## What's a flaky test? ## What's a flaky test?
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Frontend testing standards and style guidelines # Frontend testing standards and style guidelines
There are two types of test suites you'll encounter while developing frontend code There are two types of test suites you'll encounter while developing frontend code
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Testing standards and style guidelines # Testing standards and style guidelines
This document describes various guidelines and best practices for automated This document describes various guidelines and best practices for automated
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Smoke Tests # Smoke Tests
It is imperative in any testing suite that we have Smoke Tests. In short, smoke It is imperative in any testing suite that we have Smoke Tests. In short, smoke
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Testing levels # Testing levels
![Testing priority triangle](img/testing_triangle.png) ![Testing priority triangle](img/testing_triangle.png)
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Testing Rake tasks # Testing Rake tasks
To make testing Rake tasks a little easier, there is a helper that can be included To make testing Rake tasks a little easier, there is a helper that can be included
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Understanding EXPLAIN plans # Understanding EXPLAIN plans
PostgreSQL allows you to obtain query plans using the `EXPLAIN` command. This PostgreSQL allows you to obtain query plans using the `EXPLAIN` command. This
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Uploads development documentation # Uploads development documentation
[GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse) has special rules for handling uploads. [GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse) has special rules for handling uploads.
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# GitLab utilities # GitLab utilities
We have developed a number of utilities to help ease development: We have developed a number of utilities to help ease development:
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# Verifying Database Capabilities # Verifying Database Capabilities
Sometimes certain bits of code may only work on a certain database Sometimes certain bits of code may only work on a certain database
......
---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
---
# What requires downtime? # What requires downtime?
When working with a database certain operations can be performed without taking When working with a database certain operations can be performed without taking
......
--- ---
stage: none
group: unassigned
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#designated-technical-writers
type: reference, howto type: reference, howto
--- ---
......
...@@ -5,7 +5,7 @@ info: "To determine the technical writer assigned to the Stage/Group associated ...@@ -5,7 +5,7 @@ info: "To determine the technical writer assigned to the Stage/Group associated
type: reference, how-to type: reference, how-to
--- ---
# Web IDE # Web IDE **(CORE)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4539) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 10.4. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4539) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 10.4.
> - [Moved](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/44157) to GitLab Core in 10.7. > - [Moved](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/44157) to GitLab Core in 10.7.
...@@ -244,6 +244,8 @@ quickly share your project with others. ...@@ -244,6 +244,8 @@ quickly share your project with others.
### Enabling Live Preview ### Enabling Live Preview
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/268288) in GitLab 12.9, third-party assets and libraries required for Live Preview are hosted at `https://sandbox-prod.gitlab-static.net` when it is enabled. However, some libraries are still served from other third-party services which may or may not be desirable in your environment.
The Live Preview feature needs to be enabled in the GitLab instances The Live Preview feature needs to be enabled in the GitLab instances
admin settings. Live Preview is enabled for all projects on admin settings. Live Preview is enabled for all projects on
GitLab.com GitLab.com
......
- if group.present? && group.has_owner?(current_user) && user.using_gitlab_com_seat?(group) - if group.present? && current_user_is_group_owner && user.using_gitlab_com_seat?(group)
= render 'shared/members/badge', type: 'light' do = render 'shared/members/badge', type: 'light' do
= _("Is using seat") = _("Is using seat")
---
title: Fix cached queries for Groups::GroupMembersController#index
merge_request: 44626
author:
type: performance
...@@ -26,13 +26,20 @@ module Gitlab ...@@ -26,13 +26,20 @@ module Gitlab
request = Rack::Request.new(request) request = Rack::Request.new(request)
return true if string_malformed?(request.path) return true if malformed_path?(request.path)
request.params.values.any? do |value| request.params.values.any? do |value|
param_has_null_byte?(value) param_has_null_byte?(value)
end end
end end
def malformed_path?(path)
string_malformed?(Rack::Utils.unescape(path))
rescue ArgumentError
# Rack::Utils.unescape raised this, path is malformed.
true
end
def param_has_null_byte?(value, depth = 0) def param_has_null_byte?(value, depth = 0)
# Guard against possible attack sending large amounts of nested params # Guard against possible attack sending large amounts of nested params
# Should be safe as deeply nested params are highly uncommon. # Should be safe as deeply nested params are highly uncommon.
......
...@@ -5,7 +5,9 @@ require "rack/test" ...@@ -5,7 +5,9 @@ require "rack/test"
RSpec.describe Gitlab::Middleware::HandleMalformedStrings do RSpec.describe Gitlab::Middleware::HandleMalformedStrings do
let(:null_byte) { "\u0000" } let(:null_byte) { "\u0000" }
let(:escaped_null_byte) { "%00" }
let(:invalid_string) { "mal\xC0formed" } let(:invalid_string) { "mal\xC0formed" }
let(:escaped_invalid_string) { "mal%c0formed" }
let(:error_400) { [400, { 'Content-Type' => 'text/plain' }, ['Bad Request']] } let(:error_400) { [400, { 'Content-Type' => 'text/plain' }, ['Bad Request']] }
let(:app) { double(:app) } let(:app) { double(:app) }
...@@ -30,6 +32,14 @@ RSpec.describe Gitlab::Middleware::HandleMalformedStrings do ...@@ -30,6 +32,14 @@ RSpec.describe Gitlab::Middleware::HandleMalformedStrings do
expect(subject.call(env)).to eq error_400 expect(subject.call(env)).to eq error_400
end end
it 'rejects escaped null bytes' do
# We have to create the env separately or Rack::MockRequest complains about invalid URI
env = env_for
env['PATH_INFO'] = "/someplace/withan#{escaped_null_byte}escaped nullbyte"
expect(subject.call(env)).to eq error_400
end
it 'rejects malformed strings' do it 'rejects malformed strings' do
# We have to create the env separately or Rack::MockRequest complains about invalid URI # We have to create the env separately or Rack::MockRequest complains about invalid URI
env = env_for env = env_for
...@@ -37,6 +47,14 @@ RSpec.describe Gitlab::Middleware::HandleMalformedStrings do ...@@ -37,6 +47,14 @@ RSpec.describe Gitlab::Middleware::HandleMalformedStrings do
expect(subject.call(env)).to eq error_400 expect(subject.call(env)).to eq error_400
end end
it 'rejects escaped malformed strings' do
# We have to create the env separately or Rack::MockRequest complains about invalid URI
env = env_for
env['PATH_INFO'] = "/someplace/with_an/#{escaped_invalid_string}"
expect(subject.call(env)).to eq error_400
end
end end
context 'in params' do context 'in params' do
......
...@@ -5,12 +5,14 @@ require 'spec_helper' ...@@ -5,12 +5,14 @@ require 'spec_helper'
RSpec.describe BulkCreateIntegrationService do RSpec.describe BulkCreateIntegrationService do
include JiraServiceHelper include JiraServiceHelper
before do before_all do
stub_jira_service_test stub_jira_service_test
end end
let_it_be(:instance_integration) { create(:jira_service, :instance) } let_it_be(:excluded_group) { create(:group) }
let_it_be(:template_integration) { create(:jira_service, :template) } let_it_be(:excluded_project) { create(:project, group: excluded_group) }
let(:instance_integration) { create(:jira_service, :instance) }
let(:template_integration) { create(:jira_service, :template) }
let(:excluded_attributes) { %w[id project_id group_id inherit_from_id instance template created_at updated_at] } let(:excluded_attributes) { %w[id project_id group_id inherit_from_id instance template created_at updated_at] }
shared_examples 'creates integration from batch ids' do shared_examples 'creates integration from batch ids' do
...@@ -46,15 +48,19 @@ RSpec.describe BulkCreateIntegrationService do ...@@ -46,15 +48,19 @@ RSpec.describe BulkCreateIntegrationService do
described_class.new(integration, batch, association).execute described_class.new(integration, batch, association).execute
expect(project.reload.has_external_issue_tracker).to eq(true) expect(project.reload.has_external_issue_tracker).to eq(true)
expect(excluded_project.reload.has_external_issue_tracker).to eq(false)
end end
context 'with an external wiki integration' do context 'with an external wiki integration' do
let(:integration) { create(:external_wiki_service, :instance) } before do
integration.update!(category: 'common', type: 'ExternalWikiService')
end
it 'updates projects#has_external_wiki for external wiki services' do it 'updates projects#has_external_wiki for external wiki services' do
described_class.new(integration, batch, association).execute described_class.new(integration, batch, association).execute
expect(project.reload.has_external_wiki).to eq(true) expect(project.reload.has_external_wiki).to eq(true)
expect(excluded_project.reload.has_external_wiki).to eq(false)
end end
end end
end end
...@@ -77,14 +83,14 @@ RSpec.describe BulkCreateIntegrationService do ...@@ -77,14 +83,14 @@ RSpec.describe BulkCreateIntegrationService do
end end
end end
context 'with an instance-level integration' do context 'passing an instance-level integration' do
let(:integration) { instance_integration } let(:integration) { instance_integration }
let(:inherit_from_id) { integration.id } let(:inherit_from_id) { integration.id }
context 'with a project association' do context 'with a project association' do
let!(:project) { create(:project) } let!(:project) { create(:project) }
let(:created_integration) { project.jira_service } let(:created_integration) { project.jira_service }
let(:batch) { Project.without_integration(integration) } let(:batch) { Project.where(id: project.id) }
let(:association) { 'project' } let(:association) { 'project' }
it_behaves_like 'creates integration from batch ids' it_behaves_like 'creates integration from batch ids'
...@@ -101,20 +107,37 @@ RSpec.describe BulkCreateIntegrationService do ...@@ -101,20 +107,37 @@ RSpec.describe BulkCreateIntegrationService do
end end
context 'with a group association' do context 'with a group association' do
let_it_be(:group) { create(:group) } let!(:group) { create(:group) }
let(:created_integration) { Service.find_by(group: group) } let(:created_integration) { Service.find_by(group: group) }
let(:batch) { Group.all } let(:batch) { Group.where(id: group.id) }
let(:association) { 'group' } let(:association) { 'group' }
it_behaves_like 'creates integration from batch ids' it_behaves_like 'creates integration from batch ids'
it_behaves_like 'updates inherit_from_id' it_behaves_like 'updates inherit_from_id'
end
end
context 'passing a group integration' do
let_it_be(:group) { create(:group) }
context 'with a project association' do
let!(:project) { create(:project, group: group) }
let(:integration) { create(:jira_service, group: group, project: nil) }
let(:created_integration) { project.jira_service }
let(:batch) { Project.where(id: Project.minimum(:id)..Project.maximum(:id)).without_integration(integration).in_namespace(integration.group.self_and_descendants) }
let(:association) { 'project' }
let(:inherit_from_id) { integration.id }
it_behaves_like 'creates integration from batch ids'
it_behaves_like 'updates inherit_from_id'
it_behaves_like 'updates project callbacks'
end
context 'with a subgroup association' do context 'with a group association' do
let_it_be(:group_integration) { create(:jira_service, group: group, project: nil, inherit_from_id: instance_integration.id) } let!(:subgroup) { create(:group, parent: group) }
let_it_be(:subgroup) { create(:group, parent: group) } let(:integration) { create(:jira_service, group: group, project: nil, inherit_from_id: instance_integration.id) }
let(:integration) { group_integration }
let(:created_integration) { Service.find_by(group: subgroup) } let(:created_integration) { Service.find_by(group: subgroup) }
let(:batch) { Group.all } let(:batch) { Group.where(id: subgroup.id) }
let(:association) { 'group' } let(:association) { 'group' }
let(:inherit_from_id) { instance_integration.id } let(:inherit_from_id) { instance_integration.id }
...@@ -122,15 +145,14 @@ RSpec.describe BulkCreateIntegrationService do ...@@ -122,15 +145,14 @@ RSpec.describe BulkCreateIntegrationService do
it_behaves_like 'updates inherit_from_id' it_behaves_like 'updates inherit_from_id'
end end
end end
end
context 'with a template integration' do context 'passing a template integration' do
let(:integration) { template_integration } let(:integration) { template_integration }
context 'with a project association' do context 'with a project association' do
let!(:project) { create(:project) } let!(:project) { create(:project) }
let(:created_integration) { project.jira_service } let(:created_integration) { project.jira_service }
let(:batch) { Project.all } let(:batch) { Project.where(id: project.id) }
let(:association) { 'project' } let(:association) { 'project' }
let(:inherit_from_id) { integration.id } let(:inherit_from_id) { integration.id }
......
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