Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
c7a46b0419
commit
f2eb66fef8
|
@ -1 +1 @@
|
|||
0fe0cfaccc979592610cbf65807f19b307957750
|
||||
a7f84c7c8ea135881fd2cc6c7f48fdc487b125fb
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -350,7 +350,7 @@ group :development do
|
|||
end
|
||||
|
||||
group :development, :test do
|
||||
gem 'bullet', '~> 6.0.2'
|
||||
gem 'bullet', '~> 6.1.0'
|
||||
gem 'pry-byebug', '~> 3.5.1', platform: :mri
|
||||
gem 'pry-rails', '~> 0.3.9'
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ GEM
|
|||
brakeman (4.2.1)
|
||||
browser (4.2.0)
|
||||
builder (3.2.4)
|
||||
bullet (6.0.2)
|
||||
bullet (6.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
uniform_notifier (~> 1.11)
|
||||
bundler-audit (0.6.1)
|
||||
|
@ -1245,7 +1245,7 @@ DEPENDENCIES
|
|||
bootstrap_form (~> 4.2.0)
|
||||
brakeman (~> 4.2)
|
||||
browser (~> 4.2)
|
||||
bullet (~> 6.0.2)
|
||||
bullet (~> 6.1.0)
|
||||
bundler-audit (~> 0.6.1)
|
||||
capybara (~> 3.33.0)
|
||||
capybara-screenshot (~> 1.0.22)
|
||||
|
|
|
@ -14,8 +14,6 @@ module SnippetsActions
|
|||
skip_before_action :verify_authenticity_token,
|
||||
if: -> { action_name == 'show' && js_request? }
|
||||
|
||||
before_action :redirect_if_binary, only: [:edit, :update]
|
||||
|
||||
respond_to :html
|
||||
end
|
||||
|
||||
|
@ -134,10 +132,4 @@ module SnippetsActions
|
|||
|
||||
recaptcha_check_with_fallback(errors.empty?) { render action }
|
||||
end
|
||||
|
||||
def redirect_if_binary
|
||||
return if Feature.enabled?(:snippets_binary_blob)
|
||||
|
||||
redirect_to gitlab_snippet_path(snippet) if blob&.binary?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -103,7 +103,7 @@ module WikiActions
|
|||
else
|
||||
render 'shared/wikis/edit'
|
||||
end
|
||||
rescue WikiPage::PageChangedError, WikiPage::PageRenameError, Gitlab::Git::Wiki::OperationError => e
|
||||
rescue WikiPage::PageChangedError, WikiPage::PageRenameError => e
|
||||
@error = e
|
||||
render 'shared/wikis/edit'
|
||||
end
|
||||
|
@ -120,13 +120,8 @@ module WikiActions
|
|||
notice: _('Wiki was successfully updated.')
|
||||
)
|
||||
else
|
||||
flash[:alert] = response.message
|
||||
render 'shared/wikis/edit'
|
||||
end
|
||||
rescue Gitlab::Git::Wiki::OperationError => e
|
||||
@page = build_page(wiki_params)
|
||||
@error = e
|
||||
render 'shared/wikis/edit'
|
||||
end
|
||||
# rubocop:enable Gitlab/ModuleWithInstanceVariables
|
||||
|
||||
|
@ -162,14 +157,18 @@ module WikiActions
|
|||
|
||||
# rubocop:disable Gitlab/ModuleWithInstanceVariables
|
||||
def destroy
|
||||
WikiPages::DestroyService.new(container: container, current_user: current_user).execute(page)
|
||||
return render_404 unless page
|
||||
|
||||
redirect_to wiki_path(wiki),
|
||||
status: :found,
|
||||
notice: _("Page was successfully deleted")
|
||||
rescue Gitlab::Git::Wiki::OperationError => e
|
||||
@error = e
|
||||
render 'shared/wikis/edit'
|
||||
response = WikiPages::DestroyService.new(container: container, current_user: current_user).execute(page)
|
||||
|
||||
if response.success?
|
||||
redirect_to wiki_path(wiki),
|
||||
status: :found,
|
||||
notice: _("Page was successfully deleted")
|
||||
else
|
||||
@error = response
|
||||
render 'shared/wikis/edit'
|
||||
end
|
||||
end
|
||||
# rubocop:enable Gitlab/ModuleWithInstanceVariables
|
||||
|
||||
|
|
|
@ -5,16 +5,15 @@ module Search
|
|||
include Gitlab::Utils::StrongMemoize
|
||||
|
||||
attr_accessor :current_user, :params
|
||||
attr_reader :default_project_filter
|
||||
|
||||
def initialize(user, params)
|
||||
@current_user, @params = user, params.dup
|
||||
@default_project_filter = true
|
||||
end
|
||||
|
||||
def execute
|
||||
Gitlab::SearchResults.new(current_user, projects, params[:search],
|
||||
default_project_filter: default_project_filter)
|
||||
Gitlab::SearchResults.new(current_user,
|
||||
params[:search],
|
||||
projects)
|
||||
end
|
||||
|
||||
def projects
|
||||
|
|
|
@ -7,13 +7,15 @@ module Search
|
|||
def initialize(user, group, params)
|
||||
super(user, params)
|
||||
|
||||
@default_project_filter = false
|
||||
@group = group
|
||||
end
|
||||
|
||||
def execute
|
||||
Gitlab::GroupSearchResults.new(
|
||||
current_user, projects, group, params[:search], default_project_filter: default_project_filter
|
||||
current_user,
|
||||
params[:search],
|
||||
projects,
|
||||
group: group
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ module Search
|
|||
|
||||
def execute
|
||||
Gitlab::ProjectSearchResults.new(current_user,
|
||||
project,
|
||||
params[:search],
|
||||
params[:repository_ref])
|
||||
project: project,
|
||||
repository_ref: params[:repository_ref])
|
||||
end
|
||||
|
||||
def scope
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
module WikiPages
|
||||
class DestroyService < WikiPages::BaseService
|
||||
def execute(page)
|
||||
if page&.delete
|
||||
if page.delete
|
||||
execute_hooks(page)
|
||||
ServiceResponse.success(payload: { page: page })
|
||||
else
|
||||
ServiceResponse.error(
|
||||
message: _('Could not delete wiki page'), payload: { page: page }
|
||||
)
|
||||
end
|
||||
|
||||
page
|
||||
end
|
||||
|
||||
def usage_counter_action
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Remove redirection when snippet has a binary blob
|
||||
merge_request: 39858
|
||||
author:
|
||||
type: changed
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Migration of old icon button to component button in Approval Rules (private groups)
|
||||
merge_request: 39769
|
||||
author:
|
||||
type: changed
|
|
@ -4,21 +4,6 @@
|
|||
require 'yaml'
|
||||
|
||||
SEE_DOC = "See the [changelog documentation](https://docs.gitlab.com/ee/development/changelog.html)."
|
||||
CREATE_CHANGELOG_MESSAGE = <<~MSG
|
||||
If you want to create a changelog entry for GitLab FOSS, run the following:
|
||||
|
||||
```
|
||||
bin/changelog -m %<mr_iid>s "%<mr_title>s"
|
||||
```
|
||||
|
||||
If you want to create a changelog entry for GitLab EE, run the following instead:
|
||||
|
||||
```
|
||||
bin/changelog --ee -m %<mr_iid>s "%<mr_title>s"
|
||||
```
|
||||
|
||||
If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.
|
||||
MSG
|
||||
|
||||
SUGGEST_MR_COMMENT = <<~SUGGEST_COMMENT
|
||||
```suggestion
|
||||
|
@ -70,13 +55,8 @@ def check_changelog_path(path)
|
|||
end
|
||||
end
|
||||
|
||||
def sanitized_mr_title
|
||||
helper.sanitize_mr_title(gitlab.mr_json["title"])
|
||||
end
|
||||
|
||||
if git.modified_files.include?("CHANGELOG.md")
|
||||
fail "**CHANGELOG.md was edited.** Please remove the additions and create a CHANGELOG entry.\n\n" +
|
||||
format(CREATE_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], mr_title: sanitized_mr_title)
|
||||
fail changelog.modified_text
|
||||
end
|
||||
|
||||
changelog_found = changelog.found
|
||||
|
@ -84,7 +64,8 @@ changelog_found = changelog.found
|
|||
if changelog_found
|
||||
check_changelog_yaml(changelog_found)
|
||||
check_changelog_path(changelog_found)
|
||||
elsif changelog.needed?
|
||||
message "**[CHANGELOG missing](https://docs.gitlab.com/ee/development/changelog.html)**:\n\n" +
|
||||
format(CREATE_CHANGELOG_MESSAGE, mr_iid: gitlab.mr_json["iid"], mr_title: sanitized_mr_title)
|
||||
elsif changelog.required?
|
||||
fail changelog.required_text
|
||||
elsif changelog.optional?
|
||||
message changelog.optional_text
|
||||
end
|
||||
|
|
|
@ -20,8 +20,8 @@ exceptions:
|
|||
- AWS
|
||||
- CLI
|
||||
- CNAME
|
||||
- CPU
|
||||
- CORE
|
||||
- CPU
|
||||
- CSS
|
||||
- CSV
|
||||
- DNS
|
||||
|
@ -38,6 +38,7 @@ exceptions:
|
|||
- IAM
|
||||
- IBM
|
||||
- IDE
|
||||
- IID
|
||||
- IRC
|
||||
- ISO
|
||||
- JSON
|
||||
|
@ -56,8 +57,8 @@ exceptions:
|
|||
- PHP
|
||||
- POST
|
||||
- PUT
|
||||
- RPC
|
||||
- RAM
|
||||
- RPC
|
||||
- RSA
|
||||
- RSS
|
||||
- SAML
|
||||
|
@ -76,9 +77,9 @@ exceptions:
|
|||
- TODO
|
||||
- TOML
|
||||
- UNIX
|
||||
- USB
|
||||
- URI
|
||||
- URL
|
||||
- USB
|
||||
- UUID
|
||||
- VPC
|
||||
- WIP
|
||||
|
|
|
@ -129,7 +129,7 @@ the Omnibus GitLab distribution is not yet supported. Follow this
|
|||
Prepare all your new nodes by [installing
|
||||
GitLab](https://about.gitlab.com/install/).
|
||||
|
||||
- 1 Praefect node (minimal storage required)
|
||||
- At least 1 Praefect node (minimal storage required)
|
||||
- 3 Gitaly nodes (high CPU, high memory, fast storage)
|
||||
- 1 GitLab server
|
||||
|
||||
|
@ -232,7 +232,7 @@ The database used by Praefect is now configured.
|
|||
|
||||
#### PgBouncer
|
||||
|
||||
To reduce PostgreSQL resource consumption, you should set up and configure
|
||||
To reduce PostgreSQL resource consumption, we recommend setting up and configuring
|
||||
[PgBouncer](https://www.pgbouncer.org/) in front of the PostgreSQL instance. To do
|
||||
this, replace value of the `POSTGRESQL_SERVER_ADDRESS` with corresponding IP or host
|
||||
address of the PgBouncer instance.
|
||||
|
@ -275,6 +275,9 @@ PostgreSQL instances. Otherwise you should change the configuration parameter
|
|||
|
||||
### Praefect
|
||||
|
||||
NOTE: **Note:**
|
||||
If there are multiple Praefect nodes, complete these steps for **each** node.
|
||||
|
||||
To complete this section you will need:
|
||||
|
||||
- [Configured PostgreSQL server](#postgresql), including:
|
||||
|
@ -426,7 +429,7 @@ application server, or a Gitaly node.
|
|||
|
||||
1. To ensure that Praefect [has updated its Prometheus listen
|
||||
address](https://gitlab.com/gitlab-org/gitaly/-/issues/2734), [restart
|
||||
Gitaly](../restart_gitlab.md#omnibus-gitlab-restart):
|
||||
Praefect](../restart_gitlab.md#omnibus-gitlab-restart):
|
||||
|
||||
```shell
|
||||
gitlab-ctl restart praefect
|
||||
|
@ -444,7 +447,7 @@ application server, or a Gitaly node.
|
|||
|
||||
**The steps above must be completed for each Praefect node!**
|
||||
|
||||
## Enabling TLS support
|
||||
#### Enabling TLS support
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitaly/-/issues/1698) in GitLab 13.2.
|
||||
|
||||
|
@ -730,7 +733,7 @@ After all Gitaly nodes are configured, you can run the Praefect connection
|
|||
checker to verify Praefect can connect to all Gitaly servers in the Praefect
|
||||
config.
|
||||
|
||||
1. SSH into the **Praefect** node and run the Praefect connection checker:
|
||||
1. SSH into each **Praefect** node and run the Praefect connection checker:
|
||||
|
||||
```shell
|
||||
sudo /opt/gitlab/embedded/bin/praefect -config /var/opt/gitlab/praefect/config.toml dial-nodes
|
||||
|
@ -774,9 +777,9 @@ application. This is done by updating the `git_data_dirs`.
|
|||
Particular attention should be shown to:
|
||||
|
||||
- the storage name added to `git_data_dirs` in this section must match the
|
||||
storage name under `praefect['virtual_storages']` on the Praefect node. This
|
||||
storage name under `praefect['virtual_storages']` on the Praefect node(s). This
|
||||
was set in the [Praefect](#praefect) section of this guide. This document uses
|
||||
`storage-1` as the Praefect storage name.
|
||||
`default` as the Praefect storage name.
|
||||
|
||||
1. SSH into the **GitLab** node and login as root:
|
||||
|
||||
|
@ -833,7 +836,8 @@ Particular attention should be shown to:
|
|||
gitlab_shell['secret_token'] = 'GITLAB_SHELL_SECRET_TOKEN'
|
||||
```
|
||||
|
||||
1. Add Prometheus monitoring settings by editing `/etc/gitlab/gitlab.rb`.
|
||||
1. Add Prometheus monitoring settings by editing `/etc/gitlab/gitlab.rb`. If Prometheus
|
||||
is enabled on a different node, make edits on that node instead.
|
||||
|
||||
You will need to replace:
|
||||
|
||||
|
@ -871,7 +875,7 @@ Particular attention should be shown to:
|
|||
gitlab-ctl reconfigure
|
||||
```
|
||||
|
||||
1. Verify each `gitlab-shell` on each Gitaly instance can reach GitLab. On each Gitaly instance run:
|
||||
1. Verify each `gitlab-shell` on each Gitaly node can reach GitLab. On each Gitaly node run:
|
||||
|
||||
```shell
|
||||
/opt/gitlab/embedded/service/gitlab-shell/bin/check -config /opt/gitlab/embedded/service/gitlab-shell/config.yml
|
||||
|
@ -901,7 +905,7 @@ for detailed documentation.
|
|||
|
||||
To get started quickly:
|
||||
|
||||
1. SSH into the **GitLab** node and login as root:
|
||||
1. SSH into the **GitLab** node (or whichever node has Grafana enabled) and login as root:
|
||||
|
||||
```shell
|
||||
sudo -i
|
||||
|
|
|
@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
|
|||
# Issues API
|
||||
|
||||
If a user is not a member of a project and the project is private, a `GET`
|
||||
request on that project will result in a `404` status code.
|
||||
request on that project results in a `404` status code.
|
||||
|
||||
## Issues pagination
|
||||
|
||||
|
@ -17,12 +17,13 @@ are paginated.
|
|||
Read more on [pagination](README.md#pagination).
|
||||
|
||||
CAUTION: **Deprecation:**
|
||||
> `reference` attribute in response is deprecated in favour of `references`.
|
||||
> Introduced [GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20354)
|
||||
The `reference` attribute in responses is deprecated in favor of `references`.
|
||||
Introduced [GitLab 12.6](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/20354).
|
||||
|
||||
NOTE: **Note:**
|
||||
> `references.relative` is relative to the group / project that the issue is being requested. When issue is fetched from its project
|
||||
> `relative` format would be the same as `short` format and when requested across groups / projects it is expected to be the same as `full` format.
|
||||
The `references.relative` attribute is relative to the group or project of the issue being requested.
|
||||
When an issue is fetched from its project, the `relative` format is the same as the `short` format,
|
||||
and when requested across groups or projects it's expected to be the same as the `full` format.
|
||||
|
||||
## List issues
|
||||
|
||||
|
@ -49,30 +50,30 @@ GET /issues?confidential=true
|
|||
|
||||
| Attribute | Type | Required | Description |
|
||||
| ------------------- | ---------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `state` | string | no | Return `all` issues or just those that are `opened` or `closed` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
|
||||
| `with_labels_details` | boolean | no | If `true`, response will return more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. The `description_html` attribute was introduced in [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413)|
|
||||
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
|
||||
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. Defaults to `created_by_me`<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5. [Changed to snake_case](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18935) in GitLab 11.0)_ |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `assignee_username` | string array | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In GitLab CE, the `assignee_username` array should only contain a single value. Otherwise, an invalid parameter error is returned. |
|
||||
| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `author_username` | string | no | Return issues created by the given `username`. Similar to `author_id` and mutually exclusive with `author_id`. |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `assignee_username` | string array | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In GitLab CE `assignee_username` array should only contain a single value or an invalid parameter error will be returned otherwise. |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14016) in GitLab 10.0)_ |
|
||||
| `weight` **(STARTER)** | integer | no | Return issues with the specified `weight`. `None` returns issues with no weight assigned. `Any` returns issues with a weight assigned. |
|
||||
| `iids[]` | integer array | no | Return only the issues having the given `iid` |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at`, `updated_at`, `priority`, `due_date`, `relative_position`, `label_priority`, `milestone_due`, `popularity`, `weight` fields. Default is `created_at` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `search` | string | no | Search issues against their `title` and `description` |
|
||||
| `in` | string | no | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description` |
|
||||
| `confidential` | boolean | no | Filter confidential or public issues. |
|
||||
| `created_after` | datetime | no | Return issues created on or after the given time |
|
||||
| `created_before` | datetime | no | Return issues created on or before the given time |
|
||||
| `due_date` | string | no | Return issues that have no due date (`0`) or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `0` (no due date), `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`. _(Introduced in [GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/233420))_ |
|
||||
| `iids[]` | integer array | no | Return only the issues having the given `iid` |
|
||||
| `in` | string | no | Modify the scope of the `search` attribute. `title`, `description`, or a string joining them with comma. Default is `title,description` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
|
||||
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14016) in GitLab 10.0)_ |
|
||||
| `non_archived` | boolean | no | Return issues only from non-archived projects. If `false`, the response returns issues from both archived and non-archived projects. Default is `true`. _(Introduced in [GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/197170))_ |
|
||||
| `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji` |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at`, `updated_at`, `priority`, `due_date`, `relative_position`, `label_priority`, `milestone_due`, `popularity`, `weight` fields. Default is `created_at` |
|
||||
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`. Defaults to `created_by_me`<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5. [Changed to snake_case](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18935) in GitLab 11.0)_ |
|
||||
| `search` | string | no | Search issues against their `title` and `description` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `state` | string | no | Return `all` issues or just those that are `opened` or `closed` |
|
||||
| `updated_after` | datetime | no | Return issues updated on or after the given time |
|
||||
| `updated_before` | datetime | no | Return issues updated on or before the given time |
|
||||
| `confidential` | boolean | no | Filter confidential or public issues. |
|
||||
| `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji` |
|
||||
| `non_archived` | boolean | no | Return issues only from non-archived projects. If `false`, response will return issues from both archived and non-archived projects. Default is `true`. _(Introduced in [GitLab 13.0](https://gitlab.com/gitlab-org/gitlab/-/issues/197170))_ |
|
||||
| `due_date` | string | no | Return issues that have no due date (`0`) or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `0` (no due date), `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`. _(Introduced in [GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/233420))_ |
|
||||
| `weight` **(STARTER)** | integer | no | Return issues with the specified `weight`. `None` returns issues with no weight assigned. `Any` returns issues with a weight assigned. |
|
||||
| `with_labels_details` | boolean | no | If `true`, the response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. The `description_html` attribute was introduced in [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413)|
|
||||
|
||||
```shell
|
||||
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/issues"
|
||||
|
@ -165,7 +166,7 @@ Example response:
|
|||
]
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -179,7 +180,7 @@ the `weight` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see
|
||||
the `health_status` parameter:
|
||||
|
||||
```json
|
||||
|
@ -193,15 +194,20 @@ the `health_status` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform
|
||||
to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042).
|
||||
This value is only present for issues closed after GitLab 10.6 and if the user account
|
||||
that closed the issue still exists.
|
||||
|
||||
## List group issues
|
||||
|
||||
Get a list of a group's issues.
|
||||
|
||||
If the group is private, credentials will need to be provided for authorization.
|
||||
If the group is private, credentials need to be provided for authorization.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
@ -223,30 +229,30 @@ GET /groups/:id/issues?confidential=true
|
|||
|
||||
| Attribute | Type | Required | Description |
|
||||
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
|
||||
| `with_labels_details` | boolean | no | If `true`, response will return more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. The `description_html` attribute was introduced in [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413) |
|
||||
| `iids[]` | integer array | no | Return only the issues having the given `iid` |
|
||||
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
|
||||
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5. [Changed to snake_case](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18935) in GitLab 11.0)_ |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `assignee_username` | string array | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In GitLab CE, the `assignee_username` array should only contain a single value. Otherwise, an invalid parameter error is returned. |
|
||||
| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `author_username` | string | no | Return issues created by the given `username`. Similar to `author_id` and mutually exclusive with `author_id`. |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `assignee_username` | string array | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In GitLab CE `assignee_username` array should only contain a single value or an invalid parameter error will be returned otherwise. |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14016) in GitLab 10.0)_ |
|
||||
| `weight` **(STARTER)** | integer | no | Return issues with the specified `weight`. `None` returns issues with no weight assigned. `Any` returns issues with a weight assigned. |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at`, `updated_at`, `priority`, `due_date`, `relative_position`, `label_priority`, `milestone_due`, `popularity`, `weight` fields. Default is `created_at` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `search` | string | no | Search group issues against their `title` and `description` |
|
||||
| `confidential` | boolean | no | Filter confidential or public issues. |
|
||||
| `created_after` | datetime | no | Return issues created on or after the given time |
|
||||
| `created_before` | datetime | no | Return issues created on or before the given time |
|
||||
| `due_date` | string | no | Return issues that have no due date (`0`) or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `0` (no due date), `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`. _(Introduced in [GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/233420))_ |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `iids[]` | integer array | no | Return only the issues having the given `iid` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
|
||||
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14016) in GitLab 10.0)_ |
|
||||
| `non_archived` | boolean | no | Return issues from non archived projects. Default is true. _(Introduced in [GitLab 12.8](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23785))_ |
|
||||
| `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at`, `updated_at`, `priority`, `due_date`, `relative_position`, `label_priority`, `milestone_due`, `popularity`, `weight` fields. Default is `created_at` |
|
||||
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5. [Changed to snake_case](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18935) in GitLab 11.0)_ |
|
||||
| `search` | string | no | Search group issues against their `title` and `description` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
| `updated_after` | datetime | no | Return issues updated on or after the given time |
|
||||
| `updated_before` | datetime | no | Return issues updated on or before the given time |
|
||||
| `confidential` | boolean | no | Filter confidential or public issues. |
|
||||
| `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` |
|
||||
| `non_archived` | boolean | no | Return issues from non archived projects. Default is true. _(Introduced in [GitLab 12.8](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/23785))_ |
|
||||
| `due_date` | string | no | Return issues that have no due date (`0`) or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `0` (no due date), `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`. _(Introduced in [GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/233420))_ |
|
||||
| `weight` **(STARTER)** | integer | no | Return issues with the specified `weight`. `None` returns issues with no weight assigned. `Any` returns issues with a weight assigned. |
|
||||
| `with_labels_details` | boolean | no | If `true`, the response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. The `description_html` attribute was introduced in [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413) |
|
||||
|
||||
```shell
|
||||
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/4/issues"
|
||||
|
@ -338,7 +344,7 @@ Example response:
|
|||
]
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -352,7 +358,7 @@ the `weight` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see
|
||||
the `health_status` parameter:
|
||||
|
||||
```json
|
||||
|
@ -366,15 +372,19 @@ the `health_status` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042).
|
||||
This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## List project issues
|
||||
|
||||
Get a list of a project's issues.
|
||||
|
||||
If the project is private, credentials will need to be provided for authorization.
|
||||
If the project is private, you need to provide credentials to authorize.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
@ -396,29 +406,29 @@ GET /projects/:id/issues?confidential=true
|
|||
|
||||
| Attribute | Type | Required | Description |
|
||||
| ------------------- | ---------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `iids[]` | integer array | no | Return only the issues having the given `iid` |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
|
||||
| `with_labels_details` | boolean | no | If `true`, response will return more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. `description_html` Introduced in [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413) |
|
||||
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
|
||||
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5. [Changed to snake_case](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18935) in GitLab 11.0)_ |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `assignee_username` | string array | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In GitLab CE, the `assignee_username` array should only contain a single value. Otherwise, an invalid parameter error is returned. |
|
||||
| `author_id` | integer | no | Return issues created by the given user `id`. Mutually exclusive with `author_username`. Combine with `scope=all` or `scope=assigned_to_me`. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `author_username` | string | no | Return issues created by the given `username`. Similar to `author_id` and mutually exclusive with `author_id`. |
|
||||
| `assignee_id` | integer | no | Return issues assigned to the given user `id`. Mutually exclusive with `assignee_username`. `None` returns unassigned issues. `Any` returns issues with an assignee. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5)_ |
|
||||
| `assignee_username` | string array | no | Return issues assigned to the given `username`. Similar to `assignee_id` and mutually exclusive with `assignee_id`. In GitLab CE `assignee_username` array should only contain a single value or an invalid parameter error will be returned otherwise. |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14016) in GitLab 10.0)_ |
|
||||
| `weight` **(STARTER)** | integer | no | Return issues with the specified `weight`. `None` returns issues with no weight assigned. `Any` returns issues with a weight assigned. |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at`, `updated_at`, `priority`, `due_date`, `relative_position`, `label_priority`, `milestone_due`, `popularity`, `weight` fields. Default is `created_at` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `search` | string | no | Search project issues against their `title` and `description` |
|
||||
| `confidential` | boolean | no | Filter confidential or public issues. |
|
||||
| `created_after` | datetime | no | Return issues created on or after the given time |
|
||||
| `created_before` | datetime | no | Return issues created on or before the given time |
|
||||
| `due_date` | string | no | Return issues that have no due date (`0`) or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `0` (no due date), `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`. _(Introduced in [GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/233420))_ |
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `iids[]` | integer array | no | Return only the issues having the given `iid` |
|
||||
| `labels` | string | no | Comma-separated list of label names, issues must have all labels to be returned. `None` lists all issues with no labels. `Any` lists all issues with at least one label. `No+Label` (Deprecated) lists all issues with no labels. Predefined names are case-insensitive. |
|
||||
| `milestone` | string | no | The milestone title. `None` lists all issues with no milestone. `Any` lists all issues that have an assigned milestone. |
|
||||
| `my_reaction_emoji` | string | no | Return issues reacted by the authenticated user by the given `emoji`. `None` returns issues not given a reaction. `Any` returns issues given at least one reaction. _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/14016) in GitLab 10.0)_ |
|
||||
| `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` |
|
||||
| `order_by` | string | no | Return issues ordered by `created_at`, `updated_at`, `priority`, `due_date`, `relative_position`, `label_priority`, `milestone_due`, `popularity`, `weight` fields. Default is `created_at` |
|
||||
| `scope` | string | no | Return issues for the given scope: `created_by_me`, `assigned_to_me` or `all`.<br> For versions before 11.0, use the now deprecated `created-by-me` or `assigned-to-me` scopes instead.<br> _([Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/13004) in GitLab 9.5. [Changed to snake_case](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/18935) in GitLab 11.0)_ |
|
||||
| `search` | string | no | Search project issues against their `title` and `description` |
|
||||
| `sort` | string | no | Return issues sorted in `asc` or `desc` order. Default is `desc` |
|
||||
| `state` | string | no | Return all issues or just those that are `opened` or `closed` |
|
||||
| `updated_after` | datetime | no | Return issues updated on or after the given time |
|
||||
| `updated_before` | datetime | no | Return issues updated on or before the given time |
|
||||
| `confidential` | boolean | no | Filter confidential or public issues. |
|
||||
| `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` |
|
||||
| `due_date` | string | no | Return issues that have no due date (`0`) or whose due date is this week, this month, between two weeks ago and next month, or which are overdue. Accepts: `0` (no due date), `overdue`, `week`, `month`, `next_month_and_previous_two_weeks`. _(Introduced in [GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/233420))_ |
|
||||
| `weight` **(STARTER)** | integer | no | Return issues with the specified `weight`. `None` returns issues with no weight assigned. `Any` returns issues with a weight assigned. |
|
||||
| `with_labels_details` | boolean | no | If `true`, the response returns more details for each label in labels field: `:name`, `:color`, `:description`, `:description_html`, `:text_color`. Default is `false`. `description_html` Introduced in [GitLab 12.7](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/21413) |
|
||||
|
||||
```shell
|
||||
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/4/issues"
|
||||
|
@ -517,7 +527,7 @@ Example response:
|
|||
]
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -531,7 +541,7 @@ the `weight` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see
|
||||
the `health_status` parameter:
|
||||
|
||||
```json
|
||||
|
@ -545,15 +555,18 @@ the `health_status` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## Single issue
|
||||
|
||||
Get a single project issue.
|
||||
|
||||
If the project is private or the issue is confidential, credentials will need to be provided for authorization.
|
||||
If the project is private or the issue is confidential, you need to provide credentials to authorize.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
@ -653,7 +666,7 @@ Example response:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -665,7 +678,7 @@ the `weight` parameter:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Premium](https://about.gitlab.com/pricing/) will additionally see
|
||||
Users on GitLab [Premium](https://about.gitlab.com/pricing/) can also see
|
||||
the `epic` property:
|
||||
|
||||
```javascript
|
||||
|
@ -684,8 +697,8 @@ the `epic` property:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also additionally see
|
||||
the `health_status` property:
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see the `health_status`
|
||||
property:
|
||||
|
||||
```json
|
||||
[
|
||||
|
@ -698,11 +711,15 @@ the `health_status` property:
|
|||
]
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
**Note**: The `epic_iid` attribute is deprecated and [will be removed in version 5](https://gitlab.com/gitlab-org/gitlab/-/issues/35157).
|
||||
NOTE: **Note:**
|
||||
The `epic_iid` attribute is deprecated and [will be removed in version 5](https://gitlab.com/gitlab-org/gitlab/-/issues/35157).
|
||||
Please use `iid` of the `epic` attribute instead.
|
||||
|
||||
## New issue
|
||||
|
@ -716,17 +733,17 @@ POST /projects/:id/issues
|
|||
| Attribute | Type | Required | Description |
|
||||
|-------------------------------------------|----------------|----------|--------------|
|
||||
| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user |
|
||||
| `iid` | integer/string | no | The internal ID of the project's issue (requires admin or project owner rights) |
|
||||
| `iid` | integer/string | no | The internal ID of the project's issue (requires administrator or project owner rights) |
|
||||
| `title` | string | yes | The title of an issue |
|
||||
| `description` | string | no | The description of an issue. Limited to 1,048,576 characters. |
|
||||
| `confidential` | boolean | no | Set an issue to be confidential. Default is `false`. |
|
||||
| `assignee_ids` | integer array | no | The ID of the user(s) to assign the issue to. |
|
||||
| `milestone_id` | integer | no | The global ID of a milestone to assign issue |
|
||||
| `labels` | string | no | Comma-separated label names for an issue |
|
||||
| `created_at` | string | no | Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` (requires admin or project/group owner rights) |
|
||||
| `created_at` | string | no | Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` (requires administrator or project/group owner rights) |
|
||||
| `due_date` | string | no | Date time string in the format YEAR-MONTH-DAY, for example `2016-03-11` |
|
||||
| `merge_request_to_resolve_discussions_of` | integer | no | The IID of a merge request in which to resolve all issues. This will fill the issue with a default description and mark all discussions as resolved. When passing a description or title, these values will take precedence over the default values.|
|
||||
| `discussion_to_resolve` | string | no | The ID of a discussion to resolve. This will fill in the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
|
||||
| `merge_request_to_resolve_discussions_of` | integer | no | The IID of a merge request in which to resolve all issues. This fills out the issue with a default description and mark all discussions as resolved. When passing a description or title, these values take precedence over the default values.|
|
||||
| `discussion_to_resolve` | string | no | The ID of a discussion to resolve. This fills out the issue with a default description and mark the discussion as resolved. Use in combination with `merge_request_to_resolve_discussions_of`. |
|
||||
| `weight` **(STARTER)** | integer | no | The weight of the issue. Valid values are greater than or equal to 0. |
|
||||
| `epic_id` **(PREMIUM)** | integer | no | ID of the epic to add the issue to. Valid values are greater than or equal to 0. |
|
||||
| `epic_iid` **(PREMIUM)** | integer | no | IID of the epic to add the issue to. Valid values are greater than or equal to 0. (deprecated, [will be removed in version 5](https://gitlab.com/gitlab-org/gitlab/-/issues/35157)) |
|
||||
|
@ -796,7 +813,7 @@ Example response:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -808,7 +825,7 @@ the `weight` parameter:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see
|
||||
the `health_status` parameter:
|
||||
|
||||
```json
|
||||
|
@ -822,9 +839,12 @@ the `health_status` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## Rate limits
|
||||
|
||||
|
@ -853,7 +873,7 @@ PUT /projects/:id/issues/:issue_iid
|
|||
| `add_labels` | string | no | Comma-separated label names to add to an issue. |
|
||||
| `remove_labels`| string | no | Comma-separated label names to remove from an issue. |
|
||||
| `state_event` | string | no | The state event of an issue. Set `close` to close the issue and `reopen` to reopen it |
|
||||
| `updated_at` | string | no | Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` (requires admin or project owner rights). Empty string or null values are not accepted.|
|
||||
| `updated_at` | string | no | Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` (requires administrator or project owner rights). Empty string or null values are not accepted.|
|
||||
| `due_date` | string | no | Date time string in the format YEAR-MONTH-DAY, for example `2016-03-11` |
|
||||
| `weight` **(STARTER)** | integer | no | The weight of the issue. Valid values are greater than or equal to 0. 0 |
|
||||
| `discussion_locked` | boolean | no | Flag indicating if the issue's discussion is locked. If the discussion is locked only project members can add or edit comments. |
|
||||
|
@ -932,7 +952,7 @@ Example response:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -944,7 +964,7 @@ the `weight` parameter:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see
|
||||
the `health_status` parameter:
|
||||
|
||||
```json
|
||||
|
@ -965,7 +985,8 @@ NOTE: **Note:**
|
|||
`assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## Delete an issue
|
||||
|
||||
|
@ -1009,10 +1030,10 @@ curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab
|
|||
|
||||
Moves an issue to a different project. If the target project
|
||||
equals the source project or the user has insufficient permissions to move an
|
||||
issue, error `400` together with an explaining error message is returned.
|
||||
issue, status code `400` and an error message is returned.
|
||||
|
||||
If a given label and/or milestone with the same name also exists in the target
|
||||
project, it will then be assigned to the issue that is being moved.
|
||||
If a given label or milestone with the same name also exists in the target
|
||||
project, it's then assigned to the issue being moved.
|
||||
|
||||
```plaintext
|
||||
POST /projects/:id/issues/:issue_iid/move
|
||||
|
@ -1099,7 +1120,7 @@ Example response:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -1111,7 +1132,7 @@ the `weight` parameter:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Ultimate](https://about.gitlab.com/pricing/) can also see
|
||||
the `health_status` parameter:
|
||||
|
||||
```json
|
||||
|
@ -1125,9 +1146,12 @@ the `health_status` parameter:
|
|||
]
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## Subscribe to an issue
|
||||
|
||||
|
@ -1219,7 +1243,7 @@ Example response:
|
|||
}
|
||||
```
|
||||
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) will also see
|
||||
Users on GitLab [Starter, Bronze, or higher](https://about.gitlab.com/pricing/) can also see
|
||||
the `weight` parameter:
|
||||
|
||||
```json
|
||||
|
@ -1231,9 +1255,12 @@ the `weight` parameter:
|
|||
}
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## Unsubscribe from an issue
|
||||
|
||||
|
@ -1418,9 +1445,12 @@ Example response:
|
|||
}
|
||||
```
|
||||
|
||||
**Note**: `assignee` column is deprecated, now we show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
NOTE: **Note:**
|
||||
The `assignee` column is deprecated. We now show it as a single-sized array `assignees` to conform to the GitLab EE API.
|
||||
|
||||
**Note**: The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value will only be present for issues which were closed after GitLab 10.6 and when the user account that closed the issue still exists.
|
||||
NOTE: **Note:**
|
||||
The `closed_by` attribute was [introduced in GitLab 10.6](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17042). This value is only present for issues closed after GitLab 10.6 and if the user account that closed
|
||||
the issue still exists.
|
||||
|
||||
## Set a time estimate for an issue
|
||||
|
||||
|
@ -1538,7 +1568,7 @@ Example response:
|
|||
|
||||
## Get time tracking stats
|
||||
|
||||
If the project is private or the issue is confidential, credentials will need to be provided for authorization.
|
||||
If the project is private or the issue is confidential, you need to provide credentials to authorize.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
@ -1569,7 +1599,7 @@ Example response:
|
|||
|
||||
Get all the merge requests that are related to the issue.
|
||||
|
||||
If the project is private or the issue is confidential, credentials will need to be provided for authorization.
|
||||
If the project is private or the issue is confidential, you need to provide credentials to authorize.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
@ -1726,9 +1756,9 @@ Example response:
|
|||
|
||||
## List merge requests that will close issue on merge
|
||||
|
||||
Get all the merge requests that will close issue when merged.
|
||||
Get all the merge requests that will close an issue when merged.
|
||||
|
||||
If the project is private or the issue is confidential, credentials will need to be provided for authorization.
|
||||
If the project is private or the issue is confidential, you need to provide credentials to authorize.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
@ -1804,7 +1834,7 @@ Example response:
|
|||
|
||||
## Participants on issues
|
||||
|
||||
If the project is private or the issue is confidential, credentials will need to be provided for authorization.
|
||||
If the project is private or the issue is confidential, you need to provide credentials to authorize.
|
||||
The preferred way to do this, is by using [personal access tokens](../user/profile/personal_access_tokens.md).
|
||||
|
||||
```plaintext
|
||||
|
|
|
@ -80,7 +80,7 @@ Once you're familiar with how GitLab CI/CD works, see the
|
|||
for all the attributes you can set and use.
|
||||
|
||||
NOTE: **Note:**
|
||||
GitLab CI/CD and [shared runners](runners/README.md#shared-runners) are enabled in GitLab.com and available for all users, limited only to the [user's pipelines quota](../user/gitlab_com/index.md#shared-runners).
|
||||
GitLab CI/CD and [shared runners](runners/README.md#shared-runners) are enabled on GitLab.com and available for all users, limited only by the [pipeline quota](../user/gitlab_com/index.md#shared-runners).
|
||||
|
||||
## Concepts
|
||||
|
||||
|
@ -93,7 +93,7 @@ GitLab CI/CD uses a number of concepts to describe and run your build and deploy
|
|||
| [Environments](environments/index.md) | Deploy your application to different environments (e.g., staging, production). |
|
||||
| [Job artifacts](pipelines/job_artifacts.md) | Output, use, and reuse job artifacts. |
|
||||
| [Cache dependencies](caching/index.md) | Cache your dependencies for a faster execution. |
|
||||
| [GitLab Runner](https://docs.gitlab.com/runner/) | Configure your own GitLab Runners to execute your scripts. |
|
||||
| [GitLab Runner](https://docs.gitlab.com/runner/) | Configure your own runners to execute your scripts. |
|
||||
|
||||
## Configuration
|
||||
|
||||
|
@ -108,7 +108,7 @@ GitLab CI/CD supports numerous configuration options:
|
|||
| [Pipeline triggers](triggers/README.md) | Trigger pipelines through the API. |
|
||||
| [Pipelines for Merge Requests](merge_request_pipelines/index.md) | Design a pipeline structure for running a pipeline in merge requests. |
|
||||
| [Integrate with Kubernetes clusters](../user/project/clusters/index.md) | Connect your project to Google Kubernetes Engine (GKE) or an existing Kubernetes cluster. |
|
||||
| [Optimize GitLab and Runner for large repositories](large_repositories/index.md) | Recommended strategies for handling large repositories. |
|
||||
| [Optimize GitLab and GitLab Runner for large repositories](large_repositories/index.md) | Recommended strategies for handling large repositories. |
|
||||
| [`.gitlab-ci.yml` full reference](yaml/README.md) | All the attributes you can use with GitLab CI/CD. |
|
||||
|
||||
Note that certain operations can only be performed according to the
|
||||
|
|
|
@ -35,12 +35,12 @@ There are three methods to enable the use of `docker build` and `docker run`
|
|||
during jobs, each with their own tradeoffs.
|
||||
|
||||
An alternative to using `docker build` is to [use kaniko](using_kaniko.md).
|
||||
This avoids having to execute Runner in privileged mode.
|
||||
This avoids having to execute a runner in privileged mode.
|
||||
|
||||
TIP: **Tip:**
|
||||
To see how Docker and Runner are configured for shared Runners on
|
||||
GitLab.com, see [GitLab.com Shared
|
||||
Runners](../../user/gitlab_com/index.md#shared-runners).
|
||||
To see how Docker and GitLab Runner are configured for shared runners on
|
||||
GitLab.com, see [GitLab.com shared
|
||||
runners](../../user/gitlab_com/index.md#shared-runners).
|
||||
|
||||
### Use shell executor
|
||||
|
||||
|
@ -123,7 +123,7 @@ not without its own challenges:
|
|||
- By default, Docker 17.09 and higher uses `--storage-driver overlay2` which is
|
||||
the recommended storage driver. See [Using the overlayfs driver](#use-the-overlayfs-driver)
|
||||
for details.
|
||||
- Since the `docker:19.03.12-dind` container and the Runner container don't share their
|
||||
- Since the `docker:19.03.12-dind` container and the runner container don't share their
|
||||
root file system, the job's working directory can be used as a mount point for
|
||||
child containers. For example, if you have files you want to share with a
|
||||
child container, you may create a subdirectory under `/builds/$CI_PROJECT_PATH`
|
||||
|
@ -160,7 +160,7 @@ details.
|
|||
The Docker daemon supports connection over TLS and it's done by default
|
||||
for Docker 19.03.12 or higher. This is the **suggested** way to use the
|
||||
Docker-in-Docker service and
|
||||
[GitLab.com Shared Runners](../../user/gitlab_com/index.md#shared-runners)
|
||||
[GitLab.com shared runners](../../user/gitlab_com/index.md#shared-runners)
|
||||
support this.
|
||||
|
||||
1. Install [GitLab Runner](https://docs.gitlab.com/runner/install/).
|
||||
|
@ -179,7 +179,7 @@ support this.
|
|||
--docker-volumes "/certs/client"
|
||||
```
|
||||
|
||||
The above command registers a new Runner to use the special
|
||||
The above command registers a new runner to use the special
|
||||
`docker:19.03.12` image, which is provided by Docker. **Notice that it's
|
||||
using the `privileged` mode to start the build and service
|
||||
containers.** If you want to use [Docker-in-Docker](https://www.docker.com/blog/docker-can-now-run-within-docker/) mode, you always
|
||||
|
@ -255,7 +255,7 @@ Sometimes there are legitimate reasons why you might want to disable TLS.
|
|||
For example, you have no control over the GitLab Runner configuration
|
||||
that you are using.
|
||||
|
||||
Assuming that the Runner `config.toml` is similar to:
|
||||
Assuming that the runner's `config.toml` is similar to:
|
||||
|
||||
```toml
|
||||
[[runners]]
|
||||
|
@ -337,10 +337,10 @@ In order to do that, follow the steps:
|
|||
--docker-volumes /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
|
||||
The above command registers a new Runner to use the special
|
||||
The above command registers a new runner to use the special
|
||||
`docker:19.03.12` image which is provided by Docker. **Notice that it's using
|
||||
the Docker daemon of the Runner itself, and any containers spawned by Docker
|
||||
commands are siblings of the Runner rather than children of the Runner.**
|
||||
the Docker daemon of the runner itself, and any containers spawned by Docker
|
||||
commands are siblings of the runner rather than children of the runner.**
|
||||
This may have complications and limitations that are unsuitable for your workflow.
|
||||
|
||||
The above command creates a `config.toml` entry similar to this:
|
||||
|
@ -454,7 +454,7 @@ The steps in the `script` section for the `build` stage can be summed up to:
|
|||
## Use the OverlayFS driver
|
||||
|
||||
NOTE: **Note:**
|
||||
The shared Runners on GitLab.com use the `overlay2` driver by default.
|
||||
The shared runners on GitLab.com use the `overlay2` driver by default.
|
||||
|
||||
By default, when using `docker:dind`, Docker uses the `vfs` storage driver which
|
||||
copies the filesystem on every run. This is a disk-intensive operation
|
||||
|
@ -504,10 +504,10 @@ environment variable in the
|
|||
environment = ["DOCKER_DRIVER=overlay2"]
|
||||
```
|
||||
|
||||
If you're running multiple Runners, you have to modify all configuration files.
|
||||
If you're running multiple runners, you have to modify all configuration files.
|
||||
|
||||
NOTE: **Note:**
|
||||
Read more about the [Runner configuration](https://docs.gitlab.com/runner/configuration/)
|
||||
Read more about the [runner configuration](https://docs.gitlab.com/runner/configuration/)
|
||||
and [using the OverlayFS storage driver](https://docs.docker.com/engine/userguide/storagedriver/overlayfs-driver/).
|
||||
|
||||
## Using the GitLab Container Registry
|
||||
|
|
|
@ -26,7 +26,7 @@ test them on a dedicated CI server.
|
|||
|
||||
## Register Docker Runner
|
||||
|
||||
To use GitLab Runner with Docker you need to [register a new Runner](https://docs.gitlab.com/runner/register/)
|
||||
To use GitLab Runner with Docker you need to [register a new runner](https://docs.gitlab.com/runner/register/)
|
||||
to use the `docker` executor.
|
||||
|
||||
An example can be seen below. First we set up a temporary template to supply the services:
|
||||
|
@ -112,7 +112,7 @@ It may be a database like MySQL, or Redis, and even `docker:stable-dind` which
|
|||
allows you to use Docker in Docker. It can be practically anything that's
|
||||
required for the CI/CD job to proceed and is accessed by network.
|
||||
|
||||
To make sure this works, the Runner:
|
||||
To make sure this works, the runner:
|
||||
|
||||
1. Checks which ports are exposed from the container by default.
|
||||
1. Starts a special container that waits for these ports to be accessible.
|
||||
|
@ -382,7 +382,7 @@ services:
|
|||
- mysql:latest
|
||||
```
|
||||
|
||||
The Runner would start two containers using the `mysql:latest` image, but both
|
||||
The runner would start two containers using the `mysql:latest` image, but both
|
||||
of them would be added to the job's container with the `mysql` alias based on
|
||||
the [default hostname naming](#accessing-the-services). This would end with one
|
||||
of the services not being accessible.
|
||||
|
@ -398,7 +398,7 @@ services:
|
|||
alias: mysql-2
|
||||
```
|
||||
|
||||
The Runner still starts two containers using the `mysql:latest` image,
|
||||
The runner still starts two containers using the `mysql:latest` image,
|
||||
however now each of them are also accessible with the alias configured
|
||||
in `.gitlab-ci.yml` file.
|
||||
|
||||
|
@ -448,23 +448,23 @@ As you can see, the syntax of `command` is similar to [Dockerfile's `CMD`](https
|
|||
> Introduced in GitLab and GitLab Runner 9.4. Read more about the [extended configuration options](#extended-docker-configuration-options).
|
||||
|
||||
Before showing the available entrypoint override methods, let's describe shortly
|
||||
how the Runner starts and uses a Docker image for the containers used in the
|
||||
how the runner starts and uses a Docker image for the containers used in the
|
||||
CI jobs:
|
||||
|
||||
1. The Runner starts a Docker container using the defined entrypoint (default
|
||||
1. The runner starts a Docker container using the defined entrypoint (default
|
||||
from `Dockerfile` that may be overridden in `.gitlab-ci.yml`)
|
||||
1. The Runner attaches itself to a running container.
|
||||
1. The Runner prepares a script (the combination of
|
||||
1. The runner attaches itself to a running container.
|
||||
1. The runner prepares a script (the combination of
|
||||
[`before_script`](../yaml/README.md#before_script-and-after_script),
|
||||
[`script`](../yaml/README.md#script),
|
||||
and [`after_script`](../yaml/README.md#before_script-and-after_script)).
|
||||
1. The Runner sends the script to the container's shell STDIN and receives the
|
||||
1. The runner sends the script to the container's shell STDIN and receives the
|
||||
output.
|
||||
|
||||
To override the entrypoint of a Docker image, the recommended solution is to
|
||||
define an empty `entrypoint` in `.gitlab-ci.yml`, so the Runner does not start
|
||||
define an empty `entrypoint` in `.gitlab-ci.yml`, so the runner does not start
|
||||
a useless shell layer. However, that does not work for all Docker versions, and
|
||||
you should check which one your Runner is using. Specifically:
|
||||
you should check which one your runner is using. Specifically:
|
||||
|
||||
- If Docker 17.06 or later is used, the `entrypoint` can be set to an empty value.
|
||||
- If Docker 17.03 or previous versions are used, the `entrypoint` can be set to
|
||||
|
@ -477,7 +477,7 @@ inside it and you would like to use it as a base image for your job because you
|
|||
want to execute some tests with this database binary. Let's also assume that
|
||||
this image is configured with `/usr/bin/super-sql run` as an entrypoint. That
|
||||
means that when starting the container without additional options, it runs
|
||||
the database's process, while Runner expects that the image has no
|
||||
the database's process, while runner expects that the image has no
|
||||
entrypoint or that the entrypoint is prepared to start a shell command.
|
||||
|
||||
With the extended Docker configuration options, instead of creating your
|
||||
|
@ -527,7 +527,7 @@ To define which should be used, the GitLab Runner process reads the configuratio
|
|||
- `DOCKER_AUTH_CONFIG` variable provided as either:
|
||||
- A [variable](../variables/README.md#gitlab-cicd-environment-variables) in `.gitlab-ci.yml`.
|
||||
- A project's variables stored on the projects **Settings > CI/CD** page.
|
||||
- `DOCKER_AUTH_CONFIG` variable provided as environment variable in `config.toml` of the Runner.
|
||||
- `DOCKER_AUTH_CONFIG` variable provided as environment variable in `config.toml` of the runner.
|
||||
- `config.json` file placed in `$HOME/.docker` directory of the user running GitLab Runner process.
|
||||
If the `--user` flag is provided to run the GitLab Runner child processes as unprivileged user,
|
||||
the home directory of the main GitLab Runner process user is used.
|
||||
|
@ -543,7 +543,7 @@ runtime.
|
|||
- This feature requires GitLab Runner **1.8** or higher.
|
||||
- For GitLab Runner versions **>= 0.6, <1.8** there was a partial
|
||||
support for using private registries, which required manual configuration
|
||||
of credentials on runner's host. We recommend to upgrade your Runner to
|
||||
of credentials on runner's host. We recommend to upgrade your runner to
|
||||
at least version **1.8** if you want to use private registries.
|
||||
- Available for [Kubernetes executor](https://docs.gitlab.com/runner/executors/kubernetes.html)
|
||||
in GitLab Runner 13.1 and later.
|
||||
|
@ -556,9 +556,9 @@ private registry. Both require setting the environment variable
|
|||
|
||||
1. Per-job: To configure one job to access a private registry, add
|
||||
`DOCKER_AUTH_CONFIG` as a job variable.
|
||||
1. Per-runner: To configure a Runner so all its jobs can access a
|
||||
1. Per-runner: To configure a runner so all its jobs can access a
|
||||
private registry, add `DOCKER_AUTH_CONFIG` to the environment in the
|
||||
Runner's configuration.
|
||||
runner's configuration.
|
||||
|
||||
See below for examples of each.
|
||||
|
||||
|
@ -652,12 +652,12 @@ registries to the `"auths"` hash as described above.
|
|||
|
||||
NOTE: **Note:**
|
||||
The full `hostname:port` combination is required everywhere
|
||||
for the Runner to match the `DOCKER_AUTH_CONFIG`. For example, if
|
||||
for the runner to match the `DOCKER_AUTH_CONFIG`. For example, if
|
||||
`registry.example.com:5000/namespace/image:tag` is specified in `.gitlab-ci.yml`,
|
||||
then the `DOCKER_AUTH_CONFIG` must also specify `registry.example.com:5000`.
|
||||
Specifying only `registry.example.com` does not work.
|
||||
|
||||
### Configuring a Runner
|
||||
### Configuring a runner
|
||||
|
||||
If you have many pipelines that access the same registry, it is
|
||||
probably better to set up registry access at the runner level. This
|
||||
|
@ -670,16 +670,16 @@ registry with the same privilege, even across projects. If you need to
|
|||
control access to the registry, you need to be sure to control
|
||||
access to the runner.
|
||||
|
||||
To add `DOCKER_AUTH_CONFIG` to a Runner:
|
||||
To add `DOCKER_AUTH_CONFIG` to a runner:
|
||||
|
||||
1. Modify the Runner's `config.toml` file as follows:
|
||||
1. Modify the runner's `config.toml` file as follows:
|
||||
|
||||
```toml
|
||||
[[runners]]
|
||||
environment = ["DOCKER_AUTH_CONFIG={\"auths\":{\"registry.example.com:5000\":{\"auth\":\"bXlfdXNlcm5hbWU6bXlfcGFzc3dvcmQ=\"}}}"]
|
||||
```
|
||||
|
||||
1. Restart the Runner service.
|
||||
1. Restart the runner service.
|
||||
|
||||
NOTE: **Note:**
|
||||
The double quotes included in the `DOCKER_AUTH_CONFIG`
|
||||
|
@ -687,7 +687,7 @@ data must be escaped with backslashes. This prevents them from being
|
|||
interpreted as TOML.
|
||||
|
||||
NOTE: **Note:**
|
||||
The `environment` option is a list. So your Runner may
|
||||
The `environment` option is a list. So your runner may
|
||||
have existing entries and you should add this to the list, not replace
|
||||
it.
|
||||
|
||||
|
@ -713,7 +713,7 @@ To configure credentials store, follow these steps:
|
|||
}
|
||||
```
|
||||
|
||||
- Or, if you're running self-managed Runners, add the above JSON to
|
||||
- Or, if you're running self-managed runners, add the above JSON to
|
||||
`${GITLAB_RUNNER_HOME}/.docker/config.json`. GitLab Runner reads this configuration file
|
||||
and uses the needed helper for this specific repository.
|
||||
|
||||
|
@ -762,7 +762,7 @@ To configure access for `aws_account_id.dkr.ecr.region.amazonaws.com`, follow th
|
|||
|
||||
This configures Docker to use the credential helper for all Amazon ECR registries.
|
||||
|
||||
- Or, if you're running self-managed Runners,
|
||||
- Or, if you're running self-managed runners,
|
||||
add the above JSON to `${GITLAB_RUNNER_HOME}/.docker/config.json`.
|
||||
GitLab Runner reads this configuration file and uses the needed helper for this
|
||||
specific repository.
|
||||
|
|
|
@ -22,8 +22,8 @@ build](using_docker_build.md#use-docker-in-docker-workflow-with-docker-executor)
|
|||
|
||||
## Requirements
|
||||
|
||||
In order to utilize kaniko with GitLab, a [GitLab Runner](https://docs.gitlab.com/runner/)
|
||||
using one of the following executors is required:
|
||||
In order to utilize kaniko with GitLab, [a runner](https://docs.gitlab.com/runner/)
|
||||
with one of the following executors is required:
|
||||
|
||||
- [Kubernetes](https://docs.gitlab.com/runner/executors/kubernetes.html).
|
||||
- [Docker](https://docs.gitlab.com/runner/executors/docker.html).
|
||||
|
@ -100,8 +100,8 @@ The [Least Privilege Container Builds with Kaniko on GitLab](https://www.youtube
|
|||
video is a walkthrough of the [Kaniko Docker Build](https://gitlab.com/guided-explorations/containers/kaniko-docker-build)
|
||||
Guided Exploration project pipeline. It was tested on:
|
||||
|
||||
- [GitLab.com Shared Runners](../../user/gitlab_com/index.md#shared-runners)
|
||||
- [The Kubernetes Runner executor](https://docs.gitlab.com/runner/executors/kubernetes.html)
|
||||
- [GitLab.com shared runners](../../user/gitlab_com/index.md#shared-runners)
|
||||
- [The Kubernetes runner executor](https://docs.gitlab.com/runner/executors/kubernetes.html)
|
||||
|
||||
The example can be copied to your own group or instance for testing. More details
|
||||
on what other GitLab CI patterns are demonstrated are available at the project page.
|
||||
|
|
|
@ -59,7 +59,7 @@ The rest of this section illustrates how to configure environments and deploymen
|
|||
an example scenario. It assumes you have already:
|
||||
|
||||
- Created a [project](../../gitlab-basics/create-project.md) in GitLab.
|
||||
- Set up [a Runner](../runners/README.md).
|
||||
- Set up [a runner](../runners/README.md).
|
||||
|
||||
In the scenario:
|
||||
|
||||
|
@ -138,9 +138,9 @@ In summary, with the above `.gitlab-ci.yml` we have achieved the following:
|
|||
job will deploy our code to a staging server while the deployment
|
||||
will be recorded in an environment named `staging`.
|
||||
|
||||
#### Environment variables and Runner
|
||||
#### Environment variables and runners
|
||||
|
||||
Starting with GitLab 8.15, the environment name is exposed to the Runner in
|
||||
Starting with GitLab 8.15, the environment name is exposed to the runner in
|
||||
two forms:
|
||||
|
||||
- `$CI_ENVIRONMENT_NAME`. The name given in `.gitlab-ci.yml` (with any variables
|
||||
|
@ -154,7 +154,7 @@ If you change the name of an existing environment, the:
|
|||
- `$CI_ENVIRONMENT_SLUG` variable will remain unchanged to prevent unintended side
|
||||
effects.
|
||||
|
||||
Starting with GitLab 9.3, the environment URL is exposed to the Runner via
|
||||
Starting with GitLab 9.3, the environment URL is exposed to the runner via
|
||||
`$CI_ENVIRONMENT_URL`. The URL is expanded from either:
|
||||
|
||||
- `.gitlab-ci.yml`.
|
||||
|
@ -317,14 +317,14 @@ including:
|
|||
However, you cannot use variables defined:
|
||||
|
||||
- Under `script`.
|
||||
- On the Runner's side.
|
||||
- On the runner's side.
|
||||
|
||||
There are also other variables that are unsupported in the context of `environment:name`.
|
||||
For more information, see [Where variables can be used](../variables/where_variables_can_be_used.md).
|
||||
|
||||
#### Example configuration
|
||||
|
||||
GitLab Runner exposes various [environment variables](../variables/README.md) when a job runs, so
|
||||
Runners expose various [environment variables](../variables/README.md) when a job runs, so
|
||||
you can use them as environment names.
|
||||
|
||||
In the following example, the job will deploy to all branches except `master`:
|
||||
|
@ -525,7 +525,7 @@ The complete example provides the following workflow to developers:
|
|||
- Push the branch to GitLab.
|
||||
- Create a merge request.
|
||||
|
||||
Behind the scenes, GitLab Runner will:
|
||||
Behind the scenes, the runner will:
|
||||
|
||||
- Pick up the changes and start running the jobs.
|
||||
- Run the jobs sequentially as defined in `stages`:
|
||||
|
@ -700,7 +700,7 @@ stop_review:
|
|||
```
|
||||
|
||||
Setting the [`GIT_STRATEGY`](../yaml/README.md#git-strategy) to `none` is necessary in the
|
||||
`stop_review` job so that the [GitLab Runner](https://docs.gitlab.com/runner/) won't
|
||||
`stop_review` job so that the [runner](https://docs.gitlab.com/runner/) won't
|
||||
try to check out the code after the branch is deleted.
|
||||
|
||||
When you have an environment that has a stop action defined (typically when
|
||||
|
|
|
@ -26,7 +26,7 @@ terminals are available when using your own group or project runner.
|
|||
|
||||
Two things need to be configured for the interactive web terminal to work:
|
||||
|
||||
- The Runner needs to have [`[session_server]` configured
|
||||
- The runner needs to have [`[session_server]` configured
|
||||
properly](https://docs.gitlab.com/runner/configuration/advanced-configuration.html#the-session_server-section)
|
||||
- If you are using a reverse proxy with your GitLab instance, web terminals need to be
|
||||
[enabled](../../administration/integration/terminal.md#enabling-and-disabling-terminal-support)
|
||||
|
|
|
@ -41,7 +41,7 @@ This significantly speeds up fetching of changes from Git repositories,
|
|||
especially if the repository has a very long backlog consisting of number
|
||||
of big files as we effectively reduce amount of data transfer.
|
||||
|
||||
The following example makes GitLab Runner shallow clone to fetch only a given branch;
|
||||
The following example makes the runner shallow clone to fetch only a given branch;
|
||||
it does not fetch any other branches nor tags.
|
||||
|
||||
```yaml
|
||||
|
@ -226,15 +226,15 @@ with other concurrent jobs running.
|
|||
### Store custom clone options in `config.toml`
|
||||
|
||||
Ideally, all job-related configuration should be stored in `.gitlab-ci.yml`.
|
||||
However, sometimes it is desirable to make these schemes part of Runner configuration.
|
||||
However, sometimes it is desirable to make these schemes part of the runner's configuration.
|
||||
|
||||
In the above example of Forks, making this configuration discoverable for users may be preferred,
|
||||
but this brings administrative overhead as the `.gitlab-ci.yml` needs to be updated for each branch.
|
||||
In such cases, it might be desirable to keep the `.gitlab-ci.yml` clone path agnostic, but make it
|
||||
a configuration of Runner.
|
||||
a configuration of the runner.
|
||||
|
||||
We can extend our [`config.toml`](https://docs.gitlab.com/runner/configuration/advanced-configuration.html)
|
||||
with the following specification that will be used by Runner if `.gitlab-ci.yml` will not override it:
|
||||
with the following specification that will be used by the runner if `.gitlab-ci.yml` will not override it:
|
||||
|
||||
```toml
|
||||
concurrent = 4
|
||||
|
@ -255,7 +255,7 @@ concurrent = 4
|
|||
volumes = ["/builds:/builds", "/cache:/cache"]
|
||||
```
|
||||
|
||||
This makes the cloning configuration to be part of given Runner
|
||||
This makes the cloning configuration to be part of the given runner
|
||||
and does not require us to update each `.gitlab-ci.yml`.
|
||||
|
||||
## Pre-clone step
|
||||
|
|
|
@ -22,7 +22,7 @@ Pipelines comprise:
|
|||
- Jobs, which define *what* to do. For example, jobs that compile or test code.
|
||||
- Stages, which define *when* to run the jobs. For example, stages that run tests after stages that compile the code.
|
||||
|
||||
Jobs are executed by [Runners](../runners/README.md). Multiple jobs in the same stage are executed in parallel,
|
||||
Jobs are executed by [runners](../runners/README.md). Multiple jobs in the same stage are executed in parallel,
|
||||
if there are enough concurrent runners.
|
||||
|
||||
If *all* jobs in a stage succeed, the pipeline moves on to the next stage.
|
||||
|
@ -562,5 +562,5 @@ To illustrate its life cycle:
|
|||
which retains the checkout-SHA of the associated pipeline record.
|
||||
This persistent ref stays intact during the pipeline execution,
|
||||
even if the commit history of the `example` branch has been overwritten by force-push.
|
||||
1. GitLab Runner fetches the persistent pipeline ref and gets source code from the checkout-SHA.
|
||||
1. The runner fetches the persistent pipeline ref and gets source code from the checkout-SHA.
|
||||
1. When the pipeline finished, its persistent ref is cleaned up in a background process.
|
||||
|
|
|
@ -57,12 +57,12 @@ The default value is 60 minutes. Decrease the time limit if you want to impose
|
|||
a hard limit on your jobs' running time or increase it otherwise. In any case,
|
||||
if the job surpasses the threshold, it is marked as failed.
|
||||
|
||||
### Timeout overriding on Runner level
|
||||
### Timeout overriding for runners
|
||||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/17221) in GitLab 10.7.
|
||||
|
||||
Project defined timeout (either specific timeout set by user or the default
|
||||
60 minutes timeout) may be [overridden on Runner level](../runners/README.md#set-maximum-job-timeout-for-a-runner).
|
||||
60 minutes timeout) may be [overridden for runners](../runners/README.md#set-maximum-job-timeout-for-a-runner).
|
||||
|
||||
## Maximum artifacts size **(CORE ONLY)**
|
||||
|
||||
|
|
|
@ -35,15 +35,15 @@ You can call issue numbers, user names, branch names,
|
|||
pipeline and commit IDs, and much more.
|
||||
|
||||
Predefined environment variables are provided by GitLab
|
||||
for the local environment of the Runner.
|
||||
for the local environment of the runner.
|
||||
|
||||
GitLab reads the `.gitlab-ci.yml` file and sends the information
|
||||
to the Runner, where the variables are exposed. The Runner then runs the script commands.
|
||||
to the runner, where the variables are exposed. The runner then runs the script commands.
|
||||
|
||||
### Use predefined environment variables
|
||||
|
||||
You can choose one of the existing predefined variables
|
||||
to be output by the Runner.
|
||||
to be output by the runner.
|
||||
|
||||
This example shows how to output a job's stage by using the predefined variable `CI_JOB_STAGE`.
|
||||
|
||||
|
@ -57,7 +57,7 @@ test_variable:
|
|||
- echo $CI_JOB_STAGE
|
||||
```
|
||||
|
||||
In this case, the Runner outputs the `stage` for the
|
||||
In this case, the runner outputs the `stage` for the
|
||||
job `test_variable`, which is `test`:
|
||||
|
||||
![Output `$CI_JOB_STAGE`](img/ci_job_stage_output_example.png)
|
||||
|
@ -84,7 +84,7 @@ When you need a specific custom environment variable, you can
|
|||
[set it up in the UI](#create-a-custom-variable-in-the-ui), in [the API](../../api/project_level_variables.md),
|
||||
or directly [in the `.gitlab-ci.yml` file](#create-a-custom-variable-in-gitlab-ciyml).
|
||||
|
||||
The variables are used by the Runner any time the pipeline runs.
|
||||
The variables are used by the runner any time the pipeline runs.
|
||||
You can also [override variable values manually for a specific pipeline](../pipelines/index.md#specifying-variables-when-running-manual-jobs).
|
||||
|
||||
There are two types of variables: **Variable** and **File**. You cannot set types in
|
||||
|
@ -145,7 +145,7 @@ The output is:
|
|||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/46806) in GitLab 11.11.
|
||||
|
||||
For variables with the type **Variable**, the Runner creates an environment variable
|
||||
For variables with the type **Variable**, the runner creates an environment variable
|
||||
that uses the key for the name and the value for the value.
|
||||
|
||||
There are [some predefined variables](#custom-variables-validated-by-gitlab) of this type,
|
||||
|
@ -155,8 +155,8 @@ which may be further validated. They appear when you add or update a variable in
|
|||
|
||||
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/46806) in GitLab 11.11.
|
||||
|
||||
For variables with the type **File**, the Runner creates an environment variable that uses the key for the name.
|
||||
For the value, the Runner writes the variable value to a temporary file and uses this path.
|
||||
For variables with the type **File**, the runner creates an environment variable that uses the key for the name.
|
||||
For the value, the runner writes the variable value to a temporary file and uses this path.
|
||||
|
||||
You can use tools like [the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)
|
||||
and [`kubectl`](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#the-kubeconfig-environment-variable)
|
||||
|
@ -250,7 +250,7 @@ All variables are set as environment variables in the build environment, and
|
|||
they are accessible with normal methods that are used to access such variables.
|
||||
In most cases `bash` or `sh` is used to execute the job script.
|
||||
|
||||
To access environment variables, use the syntax for your Runner's [shell](https://docs.gitlab.com/runner/executors/).
|
||||
To access environment variables, use the syntax for your runner's [shell](https://docs.gitlab.com/runner/executors/).
|
||||
|
||||
| Shell | Usage |
|
||||
|----------------------|------------------------------------------|
|
||||
|
@ -445,7 +445,7 @@ To add an instance-level variable:
|
|||
1. Click the **Add variable** button, and fill in the details:
|
||||
|
||||
- **Key**: Must be one line, using only letters, numbers, or `_` (underscore), with no spaces.
|
||||
- **Value**: [Since GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/220028), 10,000 characters allowed. This is also bounded by the limits of the selected Runner operating system. In GitLab 13.0 to 13.2, 700 characters allowed.
|
||||
- **Value**: [Since GitLab 13.3](https://gitlab.com/gitlab-org/gitlab/-/issues/220028), 10,000 characters allowed. This is also bounded by the limits of the selected runner operating system. In GitLab 13.0 to 13.2, 700 characters allowed.
|
||||
- **Type**: `File` or `Variable`.
|
||||
- **Protect variable** (Optional): If selected, the variable is only available in pipelines that run on protected branches or tags.
|
||||
- **Mask variable** (Optional): If selected, the variable's **Value** is not shown in job logs. The variable is not saved if the value does not meet the [masking requirements](#masked-variable-requirements).
|
||||
|
@ -608,7 +608,7 @@ Choose the branch you want to run the pipeline for, then add a variable and its
|
|||
|
||||
![Override variable value](img/override_variable_manual_pipeline.png)
|
||||
|
||||
The Runner overrides the value previously set and uses the custom
|
||||
The runner overrides the value previously set and uses the custom
|
||||
value for this specific pipeline.
|
||||
|
||||
![Manually overridden variable output](img/override_value_via_manual_pipeline_output.png)
|
||||
|
@ -825,7 +825,7 @@ output **will** contain the content of all your variables and any other
|
|||
secrets! The output **will** be uploaded to the GitLab server and made visible
|
||||
in job logs!
|
||||
|
||||
By default, GitLab Runner hides most of the details of what it is doing when
|
||||
By default, the runner hides most of the details of what it is doing when
|
||||
processing a job. This behavior keeps job logs short, and prevents secrets
|
||||
from being leaked into the log unless your script writes them to the screen.
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ For an introduction on this subject, read through the
|
|||
|
||||
Some of the predefined environment variables are available only if a minimum
|
||||
version of [GitLab Runner](https://docs.gitlab.com/runner/) is used. Consult the table below to find the
|
||||
version of Runner required.
|
||||
version of GitLab Runner that's required.
|
||||
|
||||
NOTE: **Note:**
|
||||
Starting with GitLab 9.0, we have deprecated some variables. Read the
|
||||
|
@ -119,7 +119,7 @@ Kubernetes-specific environment variables are detailed in the
|
|||
| `CI_RUNNER_EXECUTABLE_ARCH` | all | 10.6 | The OS/architecture of the GitLab Runner executable (note that this is not necessarily the same as the environment of the executor) |
|
||||
| `CI_RUNNER_ID` | 8.10 | 0.5 | The unique ID of runner being used |
|
||||
| `CI_RUNNER_REVISION` | all | 10.6 | GitLab Runner revision that is executing the current job |
|
||||
| `CI_RUNNER_SHORT_TOKEN` | all | 12.3 | First eight characters of GitLab Runner's token used to authenticate new job requests. Used as Runner's unique ID |
|
||||
| `CI_RUNNER_SHORT_TOKEN` | all | 12.3 | First eight characters of GitLab Runner's token used to authenticate new job requests. Used as runner's unique ID |
|
||||
| `CI_RUNNER_TAGS` | 8.10 | 0.5 | The defined runner tags |
|
||||
| `CI_RUNNER_VERSION` | all | 10.6 | GitLab Runner version that is executing the current job |
|
||||
| `CI_SERVER` | all | all | Mark that job is executed in CI environment |
|
||||
|
|
|
@ -18,13 +18,13 @@ This document describes where and how the different types of variables can be us
|
|||
There are two places defined variables can be used. On the:
|
||||
|
||||
1. GitLab side, in `.gitlab-ci.yml`.
|
||||
1. The runner side, in `config.toml`.
|
||||
1. The GitLab Runner side, in `config.toml`.
|
||||
|
||||
### `.gitlab-ci.yml` file
|
||||
|
||||
| Definition | Can be expanded? | Expansion place | Description |
|
||||
|:-------------------------------------------|:-----------------|:-----------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `environment:url` | yes | GitLab | The variable expansion is made by GitLab's [internal variable expansion mechanism](#gitlab-internal-variable-expansion-mechanism).<br/><br/>Supported are all variables defined for a job (project/group variables, variables from `.gitlab-ci.yml`, variables from triggers, variables from pipeline schedules).<br/><br/>Not supported are variables defined in Runner's `config.toml` and variables created in job's `script`. |
|
||||
| `environment:url` | yes | GitLab | The variable expansion is made by GitLab's [internal variable expansion mechanism](#gitlab-internal-variable-expansion-mechanism).<br/><br/>Supported are all variables defined for a job (project/group variables, variables from `.gitlab-ci.yml`, variables from triggers, variables from pipeline schedules).<br/><br/>Not supported are variables defined in the GitLab Runner `config.toml` and variables created in the job's `script`. |
|
||||
| `environment:name` | yes | GitLab | Similar to `environment:url`, but the variables expansion doesn't support the following:<br/><br/>- Variables that are based on the environment's name (`CI_ENVIRONMENT_NAME`, `CI_ENVIRONMENT_SLUG`).<br/>- Any other variables related to environment (currently only `CI_ENVIRONMENT_URL`).<br/>- [Persisted variables](#persisted-variables). |
|
||||
| `resource_group` | yes | GitLab | Similar to `environment:url`, but the variables expansion doesn't support the following:<br/><br/>- Variables that are based on the environment's name (`CI_ENVIRONMENT_NAME`, `CI_ENVIRONMENT_SLUG`).<br/>- Any other variables related to environment (currently only `CI_ENVIRONMENT_URL`).<br/>- [Persisted variables](#persisted-variables). |
|
||||
| `variables` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
|
@ -39,13 +39,13 @@ There are two places defined variables can be used. On the:
|
|||
### `config.toml` file
|
||||
|
||||
NOTE: **Note:**
|
||||
You can read more about `config.toml` in the [Runner's docs](https://docs.gitlab.com/runner/configuration/advanced-configuration.html).
|
||||
You can read more about `config.toml` in the [GitLab Runner docs](https://docs.gitlab.com/runner/configuration/advanced-configuration.html).
|
||||
|
||||
| Definition | Can be expanded? | Description |
|
||||
|:-------------------------------------|:-----------------|:---------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `runners.environment` | yes | The variable expansion is made by the Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
| `runners.kubernetes.pod_labels` | yes | The Variable expansion is made by the Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
| `runners.kubernetes.pod_annotations` | yes | The Variable expansion is made by the Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
| `runners.environment` | yes | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
| `runners.kubernetes.pod_labels` | yes | The Variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
| `runners.kubernetes.pod_annotations` | yes | The Variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) |
|
||||
|
||||
## Expansion mechanisms
|
||||
|
||||
|
@ -59,7 +59,7 @@ There are three expansion mechanisms:
|
|||
|
||||
The expanded part needs to be in a form of `$variable`, or `${variable}` or `%variable%`.
|
||||
Each form is handled in the same way, no matter which OS/shell will finally handle the job,
|
||||
since the expansion is done in GitLab before any Runner will get the job.
|
||||
since the expansion is done in GitLab before any runner will get the job.
|
||||
|
||||
### GitLab Runner internal variable expansion mechanism
|
||||
|
||||
|
@ -67,7 +67,7 @@ since the expansion is done in GitLab before any Runner will get the job.
|
|||
variables from triggers, pipeline schedules, and manual pipelines.
|
||||
- Not supported: variables defined inside of scripts (e.g., `export MY_VARIABLE="test"`).
|
||||
|
||||
The Runner uses Go's `os.Expand()` method for variable expansion. It means that it will handle
|
||||
The runner uses Go's `os.Expand()` method for variable expansion. It means that it will handle
|
||||
only variables defined as `$variable` and `${variable}`. What's also important, is that
|
||||
the expansion is done only once, so nested variables may or may not work, depending on the
|
||||
ordering of variables definitions.
|
||||
|
|
|
@ -38,8 +38,7 @@ Some jobs use images that are built from external projects:
|
|||
in which the jobs defined in this template use an image that is built using the
|
||||
[`auto-deploy-image`](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image)
|
||||
project. By default, the Helm chart defined in
|
||||
[`auto-deploy-app`](https://gitlab.com/gitlab-org/charts/auto-deploy-app)
|
||||
is used to deploy.
|
||||
[`auto-deploy-app`](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app) is used to deploy.
|
||||
|
||||
There are extra variables that get passed to the CI jobs when Auto
|
||||
DevOps is enabled that are not present in a normal CI job. These can be
|
||||
|
|
|
@ -30,7 +30,8 @@ the `author` field. GitLab team members **should not**.
|
|||
## What warrants a changelog entry?
|
||||
|
||||
- Any change that introduces a database migration, whether it's regular, post,
|
||||
or data migration, **must** have a changelog entry.
|
||||
or data migration, **must** have a changelog entry, even if it is behind a
|
||||
disabled feature flag.
|
||||
- [Security fixes](https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/developer.md)
|
||||
**must** have a changelog entry, without `merge_request` value
|
||||
and with `type` set to `security`.
|
||||
|
@ -43,8 +44,8 @@ the `author` field. GitLab team members **should not**.
|
|||
a changelog entry regardless of these guidelines if the contributor wants one.
|
||||
Example: "Fixed a typo on the search results page."
|
||||
- Any docs-only changes **should not** have a changelog entry.
|
||||
- Any change behind a feature flag **should not** have a changelog entry - unless
|
||||
the feature flag has been defaulted to true.
|
||||
- Any change behind a disabled feature flag **should not** have a changelog entry.
|
||||
- Any change behind an enabled feature flag **should** should have a changelog entry.
|
||||
- A change that [removes a feature flag](feature_flags/development.md) **should** have a changelog entry -
|
||||
only if the feature flag did not default to true already.
|
||||
- A fix for a regression introduced and then fixed in the same release (i.e.,
|
||||
|
|
|
@ -130,7 +130,7 @@ repository or by specifying a project variable:
|
|||
|
||||
- **Bundled chart** - If your project has a `./chart` directory with a `Chart.yaml`
|
||||
file in it, Auto DevOps will detect the chart and use it instead of the
|
||||
[default chart](https://gitlab.com/gitlab-org/charts/auto-deploy-app), enabling
|
||||
[default chart](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app), enabling
|
||||
you to control exactly how your application is deployed.
|
||||
- **Project variable** - Create a [project variable](../../ci/variables/README.md#gitlab-cicd-environment-variables)
|
||||
`AUTO_DEVOPS_CHART` with the URL of a custom chart to use, or create two project
|
||||
|
@ -142,7 +142,7 @@ repository or by specifying a project variable:
|
|||
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/30628) in GitLab 12.6, `.gitlab/auto-deploy-values.yaml` will be used by default for Helm upgrades.
|
||||
|
||||
You can override the default values in the `values.yaml` file in the
|
||||
[default Helm chart](https://gitlab.com/gitlab-org/charts/auto-deploy-app) by either:
|
||||
[default Helm chart](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app) by either:
|
||||
|
||||
- Adding a file named `.gitlab/auto-deploy-values.yaml` to your repository, which is
|
||||
automatically used, if found.
|
||||
|
@ -316,7 +316,7 @@ applications.
|
|||
| `AUTO_DEVOPS_BUILD_IMAGE_CNB_BUILDER` | The builder used when building with Cloud Native Buildpacks. The default builder is `heroku/buildpacks:18`. [More details](stages.md#auto-build-using-cloud-native-buildpacks-beta). |
|
||||
| `AUTO_DEVOPS_BUILD_IMAGE_EXTRA_ARGS` | Extra arguments to be passed to the `docker build` command. Note that using quotes won't prevent word splitting. [More details](#passing-arguments-to-docker-build). |
|
||||
| `AUTO_DEVOPS_BUILD_IMAGE_FORWARDED_CI_VARIABLES` | A [comma-separated list of CI variable names](#forward-ci-variables-to-the-build-environment) to be forwarded to the build environment (the buildpack builder or `docker build`). |
|
||||
| `AUTO_DEVOPS_CHART` | Helm Chart used to deploy your apps. Defaults to the one [provided by GitLab](https://gitlab.com/gitlab-org/charts/auto-deploy-app). |
|
||||
| `AUTO_DEVOPS_CHART` | Helm Chart used to deploy your apps. Defaults to the one [provided by GitLab](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app). |
|
||||
| `AUTO_DEVOPS_CHART_REPOSITORY` | Helm Chart repository used to search for charts. Defaults to `https://charts.gitlab.io`. |
|
||||
| `AUTO_DEVOPS_CHART_REPOSITORY_NAME` | From GitLab 11.11, used to set the name of the Helm repository. Defaults to `gitlab`. |
|
||||
| `AUTO_DEVOPS_CHART_REPOSITORY_USERNAME` | From GitLab 11.11, used to set a username to connect to the Helm repository. Defaults to no credentials. Also set `AUTO_DEVOPS_CHART_REPOSITORY_PASSWORD`. |
|
||||
|
|
|
@ -19,7 +19,7 @@ If you're also using Auto Review Apps and Auto Deploy, and you choose to provide
|
|||
your own `Dockerfile`, you must either:
|
||||
|
||||
- Expose your application to port `5000`, as the
|
||||
[default Helm chart](https://gitlab.com/gitlab-org/charts/auto-deploy-app)
|
||||
[default Helm chart](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app)
|
||||
assumes this port is available.
|
||||
- Override the default values by
|
||||
[customizing the Auto Deploy Helm chart](customize.md#custom-helm-chart).
|
||||
|
@ -237,7 +237,7 @@ a link to the Review App for easy discovery. When the branch or tag is deleted,
|
|||
such as after merging a merge request, the Review App is also deleted.
|
||||
|
||||
Review apps are deployed using the
|
||||
[auto-deploy-app](https://gitlab.com/gitlab-org/charts/auto-deploy-app) chart with
|
||||
[auto-deploy-app](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app) chart with
|
||||
Helm, which you can [customize](customize.md#custom-helm-chart). The application deploys
|
||||
into the [Kubernetes namespace](../../user/project/clusters/index.md#deployment-variables)
|
||||
for the environment.
|
||||
|
@ -355,7 +355,7 @@ scale your pod replicas, and to apply custom arguments to the Auto DevOps `helm
|
|||
commands. This is an easy way to
|
||||
[customize the Auto Deploy Helm chart](customize.md#custom-helm-chart).
|
||||
|
||||
Helm uses the [auto-deploy-app](https://gitlab.com/gitlab-org/charts/auto-deploy-app)
|
||||
Helm uses the [auto-deploy-app](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app)
|
||||
chart to deploy the application into the
|
||||
[Kubernetes namespace](../../user/project/clusters/index.md#deployment-variables)
|
||||
for the environment.
|
||||
|
@ -474,7 +474,7 @@ Some web applications must run extra deployments for "worker processes". For
|
|||
example, Rails applications commonly use separate worker processes
|
||||
to run background tasks like sending emails.
|
||||
|
||||
The [default Helm chart](https://gitlab.com/gitlab-org/charts/auto-deploy-app)
|
||||
The [default Helm chart](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app)
|
||||
used in Auto Deploy
|
||||
[has support for running worker processes](https://gitlab.com/gitlab-org/charts/auto-deploy-app/-/merge_requests/9).
|
||||
|
||||
|
|
|
@ -1421,7 +1421,7 @@ Refer to the [AppArmor chart](https://gitlab.com/gitlab-org/charts/apparmor) for
|
|||
|
||||
After installing AppAmor, you can use profiles by adding Pod Annotations. If you're using Auto
|
||||
DevOps, you can [customize `auto-deploy-values.yaml`](../../topics/autodevops/customize.md#customize-values-for-helm-chart)
|
||||
to annotate your pods. Although it's helpful to be aware of the [list of custom attributes](https://gitlab.com/gitlab-org/charts/auto-deploy-app#gitlabs-auto-deploy-helm-chart), you're only required to set
|
||||
to annotate your pods. Although it's helpful to be aware of the [list of custom attributes](https://gitlab.com/gitlab-org/cluster-integration/auto-deploy-image/-/tree/master/assets/auto-deploy-app#gitlabs-auto-deploy-helm-chart), you're only required to set
|
||||
`podAnnotations` as follows:
|
||||
|
||||
```yaml
|
||||
|
|
|
@ -101,11 +101,15 @@ module API
|
|||
delete ':id/wikis/:slug' do
|
||||
authorize! :admin_wiki, container
|
||||
|
||||
WikiPages::DestroyService
|
||||
response = WikiPages::DestroyService
|
||||
.new(container: container, current_user: current_user)
|
||||
.execute(wiki_page)
|
||||
|
||||
no_content!
|
||||
if response.success?
|
||||
no_content!
|
||||
else
|
||||
render_api_error!(reponse.message)
|
||||
end
|
||||
end
|
||||
|
||||
desc 'Upload an attachment to the wiki repository' do
|
||||
|
|
|
@ -11,8 +11,36 @@ module Gitlab
|
|||
'meta'
|
||||
].freeze
|
||||
NO_CHANGELOG_CATEGORIES = %i[docs none].freeze
|
||||
CREATE_CHANGELOG_COMMAND = 'bin/changelog -m %<mr_iid>s "%<mr_title>s"'
|
||||
CREATE_EE_CHANGELOG_COMMAND = 'bin/changelog --ee -m %<mr_iid>s "%<mr_title>s"'
|
||||
CHANGELOG_MODIFIED_URL_TEXT = "**CHANGELOG.md was edited.** Please remove the additions and create a CHANGELOG entry.\n\n"
|
||||
CHANGELOG_MISSING_URL_TEXT = "**[CHANGELOG missing](https://docs.gitlab.com/ee/development/changelog.html)**:\n\n"
|
||||
|
||||
def needed?
|
||||
OPTIONAL_CHANGELOG_MESSAGE = <<~MSG
|
||||
If you want to create a changelog entry for GitLab FOSS, run the following:
|
||||
|
||||
#{CREATE_CHANGELOG_COMMAND}
|
||||
|
||||
If you want to create a changelog entry for GitLab EE, run the following instead:
|
||||
|
||||
#{CREATE_EE_CHANGELOG_COMMAND}
|
||||
|
||||
If this merge request [doesn't need a CHANGELOG entry](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry), feel free to ignore this message.
|
||||
MSG
|
||||
|
||||
REQUIRED_CHANGELOG_MESSAGE = <<~MSG
|
||||
To create a changelog entry, run the following:
|
||||
|
||||
#{CREATE_CHANGELOG_COMMAND}
|
||||
|
||||
This merge request requires a changelog entry because it [introduces a database migration](https://docs.gitlab.com/ee/development/changelog.html#what-warrants-a-changelog-entry).
|
||||
MSG
|
||||
|
||||
def required?
|
||||
git.added_files.any? { |path| path =~ %r{\Adb/(migrate|post_migrate)/} }
|
||||
end
|
||||
|
||||
def optional?
|
||||
categories_need_changelog? && without_no_changelog_label?
|
||||
end
|
||||
|
||||
|
@ -20,16 +48,35 @@ module Gitlab
|
|||
@found ||= git.added_files.find { |path| path =~ %r{\A(ee/)?(changelogs/unreleased)(-ee)?/} }
|
||||
end
|
||||
|
||||
def sanitized_mr_title
|
||||
gitlab.mr_json["title"].gsub(/^WIP: */, '').gsub(/`/, '\\\`')
|
||||
end
|
||||
|
||||
def ee_changelog?
|
||||
found.start_with?('ee/')
|
||||
end
|
||||
|
||||
def modified_text
|
||||
CHANGELOG_MODIFIED_URL_TEXT +
|
||||
format(OPTIONAL_CHANGELOG_MESSAGE, mr_iid: mr_iid, mr_title: sanitized_mr_title)
|
||||
end
|
||||
|
||||
def required_text
|
||||
CHANGELOG_MISSING_URL_TEXT +
|
||||
format(REQUIRED_CHANGELOG_MESSAGE, mr_iid: mr_iid, mr_title: sanitized_mr_title)
|
||||
end
|
||||
|
||||
def optional_text
|
||||
CHANGELOG_MISSING_URL_TEXT +
|
||||
format(OPTIONAL_CHANGELOG_MESSAGE, mr_iid: mr_iid, mr_title: sanitized_mr_title)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def mr_iid
|
||||
gitlab.mr_json["iid"]
|
||||
end
|
||||
|
||||
def sanitized_mr_title
|
||||
helper.sanitize_mr_title(gitlab.mr_json["title"])
|
||||
end
|
||||
|
||||
def categories_need_changelog?
|
||||
(helper.changes_by_category.keys - NO_CHANGELOG_CATEGORIES).any?
|
||||
end
|
||||
|
|
|
@ -6,7 +6,6 @@ module Gitlab
|
|||
include Gitlab::Git::WrapsGitalyErrors
|
||||
|
||||
DuplicatePageError = Class.new(StandardError)
|
||||
OperationError = Class.new(StandardError)
|
||||
|
||||
DEFAULT_PAGINATION = Kaminari.config.default_per_page
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ module Gitlab
|
|||
class GroupSearchResults < SearchResults
|
||||
attr_reader :group
|
||||
|
||||
def initialize(current_user, limit_projects, group, query, default_project_filter: false)
|
||||
super(current_user, limit_projects, query, default_project_filter: default_project_filter)
|
||||
|
||||
def initialize(current_user, query, limit_projects = nil, group:, default_project_filter: false)
|
||||
@group = group
|
||||
|
||||
super(current_user, query, limit_projects, default_project_filter: default_project_filter)
|
||||
end
|
||||
|
||||
# rubocop:disable CodeReuse/ActiveRecord
|
||||
|
|
|
@ -4,11 +4,11 @@ module Gitlab
|
|||
class ProjectSearchResults < SearchResults
|
||||
attr_reader :project, :repository_ref
|
||||
|
||||
def initialize(current_user, project, query, repository_ref = nil)
|
||||
@current_user = current_user
|
||||
def initialize(current_user, query, project:, repository_ref: nil)
|
||||
@project = project
|
||||
@repository_ref = repository_ref.presence
|
||||
@query = query
|
||||
|
||||
super(current_user, query, [project])
|
||||
end
|
||||
|
||||
def objects(scope, page: nil, per_page: DEFAULT_PER_PAGE, preload_method: nil)
|
||||
|
|
|
@ -19,10 +19,10 @@ module Gitlab
|
|||
# query
|
||||
attr_reader :default_project_filter
|
||||
|
||||
def initialize(current_user, limit_projects, query, default_project_filter: false)
|
||||
def initialize(current_user, query, limit_projects = nil, default_project_filter: false)
|
||||
@current_user = current_user
|
||||
@limit_projects = limit_projects || Project.all
|
||||
@query = query
|
||||
@limit_projects = limit_projects || Project.all
|
||||
@default_project_filter = default_project_filter
|
||||
end
|
||||
|
||||
|
|
|
@ -4,11 +4,8 @@ module Gitlab
|
|||
class SnippetSearchResults < SearchResults
|
||||
include SnippetsHelper
|
||||
|
||||
attr_reader :current_user
|
||||
|
||||
def initialize(current_user, query)
|
||||
@current_user = current_user
|
||||
@query = query
|
||||
super(current_user, query)
|
||||
end
|
||||
|
||||
def objects(scope, page: nil, per_page: DEFAULT_PER_PAGE, preload_method: nil)
|
||||
|
|
|
@ -6982,6 +6982,9 @@ msgstr ""
|
|||
msgid "Could not delete chat nickname %{chat_name}."
|
||||
msgstr ""
|
||||
|
||||
msgid "Could not delete wiki page"
|
||||
msgstr ""
|
||||
|
||||
msgid "Could not find design."
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ gem 'knapsack', '~> 1.17'
|
|||
gem 'parallel_tests', '~> 2.29'
|
||||
gem 'rotp', '~> 3.1.0'
|
||||
gem 'timecop', '~> 0.9.1'
|
||||
gem "parallel", "~> 1.19"
|
||||
gem 'parallel', '~> 1.19'
|
||||
gem 'rspec-parameterized', '~> 0.4.2'
|
||||
|
||||
group :development do
|
||||
gem 'pry-byebug', '~> 3.5.1', platform: :mri
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
abstract_type (0.0.7)
|
||||
activesupport (6.0.3.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
zeitwerk (~> 2.2, >= 2.2.2)
|
||||
adamantium (0.2.0)
|
||||
ice_nine (~> 0.11.0)
|
||||
memoizable (~> 0.4.0)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
airborne (0.3.4)
|
||||
|
@ -15,6 +19,8 @@ GEM
|
|||
rack-test (>= 1.1.0, < 2.0)
|
||||
rest-client (>= 2.0.2, < 3.0)
|
||||
rspec (~> 3.8)
|
||||
ast (2.4.1)
|
||||
binding_ninja (0.2.3)
|
||||
byebug (9.1.0)
|
||||
capybara (3.29.0)
|
||||
addressable
|
||||
|
@ -29,6 +35,9 @@ GEM
|
|||
launchy
|
||||
childprocess (3.0.0)
|
||||
coderay (1.1.2)
|
||||
concord (0.1.5)
|
||||
adamantium (~> 0.2.0)
|
||||
equalizer (~> 0.0.9)
|
||||
concurrent-ruby (1.1.6)
|
||||
debase (0.2.4.1)
|
||||
debase-ruby_core_source (>= 0.10.2)
|
||||
|
@ -36,6 +45,7 @@ GEM
|
|||
diff-lcs (1.3)
|
||||
domain_name (0.5.20190701)
|
||||
unf (>= 0.0.5, < 1.0.0)
|
||||
equalizer (0.0.11)
|
||||
faker (1.9.3)
|
||||
i18n (>= 0.7)
|
||||
gitlab-qa (4.0.0)
|
||||
|
@ -44,10 +54,13 @@ GEM
|
|||
domain_name (~> 0.5)
|
||||
i18n (1.8.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
ice_nine (0.11.2)
|
||||
knapsack (1.17.1)
|
||||
rake
|
||||
launchy (2.4.3)
|
||||
addressable (~> 2.3)
|
||||
memoizable (0.4.2)
|
||||
thread_safe (~> 0.3, >= 0.3.1)
|
||||
method_source (0.9.0)
|
||||
mime-types (3.3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
|
@ -61,6 +74,13 @@ GEM
|
|||
parallel (1.17.0)
|
||||
parallel_tests (2.29.0)
|
||||
parallel
|
||||
parser (2.7.1.4)
|
||||
ast (~> 2.4.1)
|
||||
proc_to_ast (0.1.0)
|
||||
coderay
|
||||
parser
|
||||
unparser
|
||||
procto (0.0.3)
|
||||
pry (0.11.3)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.9.0)
|
||||
|
@ -71,7 +91,7 @@ GEM
|
|||
rack (2.2.2)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rake (12.3.0)
|
||||
rake (12.3.3)
|
||||
regexp_parser (1.6.0)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
|
@ -91,6 +111,12 @@ GEM
|
|||
rspec-mocks (3.9.1)
|
||||
diff-lcs (>= 1.2.0, < 2.0)
|
||||
rspec-support (~> 3.9.0)
|
||||
rspec-parameterized (0.4.2)
|
||||
binding_ninja (>= 0.2.3)
|
||||
parser
|
||||
proc_to_ast
|
||||
rspec (>= 2.13, < 4)
|
||||
unparser
|
||||
rspec-retry (0.6.1)
|
||||
rspec-core (> 3.3)
|
||||
rspec-support (3.9.3)
|
||||
|
@ -109,6 +135,14 @@ GEM
|
|||
unf (0.1.4)
|
||||
unf_ext
|
||||
unf_ext (0.0.7.7)
|
||||
unparser (0.4.7)
|
||||
abstract_type (~> 0.0.7)
|
||||
adamantium (~> 0.2.0)
|
||||
concord (~> 0.1.5)
|
||||
diff-lcs (~> 1.3)
|
||||
equalizer (~> 0.0.9)
|
||||
parser (>= 2.6.5)
|
||||
procto (~> 0.0.2)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
zeitwerk (2.3.0)
|
||||
|
@ -133,6 +167,7 @@ DEPENDENCIES
|
|||
rest-client (~> 2.1.0)
|
||||
rotp (~> 3.1.0)
|
||||
rspec (~> 3.7)
|
||||
rspec-parameterized (~> 0.4.2)
|
||||
rspec-retry (~> 0.6.1)
|
||||
rspec_junit_formatter (~> 0.4.1)
|
||||
ruby-debug-ide (~> 0.7.0)
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module QA
|
||||
RSpec.describe 'Configure' do
|
||||
describe 'AutoDevOps Templates', only: { subdomain: :staging } do
|
||||
# specify jobs to be disabled in the pipeline.
|
||||
# CANARY_ENABLED will allow the pipeline to be
|
||||
# blocked by a manual job, rather than fail
|
||||
# during the production run
|
||||
let(:optional_jobs) do
|
||||
%w[
|
||||
LICENSE_MANAGEMENT_DISABLED
|
||||
SAST_DISABLED DAST_DISABLED
|
||||
DEPENDENCY_SCANNING_DISABLED
|
||||
CONTAINER_SCANNING_DISABLED
|
||||
CANARY_ENABLED
|
||||
]
|
||||
end
|
||||
|
||||
where(:template) do
|
||||
%w[rails spring express]
|
||||
end
|
||||
|
||||
with_them do
|
||||
let!(:project) do
|
||||
Resource::Project.fabricate_via_api! do |project|
|
||||
project.name = "#{template}-autodevops-project-template"
|
||||
project.template_name = template
|
||||
project.description = "Let's see if the #{template} project works..."
|
||||
project.auto_devops_enabled = true
|
||||
end
|
||||
end
|
||||
|
||||
let(:pipeline) do
|
||||
Resource::Pipeline.fabricate_via_api! do |pipeline|
|
||||
pipeline.project = project
|
||||
pipeline.variables =
|
||||
optional_jobs.map do |job|
|
||||
{ key: job, value: '1', variable_type: 'env_var' }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
before do
|
||||
Flow::Login.sign_in
|
||||
end
|
||||
|
||||
it 'works with Auto DevOps' do
|
||||
%w[build code_quality test].each do |job|
|
||||
pipeline.visit!
|
||||
|
||||
Page::Project::Pipeline::Show.perform do |show_page|
|
||||
show_page.click_job(job)
|
||||
end
|
||||
|
||||
Page::Project::Job::Show.perform do |show|
|
||||
expect(show).to have_passed(timeout: 360)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
require_relative '../qa'
|
||||
require 'rspec/retry'
|
||||
require 'rspec-parameterized'
|
||||
|
||||
if ENV['CI'] && QA::Runtime::Env.knapsack? && !ENV['NO_KNAPSACK']
|
||||
require 'knapsack'
|
||||
|
|
|
@ -190,20 +190,6 @@ RSpec.describe Projects::SnippetsController do
|
|||
snippet.reload
|
||||
end
|
||||
|
||||
it_behaves_like 'updating snippet checks blob is binary' do
|
||||
let_it_be(:title) { 'Foo' }
|
||||
let(:params) do
|
||||
{
|
||||
namespace_id: project.namespace.to_param,
|
||||
project_id: project,
|
||||
id: snippet.id,
|
||||
project_snippet: { title: title }
|
||||
}
|
||||
end
|
||||
|
||||
subject { put :update, params: params }
|
||||
end
|
||||
|
||||
context 'when the snippet is spam' do
|
||||
before do
|
||||
allow_next_instance_of(Spam::AkismetService) do |instance|
|
||||
|
@ -611,19 +597,4 @@ RSpec.describe Projects::SnippetsController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
it_behaves_like 'editing snippet checks blob is binary' do
|
||||
let(:snippet) { create(:project_snippet, :private, project: project, author: user) }
|
||||
let(:params) do
|
||||
{
|
||||
namespace_id: project.namespace,
|
||||
project_id: project,
|
||||
id: snippet
|
||||
}
|
||||
end
|
||||
|
||||
subject { get :edit, params: params }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -334,12 +334,6 @@ RSpec.describe SnippetsController do
|
|||
snippet.reload
|
||||
end
|
||||
|
||||
it_behaves_like 'updating snippet checks blob is binary' do
|
||||
let_it_be(:title) { 'Foo' }
|
||||
|
||||
subject { put :update, params: { id: snippet, personal_snippet: { title: title } } }
|
||||
end
|
||||
|
||||
context 'when the snippet is spam' do
|
||||
before do
|
||||
allow_next_instance_of(Spam::AkismetService) do |instance|
|
||||
|
@ -746,12 +740,4 @@ RSpec.describe SnippetsController do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #edit' do
|
||||
it_behaves_like 'editing snippet checks blob is binary' do
|
||||
let_it_be(:snippet) { create(:personal_snippet, :public, :repository, author: user) }
|
||||
|
||||
subject { get :edit, params: { id: snippet } }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,10 +10,6 @@ RSpec.describe 'Sort Issuable List' do
|
|||
let(:first_updated_issuable) { issuables.order_updated_asc.first }
|
||||
let(:last_updated_issuable) { issuables.order_updated_desc.first }
|
||||
|
||||
before do
|
||||
stub_feature_flags(vue_issuables_list: false)
|
||||
end
|
||||
|
||||
context 'for merge requests' do
|
||||
include MergeRequestHelpers
|
||||
|
||||
|
@ -147,7 +143,7 @@ RSpec.describe 'Sort Issuable List' do
|
|||
let(:issuable_type) { :issue }
|
||||
|
||||
it 'is "created date"' do
|
||||
visit_issues_with_state(project, 'open')
|
||||
visit_issues_with_state(project, 'opened')
|
||||
|
||||
expect(find('.filter-dropdown-container')).to have_content('Created date')
|
||||
expect(first_issue).to include(last_created_issuable.title)
|
||||
|
@ -179,11 +175,11 @@ RSpec.describe 'Sort Issuable List' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when the sort in the URL is id_desc' do
|
||||
context 'when the sort in the URL is created_date', :js do
|
||||
let(:issuable_type) { :issue }
|
||||
|
||||
before do
|
||||
visit_issues(project, sort: 'id_desc')
|
||||
visit_issues(project, sort: 'created_date')
|
||||
end
|
||||
|
||||
it 'shows the sort order as created date' do
|
||||
|
@ -194,11 +190,11 @@ RSpec.describe 'Sort Issuable List' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'custom sorting' do
|
||||
context 'custom sorting', :js do
|
||||
let(:issuable_type) { :issue }
|
||||
|
||||
it 'supports sorting in asc and desc order' do
|
||||
visit_issues_with_state(project, 'open')
|
||||
visit_issues_with_state(project, 'opened')
|
||||
|
||||
page.within('.filter-dropdown-container') do
|
||||
click_button('Created date')
|
||||
|
|
|
@ -16,20 +16,47 @@ RSpec.describe Gitlab::Danger::Changelog do
|
|||
let(:fake_gitlab) { double('fake-gitlab', mr_labels: mr_labels, mr_json: mr_json) }
|
||||
|
||||
let(:changes_by_category) { nil }
|
||||
let(:sanitize_mr_title) { nil }
|
||||
let(:ee?) { false }
|
||||
let(:fake_helper) { double('fake-helper', changes_by_category: changes_by_category, ee?: ee?) }
|
||||
let(:fake_helper) { double('fake-helper', changes_by_category: changes_by_category, sanitize_mr_title: sanitize_mr_title, ee?: ee?) }
|
||||
|
||||
let(:fake_danger) { new_fake_danger.include(described_class) }
|
||||
|
||||
subject(:changelog) { fake_danger.new(git: fake_git, gitlab: fake_gitlab, helper: fake_helper) }
|
||||
|
||||
describe '#needed?' do
|
||||
describe '#required?' do
|
||||
subject { changelog.required? }
|
||||
|
||||
context 'added files contain a migration' do
|
||||
[
|
||||
'db/migrate/20200000000000_new_migration.rb',
|
||||
'db/post_migrate/20200000000000_new_migration.rb'
|
||||
].each do |file_path|
|
||||
let(:added_files) { [file_path] }
|
||||
|
||||
it { is_expected.to be_truthy }
|
||||
end
|
||||
end
|
||||
|
||||
context 'added files do not contain a migration' do
|
||||
[
|
||||
'app/models/model.rb',
|
||||
'app/assets/javascripts/file.js'
|
||||
].each do |file_path|
|
||||
let(:added_files) { [file_path] }
|
||||
|
||||
it { is_expected.to be_falsey }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#optional?' do
|
||||
let(:category_with_changelog) { :backend }
|
||||
let(:label_with_changelog) { 'frontend' }
|
||||
let(:category_without_changelog) { Gitlab::Danger::Changelog::NO_CHANGELOG_CATEGORIES.first }
|
||||
let(:label_without_changelog) { Gitlab::Danger::Changelog::NO_CHANGELOG_LABELS.first }
|
||||
|
||||
subject { changelog.needed? }
|
||||
subject { changelog.optional? }
|
||||
|
||||
context 'when MR contains only categories requiring no changelog' do
|
||||
let(:changes_by_category) { { category_without_changelog => nil } }
|
||||
|
@ -121,4 +148,43 @@ RSpec.describe Gitlab::Danger::Changelog do
|
|||
it { is_expected.to be_falsy }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#modified_text' do
|
||||
let(:sanitize_mr_title) { 'Fake Title' }
|
||||
let(:mr_json) { { "iid" => 1234, "title" => sanitize_mr_title } }
|
||||
|
||||
subject { changelog.modified_text }
|
||||
|
||||
it do
|
||||
expect(subject).to include('CHANGELOG.md was edited')
|
||||
expect(subject).to include('bin/changelog -m 1234 "Fake Title"')
|
||||
expect(subject).to include('bin/changelog --ee -m 1234 "Fake Title"')
|
||||
end
|
||||
end
|
||||
|
||||
describe '#required_text' do
|
||||
let(:sanitize_mr_title) { 'Fake Title' }
|
||||
let(:mr_json) { { "iid" => 1234, "title" => sanitize_mr_title } }
|
||||
|
||||
subject { changelog.required_text }
|
||||
|
||||
it do
|
||||
expect(subject).to include('CHANGELOG missing')
|
||||
expect(subject).to include('bin/changelog -m 1234 "Fake Title"')
|
||||
expect(subject).not_to include('--ee')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'optional_text' do
|
||||
let(:sanitize_mr_title) { 'Fake Title' }
|
||||
let(:mr_json) { { "iid" => 1234, "title" => sanitize_mr_title } }
|
||||
|
||||
subject { changelog.optional_text }
|
||||
|
||||
it do
|
||||
expect(subject).to include('CHANGELOG missing')
|
||||
expect(subject).to include('bin/changelog -m 1234 "Fake Title"')
|
||||
expect(subject).to include('bin/changelog --ee -m 1234 "Fake Title"')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -4,9 +4,12 @@ require 'spec_helper'
|
|||
|
||||
RSpec.describe Gitlab::GroupSearchResults do
|
||||
let(:user) { create(:user) }
|
||||
let(:group) { create(:group) }
|
||||
|
||||
subject(:results) { described_class.new(user, 'gob', anything, group: group) }
|
||||
|
||||
describe 'user search' do
|
||||
let(:group) { create(:group) }
|
||||
subject(:objects) { results.objects('users') }
|
||||
|
||||
it 'returns the users belonging to the group matching the search query' do
|
||||
user1 = create(:user, username: 'gob_bluth')
|
||||
|
@ -17,9 +20,7 @@ RSpec.describe Gitlab::GroupSearchResults do
|
|||
|
||||
create(:user, username: 'gob_2018')
|
||||
|
||||
result = described_class.new(user, anything, group, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq [user1]
|
||||
is_expected.to eq [user1]
|
||||
end
|
||||
|
||||
it 'returns the user belonging to the subgroup matching the search query' do
|
||||
|
@ -29,9 +30,7 @@ RSpec.describe Gitlab::GroupSearchResults do
|
|||
|
||||
create(:user, username: 'gob_2018')
|
||||
|
||||
result = described_class.new(user, anything, group, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq [user1]
|
||||
is_expected.to eq [user1]
|
||||
end
|
||||
|
||||
it 'returns the user belonging to the parent group matching the search query' do
|
||||
|
@ -41,9 +40,7 @@ RSpec.describe Gitlab::GroupSearchResults do
|
|||
|
||||
create(:user, username: 'gob_2018')
|
||||
|
||||
result = described_class.new(user, anything, group, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq [user1]
|
||||
is_expected.to eq [user1]
|
||||
end
|
||||
|
||||
it 'does not return the user belonging to the private subgroup' do
|
||||
|
@ -53,9 +50,7 @@ RSpec.describe Gitlab::GroupSearchResults do
|
|||
|
||||
create(:user, username: 'gob_2018')
|
||||
|
||||
result = described_class.new(user, anything, group, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq []
|
||||
is_expected.to be_empty
|
||||
end
|
||||
|
||||
it 'does not return the user belonging to an unrelated group' do
|
||||
|
@ -63,15 +58,13 @@ RSpec.describe Gitlab::GroupSearchResults do
|
|||
unrelated_group = create(:group)
|
||||
create(:group_member, :developer, user: user, group: unrelated_group)
|
||||
|
||||
result = described_class.new(user, anything, group, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq []
|
||||
is_expected.to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
describe "#issuable_params" do
|
||||
it 'sets include_subgroups flag by default' do
|
||||
result = described_class.new(user, anything, group, 'gob')
|
||||
|
||||
expect(result.issuable_params[:include_subgroups]).to eq(true)
|
||||
expect(results.issuable_params[:include_subgroups]).to eq(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -8,28 +8,30 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
let(:user) { create(:user) }
|
||||
let(:project) { create(:project) }
|
||||
let(:query) { 'hello world' }
|
||||
let(:repository_ref) { nil }
|
||||
|
||||
describe 'initialize with empty ref' do
|
||||
let(:results) { described_class.new(user, project, query, '') }
|
||||
subject(:results) { described_class.new(user, query, project: project, repository_ref: repository_ref) }
|
||||
|
||||
it { expect(results.project).to eq(project) }
|
||||
it { expect(results.query).to eq('hello world') }
|
||||
end
|
||||
context 'with a repository_ref' do
|
||||
context 'when empty' do
|
||||
let(:repository_ref) { '' }
|
||||
|
||||
describe 'initialize with ref' do
|
||||
let(:ref) { 'refs/heads/test' }
|
||||
let(:results) { described_class.new(user, project, query, ref) }
|
||||
it { expect(results.project).to eq(project) }
|
||||
it { expect(results.query).to eq('hello world') }
|
||||
end
|
||||
|
||||
it { expect(results.project).to eq(project) }
|
||||
it { expect(results.repository_ref).to eq(ref) }
|
||||
it { expect(results.query).to eq('hello world') }
|
||||
context 'when set' do
|
||||
let(:repository_ref) { 'refs/heads/test' }
|
||||
|
||||
it { expect(results.project).to eq(project) }
|
||||
it { expect(results.repository_ref).to eq(repository_ref) }
|
||||
it { expect(results.query).to eq('hello world') }
|
||||
end
|
||||
end
|
||||
|
||||
describe '#formatted_count' do
|
||||
using RSpec::Parameterized::TableSyntax
|
||||
|
||||
let(:results) { described_class.new(user, project, query) }
|
||||
|
||||
where(:scope, :count_method, :expected) do
|
||||
'blobs' | :limited_blobs_count | max_limited_count
|
||||
'notes' | :limited_notes_count | max_limited_count
|
||||
|
@ -63,7 +65,8 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
|
||||
shared_examples 'general blob search' do |entity_type, blob_type|
|
||||
let(:query) { 'files' }
|
||||
subject(:results) { described_class.new(user, project, query).objects(blob_type) }
|
||||
|
||||
subject(:objects) { results.objects(blob_type) }
|
||||
|
||||
context "when #{entity_type} is disabled" do
|
||||
let(:project) { disabled_project }
|
||||
|
@ -94,17 +97,17 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
end
|
||||
|
||||
it 'finds by name' do
|
||||
expect(results.map(&:path)).to include(expected_file_by_path)
|
||||
expect(objects.map(&:path)).to include(expected_file_by_path)
|
||||
end
|
||||
|
||||
it "loads all blobs for path matches in single batch" do
|
||||
expect(Gitlab::Git::Blob).to receive(:batch).once.and_call_original
|
||||
|
||||
results.map(&:data)
|
||||
expect { objects.map(&:data) }.not_to raise_error
|
||||
end
|
||||
|
||||
it 'finds by content' do
|
||||
blob = results.select { |result| result.path == expected_file_by_content }.flatten.last
|
||||
blob = objects.select { |result| result.path == expected_file_by_content }.flatten.last
|
||||
|
||||
expect(blob.path).to eq(expected_file_by_content)
|
||||
end
|
||||
|
@ -115,7 +118,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
let(:file_finder) { double }
|
||||
let(:project_branch) { 'project_branch' }
|
||||
|
||||
subject(:results) { described_class.new(user, project, query, repository_ref).objects(blob_type) }
|
||||
subject(:objects) { results.objects(blob_type) }
|
||||
|
||||
before do
|
||||
allow(entity).to receive(:default_branch).and_return(project_branch)
|
||||
|
@ -128,7 +131,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
it 'uses it' do
|
||||
expect(Gitlab::FileFinder).to receive(:new).with(project, repository_ref).and_return(file_finder)
|
||||
|
||||
results
|
||||
expect { objects }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -138,7 +141,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
it "uses #{entity_type} repository default reference" do
|
||||
expect(Gitlab::FileFinder).to receive(:new).with(project, project_branch).and_return(file_finder)
|
||||
|
||||
results
|
||||
expect { objects }.not_to raise_error
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -148,7 +151,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
it "uses #{entity_type} repository default reference" do
|
||||
expect(Gitlab::FileFinder).to receive(:new).with(project, project_branch).and_return(file_finder)
|
||||
|
||||
results
|
||||
expect { objects }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -157,7 +160,6 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
let(:per_page) { 20 }
|
||||
let(:count_limit) { described_class::COUNT_LIMIT }
|
||||
let(:file_finder) { instance_double('Gitlab::FileFinder') }
|
||||
let(:results) { described_class.new(user, project, query) }
|
||||
let(:repository_ref) { 'master' }
|
||||
|
||||
before do
|
||||
|
@ -228,139 +230,73 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
|
||||
context 'return type' do
|
||||
let(:blobs) { [Gitlab::Search::FoundBlob.new(project: project)] }
|
||||
let(:results) { described_class.new(user, project, "Files", per_page: 20) }
|
||||
let(:query) { "Files" }
|
||||
|
||||
subject(:objects) { results.objects('wiki_blobs', per_page: 20) }
|
||||
|
||||
before do
|
||||
allow(results).to receive(:wiki_blobs).and_return(blobs)
|
||||
end
|
||||
|
||||
it 'returns list of FoundWikiPage type object' do
|
||||
objects = results.objects('wiki_blobs')
|
||||
|
||||
expect(objects).to be_present
|
||||
expect(objects).to all(be_a(Gitlab::Search::FoundWikiPage))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it 'does not list issues on private projects' do
|
||||
issue = create(:issue, project: project)
|
||||
describe 'issues search' do
|
||||
let(:issue) { create(:issue, project: project) }
|
||||
let(:query) { issue.title }
|
||||
|
||||
results = described_class.new(user, project, issue.title)
|
||||
subject(:objects) { results.objects('issues') }
|
||||
|
||||
expect(results.objects('issues')).not_to include issue
|
||||
end
|
||||
|
||||
describe 'confidential issues' do
|
||||
let(:query) { 'issue' }
|
||||
let(:author) { create(:user) }
|
||||
let(:assignee) { create(:user) }
|
||||
let(:non_member) { create(:user) }
|
||||
let(:member) { create(:user) }
|
||||
let(:admin) { create(:admin) }
|
||||
let(:project) { create(:project, :internal) }
|
||||
let!(:issue) { create(:issue, project: project, title: 'Issue 1') }
|
||||
let!(:security_issue_1) { create(:issue, :confidential, project: project, title: 'Security issue 1', author: author) }
|
||||
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignees: [assignee]) }
|
||||
|
||||
it 'does not list project confidential issues for non project members' do
|
||||
results = described_class.new(non_member, project, query)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
expect(issues).not_to include security_issue_1
|
||||
expect(issues).not_to include security_issue_2
|
||||
expect(results.limited_issues_count).to eq 1
|
||||
it 'does not list issues on private projects' do
|
||||
expect(objects).not_to include issue
|
||||
end
|
||||
|
||||
it 'does not list project confidential issues for project members with guest role' do
|
||||
project.add_guest(member)
|
||||
|
||||
results = described_class.new(member, project, query)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
expect(issues).not_to include security_issue_1
|
||||
expect(issues).not_to include security_issue_2
|
||||
expect(results.limited_issues_count).to eq 1
|
||||
end
|
||||
|
||||
it 'lists project confidential issues for author' do
|
||||
results = described_class.new(author, project, query)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
expect(issues).to include security_issue_1
|
||||
expect(issues).not_to include security_issue_2
|
||||
expect(results.limited_issues_count).to eq 2
|
||||
end
|
||||
|
||||
it 'lists project confidential issues for assignee' do
|
||||
results = described_class.new(assignee, project, query)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
expect(issues).not_to include security_issue_1
|
||||
expect(issues).to include security_issue_2
|
||||
expect(results.limited_issues_count).to eq 2
|
||||
end
|
||||
|
||||
it 'lists project confidential issues for project members' do
|
||||
project.add_developer(member)
|
||||
|
||||
results = described_class.new(member, project, query)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
expect(issues).to include security_issue_1
|
||||
expect(issues).to include security_issue_2
|
||||
expect(results.limited_issues_count).to eq 3
|
||||
end
|
||||
|
||||
it 'lists all project issues for admin' do
|
||||
results = described_class.new(admin, project, query)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
expect(issues).to include security_issue_1
|
||||
expect(issues).to include security_issue_2
|
||||
expect(results.limited_issues_count).to eq 3
|
||||
describe "confidential issues" do
|
||||
include_examples "access restricted confidential issues"
|
||||
end
|
||||
end
|
||||
|
||||
describe 'notes search' do
|
||||
it 'lists notes' do
|
||||
project = create(:project, :public)
|
||||
note = create(:note, project: project)
|
||||
let(:query) { note.note }
|
||||
|
||||
results = described_class.new(user, project, note.note)
|
||||
subject(:notes) { results.objects('notes') }
|
||||
|
||||
expect(results.objects('notes')).to include note
|
||||
context 'with a public project' do
|
||||
let(:project) { create(:project, :public) }
|
||||
let(:note) { create(:note, project: project) }
|
||||
|
||||
it 'lists notes' do
|
||||
expect(notes).to include note
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't list issue notes when access is restricted" do
|
||||
project = create(:project, :public, :issues_private)
|
||||
note = create(:note_on_issue, project: project)
|
||||
context 'with private issues' do
|
||||
let(:project) { create(:project, :public, :issues_private) }
|
||||
let(:note) { create(:note_on_issue, project: project) }
|
||||
|
||||
results = described_class.new(user, project, note.note)
|
||||
|
||||
expect(results.objects('notes')).not_to include note
|
||||
it "doesn't list issue notes when access is restricted" do
|
||||
expect(notes).not_to include note
|
||||
end
|
||||
end
|
||||
|
||||
it "doesn't list merge_request notes when access is restricted" do
|
||||
project = create(:project, :public, :merge_requests_private)
|
||||
note = create(:note_on_merge_request, project: project)
|
||||
context 'with private merge requests' do
|
||||
let(:project) { create(:project, :public, :merge_requests_private) }
|
||||
let(:note) { create(:note_on_merge_request, project: project) }
|
||||
|
||||
results = described_class.new(user, project, note.note)
|
||||
|
||||
expect(results.objects('notes')).not_to include note
|
||||
it "doesn't list merge_request notes when access is restricted" do
|
||||
expect(notes).not_to include note
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe '#limited_notes_count' do
|
||||
let(:project) { create(:project, :public) }
|
||||
let(:note) { create(:note_on_issue, project: project) }
|
||||
let(:results) { described_class.new(user, project, note.note) }
|
||||
let(:query) { note.note }
|
||||
|
||||
context 'when count_limit is lower than total amount' do
|
||||
before do
|
||||
|
@ -375,11 +311,6 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
|
||||
context 'when count_limit is higher than total amount' do
|
||||
it 'calls note finder multiple times to get the limited amount of notes' do
|
||||
project = create(:project, :public)
|
||||
note = create(:note_on_issue, project: project)
|
||||
|
||||
results = described_class.new(user, project, note.note)
|
||||
|
||||
expect(results).to receive(:notes_finder).exactly(4).times.and_call_original
|
||||
expect(results.limited_notes_count).to eq(1)
|
||||
end
|
||||
|
@ -395,7 +326,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
.with(anything, anything, anything, described_class::COUNT_LIMIT)
|
||||
.and_call_original
|
||||
|
||||
described_class.new(user, project, '.').commits_count
|
||||
results.commits_count
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -406,20 +337,24 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
# * commit
|
||||
#
|
||||
shared_examples 'access restricted commits' do
|
||||
let(:query) { search_phrase }
|
||||
|
||||
context 'when project is internal' do
|
||||
let(:project) { create(:project, :internal, :repository) }
|
||||
|
||||
it 'does not search if user is not authenticated' do
|
||||
commits = described_class.new(nil, project, search_phrase).objects('commits')
|
||||
|
||||
expect(commits).to be_empty
|
||||
end
|
||||
subject(:commits) { results.objects('commits') }
|
||||
|
||||
it 'searches if user is authenticated' do
|
||||
commits = described_class.new(user, project, search_phrase).objects('commits')
|
||||
|
||||
expect(commits).to contain_exactly commit
|
||||
end
|
||||
|
||||
context 'when the user is not authenticated' do
|
||||
let(:user) { nil }
|
||||
|
||||
it 'does not search' do
|
||||
expect(commits).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when project is private' do
|
||||
|
@ -437,29 +372,35 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
user
|
||||
end
|
||||
|
||||
it 'does not show commit to stranger' do
|
||||
commits = described_class.new(nil, private_project, search_phrase).objects('commits')
|
||||
let(:project) { private_project }
|
||||
|
||||
expect(commits).to be_empty
|
||||
subject(:commits) { results.objects('commits') }
|
||||
|
||||
context 'when the user is not authenticated' do
|
||||
let(:user) { nil }
|
||||
|
||||
it 'does not show commit to stranger' do
|
||||
expect(commits).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'team access' do
|
||||
it 'shows commit to creator' do
|
||||
commits = described_class.new(creator, private_project, search_phrase).objects('commits')
|
||||
context 'when the user is the creator' do
|
||||
let(:user) { creator }
|
||||
|
||||
expect(commits).to contain_exactly commit
|
||||
it { expect(commits).to contain_exactly commit }
|
||||
end
|
||||
|
||||
it 'shows commit to master' do
|
||||
commits = described_class.new(team_master, private_project, search_phrase).objects('commits')
|
||||
context 'when the user is a master' do
|
||||
let(:user) { team_master }
|
||||
|
||||
expect(commits).to contain_exactly commit
|
||||
it { expect(commits).to contain_exactly commit }
|
||||
end
|
||||
|
||||
it 'shows commit to reporter' do
|
||||
commits = described_class.new(team_reporter, private_project, search_phrase).objects('commits')
|
||||
context 'when the user is a reporter' do
|
||||
let(:user) { team_reporter }
|
||||
|
||||
expect(commits).to contain_exactly commit
|
||||
it { expect(commits).to contain_exactly commit }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -471,9 +412,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
|
||||
it 'returns the correct results for each page' do
|
||||
expect(results_page(1)).to contain_exactly(commit('b83d6e391c22777fca1ed3012fce84f633d7fed0'))
|
||||
|
||||
expect(results_page(2)).to contain_exactly(commit('498214de67004b1da3d820901307bed2a68a8ef6'))
|
||||
|
||||
expect(results_page(3)).to contain_exactly(commit('1b12f15a11fc6e62177bef08f47bc7b5ce50b141'))
|
||||
end
|
||||
|
||||
|
@ -506,7 +445,7 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
end
|
||||
|
||||
def results_page(page)
|
||||
described_class.new(user, project, '.').objects('commits', per_page: 1, page: page)
|
||||
described_class.new(user, '.', project: project).objects('commits', per_page: 1, page: page)
|
||||
end
|
||||
|
||||
def commit(hash)
|
||||
|
@ -518,26 +457,27 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
let(:project) { create(:project, :public, :repository) }
|
||||
let(:commit) { project.repository.commit('59e29889be61e6e0e5e223bfa9ac2721d31605b8') }
|
||||
let(:message) { 'Sorry, I did a mistake' }
|
||||
let(:query) { message }
|
||||
|
||||
subject(:commits) { results.objects('commits') }
|
||||
|
||||
it 'finds commit by message' do
|
||||
commits = described_class.new(user, project, message).objects('commits')
|
||||
|
||||
expect(commits).to contain_exactly commit
|
||||
end
|
||||
|
||||
it 'handles when no commit match' do
|
||||
commits = described_class.new(user, project, 'not really an existing description').objects('commits')
|
||||
context 'when there are not hits' do
|
||||
let(:query) { 'not really an existing description' }
|
||||
|
||||
expect(commits).to be_empty
|
||||
it 'handles when no commit match' do
|
||||
expect(commits).to be_empty
|
||||
end
|
||||
end
|
||||
|
||||
context 'when repository_ref is provided' do
|
||||
let(:message) { 'Feature added' }
|
||||
let(:query) { 'Feature added' }
|
||||
let(:repository_ref) { 'feature' }
|
||||
|
||||
it 'searches in the specified ref' do
|
||||
commits = described_class.new(user, project, message, repository_ref).objects('commits')
|
||||
|
||||
# This commit is unique to the feature branch
|
||||
expect(commits).to contain_exactly(project.repository.commit('0b4bc9a49b562e85de7cc9e834518ea6828729b9'))
|
||||
end
|
||||
|
@ -557,14 +497,14 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
|
||||
commit_hashes.each do |type, commit_hash|
|
||||
it "shows commit by #{type} hash id" do
|
||||
commits = described_class.new(user, project, commit_hash).objects('commits')
|
||||
commits = described_class.new(user, commit_hash, project: project).objects('commits')
|
||||
|
||||
expect(commits).to contain_exactly commit
|
||||
end
|
||||
end
|
||||
|
||||
it 'handles not existing commit hash correctly' do
|
||||
commits = described_class.new(user, project, 'deadbeef').objects('commits')
|
||||
commits = described_class.new(user, 'deadbeef', project: project).objects('commits')
|
||||
|
||||
expect(commits).to be_empty
|
||||
end
|
||||
|
@ -577,9 +517,13 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
end
|
||||
|
||||
describe 'user search' do
|
||||
it 'returns the user belonging to the project matching the search query' do
|
||||
project = create(:project)
|
||||
let(:query) { 'gob' }
|
||||
let(:group) { create(:group) }
|
||||
let(:project) { create(:project, namespace: group) }
|
||||
|
||||
subject(:objects) { results.objects('users') }
|
||||
|
||||
it 'returns the user belonging to the project matching the search query' do
|
||||
user1 = create(:user, username: 'gob_bluth')
|
||||
create(:project_member, :developer, user: user1, project: project)
|
||||
|
||||
|
@ -588,23 +532,16 @@ RSpec.describe Gitlab::ProjectSearchResults do
|
|||
|
||||
create(:user, username: 'gob_2018')
|
||||
|
||||
result = described_class.new(user, project, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq [user1]
|
||||
expect(objects).to contain_exactly(user1)
|
||||
end
|
||||
|
||||
it 'returns the user belonging to the group matching the search query' do
|
||||
group = create(:group)
|
||||
project = create(:project, namespace: group)
|
||||
|
||||
user1 = create(:user, username: 'gob_bluth')
|
||||
create(:group_member, :developer, user: user1, group: group)
|
||||
|
||||
create(:user, username: 'gob_2018')
|
||||
|
||||
result = described_class.new(user, project, 'gob').objects('users')
|
||||
|
||||
expect(result).to eq [user1]
|
||||
expect(objects).to contain_exactly(user1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,13 +9,10 @@ RSpec.describe Gitlab::SearchResults do
|
|||
let(:user) { create(:user) }
|
||||
let!(:project) { create(:project, name: 'foo') }
|
||||
let!(:issue) { create(:issue, project: project, title: 'foo') }
|
||||
|
||||
let!(:merge_request) do
|
||||
create(:merge_request, source_project: project, title: 'foo')
|
||||
end
|
||||
|
||||
let!(:merge_request) { create(:merge_request, source_project: project, title: 'foo') }
|
||||
let!(:milestone) { create(:milestone, project: project, title: 'foo') }
|
||||
let(:results) { described_class.new(user, Project.all, 'foo') }
|
||||
|
||||
subject(:results) { described_class.new(user, 'foo', Project.all) }
|
||||
|
||||
context 'as a user with access' do
|
||||
before do
|
||||
|
@ -133,7 +130,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
forked_project = fork_project(project, user)
|
||||
merge_request_2 = create(:merge_request, target_project: project, source_project: forked_project, title: 'foo')
|
||||
|
||||
results = described_class.new(user, Project.where(id: forked_project.id), 'foo')
|
||||
results = described_class.new(user, 'foo', Project.where(id: forked_project.id))
|
||||
|
||||
expect(results.objects('merge_requests')).to include merge_request_2
|
||||
end
|
||||
|
@ -214,7 +211,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
let!(:security_issue_5) { create(:issue, :confidential, project: project_4, title: 'Security issue 5') }
|
||||
|
||||
it 'does not list confidential issues for non project members' do
|
||||
results = described_class.new(non_member, limit_projects, query)
|
||||
results = described_class.new(non_member, query, limit_projects)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
|
@ -230,7 +227,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
project_1.add_guest(member)
|
||||
project_2.add_guest(member)
|
||||
|
||||
results = described_class.new(member, limit_projects, query)
|
||||
results = described_class.new(member, query, limit_projects)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
|
@ -243,7 +240,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
end
|
||||
|
||||
it 'lists confidential issues for author' do
|
||||
results = described_class.new(author, limit_projects, query)
|
||||
results = described_class.new(author, query, limit_projects)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
|
@ -256,7 +253,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
end
|
||||
|
||||
it 'lists confidential issues for assignee' do
|
||||
results = described_class.new(assignee, limit_projects, query)
|
||||
results = described_class.new(assignee, query, limit_projects)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
|
@ -272,7 +269,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
project_1.add_developer(member)
|
||||
project_2.add_developer(member)
|
||||
|
||||
results = described_class.new(member, limit_projects, query)
|
||||
results = described_class.new(member, query, limit_projects)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
|
@ -285,7 +282,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
end
|
||||
|
||||
it 'lists all issues for admin' do
|
||||
results = described_class.new(admin, limit_projects, query)
|
||||
results = described_class.new(admin, query, limit_projects)
|
||||
issues = results.objects('issues')
|
||||
|
||||
expect(issues).to include issue
|
||||
|
@ -323,7 +320,7 @@ RSpec.describe Gitlab::SearchResults do
|
|||
# Global search scope takes user authorized projects, internal projects and public projects.
|
||||
limit_projects = ProjectsFinder.new(current_user: user).execute
|
||||
|
||||
milestones = described_class.new(user, limit_projects, 'milestone').objects('milestones')
|
||||
milestones = described_class.new(user, 'milestone', limit_projects).objects('milestones')
|
||||
|
||||
expect(milestones).to match_array([milestone_1, milestone_2, milestone_3])
|
||||
end
|
||||
|
|
|
@ -261,6 +261,7 @@ RSpec.configure do |config|
|
|||
./spec/support/protected_tags
|
||||
./spec/support/shared_examples/features
|
||||
./spec/support/shared_examples/requests
|
||||
./spec/support/shared_examples/lib/gitlab
|
||||
./spec/views
|
||||
./spec/workers
|
||||
)
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.shared_examples 'editing snippet checks blob is binary' do
|
||||
let(:snippets_binary_blob_value) { true }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
||||
allow_next_instance_of(Blob) do |blob|
|
||||
allow(blob).to receive(:binary?).and_return(binary)
|
||||
end
|
||||
|
||||
stub_feature_flags(snippets_binary_blob: snippets_binary_blob_value)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
context 'when blob is text' do
|
||||
let(:binary) { false }
|
||||
|
||||
it 'responds with status 200' do
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template(:edit)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when blob is binary' do
|
||||
let(:binary) { true }
|
||||
|
||||
it 'responds with status 200' do
|
||||
expect(response).to have_gitlab_http_status(:ok)
|
||||
expect(response).to render_template(:edit)
|
||||
end
|
||||
|
||||
context 'when feature flag :snippets_binary_blob is disabled' do
|
||||
let(:snippets_binary_blob_value) { false }
|
||||
|
||||
it 'redirects away' do
|
||||
expect(response).to redirect_to(gitlab_snippet_path(snippet))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
RSpec.shared_examples 'updating snippet checks blob is binary' do
|
||||
let(:snippets_binary_blob_value) { true }
|
||||
|
||||
before do
|
||||
sign_in(user)
|
||||
|
||||
allow_next_instance_of(Blob) do |blob|
|
||||
allow(blob).to receive(:binary?).and_return(binary)
|
||||
end
|
||||
|
||||
stub_feature_flags(snippets_binary_blob: snippets_binary_blob_value)
|
||||
|
||||
subject
|
||||
end
|
||||
|
||||
context 'when blob is text' do
|
||||
let(:binary) { false }
|
||||
|
||||
it 'updates successfully' do
|
||||
expect(snippet.reload.title).to eq title
|
||||
expect(response).to redirect_to(gitlab_snippet_path(snippet))
|
||||
end
|
||||
end
|
||||
|
||||
context 'when blob is binary' do
|
||||
let(:binary) { true }
|
||||
|
||||
it 'updates successfully' do
|
||||
expect(snippet.reload.title).to eq title
|
||||
expect(response).to redirect_to(gitlab_snippet_path(snippet))
|
||||
end
|
||||
|
||||
context 'when feature flag :snippets_binary_blob is disabled' do
|
||||
let(:snippets_binary_blob_value) { false }
|
||||
|
||||
it 'redirects away without updating' do
|
||||
expect(response).to redirect_to(gitlab_snippet_path(snippet))
|
||||
expect(snippet.reload.title).not_to eq title
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -388,7 +388,54 @@ RSpec.shared_examples 'wiki controller actions' do
|
|||
end.not_to change { wiki.list_pages.size }
|
||||
|
||||
expect(response).to render_template('shared/wikis/edit')
|
||||
expect(flash[:alert]).to eq('Could not create wiki page')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'DELETE #destroy' do
|
||||
let(:id_param) { wiki_title }
|
||||
|
||||
subject do
|
||||
delete(:destroy,
|
||||
params: routing_params.merge(
|
||||
id: id_param
|
||||
))
|
||||
end
|
||||
|
||||
context 'when page exists' do
|
||||
it 'deletes the page' do
|
||||
expect do
|
||||
subject
|
||||
end.to change { wiki.list_pages.size }.by(-1)
|
||||
end
|
||||
|
||||
context 'but page cannot be deleted' do
|
||||
before do
|
||||
allow_next_instance_of(WikiPage) do |page|
|
||||
allow(page).to receive(:delete).and_return(false)
|
||||
end
|
||||
end
|
||||
|
||||
it 'renders the edit state' do
|
||||
expect do
|
||||
subject
|
||||
end.not_to change { wiki.list_pages.size }
|
||||
|
||||
expect(response).to render_template('shared/wikis/edit')
|
||||
expect(assigns(:error).message).to eq('Could not delete wiki page')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'when page does not exist' do
|
||||
let(:id_param) { 'nil' }
|
||||
|
||||
it 'renders 404' do
|
||||
expect do
|
||||
subject
|
||||
end.not_to change { wiki.list_pages.size }
|
||||
|
||||
expect(response).to have_gitlab_http_status(:not_found)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,6 +19,13 @@ RSpec.shared_examples 'a mutation that returns top-level errors' do |errors: []|
|
|||
end
|
||||
end
|
||||
|
||||
# There must be a method or let called `mutation` defined that executes
|
||||
# the mutation.
|
||||
RSpec.shared_examples 'a mutation that returns a top-level access error' do
|
||||
include_examples 'a mutation that returns top-level errors',
|
||||
errors: [Gitlab::Graphql::Authorize::AuthorizeResource::RESOURCE_ACCESS_ERROR]
|
||||
end
|
||||
|
||||
RSpec.shared_examples 'an invalid argument to the mutation' do |argument_name:|
|
||||
it_behaves_like 'a mutation that returns top-level errors' do
|
||||
let(:match_errors) do
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
RSpec.shared_examples 'access restricted confidential issues' do
|
||||
let(:query) { 'issue' }
|
||||
let(:author) { create(:user) }
|
||||
let(:assignee) { create(:user) }
|
||||
let(:project) { create(:project, :internal) }
|
||||
|
||||
let!(:issue) { create(:issue, project: project, title: 'Issue 1') }
|
||||
let!(:security_issue_1) { create(:issue, :confidential, project: project, title: 'Security issue 1', author: author) }
|
||||
let!(:security_issue_2) { create(:issue, :confidential, title: 'Security issue 2', project: project, assignees: [assignee]) }
|
||||
|
||||
subject(:objects) do
|
||||
described_class.new(user, query, project: project).objects('issues')
|
||||
end
|
||||
|
||||
context 'when the user is non-member' do
|
||||
let(:user) { create(:user) }
|
||||
|
||||
it 'does not list project confidential issues for non project members' do
|
||||
expect(objects).to contain_exactly(issue)
|
||||
expect(results.limited_issues_count).to eq 1
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the member is guest' do
|
||||
let(:user) do
|
||||
create(:user) { |guest| project.add_guest(guest) }
|
||||
end
|
||||
|
||||
it 'does not list project confidential issues for project members with guest role' do
|
||||
expect(objects).to contain_exactly(issue)
|
||||
expect(results.limited_issues_count).to eq 1
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is the author' do
|
||||
let(:user) { author }
|
||||
|
||||
it 'lists project confidential issues' do
|
||||
expect(objects).to contain_exactly(issue,
|
||||
security_issue_1)
|
||||
expect(results.limited_issues_count).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is the assignee' do
|
||||
let(:user) { assignee }
|
||||
|
||||
it 'lists project confidential issues for assignee' do
|
||||
expect(objects).to contain_exactly(issue,
|
||||
security_issue_2)
|
||||
expect(results.limited_issues_count).to eq 2
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is a developper' do
|
||||
let(:user) do
|
||||
create(:user) { |user| project.add_developer(user) }
|
||||
end
|
||||
|
||||
it 'lists project confidential issues' do
|
||||
expect(objects).to contain_exactly(issue,
|
||||
security_issue_1,
|
||||
security_issue_2)
|
||||
expect(results.limited_issues_count).to eq 3
|
||||
end
|
||||
end
|
||||
|
||||
context 'when the user is admin', :request_store do
|
||||
let(:user) { create(:user, admin: true) }
|
||||
|
||||
it 'lists all project issues' do
|
||||
expect(objects).to contain_exactly(issue,
|
||||
security_issue_1,
|
||||
security_issue_2)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -32,9 +32,19 @@ RSpec.shared_examples 'WikiPages::DestroyService#execute' do |container_type|
|
|||
)
|
||||
end
|
||||
|
||||
it 'does not increment the delete count if the deletion failed' do
|
||||
counter = Gitlab::UsageDataCounters::WikiPageCounter
|
||||
context 'when the deletion fails' do
|
||||
before do
|
||||
expect(page).to receive(:delete).and_return(false)
|
||||
end
|
||||
|
||||
expect { service.execute(nil) }.not_to change { counter.read(:delete) }
|
||||
it 'returns an error response' do
|
||||
response = service.execute(page)
|
||||
expect(response).to be_error
|
||||
end
|
||||
|
||||
it 'does not increment the delete count if the deletion failed' do
|
||||
counter = Gitlab::UsageDataCounters::WikiPageCounter
|
||||
expect { service.execute(page) }.not_to change { counter.read(:delete) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue