Commit 449e63bd authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 9d589b9f c17c86e9
...@@ -6,6 +6,7 @@ import issueBoardFilters from '~/boards/issue_board_filters'; ...@@ -6,6 +6,7 @@ import issueBoardFilters from '~/boards/issue_board_filters';
import { TYPE_USER } from '~/graphql_shared/constants'; import { TYPE_USER } from '~/graphql_shared/constants';
import { convertToGraphQLId } from '~/graphql_shared/utils'; import { convertToGraphQLId } from '~/graphql_shared/utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { DEFAULT_MILESTONES_GRAPHQL } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
...@@ -63,17 +64,17 @@ export default { ...@@ -63,17 +64,17 @@ export default {
return [ return [
{ {
icon: 'labels', icon: 'user',
title: label, title: assignee,
type: 'label_name', type: 'assignee_username',
operators: [ operators: [
{ value: '=', description: is }, { value: '=', description: is },
{ value: '!=', description: isNot }, { value: '!=', description: isNot },
], ],
token: LabelToken, token: AuthorToken,
unique: false, unique: true,
symbol: '~', fetchAuthors,
fetchLabels, preloadedAuthors: this.preloadedAuthors(),
}, },
{ {
icon: 'pencil', icon: 'pencil',
...@@ -90,17 +91,27 @@ export default { ...@@ -90,17 +91,27 @@ export default {
preloadedAuthors: this.preloadedAuthors(), preloadedAuthors: this.preloadedAuthors(),
}, },
{ {
icon: 'user', icon: 'labels',
title: assignee, title: label,
type: 'assignee_username', type: 'label_name',
operators: [ operators: [
{ value: '=', description: is }, { value: '=', description: is },
{ value: '!=', description: isNot }, { value: '!=', description: isNot },
], ],
token: AuthorToken, token: LabelToken,
unique: false,
symbol: '~',
fetchLabels,
},
{
type: 'milestone_title',
title: milestone,
icon: 'clock',
symbol: '%',
token: MilestoneToken,
unique: true, unique: true,
fetchAuthors, defaultMilestones: DEFAULT_MILESTONES_GRAPHQL,
preloadedAuthors: this.preloadedAuthors(), fetchMilestones: this.fetchMilestones,
}, },
{ {
icon: 'issues', icon: 'issues',
...@@ -114,16 +125,6 @@ export default { ...@@ -114,16 +125,6 @@ export default {
{ icon: 'issue-type-incident', value: types.INCIDENT, title: incident }, { icon: 'issue-type-incident', value: types.INCIDENT, title: incident },
], ],
}, },
{
type: 'milestone_title',
title: milestone,
icon: 'clock',
symbol: '%',
token: MilestoneToken,
unique: true,
defaultMilestones: [], // todo: https://gitlab.com/gitlab-org/gitlab/-/issues/337044#note_640010094
fetchMilestones: this.fetchMilestones,
},
{ {
type: 'weight', type: 'weight',
title: weight, title: weight,
......
...@@ -136,7 +136,7 @@ export default { ...@@ -136,7 +136,7 @@ export default {
this.updateGroups(res, Boolean(filterGroupsBy)); this.updateGroups(res, Boolean(filterGroupsBy));
}); });
}, },
fetchPage(page, filterGroupsBy, sortBy, archived) { fetchPage({ page, filterGroupsBy, sortBy, archived }) {
this.isLoading = true; this.isLoading = true;
return this.fetchGroups({ return this.fetchGroups({
......
...@@ -32,10 +32,10 @@ export default { ...@@ -32,10 +32,10 @@ export default {
}, },
methods: { methods: {
change(page) { change(page) {
const filterGroupsParam = getParameterByName('filter'); const filterGroupsBy = getParameterByName('filter');
const sortParam = getParameterByName('sort'); const sortBy = getParameterByName('sort');
const archivedParam = getParameterByName('archived'); const archived = getParameterByName('archived');
eventHub.$emit(`${this.action}fetchPage`, page, filterGroupsParam, sortParam, archivedParam); eventHub.$emit(`${this.action}fetchPage`, { page, filterGroupsBy, sortBy, archived });
}, },
}, },
}; };
......
...@@ -20,8 +20,12 @@ export const OPERATOR_IS_ONLY = [{ value: OPERATOR_IS, description: OPERATOR_IS_ ...@@ -20,8 +20,12 @@ export const OPERATOR_IS_ONLY = [{ value: OPERATOR_IS, description: OPERATOR_IS_
export const OPERATOR_IS_NOT_ONLY = [{ value: OPERATOR_IS_NOT, description: OPERATOR_IS_NOT_TEXT }]; export const OPERATOR_IS_NOT_ONLY = [{ value: OPERATOR_IS_NOT, description: OPERATOR_IS_NOT_TEXT }];
export const OPERATOR_IS_AND_IS_NOT = [...OPERATOR_IS_ONLY, ...OPERATOR_IS_NOT_ONLY]; export const OPERATOR_IS_AND_IS_NOT = [...OPERATOR_IS_ONLY, ...OPERATOR_IS_NOT_ONLY];
export const DEFAULT_LABEL_NONE = { value: FILTER_NONE, text: __(FILTER_NONE) }; export const DEFAULT_LABEL_NONE = {
export const DEFAULT_LABEL_ANY = { value: FILTER_ANY, text: __(FILTER_ANY) }; value: FILTER_NONE,
text: __(FILTER_NONE),
title: __(FILTER_NONE),
};
export const DEFAULT_LABEL_ANY = { value: FILTER_ANY, text: __(FILTER_ANY), title: __(FILTER_ANY) };
export const DEFAULT_NONE_ANY = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY]; export const DEFAULT_NONE_ANY = [DEFAULT_LABEL_NONE, DEFAULT_LABEL_ANY];
export const DEFAULT_ITERATIONS = DEFAULT_NONE_ANY.concat([ export const DEFAULT_ITERATIONS = DEFAULT_NONE_ANY.concat([
...@@ -29,10 +33,17 @@ export const DEFAULT_ITERATIONS = DEFAULT_NONE_ANY.concat([ ...@@ -29,10 +33,17 @@ export const DEFAULT_ITERATIONS = DEFAULT_NONE_ANY.concat([
]); ]);
export const DEFAULT_MILESTONES = DEFAULT_NONE_ANY.concat([ export const DEFAULT_MILESTONES = DEFAULT_NONE_ANY.concat([
{ value: FILTER_UPCOMING, text: __(FILTER_UPCOMING) }, { value: FILTER_UPCOMING, text: __(FILTER_UPCOMING), title: __(FILTER_UPCOMING) },
{ value: FILTER_STARTED, text: __(FILTER_STARTED) }, { value: FILTER_STARTED, text: __(FILTER_STARTED), title: __(FILTER_STARTED) },
]); ]);
export const DEFAULT_MILESTONES_GRAPHQL = [
{ value: 'any', text: __(FILTER_ANY), title: __(FILTER_ANY) },
{ value: 'none', text: __(FILTER_NONE), title: __(FILTER_NONE) },
{ value: '#upcoming', text: __(FILTER_UPCOMING), title: __(FILTER_UPCOMING) },
{ value: '#started', text: __(FILTER_STARTED), title: __(FILTER_STARTED) },
];
export const SortDirection = { export const SortDirection = {
descending: 'descending', descending: 'descending',
ascending: 'ascending', ascending: 'ascending',
......
...@@ -39,8 +39,16 @@ export default { ...@@ -39,8 +39,16 @@ export default {
}, },
methods: { methods: {
getActiveMilestone(milestones, data) { getActiveMilestone(milestones, data) {
return milestones.find( /* We need to check default milestones against the value not the
(milestone) => milestone.title.toLowerCase() === stripQuotes(data).toLowerCase(), * title because there is a discrepancy between the value graphql
* accepts and the title.
* https://gitlab.com/gitlab-org/gitlab/-/issues/337687#note_648058797
*/
return (
milestones.find(
(milestone) => milestone.title.toLowerCase() === stripQuotes(data).toLowerCase(),
) || this.defaultMilestones.find(({ value }) => value === data)
); );
}, },
fetchMilestones(searchTerm) { fetchMilestones(searchTerm) {
......
<script> <script>
import { GlModal, GlSprintf, GlLink } from '@gitlab/ui'; import { GlModal, GlSprintf, GlLink } from '@gitlab/ui';
import awsCloudFormationImageUrl from 'images/aws-cloud-formation.png';
import ExperimentTracking from '~/experimentation/experiment_tracking'; import ExperimentTracking from '~/experimentation/experiment_tracking';
import { getBaseURL, objectToQuery } from '~/lib/utils/url_utility'; import { getBaseURL, objectToQuery } from '~/lib/utils/url_utility';
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
...@@ -22,6 +23,11 @@ export default { ...@@ -22,6 +23,11 @@ export default {
type: String, type: String,
required: true, required: true,
}, },
imgSrc: {
type: String,
required: false,
default: awsCloudFormationImageUrl,
},
}, },
methods: { methods: {
easyButtonUrl(easyButton) { easyButtonUrl(easyButton) {
...@@ -76,7 +82,7 @@ export default { ...@@ -76,7 +82,7 @@ export default {
<img <img
:title="easyButton.stackName" :title="easyButton.stackName"
:alt="easyButton.stackName" :alt="easyButton.stackName"
src="/assets/aws-cloud-formation.png" :src="imgSrc"
width="46" width="46"
height="46" height="46"
class="gl-mt-2 gl-mr-5 gl-mb-6" class="gl-mt-2 gl-mr-5 gl-mb-6"
......
...@@ -74,7 +74,7 @@ See [Google Secure LDAP](google_secure_ldap.md) for detailed configuration instr ...@@ -74,7 +74,7 @@ See [Google Secure LDAP](google_secure_ldap.md) for detailed configuration instr
## Configuration ## Configuration
To enable LDAP integration you need to add your LDAP server settings in To enable LDAP integration you must add your LDAP server settings in
`/etc/gitlab/gitlab.rb` or `/home/git/gitlab/config/gitlab.yml` for Omnibus `/etc/gitlab/gitlab.rb` or `/home/git/gitlab/config/gitlab.yml` for Omnibus
GitLab and installations from source respectively. GitLab and installations from source respectively.
...@@ -169,7 +169,7 @@ production: ...@@ -169,7 +169,7 @@ production:
| `verify_certificates` | Enables SSL certificate verification if encryption method is `start_tls` or `simple_tls`. Defaults to true. | **{dotted-circle}** No | boolean | | `verify_certificates` | Enables SSL certificate verification if encryption method is `start_tls` or `simple_tls`. Defaults to true. | **{dotted-circle}** No | boolean |
| `timeout` | Set a timeout, in seconds, for LDAP queries. This helps avoid blocking a request if the LDAP server becomes unresponsive. A value of `0` means there is no timeout. (default: `10`) | **{dotted-circle}** No | `10` or `30` | | `timeout` | Set a timeout, in seconds, for LDAP queries. This helps avoid blocking a request if the LDAP server becomes unresponsive. A value of `0` means there is no timeout. (default: `10`) | **{dotted-circle}** No | `10` or `30` |
| `active_directory` | This setting specifies if LDAP server is Active Directory LDAP server. For non-AD servers it skips the AD specific queries. If your LDAP server is not AD, set this to false. | **{dotted-circle}** No | boolean | | `active_directory` | This setting specifies if LDAP server is Active Directory LDAP server. For non-AD servers it skips the AD specific queries. If your LDAP server is not AD, set this to false. | **{dotted-circle}** No | boolean |
| `allow_username_or_email_login` | If enabled, GitLab ignores everything after the first `@` in the LDAP username submitted by the user on sign-in. If you are using `uid: 'userPrincipalName'` on ActiveDirectory you need to disable this setting, because the userPrincipalName contains an `@`. | **{dotted-circle}** No | boolean | | `allow_username_or_email_login` | If enabled, GitLab ignores everything after the first `@` in the LDAP username submitted by the user on sign-in. If you are using `uid: 'userPrincipalName'` on ActiveDirectory you must disable this setting, because the userPrincipalName contains an `@`. | **{dotted-circle}** No | boolean |
| `block_auto_created_users` | To maintain tight control over the number of billable users on your GitLab installation, enable this setting to keep new users blocked until they have been cleared by an administrator (default: false). | **{dotted-circle}** No | boolean | | `block_auto_created_users` | To maintain tight control over the number of billable users on your GitLab installation, enable this setting to keep new users blocked until they have been cleared by an administrator (default: false). | **{dotted-circle}** No | boolean |
| `base` | Base where we can search for users. | **{check-circle}** Yes | `'ou=people,dc=gitlab,dc=example'` or `'DC=mydomain,DC=com'` | | `base` | Base where we can search for users. | **{check-circle}** Yes | `'ou=people,dc=gitlab,dc=example'` or `'DC=mydomain,DC=com'` |
| `user_filter` | Filter LDAP users. Format: [RFC 4515](https://tools.ietf.org/search/rfc4515) Note: GitLab does not support `omniauth-ldap`'s custom filter syntax. | **{dotted-circle}** No | For examples, read [Examples of user filters](#examples-of-user-filters). | | `user_filter` | Filter LDAP users. Format: [RFC 4515](https://tools.ietf.org/search/rfc4515) Note: GitLab does not support `omniauth-ldap`'s custom filter syntax. | **{dotted-circle}** No | For examples, read [Examples of user filters](#examples-of-user-filters). |
...@@ -187,7 +187,7 @@ Some examples of the `user_filter` field syntax: ...@@ -187,7 +187,7 @@ Some examples of the `user_filter` field syntax:
| Setting | Description | Required | Examples | | Setting | Description | Required | Examples |
|---------------|-------------|----------|----------| |---------------|-------------|----------|----------|
| `ca_file` | Specifies the path to a file containing a PEM-format CA certificate, for example, if you need to use an internal CA. | **{dotted-circle}** No | `'/etc/ca.pem'` | | `ca_file` | Specifies the path to a file containing a PEM-format CA certificate, for example, if you need an internal CA. | **{dotted-circle}** No | `'/etc/ca.pem'` |
| `ssl_version` | Specifies the SSL version for OpenSSL to use, if the OpenSSL default is not appropriate. | **{dotted-circle}** No | `'TLSv1_1'` | | `ssl_version` | Specifies the SSL version for OpenSSL to use, if the OpenSSL default is not appropriate. | **{dotted-circle}** No | `'TLSv1_1'` |
| `ciphers` | Specific SSL ciphers to use in communication with LDAP servers. | **{dotted-circle}** No | `'ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2'` | | `ciphers` | Specific SSL ciphers to use in communication with LDAP servers. | **{dotted-circle}** No | `'ALL:!EXPORT:!LOW:!aNULL:!eNULL:!SSLv2'` |
| `cert` | Client certificate. | **{dotted-circle}** No | `'-----BEGIN CERTIFICATE----- <REDACTED> -----END CERTIFICATE -----'` | | `cert` | Client certificate. | **{dotted-circle}** No | `'-----BEGIN CERTIFICATE----- <REDACTED> -----END CERTIFICATE -----'` |
...@@ -365,7 +365,7 @@ This does not disable [using LDAP credentials for Git access](#git-password-auth ...@@ -365,7 +365,7 @@ This does not disable [using LDAP credentials for Git access](#git-password-auth
### Using encrypted credentials ### Using encrypted credentials
Instead of having the LDAP integration credentials stored in plaintext in the configuration files, you can optionally Instead of having the LDAP integration credentials stored in plaintext in the configuration files, you can optionally
use an encrypted file for the LDAP credentials. To use this feature, you first need to enable use an encrypted file for the LDAP credentials. To use this feature, first you must enable
[GitLab encrypted configuration](../../encrypted_configuration.md). [GitLab encrypted configuration](../../encrypted_configuration.md).
The encrypted configuration for LDAP exists in an encrypted YAML file. By default the file is created at The encrypted configuration for LDAP exists in an encrypted YAML file. By default the file is created at
...@@ -635,7 +635,7 @@ following. ...@@ -635,7 +635,7 @@ following.
1. [Restart GitLab](../../restart_gitlab.md#installations-from-source) for the changes to take effect. 1. [Restart GitLab](../../restart_gitlab.md#installations-from-source) for the changes to take effect.
To take advantage of group sync, group owners or maintainers need to [create one To take advantage of group sync, group owners or maintainers must [create one
or more LDAP group links](#adding-group-links). or more LDAP group links](#adding-group-links).
### Adding group links **(PREMIUM SELF)** ### Adding group links **(PREMIUM SELF)**
...@@ -702,7 +702,7 @@ When enabled, the following applies: ...@@ -702,7 +702,7 @@ When enabled, the following applies:
- Users are not allowed to share project with other groups or invite members to - Users are not allowed to share project with other groups or invite members to
a project created in a group. a project created in a group.
To enable it you need to: To enable it, you must:
1. [Enable LDAP](#configuration) 1. [Enable LDAP](#configuration)
1. On the top bar, select **Menu > Admin**. 1. On the top bar, select **Menu > Admin**.
......
...@@ -32,6 +32,8 @@ Feature.disable(:ci_job_token_scope) ...@@ -32,6 +32,8 @@ Feature.disable(:ci_job_token_scope)
## Change the visibility of the Container Registry ## Change the visibility of the Container Registry
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18792) in GitLab 14.2.
This controls who can view the Container Registry. This controls who can view the Container Registry.
```plaintext ```plaintext
......
...@@ -7,7 +7,7 @@ type: concepts, howto ...@@ -7,7 +7,7 @@ type: concepts, howto
# Dashboard annotations API **(FREE)** # Dashboard annotations API **(FREE)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29089) in GitLab 12.10 behind a disabled feature flag. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/29089) in GitLab 12.10 behind a disabled feature flag.
Metrics dashboard annotations allow you to indicate events on your graphs at a single point in time or over a time span. Metrics dashboard annotations allow you to indicate events on your graphs at a single point in time or over a time span.
......
...@@ -43,7 +43,7 @@ Example Response: ...@@ -43,7 +43,7 @@ Example Response:
## Remove a star from a dashboard ## Remove a star from a dashboard
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31892) in GitLab 13.0. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31892) in GitLab 13.0.
```plaintext ```plaintext
DELETE /projects/:id/metrics/user_starred_dashboards DELETE /projects/:id/metrics/user_starred_dashboards
......
...@@ -41,7 +41,6 @@ GET /runners?scope=active ...@@ -41,7 +41,6 @@ GET /runners?scope=active
GET /runners?type=project_type GET /runners?type=project_type
GET /runners?status=active GET /runners?status=active
GET /runners?tag_list=tag1,tag2 GET /runners?tag_list=tag1,tag2
GET /runners?search=gitlab
``` ```
| Attribute | Type | Required | Description | | Attribute | Type | Required | Description |
...@@ -50,7 +49,6 @@ GET /runners?search=gitlab ...@@ -50,7 +49,6 @@ GET /runners?search=gitlab
| `type` | string | no | The type of runners to show, one of: `instance_type`, `group_type`, `project_type` | | `type` | string | no | The type of runners to show, one of: `instance_type`, `group_type`, `project_type` |
| `status` | string | no | The status of runners to show, one of: `active`, `paused`, `online`, `offline` | | `status` | string | no | The status of runners to show, one of: `active`, `paused`, `online`, `offline` |
| `tag_list` | string array | no | List of the runner's tags | | `tag_list` | string array | no | List of the runner's tags |
| `search` | string | no | The full token or partial description text to match |
```shell ```shell
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/runners" curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/runners"
......
...@@ -503,7 +503,7 @@ GET /projects/:id/services/emails-on-push ...@@ -503,7 +503,7 @@ GET /projects/:id/services/emails-on-push
## Confluence service ## Confluence service
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/220934) in GitLab 13.2. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/220934) in GitLab 13.2.
Replaces the link to the internal wiki with a link to a Confluence Cloud Workspace. Replaces the link to the internal wiki with a link to a Confluence Cloud Workspace.
......
...@@ -11,7 +11,7 @@ The Service Data API is associated with [Service Ping](../development/service_pi ...@@ -11,7 +11,7 @@ The Service Data API is associated with [Service Ping](../development/service_pi
## Export metric definitions as a single YAML file ## Export metric definitions as a single YAML file
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57270) in GitLab 13.11. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57270) in GitLab 13.11.
Export all metric definitions as a single YAML file, similar to the [Metrics Dictionary](https://gitlab-org.gitlab.io/growth/product-intelligence/metric-dictionary), for easier importing. Export all metric definitions as a single YAML file, similar to the [Metrics Dictionary](https://gitlab-org.gitlab.io/growth/product-intelligence/metric-dictionary), for easier importing.
......
...@@ -95,7 +95,7 @@ To configure your Vault server: ...@@ -95,7 +95,7 @@ To configure your Vault server:
## Use Vault secrets in a CI job **(PREMIUM)** ## Use Vault secrets in a CI job **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/28321) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.4 and GitLab Runner 13.4. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/28321) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.4 and GitLab Runner 13.4.
After [configuring your Vault server](#configure-your-vault-server), you can use After [configuring your Vault server](#configure-your-vault-server), you can use
the secrets stored in Vault by defining them with the `vault` keyword: the secrets stored in Vault by defining them with the `vault` keyword:
......
...@@ -3194,10 +3194,10 @@ dashboards. ...@@ -3194,10 +3194,10 @@ dashboards.
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207528) in GitLab 13.0. > - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/207528) in GitLab 13.0.
> - Requires [GitLab Runner](https://docs.gitlab.com/runner/) 11.5 and above. > - Requires [GitLab Runner](https://docs.gitlab.com/runner/) 11.5 and above.
The `terraform` report obtains a Terraform `tfplan.json` file. [JQ processing required to remove credentials](../../user/infrastructure/mr_integration.md#configure-terraform-report-artifacts). The collected Terraform The `terraform` report obtains a Terraform `tfplan.json` file. [JQ processing required to remove credentials](../../user/infrastructure/iac/mr_integration.md#configure-terraform-report-artifacts). The collected Terraform
plan report uploads to GitLab as an artifact and displays plan report uploads to GitLab as an artifact and displays
in merge requests. For more information, see in merge requests. For more information, see
[Output `terraform plan` information into a merge request](../../user/infrastructure/mr_integration.md). [Output `terraform plan` information into a merge request](../../user/infrastructure/iac/mr_integration.md).
#### `artifacts:untracked` #### `artifacts:untracked`
......
...@@ -249,18 +249,88 @@ logic to delete these rows if or whenever necessary in your domain. ...@@ -249,18 +249,88 @@ logic to delete these rows if or whenever necessary in your domain.
Finally, this de-normalization and new query also improves performance because Finally, this de-normalization and new query also improves performance because
it does less joins and needs less filtering. it does less joins and needs less filtering.
#### Summary of cross-join removal patterns #### Use `disable_joins` for `has_one` or `has_many` `through:` relations
A quick checklist for fixing a specific join query would be: Sometimes a join query is caused by using `has_one ... through:` or `has_many
... through:` across tables that span the different databases. These joins
1. Is the code even used? If not just remove it sometimes can be solved by adding
1. If the code is used, then is this feature even used or can we implement the [`disable_joins:true`](https://edgeguides.rubyonrails.org/active_record_multiple_databases.html#handling-associations-with-joins-across-databases).
feature in a simpler way and still meet the requirements. Always prefer the This is a Rails feature which we
simplest option. [backported](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66400). We
1. Can we remove the join if we de-normalize the data you are joining to by also extended the feature to allow a lambda syntax for enabling `disable_joins`
adding a new column with a feature flag. If you use this feature we encourage using a feature flag
1. Can we remove the join by adding a new table in the correct database that as it mitigates risk if there is some serious performance regression.
replicates the minimum data needed to do the join
You can see an example where this was used in
<https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66709/diffs>.
With any change to DB queries it is important to analyze and compare the SQL
before and after the change. `disable_joins` can introduce very poorly performing
code depending on the actual logic of the `has_many` or `has_one` relationship.
The key thing to look for is whether any of the intermediate result sets
used to construct the final result set have an unbounded amount of data loaded.
The best way to tell is by looking at the SQL generated and confirming that
each one is limited in some way. You can tell by either a `LIMIT 1` clause or
by `WHERE` clause that is limiting based on a unique column. Any unbounded
intermediate dataset could lead to loading too many IDs into memory.
An example where you may see very poor performance is the following
hypothetical code:
```ruby
class Project
has_many :pipelines
has_many :builds, through: :pipelines
end
class Pipeline
has_many :builds
end
class Build
belongs_to :pipeline
end
def some_action
@builds = Project.find(5).builds.order(created_at: :desc).limit(10)
end
```
In the above case `some_action` will generate a query like:
```sql
select * from builds
inner join pipelines on builds.pipeline_id = pipelines.id
where pipelines.project_id = 5
order by builds.created_at desc
limit 10
```
However, if you changed the relation to be:
```ruby
class Project
has_many :pipelines
has_many :builds, through: :pipelines, disable_joins: true
end
```
Then you would get the following 2 queries:
```sql
select id from pipelines where project_id = 5;
select * from builds where pipeline_id in (...)
order by created_at desc
limit 10;
```
Because the first query does not limit by any unique column or
have a `LIMIT` clause, it can load an unlimited number of
pipeline IDs into memory, which are then sent in the following query.
This can lead to very poor performance in the Rails application and the
database. In cases like this, you might need to re-write the
query or look at other patterns described above for removing cross-joins.
#### How to validate you have correctly removed a cross-join #### How to validate you have correctly removed a cross-join
......
...@@ -190,7 +190,7 @@ bulk_imports = distinct_count(::BulkImport, :user_id) ...@@ -190,7 +190,7 @@ bulk_imports = distinct_count(::BulkImport, :user_id)
#### Estimated batch counters #### Estimated batch counters
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48233) in GitLab 13.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48233) in GitLab 13.7.
Estimated batch counter functionality handles `ActiveRecord::StatementInvalid` errors Estimated batch counter functionality handles `ActiveRecord::StatementInvalid` errors
when used through the provided `estimate_batch_distinct_count` method. when used through the provided `estimate_batch_distinct_count` method.
...@@ -972,7 +972,7 @@ Becomes: ...@@ -972,7 +972,7 @@ Becomes:
### Redis sourced aggregated metrics ### Redis sourced aggregated metrics
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45979) in GitLab 13.6. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45979) in GitLab 13.6.
To declare the aggregate of events collected with [Redis HLL Counters](#redis-hll-counters), To declare the aggregate of events collected with [Redis HLL Counters](#redis-hll-counters),
you must fulfill the following requirements: you must fulfill the following requirements:
......
...@@ -713,7 +713,7 @@ default weight, which is 1. ...@@ -713,7 +713,7 @@ default weight, which is 1.
## Worker context ## Worker context
> - [Introduced](https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/9) in GitLab 12.8. > [Introduced](https://gitlab.com/gitlab-com/gl-infra/scalability/-/issues/9) in GitLab 12.8.
To have some more information about workers in the logs, we add To have some more information about workers in the logs, we add
[metadata to the jobs in the form of an [metadata to the jobs in the form of an
......
...@@ -61,7 +61,7 @@ Prometheus server to use the ...@@ -61,7 +61,7 @@ Prometheus server to use the
## Trigger actions from alerts **(ULTIMATE)** ## Trigger actions from alerts **(ULTIMATE)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4925) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.11. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/4925) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 11.11.
Alerts can be used to trigger actions, like opening an issue automatically Alerts can be used to trigger actions, like opening an issue automatically
(disabled by default since `13.1`). To configure the actions: (disabled by default since `13.1`). To configure the actions:
......
...@@ -12,7 +12,7 @@ recommend that you prepare them before enabling Auto DevOps. ...@@ -12,7 +12,7 @@ recommend that you prepare them before enabling Auto DevOps.
## Deployment strategy ## Deployment strategy
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/38542) in GitLab 11.0. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/38542) in GitLab 11.0.
When using Auto DevOps to deploy your applications, choose the When using Auto DevOps to deploy your applications, choose the
[continuous deployment strategy](../../ci/introduction/index.md) [continuous deployment strategy](../../ci/introduction/index.md)
......
...@@ -15,7 +15,7 @@ from planning to monitoring. ...@@ -15,7 +15,7 @@ from planning to monitoring.
To see DevOps Report: To see DevOps Report:
1. On the top bar, select **Menu > Admin**. 1. On the top bar, select **Menu > Admin**.
1. In the left sidebar, select **Analytics > DevOps Report**. 1. On the left sidebar, select **Analytics > DevOps Report**.
## DevOps Score ## DevOps Score
......
...@@ -11,7 +11,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -11,7 +11,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
Administrators have access to instance-wide analytics: Administrators have access to instance-wide analytics:
1. On the top bar, select **Menu > Admin**. 1. On the top bar, select **Menu > Admin**.
1. In the left sidebar, select **Analytics**. 1. On the left sidebar, select **Analytics**.
There are several kinds of statistics: There are several kinds of statistics:
......
...@@ -194,7 +194,7 @@ Users can also be activated using the [GitLab API](../../api/users.md#activate-u ...@@ -194,7 +194,7 @@ Users can also be activated using the [GitLab API](../../api/users.md#activate-u
## Ban and unban users ## Ban and unban users
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/327353) in GitLab 14.2. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/327353) in GitLab 14.2.
GitLab administrators can ban and unban users. Banned users are blocked, and their issues are hidden. GitLab administrators can ban and unban users. Banned users are blocked, and their issues are hidden.
The banned user's comments are still displayed. Hiding a banned user's comments is [tracked in this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/327356). The banned user's comments are still displayed. Hiding a banned user's comments is [tracked in this issue](https://gitlab.com/gitlab-org/gitlab/-/issues/327356).
......
...@@ -7,7 +7,7 @@ type: reference ...@@ -7,7 +7,7 @@ type: reference
# Instance template repository **(PREMIUM SELF)** # Instance template repository **(PREMIUM SELF)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5986) in GitLab Premium 11.3. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/5986) in GitLab Premium 11.3.
In hosted systems, enterprises often have a need to share their own templates In hosted systems, enterprises often have a need to share their own templates
across teams. This feature allows an administrator to pick a project to be the across teams. This feature allows an administrator to pick a project to be the
......
...@@ -26,7 +26,7 @@ You can restrict the password authentication for web interface and Git over HTTP ...@@ -26,7 +26,7 @@ You can restrict the password authentication for web interface and Git over HTTP
## Admin Mode ## Admin Mode
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2158) in GitLab 13.10. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2158) in GitLab 13.10.
When this feature is enabled, instance administrators are limited as regular users. During that period, When this feature is enabled, instance administrators are limited as regular users. During that period,
they do not have access to all projects, groups, or the **Admin Area** menu. they do not have access to all projects, groups, or the **Admin Area** menu.
......
...@@ -74,8 +74,9 @@ If your GitLab instance is behind a proxy, set the appropriate ...@@ -74,8 +74,9 @@ If your GitLab instance is behind a proxy, set the appropriate
To enable or disable Service Ping and version check: To enable or disable Service Ping and version check:
1. On the top bar, select **Menu > Admin**. 1. On the top bar, select **Menu > Admin**.
1. In the left sidebar, select **Settings > Metrics and profiling**, and expand **Usage statistics**. 1. On the left sidebar, select **Settings > Metrics and profiling**.
1. Select or clear the **Version check** and **Service ping** checkboxes. 1. Expand **Usage statistics**.
1. Select or clear the **Enable version check** and **Enable service ping** checkboxes.
1. Select **Save changes**. 1. Select **Save changes**.
<!-- ## Troubleshooting <!-- ## Troubleshooting
......
...@@ -7,13 +7,16 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -7,13 +7,16 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Issue Analytics **(PREMIUM)** # Issue Analytics **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/196561) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.9. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/196561) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.9.
Issue Analytics is a bar graph which illustrates the number of issues created each month. Issue Analytics is a bar graph which illustrates the number of issues created each month.
The default time span is 13 months, which includes the current month, and the 12 months The default time span is 13 months, which includes the current month, and the 12 months
prior. prior.
To access the chart, navigate to your project sidebar and select **Analytics > Issue**. To access the chart:
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Analytics > Issue**.
Hover over each bar to see the total number of issues. Hover over each bar to see the total number of issues.
......
...@@ -20,7 +20,10 @@ The Throughput chart shows the number of merge requests merged, by month. Merge ...@@ -20,7 +20,10 @@ The Throughput chart shows the number of merge requests merged, by month. Merge
a common measure of productivity in software engineering. Although imperfect, the average throughput can a common measure of productivity in software engineering. Although imperfect, the average throughput can
be a meaningful benchmark of your team's overall productivity. be a meaningful benchmark of your team's overall productivity.
To access Merge Request Analytics, from your project's menu, go to **Analytics > Merge Request**. To access Merge Request Analytics:
1. On the top bar, select **Menu > Projects** and find your project.
1. On the left sidebar, select **Analytics > Merge request**.
## Use cases ## Use cases
...@@ -93,10 +96,10 @@ You can filter the data that is presented on the page based on the following par ...@@ -93,10 +96,10 @@ You can filter the data that is presented on the page based on the following par
To filter results: To filter results:
1. Click on the filter bar. 1. Select the filter bar.
1. Select a parameter to filter by. 1. Select a parameter to filter by.
1. Select a value from the autocompleted results, or enter search text to refine the results. 1. Select a value from the autocompleted results, or enter search text to refine the results.
1. Hit the "Return" key. 1. Press Enter.
## Date range ## Date range
......
...@@ -85,7 +85,7 @@ In GitLab 14.0 and later, API fuzzing configuration files must be in your reposi ...@@ -85,7 +85,7 @@ In GitLab 14.0 and later, API fuzzing configuration files must be in your reposi
### Web API fuzzing configuration form ### Web API fuzzing configuration form
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/299234) in GitLab 13.10. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/299234) in GitLab 13.10.
WARNING: WARNING:
This feature might not be available to you. Check the **version history** note above for details. This feature might not be available to you. Check the **version history** note above for details.
......
...@@ -897,7 +897,7 @@ variables: ...@@ -897,7 +897,7 @@ variables:
### Exclude Paths ### Exclude Paths
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211892) in GitLab 14.0. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/211892) in GitLab 14.0.
When testing an API it can be useful to exclude certain paths. For example, you might exclude testing of an authentication service or an older version of the API. To exclude paths, use the `FUZZAPI_EXCLUDE_PATHS` CI/CD variable . This variable is specified in your `.gitlab-ci.yml` file. To exclude multiple paths, separate entries using the `;` character. In the provided paths you can use a single character wildcard `?` and `*` for a multiple character wildcard. When testing an API it can be useful to exclude certain paths. For example, you might exclude testing of an authentication service or an older version of the API. To exclude paths, use the `FUZZAPI_EXCLUDE_PATHS` CI/CD variable . This variable is specified in your `.gitlab-ci.yml` file. To exclude multiple paths, separate entries using the `;` character. In the provided paths you can use a single character wildcard `?` and `*` for a multiple character wildcard.
......
...@@ -285,10 +285,10 @@ postgresql: ...@@ -285,10 +285,10 @@ postgresql:
``` ```
Support for installing the Sentry managed application is provided by the Support for installing the Sentry managed application is provided by the
GitLab Health group. If you run into unknown issues, GitLab Monitor group. If you run into unknown issues,
[open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at [open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at
least 2 people from the least 2 people from the
[Health group](https://about.gitlab.com/handbook/product/categories/#health-group). [Monitor group](https://about.gitlab.com/handbook/product/categories/#monitor-group).
### Install PostHog using GitLab CI/CD ### Install PostHog using GitLab CI/CD
...@@ -366,9 +366,9 @@ project. Refer to the ...@@ -366,9 +366,9 @@ project. Refer to the
of the Prometheus chart's README for the available configuration options. of the Prometheus chart's README for the available configuration options.
Support for installing the Prometheus managed application is provided by the Support for installing the Prometheus managed application is provided by the
GitLab APM group. If you run into unknown issues, GitLab Monitor group. If you run into unknown issues,
[open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at [open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at
least 2 people from the [APM group](https://about.gitlab.com/handbook/product/categories/#apm-group). least 2 people from the [Monitor group](https://about.gitlab.com/handbook/product/categories/#monitor-group).
### Install GitLab Runner using GitLab CI/CD ### Install GitLab Runner using GitLab CI/CD
...@@ -819,9 +819,9 @@ management project. Refer to the ...@@ -819,9 +819,9 @@ management project. Refer to the
available configuration options. available configuration options.
Support for installing the Elastic Stack managed application is provided by the Support for installing the Elastic Stack managed application is provided by the
GitLab APM group. If you run into unknown issues, GitLab Monitor group. If you run into unknown issues,
[open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at [open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at
least 2 people from the [APM group](https://about.gitlab.com/handbook/product/categories/#apm-group). least 2 people from the [Monitor group](https://about.gitlab.com/handbook/product/categories/#monitor-group).
### Install Crossplane using GitLab CI/CD ### Install Crossplane using GitLab CI/CD
......
...@@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -7,7 +7,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Issue Analytics **(PREMIUM)** # Issue Analytics **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7478) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/7478) in [GitLab Premium](https://about.gitlab.com/pricing/) 11.5.
Issue Analytics is a bar graph which illustrates the number of issues created each month. Issue Analytics is a bar graph which illustrates the number of issues created each month.
The default time span is 13 months, which includes the current month, and the 12 months The default time span is 13 months, which includes the current month, and the 12 months
......
...@@ -16,7 +16,7 @@ This feature might not be available to you. Check the **version history** note a ...@@ -16,7 +16,7 @@ This feature might not be available to you. Check the **version history** note a
## Current group code coverage ## Current group code coverage
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/263478) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/263478) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.7.
The **Analytics > Repositories** group page displays the overall test coverage of all your projects in your group. The **Analytics > Repositories** group page displays the overall test coverage of all your projects in your group.
In the **Overall activity** section, you can see: In the **Overall activity** section, you can see:
...@@ -27,13 +27,13 @@ In the **Overall activity** section, you can see: ...@@ -27,13 +27,13 @@ In the **Overall activity** section, you can see:
## Average group test coverage from the last 30 days ## Average group test coverage from the last 30 days
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215140) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.9. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/215140) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.9.
The **Analytics > Repositories** group page displays the average test coverage of all your projects in your group in a graph for the last 30 days. The **Analytics > Repositories** group page displays the average test coverage of all your projects in your group in a graph for the last 30 days.
## Latest project test coverage list ## Latest project test coverage list
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/267624) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.6. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/267624) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.6.
To see the latest code coverage for each project in your group: To see the latest code coverage for each project in your group:
......
...@@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
--- ---
# Group import/export **(FREE)** # Group import/export **(FREE)**
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2888) in GitLab 13.0 as an experimental feature. May change in future releases. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/2888) in GitLab 13.0 as an experimental feature. May change in future releases.
Existing groups running on any GitLab instance or GitLab.com can be exported with all their related data and moved to a Existing groups running on any GitLab instance or GitLab.com can be exported with all their related data and moved to a
new GitLab instance. new GitLab instance.
......
...@@ -29,6 +29,6 @@ management project. Refer to the ...@@ -29,6 +29,6 @@ management project. Refer to the
available configuration options. available configuration options.
Support for installing the Elastic Stack managed application is provided by the Support for installing the Elastic Stack managed application is provided by the
GitLab APM group. If you run into unknown issues, GitLab Monitor group. If you run into unknown issues,
[open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at [open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at
least 2 people from the [APM group](https://about.gitlab.com/handbook/product/categories/#apm-group). least 2 people from the [Monitor group](https://about.gitlab.com/handbook/product/categories/#monitor-group).
...@@ -27,6 +27,6 @@ management project. Refer to the ...@@ -27,6 +27,6 @@ management project. Refer to the
of the Prometheus chart's README for the available configuration options. of the Prometheus chart's README for the available configuration options.
Support for installing the Prometheus managed application is provided by the Support for installing the Prometheus managed application is provided by the
GitLab APM group. If you run into unknown issues, GitLab Monitor group. If you run into unknown issues,
[open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at [open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at
least 2 people from the [APM group](https://about.gitlab.com/handbook/product/categories/#apm-group). least 2 people from the [Monitor group](https://about.gitlab.com/handbook/product/categories/#monitor-group).
...@@ -70,7 +70,7 @@ postgresql: ...@@ -70,7 +70,7 @@ postgresql:
``` ```
Support for installing the Sentry managed application is provided by the Support for installing the Sentry managed application is provided by the
GitLab Health group. If you run into unknown issues, GitLab Monitor group. If you run into unknown issues,
[open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at [open a new issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new), and ping at
least 2 people from the least 2 people from the
[Health group](https://about.gitlab.com/handbook/product/categories/#health-group). [Monitor group](https://about.gitlab.com/handbook/product/categories/#monitor-group).
...@@ -65,7 +65,7 @@ Amazon S3 or Google Cloud Storage. Its features include: ...@@ -65,7 +65,7 @@ Amazon S3 or Google Cloud Storage. Its features include:
- Locking and unlocking state. - Locking and unlocking state.
- Remote Terraform plan and apply execution. - Remote Terraform plan and apply execution.
Read more on setting up and [using GitLab Managed Terraform states](../terraform_state.md) Read more on setting up and [using GitLab Managed Terraform states](terraform_state.md).
## Terraform module registry ## Terraform module registry
...@@ -81,7 +81,7 @@ solution to help collaboration around Terraform code changes and their expected ...@@ -81,7 +81,7 @@ solution to help collaboration around Terraform code changes and their expected
effects using the Merge Request pages. This way users don't have to build custom effects using the Merge Request pages. This way users don't have to build custom
tools or rely on 3rd party solutions to streamline their IaC workflows. tools or rely on 3rd party solutions to streamline their IaC workflows.
Read more on setting up and [using the merge request integrations](../mr_integration.md). Read more on setting up and [using the merge request integrations](mr_integration.md).
## The GitLab Terraform provider ## The GitLab Terraform provider
......
---
stage: Configure
group: Configure
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
---
# Terraform integration in Merge Requests **(FREE)**
Collaborating around Infrastructure as Code (IaC) changes requires both code changes and expected infrastructure changes to be checked and approved. GitLab provides a solution to help collaboration around Terraform code changes and their expected effects using the Merge Request pages. This way users don't have to build custom tools or rely on 3rd party solutions to streamline their IaC workflows.
## Output Terraform Plan information into a merge request
Using the [GitLab Terraform Report artifact](../../../ci/yaml/index.md#artifactsreportsterraform),
you can expose details from `terraform plan` runs directly into a merge request widget,
enabling you to see statistics about the resources that Terraform creates,
modifies, or destroys.
WARNING:
Like any other job artifact, Terraform Plan data is [viewable by anyone with Guest access](../../permissions.md) to the repository.
Neither Terraform nor GitLab encrypts the plan file by default. If your Terraform Plan
includes sensitive data such as passwords, access tokens, or certificates, we strongly
recommend encrypting plan output or modifying the project visibility settings.
## Configure Terraform report artifacts
GitLab ships with a [pre-built CI template](index.md#quick-start) that uses GitLab Managed Terraform state and integrates Terraform changes into merge requests. We recommend customizing the pre-built image and relying on the `gitlab-terraform` helper provided within for a quick setup.
To manually configure a GitLab Terraform Report artifact:
1. For simplicity, let's define a few reusable variables to allow us to
refer to these files multiple times:
```yaml
variables:
PLAN: plan.cache
PLAN_JSON: plan.json
```
1. Install `jq`, a
[lightweight and flexible command-line JSON processor](https://stedolan.github.io/jq/).
1. Create an alias for a specific `jq` command that parses out the information we
want to extract from the `terraform plan` output:
```yaml
before_script:
- apk --no-cache add jq
- alias convert_report="jq -r '([.resource_changes[]?.change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
```
NOTE:
In distributions that use Bash (for example, Ubuntu), `alias` statements are not
expanded in non-interactive mode. If your pipelines fail with the error
`convert_report: command not found`, alias expansion can be activated explicitly
by adding a `shopt` command to your script:
```yaml
before_script:
- shopt -s expand_aliases
- alias convert_report="jq -r '([.resource_changes[]?.change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
```
1. Define a `script` that runs `terraform plan` and `terraform show`. These commands
pipe the output and convert the relevant bits into a store variable `PLAN_JSON`.
This JSON is used to create a
[GitLab Terraform Report artifact](../../../ci/yaml/index.md#artifactsreportsterraform).
The Terraform report obtains a Terraform `tfplan.json` file. The collected
Terraform plan report is uploaded to GitLab as an artifact, and is shown in merge requests.
```yaml
plan:
stage: build
script:
- terraform plan -out=$PLAN
- terraform show --json $PLAN | convert_report > $PLAN_JSON
artifacts:
reports:
terraform: $PLAN_JSON
```
For a full example using the pre-built image, see [Example `.gitlab-ci.yml`
file](#example-gitlab-ciyml-file).
For an example displaying multiple reports, see [`.gitlab-ci.yml` multiple reports file](#multiple-terraform-plan-reports).
1. Running the pipeline displays the widget in the merge request, like this:
![Merge Request Terraform widget](img/terraform_plan_widget_v13_2.png)
1. Clicking the **View Full Log** button in the widget takes you directly to the
plan output present in the pipeline logs:
![Terraform plan logs](img/terraform_plan_log_v13_0.png)
### Example `.gitlab-ci.yml` file
```yaml
default:
image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
cache:
key: example-production
paths:
- ${TF_ROOT}/.terraform
variables:
TF_ROOT: ${CI_PROJECT_DIR}/environments/example/production
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/example-production
before_script:
- cd ${TF_ROOT}
stages:
- prepare
- validate
- build
- deploy
init:
stage: prepare
script:
- gitlab-terraform init
validate:
stage: validate
script:
- gitlab-terraform validate
plan:
stage: build
script:
- gitlab-terraform plan
- gitlab-terraform plan-json
artifacts:
name: plan
paths:
- ${TF_ROOT}/plan.cache
reports:
terraform: ${TF_ROOT}/plan.json
apply:
stage: deploy
environment:
name: production
script:
- gitlab-terraform apply
dependencies:
- plan
when: manual
only:
- master
```
### Multiple Terraform Plan reports
Starting with GitLab version 13.2, you can display multiple reports on the Merge Request
page. The reports also display the `artifacts: name:`. See example below for a suggested setup.
```yaml
default:
image:
name: registry.gitlab.com/gitlab-org/gitlab-build-images:terraform
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
cache:
paths:
- .terraform
stages:
- build
.terraform-plan-generation:
stage: build
variables:
PLAN: plan.tfplan
JSON_PLAN_FILE: tfplan.json
before_script:
- cd ${TERRAFORM_DIRECTORY}
- terraform --version
- terraform init
- apk --no-cache add jq
script:
- terraform validate
- terraform plan -out=${PLAN}
- terraform show --json ${PLAN} | jq -r '([.resource_changes[]?.change.actions?]|flatten)|{"create":(map(select(.=="create"))|length),"update":(map(select(.=="update"))|length),"delete":(map(select(.=="delete"))|length)}' > ${JSON_PLAN_FILE}
artifacts:
reports:
terraform: ${TERRAFORM_DIRECTORY}/${JSON_PLAN_FILE}
review_plan:
extends: .terraform-plan-generation
variables:
TERRAFORM_DIRECTORY: "review/"
# Review will not include an artifact name
staging_plan:
extends: .terraform-plan-generation
variables:
TERRAFORM_DIRECTORY: "staging/"
artifacts:
name: Staging
production_plan:
extends: .terraform-plan-generation
variables:
TERRAFORM_DIRECTORY: "production/"
artifacts:
name: Production
```
This diff is collapsed.
...@@ -27,8 +27,8 @@ The various GitLab integrations help you: ...@@ -27,8 +27,8 @@ The various GitLab integrations help you:
Read more about the [Infrastructure as Code features](iac/index.md), including: Read more about the [Infrastructure as Code features](iac/index.md), including:
- [The GitLab Managed Terraform State](terraform_state.md). - [The GitLab Managed Terraform State](iac/terraform_state.md).
- [The Terraform MR widget](mr_integration.md). - [The Terraform MR widget](iac/mr_integration.md).
- [The Terraform module registry](../packages/terraform_module_registry/index.md). - [The Terraform module registry](../packages/terraform_module_registry/index.md).
## Integrated Kubernetes management ## Integrated Kubernetes management
......
--- ---
stage: Configure redirect_to: 'iac/mr_integration.md'
group: Configure remove_date: '2021-11-26'
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
--- ---
# Terraform integration in Merge Requests **(FREE)** This document was moved to [another location](iac/mr_integration.md).
Collaborating around Infrastructure as Code (IaC) changes requires both code changes and expected infrastructure changes to be checked and approved. GitLab provides a solution to help collaboration around Terraform code changes and their expected effects using the Merge Request pages. This way users don't have to build custom tools or rely on 3rd party solutions to streamline their IaC workflows. <!-- This redirect file can be deleted after <2021-11-26>. -->
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
## Output Terraform Plan information into a merge request
Using the [GitLab Terraform Report artifact](../../ci/yaml/index.md#artifactsreportsterraform),
you can expose details from `terraform plan` runs directly into a merge request widget,
enabling you to see statistics about the resources that Terraform creates,
modifies, or destroys.
WARNING:
Like any other job artifact, Terraform Plan data is [viewable by anyone with Guest access](../permissions.md) to the repository.
Neither Terraform nor GitLab encrypts the plan file by default. If your Terraform Plan
includes sensitive data such as passwords, access tokens, or certificates, we strongly
recommend encrypting plan output or modifying the project visibility settings.
## Configure Terraform report artifacts
GitLab ships with a [pre-built CI template](iac/index.md#quick-start) that uses GitLab Managed Terraform state and integrates Terraform changes into merge requests. We recommend customizing the pre-built image and relying on the `gitlab-terraform` helper provided within for a quick setup.
To manually configure a GitLab Terraform Report artifact:
1. For simplicity, let's define a few reusable variables to allow us to
refer to these files multiple times:
```yaml
variables:
PLAN: plan.cache
PLAN_JSON: plan.json
```
1. Install `jq`, a
[lightweight and flexible command-line JSON processor](https://stedolan.github.io/jq/).
1. Create an alias for a specific `jq` command that parses out the information we
want to extract from the `terraform plan` output:
```yaml
before_script:
- apk --no-cache add jq
- alias convert_report="jq -r '([.resource_changes[]?.change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
```
NOTE:
In distributions that use Bash (for example, Ubuntu), `alias` statements are not
expanded in non-interactive mode. If your pipelines fail with the error
`convert_report: command not found`, alias expansion can be activated explicitly
by adding a `shopt` command to your script:
```yaml
before_script:
- shopt -s expand_aliases
- alias convert_report="jq -r '([.resource_changes[]?.change.actions?]|flatten)|{\"create\":(map(select(.==\"create\"))|length),\"update\":(map(select(.==\"update\"))|length),\"delete\":(map(select(.==\"delete\"))|length)}'"
```
1. Define a `script` that runs `terraform plan` and `terraform show`. These commands
pipe the output and convert the relevant bits into a store variable `PLAN_JSON`.
This JSON is used to create a
[GitLab Terraform Report artifact](../../ci/yaml/index.md#artifactsreportsterraform).
The Terraform report obtains a Terraform `tfplan.json` file. The collected
Terraform plan report is uploaded to GitLab as an artifact, and is shown in merge requests.
```yaml
plan:
stage: build
script:
- terraform plan -out=$PLAN
- terraform show --json $PLAN | convert_report > $PLAN_JSON
artifacts:
reports:
terraform: $PLAN_JSON
```
For a full example using the pre-built image, see [Example `.gitlab-ci.yml`
file](#example-gitlab-ciyml-file).
For an example displaying multiple reports, see [`.gitlab-ci.yml` multiple reports file](#multiple-terraform-plan-reports).
1. Running the pipeline displays the widget in the merge request, like this:
![Merge Request Terraform widget](img/terraform_plan_widget_v13_2.png)
1. Clicking the **View Full Log** button in the widget takes you directly to the
plan output present in the pipeline logs:
![Terraform plan logs](img/terraform_plan_log_v13_0.png)
### Example `.gitlab-ci.yml` file
```yaml
default:
image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
cache:
key: example-production
paths:
- ${TF_ROOT}/.terraform
variables:
TF_ROOT: ${CI_PROJECT_DIR}/environments/example/production
TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/example-production
before_script:
- cd ${TF_ROOT}
stages:
- prepare
- validate
- build
- deploy
init:
stage: prepare
script:
- gitlab-terraform init
validate:
stage: validate
script:
- gitlab-terraform validate
plan:
stage: build
script:
- gitlab-terraform plan
- gitlab-terraform plan-json
artifacts:
name: plan
paths:
- ${TF_ROOT}/plan.cache
reports:
terraform: ${TF_ROOT}/plan.json
apply:
stage: deploy
environment:
name: production
script:
- gitlab-terraform apply
dependencies:
- plan
when: manual
only:
- master
```
### Multiple Terraform Plan reports
Starting with GitLab version 13.2, you can display multiple reports on the Merge Request
page. The reports also display the `artifacts: name:`. See example below for a suggested setup.
```yaml
default:
image:
name: registry.gitlab.com/gitlab-org/gitlab-build-images:terraform
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
cache:
paths:
- .terraform
stages:
- build
.terraform-plan-generation:
stage: build
variables:
PLAN: plan.tfplan
JSON_PLAN_FILE: tfplan.json
before_script:
- cd ${TERRAFORM_DIRECTORY}
- terraform --version
- terraform init
- apk --no-cache add jq
script:
- terraform validate
- terraform plan -out=${PLAN}
- terraform show --json ${PLAN} | jq -r '([.resource_changes[]?.change.actions?]|flatten)|{"create":(map(select(.=="create"))|length),"update":(map(select(.=="update"))|length),"delete":(map(select(.=="delete"))|length)}' > ${JSON_PLAN_FILE}
artifacts:
reports:
terraform: ${TERRAFORM_DIRECTORY}/${JSON_PLAN_FILE}
review_plan:
extends: .terraform-plan-generation
variables:
TERRAFORM_DIRECTORY: "review/"
# Review will not include an artifact name
staging_plan:
extends: .terraform-plan-generation
variables:
TERRAFORM_DIRECTORY: "staging/"
artifacts:
name: Staging
production_plan:
extends: .terraform-plan-generation
variables:
TERRAFORM_DIRECTORY: "production/"
artifacts:
name: Production
```
This diff is collapsed.
...@@ -747,6 +747,8 @@ The **Packages & Registries > Container Registry** entry is removed from the pro ...@@ -747,6 +747,8 @@ The **Packages & Registries > Container Registry** entry is removed from the pro
## Change visibility of the Container Registry ## Change visibility of the Container Registry
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/18792) in GitLab 14.2.
By default, the Container Registry is visible to everyone with access to the project. By default, the Container Registry is visible to everyone with access to the project.
You can, however, change the visibility of the Container Registry for a project. You can, however, change the visibility of the Container Registry for a project.
......
...@@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -6,7 +6,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Terraform module registry **(FREE)** # Terraform module registry **(FREE)**
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3221) in GitLab 14.0. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/3221) in GitLab 14.0.
Publish Terraform modules in your project's Infrastructure Registry, then reference them using GitLab Publish Terraform modules in your project's Infrastructure Registry, then reference them using GitLab
as a Terraform module registry. as a Terraform module registry.
......
...@@ -46,7 +46,7 @@ branch. The [Developer role](../../../permissions.md) is required to do so. ...@@ -46,7 +46,7 @@ branch. The [Developer role](../../../permissions.md) is required to do so.
## Multi-line suggestions ## Multi-line suggestions
> - [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53310) in GitLab 11.10. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/-/issues/53310) in GitLab 11.10.
Reviewers can also suggest changes to multiple lines with a single suggestion Reviewers can also suggest changes to multiple lines with a single suggestion
within merge request diff threads by adjusting the range offsets. The within merge request diff threads by adjusting the range offsets. The
......
...@@ -105,7 +105,7 @@ Wiki pages are stored as files in a Git repository, so certain characters have a ...@@ -105,7 +105,7 @@ Wiki pages are stored as files in a Git repository, so certain characters have a
### Length restrictions for file and directory names ### Length restrictions for file and directory names
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24364) in GitLab 12.8. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/24364) in GitLab 12.8.
Many common file systems have a [limit of 255 bytes](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits) Many common file systems have a [limit of 255 bytes](https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits)
for file and directory names. Git and GitLab both support paths exceeding for file and directory names. Git and GitLab both support paths exceeding
...@@ -175,7 +175,7 @@ From the history page you can see: ...@@ -175,7 +175,7 @@ From the history page you can see:
### View changes between page versions ### View changes between page versions
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15242) in GitLab 13.2. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/15242) in GitLab 13.2.
You can see the changes made in a version of a wiki page, similar to versioned diff file views: You can see the changes made in a version of a wiki page, similar to versioned diff file views:
...@@ -201,7 +201,7 @@ Commits to wikis are not counted in [repository analytics](../../analytics/repos ...@@ -201,7 +201,7 @@ Commits to wikis are not counted in [repository analytics](../../analytics/repos
## Customize sidebar ## Customize sidebar
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/23109) in GitLab 13.8, the sidebar can be customized by selecting the **Edit sidebar** button. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/23109) in GitLab 13.8, the sidebar can be customized by selecting the **Edit sidebar** button.
You need Developer [permissions](../../permissions.md) or higher to customize the wiki You need Developer [permissions](../../permissions.md) or higher to customize the wiki
navigation sidebar. This process creates a wiki page named `_sidebar` which fully navigation sidebar. This process creates a wiki page named `_sidebar` which fully
...@@ -238,7 +238,7 @@ Administrators for self-managed GitLab installs can ...@@ -238,7 +238,7 @@ Administrators for self-managed GitLab installs can
## Group wikis **(PREMIUM)** ## Group wikis **(PREMIUM)**
> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13195) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/13195) in [GitLab Premium](https://about.gitlab.com/pricing/) 13.5.
Group wikis work the same way as project wikis. Their usage is similar to project Group wikis work the same way as project wikis. Their usage is similar to project
wikis, with a few limitations: wikis, with a few limitations:
...@@ -306,7 +306,7 @@ to disable the wiki but toggle it on (in blue). ...@@ -306,7 +306,7 @@ to disable the wiki but toggle it on (in blue).
## Content Editor **(FREE)** ## Content Editor **(FREE)**
> - [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/5643) in GitLab 14.0. > [Introduced](https://gitlab.com/groups/gitlab-org/-/epics/5643) in GitLab 14.0.
GitLab version 14.0 introduces a WYSIWYG editing experience for GitLab Flavored Markdown GitLab version 14.0 introduces a WYSIWYG editing experience for GitLab Flavored Markdown
in Wikis through the [Content Editor](../../../development/fe_guide/content_editor.md). in Wikis through the [Content Editor](../../../development/fe_guide/content_editor.md).
......
...@@ -107,6 +107,7 @@ tree: ...@@ -107,6 +107,7 @@ tree:
- lists: - lists:
- label: - label:
- :priorities - :priorities
- :service_desk_setting
group_members: group_members:
- :user - :user
...@@ -455,7 +456,6 @@ ee: ...@@ -455,7 +456,6 @@ ee:
- :unprotect_access_levels - :unprotect_access_levels
- protected_environments: - protected_environments:
- :deploy_access_levels - :deploy_access_levels
- :service_desk_setting
- :security_setting - :security_setting
- :push_rule - :push_rule
......
...@@ -7,6 +7,7 @@ import '~/boards/models/list'; ...@@ -7,6 +7,7 @@ import '~/boards/models/list';
import { ListType } from '~/boards/constants'; import { ListType } from '~/boards/constants';
import boardsStore from '~/boards/stores/boards_store'; import boardsStore from '~/boards/stores/boards_store';
import { __ } from '~/locale'; import { __ } from '~/locale';
import { DEFAULT_MILESTONES_GRAPHQL } from '~/vue_shared/components/filtered_search_bar/constants';
import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue';
import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue'; import LabelToken from '~/vue_shared/components/filtered_search_bar/tokens/label_token.vue';
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
...@@ -547,17 +548,17 @@ export const mockMoveData = { ...@@ -547,17 +548,17 @@ export const mockMoveData = {
export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [
{ {
icon: 'labels', icon: 'user',
title: __('Label'), title: __('Assignee'),
type: 'label_name', type: 'assignee_username',
operators: [ operators: [
{ value: '=', description: 'is' }, { value: '=', description: 'is' },
{ value: '!=', description: 'is not' }, { value: '!=', description: 'is not' },
], ],
token: LabelToken, token: AuthorToken,
unique: false, unique: true,
symbol: '~', fetchAuthors,
fetchLabels, preloadedAuthors: [],
}, },
{ {
icon: 'pencil', icon: 'pencil',
...@@ -574,17 +575,27 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [ ...@@ -574,17 +575,27 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [
preloadedAuthors: [], preloadedAuthors: [],
}, },
{ {
icon: 'user', icon: 'labels',
title: __('Assignee'), title: __('Label'),
type: 'assignee_username', type: 'label_name',
operators: [ operators: [
{ value: '=', description: 'is' }, { value: '=', description: 'is' },
{ value: '!=', description: 'is not' }, { value: '!=', description: 'is not' },
], ],
token: AuthorToken, token: LabelToken,
unique: false,
symbol: '~',
fetchLabels,
},
{
icon: 'clock',
title: __('Milestone'),
symbol: '%',
type: 'milestone_title',
token: MilestoneToken,
unique: true, unique: true,
fetchAuthors, defaultMilestones: DEFAULT_MILESTONES_GRAPHQL,
preloadedAuthors: [], fetchMilestones,
}, },
{ {
icon: 'issues', icon: 'issues',
...@@ -598,16 +609,6 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [ ...@@ -598,16 +609,6 @@ export const mockTokens = (fetchLabels, fetchAuthors, fetchMilestones) => [
{ icon: 'issue-type-incident', value: 'INCIDENT', title: 'Incident' }, { icon: 'issue-type-incident', value: 'INCIDENT', title: 'Incident' },
], ],
}, },
{
icon: 'clock',
title: __('Milestone'),
symbol: '%',
type: 'milestone_title',
token: MilestoneToken,
unique: true,
defaultMilestones: [],
fetchMilestones,
},
{ {
icon: 'weight', icon: 'weight',
title: __('Weight'), title: __('Weight'),
......
...@@ -182,7 +182,12 @@ describe('AppComponent', () => { ...@@ -182,7 +182,12 @@ describe('AppComponent', () => {
jest.spyOn(window.history, 'replaceState').mockImplementation(() => {}); jest.spyOn(window.history, 'replaceState').mockImplementation(() => {});
jest.spyOn(window, 'scrollTo').mockImplementation(() => {}); jest.spyOn(window, 'scrollTo').mockImplementation(() => {});
const fetchPagePromise = vm.fetchPage(2, null, null, true); const fetchPagePromise = vm.fetchPage({
page: 2,
filterGroupsBy: null,
sortBy: null,
archived: true,
});
expect(vm.isLoading).toBe(true); expect(vm.isLoading).toBe(true);
expect(vm.fetchGroups).toHaveBeenCalledWith({ expect(vm.fetchGroups).toHaveBeenCalledWith({
......
...@@ -41,13 +41,12 @@ describe('GroupsComponent', () => { ...@@ -41,13 +41,12 @@ describe('GroupsComponent', () => {
vm.change(2); vm.change(2);
expect(eventHub.$emit).toHaveBeenCalledWith( expect(eventHub.$emit).toHaveBeenCalledWith('fetchPage', {
'fetchPage', page: 2,
2, archived: null,
expect.any(Object), filterGroupsBy: null,
expect.any(Object), sortBy: null,
expect.any(Object), });
);
}); });
}); });
}); });
......
...@@ -11,7 +11,10 @@ import createFlash from '~/flash'; ...@@ -11,7 +11,10 @@ import createFlash from '~/flash';
import axios from '~/lib/utils/axios_utils'; import axios from '~/lib/utils/axios_utils';
import { sortMilestonesByDueDate } from '~/milestones/milestone_utils'; import { sortMilestonesByDueDate } from '~/milestones/milestone_utils';
import { DEFAULT_MILESTONES } from '~/vue_shared/components/filtered_search_bar/constants'; import {
DEFAULT_MILESTONES,
DEFAULT_MILESTONES_GRAPHQL,
} from '~/vue_shared/components/filtered_search_bar/constants';
import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue'; import MilestoneToken from '~/vue_shared/components/filtered_search_bar/tokens/milestone_token.vue';
import { mockMilestoneToken, mockMilestones, mockRegularMilestone } from '../mock_data'; import { mockMilestoneToken, mockMilestones, mockRegularMilestone } from '../mock_data';
...@@ -191,5 +194,22 @@ describe('MilestoneToken', () => { ...@@ -191,5 +194,22 @@ describe('MilestoneToken', () => {
expect(suggestions.at(index).text()).toBe(milestone.text); expect(suggestions.at(index).text()).toBe(milestone.text);
}); });
}); });
describe('when getActiveMilestones is called and milestones is empty', () => {
beforeEach(() => {
wrapper = createComponent({
active: true,
config: { ...mockMilestoneToken, defaultMilestones: DEFAULT_MILESTONES_GRAPHQL },
});
});
it('finds the correct value from the activeToken', () => {
DEFAULT_MILESTONES_GRAPHQL.forEach(({ value, title }) => {
const activeToken = wrapper.vm.getActiveMilestone([], value);
expect(activeToken.title).toEqual(title);
});
});
});
}); });
}); });
...@@ -21,6 +21,7 @@ describe('RunnerAwsDeploymentsModal', () => { ...@@ -21,6 +21,7 @@ describe('RunnerAwsDeploymentsModal', () => {
wrapper = shallowMount(RunnerAwsDeploymentsModal, { wrapper = shallowMount(RunnerAwsDeploymentsModal, {
propsData: { propsData: {
modalId: 'runner-aws-deployments-modal', modalId: 'runner-aws-deployments-modal',
imgSrc: '/assets/aws-cloud-formation.png',
}, },
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment