Commit 662bb2b6 authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@12-5-stable-ee

parent ed8af410
...@@ -92,6 +92,14 @@ setup-test-env: ...@@ -92,6 +92,14 @@ setup-test-env:
- .use-pg10 - .use-pg10
- .only-master - .only-master
rspec migration pg9:
extends: .rspec-base-pg9
parallel: 4
rspec migration pg9-foss:
extends: .rspec-base-pg9-foss
parallel: 4
rspec unit pg9: rspec unit pg9:
extends: .rspec-base-pg9 extends: .rspec-base-pg9
parallel: 20 parallel: 20
...@@ -140,9 +148,13 @@ rspec system pg10: ...@@ -140,9 +148,13 @@ rspec system pg10:
- .only-ee - .only-ee
- .use-pg10-ee - .use-pg10-ee
rspec-ee migration pg9:
extends: .rspec-ee-base-pg9
parallel: 2
rspec-ee unit pg9: rspec-ee unit pg9:
extends: .rspec-ee-base-pg9 extends: .rspec-ee-base-pg9
parallel: 7 parallel: 5
rspec-ee integration pg9: rspec-ee integration pg9:
extends: .rspec-ee-base-pg9 extends: .rspec-ee-base-pg9
...@@ -152,11 +164,17 @@ rspec-ee system pg9: ...@@ -152,11 +164,17 @@ rspec-ee system pg9:
extends: .rspec-ee-base-pg9 extends: .rspec-ee-base-pg9
parallel: 5 parallel: 5
rspec-ee migration pg10:
extends:
- .rspec-ee-base-pg10
- .only-master
parallel: 2
rspec-ee unit pg10: rspec-ee unit pg10:
extends: extends:
- .rspec-ee-base-pg10 - .rspec-ee-base-pg10
- .only-master - .only-master
parallel: 7 parallel: 5
rspec-ee integration pg10: rspec-ee integration pg10:
extends: extends:
......
...@@ -170,7 +170,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity ...@@ -170,7 +170,7 @@ Crossplane runs inside your Kubernetes cluster and supports secure connectivity
), ),
), ),
{ {
gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ce/user/project/integrations/crossplane.html" gitlabIntegrationLink: `<a href="https://docs.gitlab.com/ee/user/clusters/applications.html#crossplane"
target="_blank" rel="noopener noreferrer"> target="_blank" rel="noopener noreferrer">
${_.escape(s__('ClusterIntegration|Gitlab Integration'))}</a>`, ${_.escape(s__('ClusterIntegration|Gitlab Integration'))}</a>`,
kubectl: `<code>kubectl</code>`, kubectl: `<code>kubectl</code>`,
......
...@@ -9,7 +9,12 @@ export default { ...@@ -9,7 +9,12 @@ export default {
LogLine, LogLine,
}, },
computed: { computed: {
...mapState(['traceEndpoint', 'trace', 'isTraceComplete']), ...mapState([
'traceEndpoint',
'trace',
'isTraceComplete',
'isScrolledToBottomBeforeReceivingTrace',
]),
}, },
updated() { updated() {
this.$nextTick(() => { this.$nextTick(() => {
......
...@@ -274,12 +274,6 @@ ...@@ -274,12 +274,6 @@
height: 24px; height: 24px;
} }
.git-clone-holder {
.btn {
height: auto;
}
}
.dropdown-toggle, .dropdown-toggle,
.clone-dropdown-btn { .clone-dropdown-btn {
.fa { .fa {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
class Projects::ErrorTrackingController < Projects::ApplicationController class Projects::ErrorTrackingController < Projects::ApplicationController
before_action :authorize_read_sentry_issue! before_action :authorize_read_sentry_issue!
before_action :set_issue_id, only: [:details, :stack_trace]
POLLING_INTERVAL = 10_000 POLLING_INTERVAL = 10_000
...@@ -113,6 +114,10 @@ class Projects::ErrorTrackingController < Projects::ApplicationController ...@@ -113,6 +114,10 @@ class Projects::ErrorTrackingController < Projects::ApplicationController
params.permit(:issue_id) params.permit(:issue_id)
end end
def set_issue_id
@issue_id = issue_details_params[:issue_id]
end
def set_polling_interval def set_polling_interval
Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL) Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
end end
......
...@@ -14,12 +14,12 @@ module Projects::ErrorTrackingHelper ...@@ -14,12 +14,12 @@ module Projects::ErrorTrackingHelper
} }
end end
def error_details_data(project, issue) def error_details_data(project, issue_id)
opts = [project, issue, { format: :json }] opts = [project, issue_id, { format: :json }]
{ {
'issue-details-path' => details_namespace_project_error_tracking_index_path(*opts), 'issue-details-path' => details_project_error_tracking_index_path(*opts),
'issue-stack-trace-path' => stack_trace_namespace_project_error_tracking_index_path(*opts) 'issue-stack-trace-path' => stack_trace_project_error_tracking_index_path(*opts)
} }
end end
end end
...@@ -4,14 +4,14 @@ module MergeRequests ...@@ -4,14 +4,14 @@ module MergeRequests
class PushOptionsHandlerService class PushOptionsHandlerService
LIMIT = 10 LIMIT = 10
attr_reader :branches, :changes_by_branch, :current_user, :errors, attr_reader :current_user, :errors, :changes,
:project, :push_options, :target_project :project, :push_options, :target_project
def initialize(project, current_user, changes, push_options) def initialize(project, current_user, changes, push_options)
@project = project @project = project
@target_project = @project.default_merge_request_target @target_project = @project.default_merge_request_target
@current_user = current_user @current_user = current_user
@branches = get_branches(changes) @changes = Gitlab::ChangesList.new(changes)
@push_options = push_options @push_options = push_options
@errors = [] @errors = []
end end
...@@ -34,8 +34,12 @@ module MergeRequests ...@@ -34,8 +34,12 @@ module MergeRequests
private private
def get_branches(raw_changes) def branches
Gitlab::ChangesList.new(raw_changes).map do |changes| changes_by_branch.keys
end
def changes_by_branch
@changes_by_branch ||= changes.each_with_object({}) do |changes, result|
next unless Gitlab::Git.branch_ref?(changes[:ref]) next unless Gitlab::Git.branch_ref?(changes[:ref])
# Deleted branch # Deleted branch
...@@ -45,8 +49,8 @@ module MergeRequests ...@@ -45,8 +49,8 @@ module MergeRequests
branch_name = Gitlab::Git.branch_name(changes[:ref]) branch_name = Gitlab::Git.branch_name(changes[:ref])
next if branch_name == target_project.default_branch next if branch_name == target_project.default_branch
branch_name result[branch_name] = changes
end.compact.uniq end
end end
def validate_service def validate_service
...@@ -112,7 +116,7 @@ module MergeRequests ...@@ -112,7 +116,7 @@ module MergeRequests
merge_request = ::MergeRequests::UpdateService.new( merge_request = ::MergeRequests::UpdateService.new(
target_project, target_project,
current_user, current_user,
update_params update_params(merge_request)
).execute(merge_request) ).execute(merge_request)
collect_errors_from_merge_request(merge_request) unless merge_request.valid? collect_errors_from_merge_request(merge_request) unless merge_request.valid?
...@@ -130,19 +134,22 @@ module MergeRequests ...@@ -130,19 +134,22 @@ module MergeRequests
params.compact! params.compact!
if push_options.key?(:merge_when_pipeline_succeeds)
params.merge!(
merge_when_pipeline_succeeds: push_options[:merge_when_pipeline_succeeds],
merge_user: current_user
)
end
params[:add_labels] = params.delete(:label).keys if params.has_key?(:label) params[:add_labels] = params.delete(:label).keys if params.has_key?(:label)
params[:remove_labels] = params.delete(:unlabel).keys if params.has_key?(:unlabel) params[:remove_labels] = params.delete(:unlabel).keys if params.has_key?(:unlabel)
params params
end end
def merge_params(branch)
return {} unless push_options.key?(:merge_when_pipeline_succeeds)
{
merge_when_pipeline_succeeds: push_options[:merge_when_pipeline_succeeds],
merge_user: current_user,
sha: changes_by_branch.dig(branch, :newrev)
}
end
def create_params(branch) def create_params(branch)
params = base_params params = base_params
...@@ -153,13 +160,15 @@ module MergeRequests ...@@ -153,13 +160,15 @@ module MergeRequests
target_project: target_project target_project: target_project
) )
params.merge!(merge_params(branch))
params[:target_branch] ||= target_project.default_branch params[:target_branch] ||= target_project.default_branch
params params
end end
def update_params def update_params(merge_request)
base_params base_params.merge(merge_params(merge_request.source_branch))
end end
def collect_errors_from_merge_request(merge_request) def collect_errors_from_merge_request(merge_request)
......
- if !Gitlab::CurrentSettings.eks_integration_enabled? - if !Gitlab::CurrentSettings.eks_integration_enabled?
- documentation_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path("integration/amazon") } - documentation_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: help_page_path('user/project/clusters/add_remove_clusters.md',
anchor: 'additional-requirements-for-self-managed-instances') }
= s_('Amazon authentication is not %{link_start}correctly configured%{link_end}. Ask your GitLab administrator if you want to use this service.').html_safe % { link_start: documentation_link_start, link_end: '<a/>'.html_safe } = s_('Amazon authentication is not %{link_start}correctly configured%{link_end}. Ask your GitLab administrator if you want to use this service.').html_safe % { link_start: documentation_link_start, link_end: '<a/>'.html_safe }
- else - else
.js-create-eks-cluster-form-container{ data: { 'gitlab-managed-cluster-help-path' => help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'), .js-create-eks-cluster-form-container{ data: { 'gitlab-managed-cluster-help-path' => help_page_path('user/project/clusters/index.md', anchor: 'gitlab-managed-clusters'),
...@@ -16,5 +17,7 @@ ...@@ -16,5 +17,7 @@
'account-id' => Gitlab::CurrentSettings.eks_account_id, 'account-id' => Gitlab::CurrentSettings.eks_account_id,
'external-id' => @aws_role.role_external_id, 'external-id' => @aws_role.role_external_id,
'kubernetes-integration-help-path' => help_page_path('user/project/clusters/index'), 'kubernetes-integration-help-path' => help_page_path('user/project/clusters/index'),
'account-and-external-ids-help-path' => help_page_path('user/project/clusters/add_remove_clusters.md', anchor: 'eks-cluster'),
'create-role-arn-help-path' => help_page_path('user/project/clusters/add_remove_clusters.md', anchor: 'eks-cluster'),
'external-link-icon' => icon('external-link'), 'external-link-icon' => icon('external-link'),
'has-credentials' => @aws_role.role_arn.present?.to_s } } 'has-credentials' => @aws_role.role_arn.present?.to_s } }
- page_title _('Error Details') - page_title _('Error Details')
- add_to_breadcrumbs 'Errors', project_error_tracking_index_path(@project) - add_to_breadcrumbs 'Errors', project_error_tracking_index_path(@project)
#js-error_details{ data: error_details_data(@current_user, @project) } #js-error_details{ data: error_details_data(@project, @issue_id) }
---
title: Fix Crossplane help link in cluster applications page
merge_request: 20668
author:
type: fixed
---
title: Fixes job log not scrolling to the bottom
merge_request:
author:
type: fixed
---
title: Fix merging merge requests from push options
merge_request: 20639
author:
type: fixed
---
title: Fix project creation with templates using /projects/user/:id API
merge_request: 20590
author:
type: fixed
---
title: Flatten exception details in API and controller logs
merge_request: 20434
author:
type: changed
...@@ -44,16 +44,7 @@ unless Sidekiq.server? ...@@ -44,16 +44,7 @@ unless Sidekiq.server?
# https://github.com/roidrage/lograge#logging-errors--exceptions # https://github.com/roidrage/lograge#logging-errors--exceptions
exception = event.payload[:exception_object] exception = event.payload[:exception_object]
if exception ::Gitlab::ExceptionLogFormatter.format!(exception, payload)
payload[:exception] = {
class: exception.class.name,
message: exception.message
}
if exception.backtrace
payload[:exception][:backtrace] = Gitlab::Profiler.clean_backtrace(exception.backtrace)
end
end
payload payload
end end
......
...@@ -8,10 +8,13 @@ class RemoveIndexOnSnippetsProjectId < ActiveRecord::Migration[5.2] ...@@ -8,10 +8,13 @@ class RemoveIndexOnSnippetsProjectId < ActiveRecord::Migration[5.2]
disable_ddl_transaction! disable_ddl_transaction!
def up def up
remove_concurrent_index :snippets, [:project_id] remove_concurrent_index_by_name :snippets, 'index_snippets_on_project_id'
# This is an extra index that is not present in db/schema.rb but known to exist on some installs
remove_concurrent_index_by_name :snippets, :snippets_project_id_idx if index_exists_by_name? :snippets, :snippets_project_id_idx
end end
def down def down
add_concurrent_index :snippets, [:project_id] add_concurrent_index :snippets, [:project_id], name: 'index_snippets_on_project_id'
end end
end end
...@@ -266,7 +266,7 @@ these epics/issues: ...@@ -266,7 +266,7 @@ these epics/issues:
| All database content | **Yes** | **Yes** | | | All database content | **Yes** | **Yes** | |
| Project repository | **Yes** | **Yes** | | | Project repository | **Yes** | **Yes** | |
| Project wiki repository | **Yes** | **Yes** | | | Project wiki repository | **Yes** | **Yes** | |
| Project designs repository | [No][design-replication] | [No][design-verification] | | | Project designs repository | **Yes** | [No][design-verification] | Behind feature flag (2) |
| Uploads | **Yes** | [No][upload-verification] | Verified only on transfer, or manually (1) | | Uploads | **Yes** | [No][upload-verification] | Verified only on transfer, or manually (1) |
| LFS Objects | **Yes** | [No][lfs-verification] | Verified only on transfer, or manually (1) | | LFS Objects | **Yes** | [No][lfs-verification] | Verified only on transfer, or manually (1) |
| CI job artifacts (other than traces) | **Yes** | [No][artifact-verification] | Verified only manually (1) | | CI job artifacts (other than traces) | **Yes** | [No][artifact-verification] | Verified only manually (1) |
...@@ -307,6 +307,12 @@ these epics/issues: ...@@ -307,6 +307,12 @@ these epics/issues:
1. The integrity can be verified manually using 1. The integrity can be verified manually using
[Integrity Check Rake Task](../../raketasks/check.md) [Integrity Check Rake Task](../../raketasks/check.md)
on both nodes and comparing the output between them. on both nodes and comparing the output between them.
1. Enable the `enable_geo_design_sync` feature flag by running the
following in a Rails console:
```ruby
Feature.disable(:enable_geo_design_sync)
```
DANGER: **DANGER** DANGER: **DANGER**
Features not on this list, or with **No** in the **Replicated** column, Features not on this list, or with **No** in the **Replicated** column,
......
...@@ -67,10 +67,9 @@ NOTE: **Note:** Starting with GitLab 12.5, if an error occurs, an ...@@ -67,10 +67,9 @@ NOTE: **Note:** Starting with GitLab 12.5, if an error occurs, an
"queue_duration": 274.35, "queue_duration": 274.35,
"correlation_id": "KjDVUhNvvV3", "correlation_id": "KjDVUhNvvV3",
"cpu_s": 2.837645135999999, "cpu_s": 2.837645135999999,
"exception": { "exception.class": "NameError",
"class": "NameError", "exception.message": "undefined local variable or method `adsf' for #<Admin::DashboardController:0x00007ff3c9648588>",
"message": "undefined local variable or method `adsf' for #<Admin::DashboardController:0x00007ff3c9648588>", "exception.backtrace": [
"backtrace": [
"app/controllers/admin/dashboard_controller.rb:11:in `index'", "app/controllers/admin/dashboard_controller.rb:11:in `index'",
"ee/app/controllers/ee/admin/dashboard_controller.rb:14:in `index'", "ee/app/controllers/ee/admin/dashboard_controller.rb:14:in `index'",
"ee/lib/gitlab/ip_address_state.rb:10:in `with'", "ee/lib/gitlab/ip_address_state.rb:10:in `with'",
...@@ -80,7 +79,6 @@ NOTE: **Note:** Starting with GitLab 12.5, if an error occurs, an ...@@ -80,7 +79,6 @@ NOTE: **Note:** Starting with GitLab 12.5, if an error occurs, an
"app/controllers/application_controller.rb:444:in `set_locale'", "app/controllers/application_controller.rb:444:in `set_locale'",
"ee/lib/gitlab/jira/middleware.rb:19:in `call'" "ee/lib/gitlab/jira/middleware.rb:19:in `call'"
] ]
}
} }
``` ```
......
...@@ -738,6 +738,11 @@ NOTE: **Note:** ...@@ -738,6 +738,11 @@ NOTE: **Note:**
The most _specific_ spec takes precedence over the other wildcard matching. The most _specific_ spec takes precedence over the other wildcard matching.
In this case, `review/feature-1` spec takes precedence over `review/*` and `*` specs. In this case, `review/feature-1` spec takes precedence over `review/*` and `*` specs.
### Environments Dashboard **(PREMIUM)**
See [Environments Dashboard](environments/environments_dashboard.md) for a summary of each
environment's operational health.
## Limitations ## Limitations
In the `environment: name`, you are limited to only the [predefined environment variables](variables/predefined_variables.md). In the `environment: name`, you are limited to only the [predefined environment variables](variables/predefined_variables.md).
......
---
type: reference
---
# Environments Dashboard **(PREMIUM)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/3713) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.5.
The Environments Dashboard provides a cross-project
environment-based view that lets you see the big picture
of what is going on in each environment. From a single
location, you can track the progress as changes flow
from development to staging, and then to production (or
through any series of custom environment flows you can set up).
With an at-a-glance view of multiple projects, you can instantly
see which pipelines are green and which are red allowing you to
diagnose if there is a block at a particular point, or if there’s
a more systemic problem you need to investigate.
You can access the dashboard from the top bar by clicking
**More > Environments**.
![Environments Dashboard with projects](img/environments_dashboard_v12_5.png)
The Environments Dashboard displays a maximum of 7 projects
and 3 environments per project.
The listed environments for each project are unique, such as
"production", "staging", etc. Review apps and other grouped
environments are not displayed.
## Adding a project to the dashboard
To add a project to the dashboard:
1. Click the **Add projects** button in the homescreen of the dashboard.
1. Search and add one or more projects using the **Search your projects** field.
1. Click the **Add projects** button.
Once added, you can see a summary of each project's environment operational
health, including the latest commit, pipeline status, and deployment time.
The Environments and [Operations](../../user/operations_dashboard/index.md)
dashboards share the same list of projects. When you add or remove a
project from one, GitLab adds or removes the project from the other.
## Environment dashboards on GitLab.com
GitLab.com users can add public projects to the Environments
Dashboard for free. If your project is private, the group it belongs
to must have a [GitLab Silver](https://about.gitlab.com/pricing/) plan.
...@@ -1539,9 +1539,14 @@ cache: ...@@ -1539,9 +1539,14 @@ cache:
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/18986) in GitLab v12.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/18986) in GitLab v12.5.
If `cache:key:files` is added, one or two files must be defined with it. The cache `key` The `cache:key:files` keyword extends the `cache:key` functionality by making it easier
will be a SHA computed from the most recent commits (one or two) that changed the to reuse some caches, and rebuild them less often, which will speed up subsequent pipeline
given files. If neither file was changed in any commits, the key will be `default`. runs.
When you include `cache:key:files`, you must also list the project files that will be used to generate the key, up to a maximum of two files.
The cache `key` will be a SHA checksum computed from the most recent commits (up to two, if two files are listed)
that changed the given files. If neither file was changed in any commits,
the fallback key will be `default`.
```yaml ```yaml
cache: cache:
...@@ -1554,20 +1559,26 @@ cache: ...@@ -1554,20 +1559,26 @@ cache:
- node_modules - node_modules
``` ```
In this example we are creating a cache for Ruby and Nodejs dependencies that
is tied to current versions of the `Gemfile.lock` and `package.json` files. Whenever one of
these files changes, a new cache key is computed and a new cache is created. Any future
job runs using the same `Gemfile.lock` and `package.json` with `cache:key:files` will
use the new cache, instead of rebuilding the dependencies.
##### `cache:key:prefix` ##### `cache:key:prefix`
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/18986) in GitLab v12.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/18986) in GitLab v12.5.
The `prefix` parameter adds extra functionality to `key:files` by allowing the key to The `prefix` parameter adds extra functionality to `key:files` by allowing the key to
be composed of the given `prefix` combined with the SHA computed for `cache:key:files`. be composed of the given `prefix` combined with the SHA computed for `cache:key:files`.
For example, adding a `prefix` of `rspec`, will For example, adding a `prefix` of `test`, will cause keys to look like: `test-feef9576d21ee9b6a32e30c5c79d0a0ceb68d1e5`.
cause keys to look like: `rspec-feef9576d21ee9b6a32e30c5c79d0a0ceb68d1e5`. If neither If neither file was changed in any commits, the prefix is added to `default`, so the
file was changed in any commits, the prefix is added to `default`, so the key in the key in the example would be `test-default`.
example would be `rspec-default`.
`prefix` follows the same restrictions as `key`, so it can use any of the Like `cache:key`, `prefix` can use any of the [predefined variables](../variables/README.md),
[predefined variables](../variables/README.md). Similarly, the `/` character or the but the following are not allowed:
equivalent URI-encoded `%2F`, or a value made only of `.` or `%2E`, is not allowed.
- the `/` character (or the equivalent URI-encoded `%2F`)
- a value made only of `.` (or the equivalent URI-encoded `%2E`)
```yaml ```yaml
cache: cache:
...@@ -1577,8 +1588,20 @@ cache: ...@@ -1577,8 +1588,20 @@ cache:
prefix: ${CI_JOB_NAME} prefix: ${CI_JOB_NAME}
paths: paths:
- vendor/ruby - vendor/ruby
rspec:
script:
- bundle exec rspec
``` ```
For example, adding a `prefix` of `$CI_JOB_NAME` will
cause the key to look like: `rspec-feef9576d21ee9b6a32e30c5c79d0a0ceb68d1e5` and
the job cache is shared across different branches. If a branch changes
`Gemfile.lock`, that branch will have a new SHA checksum for `cache:key:files`. A new cache key
will be generated, and a new cache will be created for that key.
If `Gemfile.lock` is not found, the prefix is added to
`default`, so the key in the example would be `rspec-default`.
#### `cache:untracked` #### `cache:untracked`
Set `untracked: true` to cache all files that are untracked in your Git Set `untracked: true` to cache all files that are untracked in your Git
......
...@@ -108,9 +108,10 @@ When visiting one of these views, you can now hover over a code reference to see ...@@ -108,9 +108,10 @@ When visiting one of these views, you can now hover over a code reference to see
Sourcegraph powered code intelligence will be incrementally rolled out on GitLab.com. Sourcegraph powered code intelligence will be incrementally rolled out on GitLab.com.
It will eventually become available for all public projects, but for now, it is only It will eventually become available for all public projects, but for now, it is only
available for some specific [`gitlab-org` projects](https://gitlab.com/gitlab-org/). available for some specific projects within the [`gitlab-org`](https://gitlab.com/gitlab-org/)
This means that you can see it working and use it to dig into the code of these projects, group, e.g., <https://gitlab.com/gitlab-org/gitlab>. This means that you can see
but you cannot use it on your own project on GitLab.com yet. it working and use it to dig into the code of these projects, but you cannot use
it on your own project on GitLab.com yet.
If you would like to use it in your own projects as of GitLab 12.5, you can do so by If you would like to use it in your own projects as of GitLab 12.5, you can do so by
setting up a self-managed GitLab instance. setting up a self-managed GitLab instance.
......
...@@ -161,6 +161,11 @@ but commented out to help encourage others to add to it in the future. --> ...@@ -161,6 +161,11 @@ but commented out to help encourage others to add to it in the future. -->
## Required pipeline configuration **(PREMIUM ONLY)** ## Required pipeline configuration **(PREMIUM ONLY)**
CAUTION: **Caution:**
The Required Pipeline Configuration feature is deprecated and will be removed when an
[improved compliance solution](https://gitlab.com/gitlab-org/gitlab/issues/34830)
is added to GitLab. It is recommended to avoid using this feature.
GitLab administrators can force a pipeline configuration to run on every GitLab administrators can force a pipeline configuration to run on every
pipeline. pipeline.
......
...@@ -15,7 +15,7 @@ SAST supports the following official analyzers: ...@@ -15,7 +15,7 @@ SAST supports the following official analyzers:
- [`bandit`](https://gitlab.com/gitlab-org/security-products/analyzers/bandit) (Bandit) - [`bandit`](https://gitlab.com/gitlab-org/security-products/analyzers/bandit) (Bandit)
- [`brakeman`](https://gitlab.com/gitlab-org/security-products/analyzers/brakeman) (Brakeman) - [`brakeman`](https://gitlab.com/gitlab-org/security-products/analyzers/brakeman) (Brakeman)
- [`eslint`](https://gitlab.com/gitlab-org/security-products/analyzers/eslint) (ESLint (JavaScript)) - [`eslint`](https://gitlab.com/gitlab-org/security-products/analyzers/eslint) (ESLint (JavaScript and React))
- [`flawfinder`](https://gitlab.com/gitlab-org/security-products/analyzers/flawfinder) (Flawfinder) - [`flawfinder`](https://gitlab.com/gitlab-org/security-products/analyzers/flawfinder) (Flawfinder)
- [`gosec`](https://gitlab.com/gitlab-org/security-products/analyzers/gosec) (Gosec) - [`gosec`](https://gitlab.com/gitlab-org/security-products/analyzers/gosec) (Gosec)
- [`nodejs-scan`](https://gitlab.com/gitlab-org/security-products/analyzers/nodejs-scan) (NodeJsScan) - [`nodejs-scan`](https://gitlab.com/gitlab-org/security-products/analyzers/nodejs-scan) (NodeJsScan)
......
...@@ -76,6 +76,7 @@ The following table shows which languages, package managers and frameworks are s ...@@ -76,6 +76,7 @@ The following table shows which languages, package managers and frameworks are s
| Node.js | [NodeJsScan](https://github.com/ajinabraham/NodeJsScan) | 11.1 | | Node.js | [NodeJsScan](https://github.com/ajinabraham/NodeJsScan) | 11.1 |
| PHP | [phpcs-security-audit](https://github.com/FloeDesignTechnologies/phpcs-security-audit) | 10.8 | | PHP | [phpcs-security-audit](https://github.com/FloeDesignTechnologies/phpcs-security-audit) | 10.8 |
| Python ([pip](https://pip.pypa.io/en/stable/)) | [bandit](https://github.com/PyCQA/bandit) | 10.3 | | Python ([pip](https://pip.pypa.io/en/stable/)) | [bandit](https://github.com/PyCQA/bandit) | 10.3 |
| React | [ESLint react plugin](https://github.com/yannickcr/eslint-plugin-react) | 12.5 |
| Ruby on Rails | [brakeman](https://brakemanscanner.org) | 10.3 | | Ruby on Rails | [brakeman](https://brakemanscanner.org) | 10.3 |
| Scala ([Ant](https://ant.apache.org/), [Gradle](https://gradle.org/), [Maven](https://maven.apache.org/) and [SBT](https://www.scala-sbt.org/)) | [SpotBugs](https://spotbugs.github.io/) with the [find-sec-bugs](https://find-sec-bugs.github.io/) plugin | 11.0 (SBT) & 11.9 (Ant, Gradle, Maven) | | Scala ([Ant](https://ant.apache.org/), [Gradle](https://gradle.org/), [Maven](https://maven.apache.org/) and [SBT](https://www.scala-sbt.org/)) | [SpotBugs](https://spotbugs.github.io/) with the [find-sec-bugs](https://find-sec-bugs.github.io/) plugin | 11.0 (SBT) & 11.9 (Ant, Gradle, Maven) |
| TypeScript | [TSLint config security](https://github.com/webschik/tslint-config-security/) | 11.9 | | TypeScript | [TSLint config security](https://github.com/webschik/tslint-config-security/) | 11.9 |
......
...@@ -71,7 +71,7 @@ Once you're on the dashboard, at the top you should see a series of filters for: ...@@ -71,7 +71,7 @@ Once you're on the dashboard, at the top you should see a series of filters for:
- Report type - Report type
- Project - Project
To the right of the filters, you should see a **Hide dismissed** toggle button ([available in GitLab Ultimate 12.5](https://gitlab.com/gitlab-org/gitlab/issues/9102)). To the right of the filters, you should see a **Hide dismissed** toggle button ([available for GitLab.com Gold, planned for GitLab Ultimate 12.6](https://gitlab.com/gitlab-org/gitlab/issues/9102)).
NOTE: **Note:** NOTE: **Note:**
The dashboard only shows projects with [security reports](#supported-reports) enabled in a group. The dashboard only shows projects with [security reports](#supported-reports) enabled in a group.
......
...@@ -417,6 +417,18 @@ install Crossplane using the ...@@ -417,6 +417,18 @@ install Crossplane using the
[`values.yaml`](https://github.com/crossplaneio/crossplane/blob/master/cluster/charts/crossplane/values.yaml.tmpl) [`values.yaml`](https://github.com/crossplaneio/crossplane/blob/master/cluster/charts/crossplane/values.yaml.tmpl)
file. file.
#### Enabling installation
This is a preliminary release of Crossplane as a GitLab-managed application. By default,
the ability to install it is disabled.
To allow installation of Crossplane as a GitLab-managed application, ask a GitLab
administrator to run following command within a Rails console:
```ruby
Feature.enable(:enable_cluster_application_crossplane)
```
## Upgrading applications ## Upgrading applications
> [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/24789) in GitLab 11.8. > [Introduced](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/24789) in GitLab 11.8.
......
...@@ -50,14 +50,17 @@ Any issue that belongs to a project in the epic's group, or any of the epic's ...@@ -50,14 +50,17 @@ Any issue that belongs to a project in the epic's group, or any of the epic's
subgroups, are eligible to be added. New issues appear at the top of the list of issues in the **Epics and Issues** tab. subgroups, are eligible to be added. New issues appear at the top of the list of issues in the **Epics and Issues** tab.
An epic contains a list of issues and an issue can be associated with at most An epic contains a list of issues and an issue can be associated with at most
one epic. When you add an issue to an epic that is already associated with another epic, one epic. When you add an issue that is already linked to an epic,
the issue is automatically removed from the previous epic. the issue is automatically unlinked from its current parent.
To add an issue to an epic: To add an issue to an epic:
1. Click **Add an issue**. 1. Click **Add an issue**.
1. Paste the link of the issue. 1. Identify the issue to be added, using either of the following methods:
- Press <kbd>Spacebar</kbd> and repeat this step if there are multiple issues. - Paste the link of the issue.
- Search for the desired issue by entering part of the issue's title, then selecting the desired match. ([From GitLab 12.5](https://gitlab.com/gitlab-org/gitlab/issues/9126))
If there are multiple issues to be added, press <kbd>Spacebar</kbd> and repeat this step.
1. Click **Add**. 1. Click **Add**.
To remove an issue from an epic: To remove an issue from an epic:
...@@ -72,17 +75,19 @@ To remove an issue from an epic: ...@@ -72,17 +75,19 @@ To remove an issue from an epic:
Any epic that belongs to a group, or subgroup of the parent epic's group, is Any epic that belongs to a group, or subgroup of the parent epic's group, is
eligible to be added. New child epics appear at the top of the list of epics in the **Epics and Issues** tab. eligible to be added. New child epics appear at the top of the list of epics in the **Epics and Issues** tab.
When you add a child epic that is already associated with another epic, When you add an epic that is already linked to a parent epic, the link to its current parent is removed.
that epic is automatically removed from the previous epic.
An epic can have multiple child epics with An epic can have multiple child epics with
the maximum depth being 5. the maximum depth being 5.
To add a child epic: To add a child epic to an epic:
1. Click **Add an epic**. 1. Click **Add an epic**.
1. Paste the link of the epic. 1. Identify the epic to be added, using either of the following methods:
- Press <kbd>Spacebar</kbd> and repeat this step if there are multiple issues. - Paste the link of the epic.
- Search for the desired issue by entering part of the epic's title, then selecting the desired match. ([From GitLab 12.5](https://gitlab.com/gitlab-org/gitlab/issues/9126))
If there are multiple epics to be added, press <kbd>Spacebar</kbd> and repeat this step.
1. Click **Add**. 1. Click **Add**.
To remove a child epic from a parent epic: To remove a child epic from a parent epic:
......
...@@ -23,6 +23,8 @@ To add a project to the dashboard: ...@@ -23,6 +23,8 @@ To add a project to the dashboard:
Once added, the dashboard will display the project's number of active alerts, Once added, the dashboard will display the project's number of active alerts,
last commit, pipeline status, and when it was last deployed. last commit, pipeline status, and when it was last deployed.
The Operations and [Environments](../../ci/environments/environments_dashboard.md) dashboards share the same list of projects. Adding or removing a project from one adds or removes the project from the other.
![Operations Dashboard with projects](img/index_operations_dashboard_with_projects.png) ![Operations Dashboard with projects](img/index_operations_dashboard_with_projects.png)
## Arranging projects on a dashboard ## Arranging projects on a dashboard
......
...@@ -206,9 +206,46 @@ GitLab supports: ...@@ -206,9 +206,46 @@ GitLab supports:
Before creating your first cluster on Amazon EKS with GitLab's integration, Before creating your first cluster on Amazon EKS with GitLab's integration,
make sure the following requirements are met: make sure the following requirements are met:
- Enable the `create_eks_clusters` feature flag for your GitLab instance.
- An [Amazon Web Services](https://aws.amazon.com/) account is set up and you are able to log in. - An [Amazon Web Services](https://aws.amazon.com/) account is set up and you are able to log in.
- You have permissions to manage IAM resources. - You have permissions to manage IAM resources.
#### Enable the `create_eks_clusters` feature flag **(CORE ONLY)**
NOTE: **Note:**
If you are running a self-managed instance, EKS cluster creation will not be available
unless the feature flag `create_eks_clusters` is enabled. This can be done from the Rails console
by instance administrators.
Use these commands to start the Rails console:
```sh
# Omnibus GitLab
gitlab-rails console
# Installation from source
cd /home/git/gitlab
sudo -u git -H bin/rails console RAILS_ENV=production
```
Then run the following command to enable the feature flag:
```
Feature.enable(:create_eks_clusters)
```
You can also enable the feature flag only for specific projects with:
```
Feature.enable(:create_eks_clusters, Project.find_by_full_path('my_group/my_project'))
```
Run the following command to disable the feature flag:
```
Feature.disable(:create_eks_clusters)
```
##### Additional requirements for self-managed instances ##### Additional requirements for self-managed instances
If you are using a self-managed GitLab instance, GitLab must first If you are using a self-managed GitLab instance, GitLab must first
......
...@@ -157,6 +157,8 @@ The plain text title and description of the issue fill the top center of the iss ...@@ -157,6 +157,8 @@ The plain text title and description of the issue fill the top center of the iss
The description fully supports [GitLab Flavored Markdown](../../markdown.md#gitlab-flavored-markdown-gfm), The description fully supports [GitLab Flavored Markdown](../../markdown.md#gitlab-flavored-markdown-gfm),
allowing many formatting options. allowing many formatting options.
> [Since GitLab 12.5](https://gitlab.com/gitlab-org/gitlab/issues/10103), changes to an issue's description are listed in the [issue history](#23-issue-history).**(STARTER)**
#### 17. Mentions #### 17. Mentions
You can mention a user or a group present in your GitLab instance with `@username` or You can mention a user or a group present in your GitLab instance with `@username` or
......
...@@ -147,7 +147,7 @@ You can also edit an existing tag to add release notes: ...@@ -147,7 +147,7 @@ You can also edit an existing tag to add release notes:
## Release Evidence ## Release Evidence
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26019) in GitLab 12.5. > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/26019) in GitLab 12.6.
Each time a new release is created, specific related data is collected in Each time a new release is created, specific related data is collected in
parallel. This dataset will be a snapshot this new release (including linked parallel. This dataset will be a snapshot this new release (including linked
...@@ -155,7 +155,7 @@ milestones and issues) at moment of creation. Such collection of data will ...@@ -155,7 +155,7 @@ milestones and issues) at moment of creation. Such collection of data will
provide a chain of custody and facilitate processes like external audits, for example. provide a chain of custody and facilitate processes like external audits, for example.
The gathered Evidence data is stored in the database upon creation of a new The gathered Evidence data is stored in the database upon creation of a new
release as a JSON object. In GitLab 12.5, a link to release as a JSON object. In GitLab 12.6, a link to
the Evidence data is provided for [each Release](#releases-list). the Evidence data is provided for [each Release](#releases-list).
Here's what this object can look like: Here's what this object can look like:
......
...@@ -191,6 +191,7 @@ module API ...@@ -191,6 +191,7 @@ module API
optional :path, type: String, desc: 'The path of the repository' optional :path, type: String, desc: 'The path of the repository'
optional :default_branch, type: String, desc: 'The default branch of the project' optional :default_branch, type: String, desc: 'The default branch of the project'
use :optional_project_params use :optional_project_params
use :optional_create_project_params
use :create_params use :create_params
end end
# rubocop: disable CodeReuse/ActiveRecord # rubocop: disable CodeReuse/ActiveRecord
......
# frozen_string_literal: true
module Gitlab
module ExceptionLogFormatter
def self.format!(exception, payload)
return unless exception
# Elasticsearch/Fluentd don't handle nested structures well.
# Use periods to flatten the fields.
payload.merge!(
'exception.class' => exception.class.name,
'exception.message' => exception.message
)
if exception.backtrace
payload['exception.backtrace'] = Gitlab::Profiler.clean_backtrace(exception.backtrace)
end
end
end
end
...@@ -11,19 +11,11 @@ module Gitlab ...@@ -11,19 +11,11 @@ module Gitlab
# precedence so the logger never sees it. We need to # precedence so the logger never sees it. We need to
# store and retrieve the exception from the environment. # store and retrieve the exception from the environment.
exception = request.env[::API::Helpers::API_EXCEPTION_ENV] exception = request.env[::API::Helpers::API_EXCEPTION_ENV]
data = {}
return {} unless exception.is_a?(Exception) return data unless exception.is_a?(Exception)
data = { Gitlab::ExceptionLogFormatter.format!(exception, data)
exception: {
class: exception.class.to_s,
message: exception.message
}
}
if exception.backtrace
data[:exception][:backtrace] = Gitlab::Profiler.clean_backtrace(exception.backtrace)
end
data data
end end
......
...@@ -327,7 +327,12 @@ module Gitlab ...@@ -327,7 +327,12 @@ module Gitlab
end end
def find_or_create_object! def find_or_create_object!
return relation_class.find_or_create_by(project_id: @project.id) if UNIQUE_RELATIONS.include?(@relation_name) if UNIQUE_RELATIONS.include?(@relation_name)
unique_relation_object = relation_class.find_or_create_by(project_id: @project.id)
unique_relation_object.assign_attributes(parsed_relation_hash)
return unique_relation_object
end
# Can't use IDs as validation exists calling `group` or `project` attributes # Can't use IDs as validation exists calling `group` or `project` attributes
finder_hash = parsed_relation_hash.tap do |hash| finder_hash = parsed_relation_hash.tap do |hash|
......
...@@ -36,6 +36,10 @@ module Quality ...@@ -36,6 +36,10 @@ module Quality
workers workers
elastic_integration elastic_integration
], ],
migration: %w[
migrations
lib/gitlab/background_migration
],
integration: %w[ integration: %w[
controllers controllers
mailers mailers
...@@ -62,6 +66,10 @@ module Quality ...@@ -62,6 +66,10 @@ module Quality
def level_for(file_path) def level_for(file_path)
case file_path case file_path
# Detect migration first since some background migration tests are under
# spec/lib/gitlab/background_migration and tests under spec/lib are unit by default
when regexp(:migration)
:migration
when regexp(:unit) when regexp(:unit)
:unit :unit
when regexp(:integration) when regexp(:integration)
......
...@@ -7209,15 +7209,15 @@ ...@@ -7209,15 +7209,15 @@
} }
], ],
"project_feature": { "project_feature": {
"builds_access_level": 0, "builds_access_level": 10,
"created_at": "2014-12-26T09:26:45.000Z", "created_at": "2014-12-26T09:26:45.000Z",
"id": 2, "id": 2,
"issues_access_level": 0, "issues_access_level": 10,
"merge_requests_access_level": 20, "merge_requests_access_level": 10,
"project_id": 4, "project_id": 4,
"snippets_access_level": 20, "snippets_access_level": 10,
"updated_at": "2016-09-23T11:58:28.000Z", "updated_at": "2016-09-23T11:58:28.000Z",
"wiki_access_level": 20 "wiki_access_level": 10
}, },
"custom_attributes": [ "custom_attributes": [
{ {
...@@ -7257,6 +7257,9 @@ ...@@ -7257,6 +7257,9 @@
"image_url": "http://www.example.com" "image_url": "http://www.example.com"
} }
], ],
"ci_cd_settings": {
"group_runners_enabled": false
},
"boards": [ "boards": [
{ {
"id": 29, "id": 29,
......
...@@ -75,4 +75,21 @@ describe Projects::ErrorTrackingHelper do ...@@ -75,4 +75,21 @@ describe Projects::ErrorTrackingHelper do
end end
end end
end end
describe '#error_details_data' do
let(:issue_id) { 1234 }
let(:route_params) { [project.owner, project, issue_id, { format: :json }] }
let(:details_path) { details_namespace_project_error_tracking_index_path(*route_params) }
let(:stack_trace_path) { stack_trace_namespace_project_error_tracking_index_path(*route_params) }
let(:result) { helper.error_details_data(project, issue_id) }
it 'returns the correct details path' do
expect(result['issue-details-path']).to eq details_path
end
it 'returns the correct stack trace path' do
expect(result['issue-stack-trace-path']).to eq stack_trace_path
end
end
end end
...@@ -110,9 +110,9 @@ describe 'lograge', type: :request do ...@@ -110,9 +110,9 @@ describe 'lograge', type: :request do
log_data = JSON.parse(log_output.string) log_data = JSON.parse(log_output.string)
expect(log_data['exception']['class']).to eq('RuntimeError') expect(log_data['exception.class']).to eq('RuntimeError')
expect(log_data['exception']['message']).to eq('bad request') expect(log_data['exception.message']).to eq('bad request')
expect(log_data['exception']['backtrace']).to eq(Gitlab::Profiler.clean_backtrace(backtrace)) expect(log_data['exception.backtrace']).to eq(Gitlab::Profiler.clean_backtrace(backtrace))
end end
end end
end end
......
...@@ -24,10 +24,8 @@ describe Gitlab::GrapeLogging::Loggers::ExceptionLogger do ...@@ -24,10 +24,8 @@ describe Gitlab::GrapeLogging::Loggers::ExceptionLogger do
let(:expected) do let(:expected) do
{ {
exception: { 'exception.class' => 'RuntimeError',
class: 'RuntimeError', 'exception.message' => 'This is a test'
message: 'This is a test'
}
} }
end end
...@@ -39,7 +37,7 @@ describe Gitlab::GrapeLogging::Loggers::ExceptionLogger do ...@@ -39,7 +37,7 @@ describe Gitlab::GrapeLogging::Loggers::ExceptionLogger do
before do before do
current_backtrace = caller current_backtrace = caller
allow(exception).to receive(:backtrace).and_return(current_backtrace) allow(exception).to receive(:backtrace).and_return(current_backtrace)
expected[:exception][:backtrace] = Gitlab::Profiler.clean_backtrace(current_backtrace) expected['exception.backtrace'] = Gitlab::Profiler.clean_backtrace(current_backtrace)
end end
it 'includes the backtrace' do it 'includes the backtrace' do
......
...@@ -48,11 +48,11 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -48,11 +48,11 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
it 'restore correct project features' do it 'restore correct project features' do
project = Project.find_by_path('project') project = Project.find_by_path('project')
expect(project.project_feature.issues_access_level).to eq(ProjectFeature::DISABLED) expect(project.project_feature.issues_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.builds_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.builds_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.snippets_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.snippets_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.wiki_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.wiki_access_level).to eq(ProjectFeature::PRIVATE)
expect(project.project_feature.merge_requests_access_level).to eq(ProjectFeature::ENABLED) expect(project.project_feature.merge_requests_access_level).to eq(ProjectFeature::PRIVATE)
end end
it 'has the project description' do it 'has the project description' do
...@@ -220,6 +220,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do ...@@ -220,6 +220,10 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect(award_emoji.map(&:name)).to contain_exactly('thumbsup', 'coffee') expect(award_emoji.map(&:name)).to contain_exactly('thumbsup', 'coffee')
end end
it 'restores `ci_cd_settings` : `group_runners_enabled` setting' do
expect(@project.ci_cd_settings.group_runners_enabled?).to eq(false)
end
it 'restores the correct service' do it 'restores the correct service' do
expect(CustomIssueTrackerService.first).not_to be_nil expect(CustomIssueTrackerService.first).not_to be_nil
end end
......
...@@ -25,6 +25,13 @@ RSpec.describe Quality::TestLevel do ...@@ -25,6 +25,13 @@ RSpec.describe Quality::TestLevel do
end end
end end
context 'when level is migration' do
it 'returns a pattern' do
expect(subject.pattern(:migration))
.to eq("spec/{migrations,lib/gitlab/background_migration}{,/**/}*_spec.rb")
end
end
context 'when level is integration' do context 'when level is integration' do
it 'returns a pattern' do it 'returns a pattern' do
expect(subject.pattern(:integration)) expect(subject.pattern(:integration))
...@@ -79,6 +86,13 @@ RSpec.describe Quality::TestLevel do ...@@ -79,6 +86,13 @@ RSpec.describe Quality::TestLevel do
end end
end end
context 'when level is migration' do
it 'returns a regexp' do
expect(subject.regexp(:migration))
.to eq(%r{spec/(migrations|lib/gitlab/background_migration)})
end
end
context 'when level is integration' do context 'when level is integration' do
it 'returns a regexp' do it 'returns a regexp' do
expect(subject.regexp(:integration)) expect(subject.regexp(:integration))
...@@ -116,6 +130,18 @@ RSpec.describe Quality::TestLevel do ...@@ -116,6 +130,18 @@ RSpec.describe Quality::TestLevel do
expect(subject.level_for('spec/models/abuse_report_spec.rb')).to eq(:unit) expect(subject.level_for('spec/models/abuse_report_spec.rb')).to eq(:unit)
end end
it 'returns the correct level for a migration test' do
expect(subject.level_for('spec/migrations/add_default_and_free_plans_spec.rb')).to eq(:migration)
end
it 'returns the correct level for a background_migration test' do
expect(subject.level_for('spec/lib/gitlab/background_migration/archive_legacy_traces_spec.rb')).to eq(:migration)
end
it 'returns the correct level for a geo migration test' do
expect(described_class.new('ee/').level_for('ee/spec/migrations/geo/migrate_ci_job_artifacts_to_separate_registry_spec.rb')).to eq(:migration)
end
it 'returns the correct level for an integration test' do it 'returns the correct level for an integration test' do
expect(subject.level_for('spec/mailers/abuse_report_mailer_spec.rb')).to eq(:integration) expect(subject.level_for('spec/mailers/abuse_report_mailer_spec.rb')).to eq(:integration)
end end
......
...@@ -101,17 +101,15 @@ describe MergeRequests::PushOptionsHandlerService do ...@@ -101,17 +101,15 @@ describe MergeRequests::PushOptionsHandlerService do
shared_examples_for 'a service that can set the merge request to merge when pipeline succeeds' do shared_examples_for 'a service that can set the merge request to merge when pipeline succeeds' do
subject(:last_mr) { MergeRequest.last } subject(:last_mr) { MergeRequest.last }
let(:change) { Gitlab::ChangesList.new(changes).changes.first }
it 'sets auto_merge_enabled' do it 'sets auto_merge_enabled' do
service.execute service.execute
expect(last_mr.auto_merge_enabled).to eq(true) expect(last_mr.auto_merge_enabled).to eq(true)
expect(last_mr.auto_merge_strategy).to eq(AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS) expect(last_mr.auto_merge_strategy).to eq(AutoMergeService::STRATEGY_MERGE_WHEN_PIPELINE_SUCCEEDS)
end
it 'sets merge_user to the user' do
service.execute
expect(last_mr.merge_user).to eq(user) expect(last_mr.merge_user).to eq(user)
expect(last_mr.merge_params['sha']).to eq(change[:newrev])
end end
end end
......
...@@ -29,6 +29,39 @@ RSpec.configure do |config| ...@@ -29,6 +29,39 @@ RSpec.configure do |config|
delete_from_all_tables! delete_from_all_tables!
end end
config.append_after(:context, :migration) do
delete_from_all_tables!
# Postgres maximum number of columns in a table is 1600 (https://github.com/postgres/postgres/blob/de41869b64d57160f58852eab20a27f248188135/src/include/access/htup_details.h#L23-L47).
# And since:
# "The DROP COLUMN form does not physically remove the column, but simply makes
# it invisible to SQL operations. Subsequent insert and update operations in the
# table will store a null value for the column. Thus, dropping a column is quick
# but it will not immediately reduce the on-disk size of your table, as the space
# occupied by the dropped column is not reclaimed.
# The space will be reclaimed over time as existing rows are updated."
# according to https://www.postgresql.org/docs/current/sql-altertable.html.
# We drop and recreate the database if any table has more than 1200 columns, just to be safe.
max_allowed_columns = 1200
tables_with_more_than_allowed_columns =
ApplicationRecord.connection.execute("SELECT attrelid::regclass::text AS table, COUNT(*) AS column_count FROM pg_attribute GROUP BY attrelid HAVING COUNT(*) > #{max_allowed_columns}")
if tables_with_more_than_allowed_columns.any?
tables_with_more_than_allowed_columns.each do |result|
puts "The #{result['table']} table has #{result['column_count']} columns."
end
puts "Recreating the database"
start = Gitlab::Metrics::System.monotonic_time
ActiveRecord::Tasks::DatabaseTasks.drop_current
ActiveRecord::Tasks::DatabaseTasks.create_current
ActiveRecord::Tasks::DatabaseTasks.load_schema_current
ActiveRecord::Tasks::DatabaseTasks.migrate
puts "Database re-creation done in #{Gitlab::Metrics::System.monotonic_time - start}"
end
end
config.around(:each, :delete) do |example| config.around(:each, :delete) do |example|
self.class.use_transactional_tests = false self.class.use_transactional_tests = false
......
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