From ddf2ec57422425caab9cb8ba3c917ccd448abf22 Mon Sep 17 00:00:00 2001 From: Evan Read Date: Thu, 20 Jun 2019 22:12:35 +0000 Subject: [PATCH 01/15] Merge branch 'sh-update-component-list-docs' into 'master' Update Grafana and GitLab Monitor in component list See merge request gitlab-org/gitlab-ce!29537 (cherry picked from commit 2c48cb24983314ab78963d2dfb2a74b0f9104fc8) be3b60af Update Grafana and GitLab Monitor in component list 6fd4784f Update link to gitlab-monitor-charts --- doc/development/architecture.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/development/architecture.md b/doc/development/architecture.md index 5f32cd7eba2..fc161fa09a9 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -141,13 +141,13 @@ Component statuses are linked to configuration documentation for each component. | [Consul](#consul) | Database node discovery, failover | [⚙][consul-omnibus] | [❌][consul-charts] | [❌][consul-charts] | [✅](../user/gitlab_com/index.md#consul) | ❌ | ❌ | EE Only | | [GitLab self-monitoring: Prometheus](#prometheus) | Time-series database, metrics collection, and query service | [✅][prometheus-omnibus] | [✅][prometheus-charts] | [⚙][prometheus-charts] | [✅](../user/gitlab_com/index.md#prometheus) | ❌ | ❌ | CE & EE | | [GitLab self-monitoring: Alertmanager](#alertmanager) | Deduplicates, groups, and routes alerts from Prometheus | [⚙][alertmanager-omnibus] | [✅][alertmanager-charts] | [⚙][alertmanager-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | -| [GitLab self-monitoring: Grafana](#grafana) | Metrics dashboard | [⚙][grafana-omnibus] | [⤓][grafana-charts] | [⤓][grafana-charts] | [✅](https://dashboards.gitlab.com/d/RZmbBr7mk/gitlab-triage?refresh=30s) | ❌ | ❌ | CE & EE | +| [GitLab self-monitoring: Grafana](#grafana) | Metrics dashboard | [✅][grafana-omnibus] | [⤓][grafana-charts] | [⤓][grafana-charts] | [✅](https://dashboards.gitlab.com/d/RZmbBr7mk/gitlab-triage?refresh=30s) | ❌ | ❌ | CE & EE | | [GitLab self-monitoring: Sentry](#sentry) | Track errors generated by the GitLab instance | [⤓][sentry-omnibus] | [❌][sentry-charts] | [❌][sentry-charts] | [✅](https://about.gitlab.com/handbook/support/workflows/services/gitlab_com/500_errors.html#searching-sentry) | [⤓][gitlab-yml] | [⤓][gitlab-yml] | CE & EE | | [GitLab self-monitoring: Jaeger](#jaeger) | View traces generated by the GitLab instance | [❌][jaeger-omnibus] | [❌][jaeger-charts] | [❌][jaeger-charts] | [❌](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4104) | [⤓][jaeger-source] | [⚙][jaeger-gdk] | CE & EE | | [Redis Exporter](#redis-exporter) | Prometheus endpoint with Redis metrics | [✅][redis-exporter-omnibus] | [✅][redis-exporter-charts] | [✅][redis-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | | [Postgres Exporter](#postgres-exporter) | Prometheus endpoint with PostgreSQL metrics | [✅][postgres-exporter-omnibus] | [✅][postgres-exporter-charts] | [✅][postgres-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | | [PgBouncer Exporter](#pgbouncer-exporter) | Prometheus endpoint with PgBouncer metrics | [⚙][pgbouncer-exporter-omnibus] | [❌][pgbouncer-exporter-charts] | [❌][pgbouncer-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | -| [GitLab Monitor](#gitlab-monitor) | Generates a variety of GitLab metrics | [✅][gitlab-monitor-omnibus] | [❌][gitab-monitor-charts] | [❌][gitab-monitor-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | +| [GitLab Monitor](#gitlab-monitor) | Generates a variety of GitLab metrics | [✅][gitlab-monitor-omnibus] | [✅][gitab-monitor-charts] | [✅][gitab-monitor-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | | [Node Exporter](#node-exporter) | Prometheus endpoint with system metrics | [✅][node-exporter-omnibus] | [❌][node-exporter-charts] | [❌][node-exporter-charts] | [✅](https://about.gitlab.com/handbook/engineering/monitoring/) | ❌ | ❌ | CE & EE | | [Mattermost](#mattermost) | Open-source Slack alternative | [⚙][mattermost-omnibus] | [⤓][mattermost-charts] | [⤓][mattermost-charts] | [⤓](../user/project/integrations/mattermost_slash_commands.md#manual-configuration), [⤓](../user/project/integrations/mattermost.html) | ❌ | ❌ | CE & EE | | [MinIO](#minio) | Object storage service | [⤓][minio-omnibus] | [✅][minio-charts] | [✅][minio-charts] | [✅](https://about.gitlab.com/handbook/engineering/infrastructure/production-architecture/#storage-architecture) | ❌ | [⚙][minio-gdk] | CE & EE | @@ -681,7 +681,7 @@ We've also detailed [our architecture of GitLab.com](https://about.gitlab.com/ha [pgbouncer-exporter-omnibus]: ../administration/monitoring/prometheus/pgbouncer_exporter.md [pgbouncer-exporter-charts]: https://docs.gitlab.com/charts/installation/deployment.html#postgresql [gitlab-monitor-omnibus]: ../administration/monitoring/prometheus/gitlab_monitor_exporter.md -[gitab-monitor-charts]: https://gitlab.com/charts/gitlab/issues/319 +[gitab-monitor-charts]: https://docs.gitlab.com/charts/charts/gitlab/gitlab-monitor/index.html [node-exporter-omnibus]: ../administration/monitoring/prometheus/node_exporter.md [node-exporter-charts]: https://gitlab.com/charts/gitlab/issues/1332 [mattermost-omnibus]: https://docs.gitlab.com/omnibus/gitlab-mattermost/ -- GitLab From c22cced31eedca5343552f64d5eaaff90d010bb2 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 21 Jun 2019 15:55:58 +0000 Subject: [PATCH 02/15] Merge branch 'docs-prometheus-service-discovery' into 'master' Documentation for Prometheus Service Discovery Closes #63110 See merge request gitlab-org/gitlab-ce!29811 (cherry picked from commit 46640168fa13e7e4b7b32adb003ff3a5b883192b) 95525a56 Adding documentation for Prometheus Service Discovery 781d05af Moved monitoring to its own step f6c0fd2e Adding monitoring to number list in Redis db2f83f3 Updates based on review 1105b8ea A couple of missed adjustments --- .../high_availability/README.md | 6 ++ .../high_availability/database.md | 23 ++++++- .../high_availability/gitaly.md | 25 +++++++ .../high_availability/gitlab.md | 45 ++++++++++++- .../high_availability/monitoring_node.md | 67 +++++++++++++++++++ doc/administration/high_availability/redis.md | 28 ++++++++ 6 files changed, 192 insertions(+), 2 deletions(-) create mode 100644 doc/administration/high_availability/monitoring_node.md diff --git a/doc/administration/high_availability/README.md b/doc/administration/high_availability/README.md index d9c80b1ec59..0c4f926c579 100644 --- a/doc/administration/high_availability/README.md +++ b/doc/administration/high_availability/README.md @@ -65,6 +65,7 @@ larger one. - 1 Redis node - 1 NFS/Gitaly storage server - 2 or more GitLab application nodes (Unicorn, Workhorse, Sidekiq) +- 1 Monitoring node (Prometheus, Grafana) #### Installation Instructions @@ -76,6 +77,7 @@ you can continue with the next step. 1. [Redis](redis.md#redis-in-a-scaled-environment) 1. [Gitaly](gitaly.md) (recommended) or [NFS](nfs.md) 1. [GitLab application nodes](gitlab.md) +1. [Monitoring node (Prometheus and Grafana)](monitoring_node.md) ### Full Scaling @@ -90,6 +92,7 @@ in size, indicating that there is contention or not enough resources. - 2 or more NFS/Gitaly storage servers - 2 or more Sidekiq nodes - 2 or more GitLab application nodes (Unicorn, Workhorse) +- 1 Monitoring node (Prometheus, Grafana) ## High Availability Architecture Examples @@ -133,6 +136,7 @@ the contention. - 3 Consul/Sentinel nodes - 2 or more GitLab application nodes (Unicorn, Workhorse, Sidekiq, PGBouncer) - 1 NFS/Gitaly server +- 1 Monitoring node (Prometheus, Grafana) ![Horizontal architecture diagram](img/horizontal.png) @@ -192,6 +196,7 @@ with the added complexity of many more nodes to configure, manage and monitor. - 2 or more API nodes (All requests to `/api`) - 2 or more Web nodes (All other web requests) - 2 or more NFS/Gitaly servers +- 1 Monitoring node (Prometheus, Grafana) ![Fully Distributed architecture diagram](img/fully-distributed.png) @@ -205,4 +210,5 @@ separately: 1. [NFS Client and Host setup](nfs_host_client_setup.md) 1. [Configure the GitLab application servers](gitlab.md) 1. [Configure the load balancers](load_balancer.md) +1. [Monitoring node (Prometheus and Grafana)](monitoring_node.md) diff --git a/doc/administration/high_availability/database.md b/doc/administration/high_availability/database.md index 3b874e5d312..0aab7d6a58f 100644 --- a/doc/administration/high_availability/database.md +++ b/doc/administration/high_availability/database.md @@ -82,7 +82,8 @@ deploy the bundled PostgreSQL. 1. Note the PostgreSQL node's IP address or hostname, port, and plain text password. These will be necessary when configuring the GitLab application servers later. - +1. [Enable monitoring](#enable-monitoring) + Advanced configuration options are supported and can be added if needed. @@ -399,6 +400,7 @@ check the [Troubleshooting section](#troubleshooting) before proceeding. ``` 1. [Reconfigure GitLab] for the changes to take effect. +1. [Enable Monitoring](#enable-monitoring) > Please note: > @@ -1086,6 +1088,25 @@ the previous section: the `gitlab` database user 1. [Reconfigure GitLab] for the changes to take effect +## Enable Monitoring + +> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0. + +If you enable Monitoring, it must be enabled on **all** database servers. + +1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration: + + ```ruby + # Enable service discovery for Prometheus + consul['monitoring_service_discovery'] = true + + # Set the network addresses that the exporters will listen on + node_exporter['listen_address'] = '0.0.0.0:9100' + postgres_exporter['listen_address'] = '0.0.0.0:9187' + ``` + +1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. + ## Troubleshooting #### Consul and PostgreSQL changes not taking effect. diff --git a/doc/administration/high_availability/gitaly.md b/doc/administration/high_availability/gitaly.md index 1d8e6c999cb..90e5f71d835 100644 --- a/doc/administration/high_availability/gitaly.md +++ b/doc/administration/high_availability/gitaly.md @@ -19,3 +19,28 @@ Continue configuration of other components by going back to: - [Scaled Architectures](README.md#scalable-architecture-examples) - [High Availability Architectures](README.md#high-availability-architecture-examples) + +## Enable Monitoring + +> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0. + + 1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration: + + ```ruby + # Enable service discovery for Prometheus + consul['enable'] = true + consul['monitoring_service_discovery'] = true + + # Replace placeholders + # Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z + # with the addresses of the Consul server nodes + consul['configuration'] = { + retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z), + } + + # Set the network addresses that the exporters will listen on + node_exporter['listen_address'] = '0.0.0.0:9100' + gitaly['prometheus_listen_addr'] = "0.0.0.0:9236" + ``` + + 1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. diff --git a/doc/administration/high_availability/gitlab.md b/doc/administration/high_availability/gitlab.md index 888426ece5c..1a530bb6255 100644 --- a/doc/administration/high_availability/gitlab.md +++ b/doc/administration/high_availability/gitlab.md @@ -76,6 +76,8 @@ registry['gid'] = 9002 ``` +1. [Enable monitoring](#enable-monitoring) + > **Note:** To maintain uniformity of links across HA clusters, the `external_url` on the first application server as well as the additional application servers should point to the external url that users will use to access GitLab. @@ -88,7 +90,8 @@ [Nginx documentation](http://docs.gitlab.com/omnibus/settings/nginx.html#enable-https) for more information. > - > **Note:** It is best to set the `uid` and `gid`s prior to the initial reconfigure of GitLab. Omnibus will not recursively `chown` directories if set after the initial reconfigure. + > **Note:** It is best to set the `uid` and `gid`s prior to the initial reconfigure + of GitLab. Omnibus will not recursively `chown` directories if set after the initial reconfigure. ## First GitLab application server @@ -129,6 +132,46 @@ need some extra configuration. 1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. +## Enable Monitoring + +> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0. + +If you enable Monitoring, it must be enabled on **all** GitLab servers. + +1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration: + + ```ruby + # Enable service discovery for Prometheus + consul['enable'] = true + consul['monitoring_service_discovery'] = true + + # Replace placeholders + # Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z + # with the addresses of the Consul server nodes + consul['configuration'] = { + retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z), + } + + # Set the network addresses that the exporters will listen on + node_exporter['listen_address'] = '0.0.0.0:9100' + gitlab_workhorse['prometheus_listen_addr'] = '0.0.0.0:9229' + sidekiq['listen_address'] = "0.0.0.0" + unicorn['listen'] = '0.0.0.0' + + # Add the monitoring node's IP address to the monitoring whitelist and allow it to scrape the NGINX metrics + # Replace placeholder + # monitoring.gitlab.example.com + # with the addresses gathered for the monitoring node + gitlab_rails['monitoring_whitelist'] = ['monitoring.gitlab.example.com'] + nginx['status']['options']['allow'] = ['monitoring.gitlab.example.com'] + ``` + +1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. + +> **Warning:** After changing `unicorn['listen']` in `gitlab.rb`, and running `sudo gitlab-ctl reconfigure`, + it can take an extended period of time for unicorn to complete reloading after receiving a `HUP`. + For more information, see the [issue](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/4401). + ## Troubleshooting - `mount: wrong fs type, bad option, bad superblock on` diff --git a/doc/administration/high_availability/monitoring_node.md b/doc/administration/high_availability/monitoring_node.md new file mode 100644 index 00000000000..d16bf7dc0f0 --- /dev/null +++ b/doc/administration/high_availability/monitoring_node.md @@ -0,0 +1,67 @@ +# Configuring a Monitoring node for Scaling and High Availability + +> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0. + +## Standalone Monitoring node using GitLab Omnibus + +The GitLab Omnibus package can be used to configure a standalone Monitoring node running Prometheus and Grafana. +The monitoring node is not highly available. See [Scaling and High Availability](README.md) +for an overview of GitLab scaling and high availability options. + +The steps below are the minimum necessary to configure a Monitoring node running Prometheus and Grafana with +Omnibus: + +1. SSH into the Monitoring node. +1. [Download/install](https://about.gitlab.com/installation) the Omnibus GitLab + package you want using **steps 1 and 2** from the GitLab downloads page. + - Do not complete any other steps on the download page. + +1. Edit `/etc/gitlab/gitlab.rb` and add the contents: + + ```ruby + external_url 'http://gitlab.example.com' + + # Enable Prometheus + prometheus['enable'] = true + prometheus['listen_address'] = '0.0.0.0:9090' + prometheus['monitor_kubernetes'] = false + + # Enable Grafana + grafana['enable'] = true + grafana['admin_password'] = 'toomanysecrets' + + # Enable service discovery for Prometheus + consul['enable'] = true + consul['monitoring_service_discovery'] = true + + # Replace placeholders + # Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z + # with the addresses of the Consul server nodes + consul['configuration'] = { + retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z), + } + + # Disable all other services + gitlab_rails['auto_migrate'] = false + alertmanager['enable'] = false + gitaly['enable'] = false + gitlab_monitor['enable'] = false + gitlab_workhorse['enable'] = false + nginx['enable'] = true + postgres_exporter['enable'] = false + postgresql['enable'] = false + redis['enable'] = false + redis_exporter['enable'] = false + sidekiq['enable'] = false + unicorn['enable'] = false + node_exporter['enable'] = false + ``` + +1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. + +## Migrating to Service Discovery + +Once monitoring using Service Discovery is enabled with `consul['monitoring_service_discovery'] = true`, +ensure that `prometheus['scrape_configs']` is not set in `/etc/gitlab/gitlab.rb`. Setting both +`consul['monitoring_service_discovery'] = true` and `prometheus['scrape_configs']` in `/etc/gitlab/gitlab.rb` +will result in errors. diff --git a/doc/administration/high_availability/redis.md b/doc/administration/high_availability/redis.md index 1aaa709fc8f..f61a8834af3 100644 --- a/doc/administration/high_availability/redis.md +++ b/doc/administration/high_availability/redis.md @@ -74,6 +74,7 @@ Omnibus: 1. Note the Redis node's IP address or hostname, port, and Redis password. These will be necessary when configuring the GitLab application servers later. +1. [Enable Monitoring](#enable-monitoring) Advanced configuration options are supported and can be added if needed. @@ -749,6 +750,33 @@ gitlab_rails['redis_sentinels'] = [ [Reconfigure Omnibus GitLab][reconfigure] for the changes to take effect. +## Enable Monitoring + +> [Introduced](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3786) in GitLab 12.0. + + If you enable Monitoring, it must be enabled on **all** Redis servers. + + 1. Create/edit `/etc/gitlab/gitlab.rb` and add the following configuration: + + ```ruby + # Enable service discovery for Prometheus + consul['enable'] = true + consul['monitoring_service_discovery'] = true + + # Replace placeholders + # Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z + # with the addresses of the Consul server nodes + consul['configuration'] = { + retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z), + } + + # Set the network addresses that the exporters will listen on + node_exporter['listen_address'] = '0.0.0.0:9100' + redis_exporter['listen_address'] = '0.0.0.0:9121' + ``` + + 1. Run `sudo gitlab-ctl reconfigure` to compile the configuration. + ## Advanced configuration Omnibus GitLab configures some things behind the curtains to make the sysadmins' -- GitLab From 5a5db0508a4dad5f0ddda6f3565152e00faebc47 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 19 Jun 2019 05:43:35 +0000 Subject: [PATCH 03/15] Merge branch 'fix-microsoft-teams-notification-flags' into 'master' Fix missing API notification flags for Microsoft Teams See merge request gitlab-org/gitlab-ce!29824 (cherry picked from commit 51267258d1c39835c995eaaf29b7df678334ded1) d5d2f8fb 59702 Fix API notification flags for MS Teams f7658c0f 59702 Add changelog entry 1ce2c4dc Add missing test for Microsoft Teams notify_only_default_branch flag --- .../59702-fix-notification-flags-for-ms-teams.yml | 5 +++++ doc/api/services.md | 2 ++ lib/api/helpers/services_helpers.rb | 5 +++-- .../project_services/microsoft_teams_service_spec.rb | 12 ++++++++++++ 4 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml diff --git a/changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml b/changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml new file mode 100644 index 00000000000..14a8da95ed9 --- /dev/null +++ b/changelogs/unreleased/59702-fix-notification-flags-for-ms-teams.yml @@ -0,0 +1,5 @@ +--- +title: Fix missing API notification flags for Microsoft Teams +merge_request: 29824 +author: Seiji Suenaga +type: fixed diff --git a/doc/api/services.md b/doc/api/services.md index f38f96f64ad..042fee4a21a 100644 --- a/doc/api/services.md +++ b/doc/api/services.md @@ -1023,6 +1023,8 @@ Parameters: | Parameter | Type | Required | Description | | --------- | ---- | -------- | ----------- | | `webhook` | string | true | The Microsoft Teams webhook. For example, `https://outlook.office.com/webhook/...` | +| `notify_only_broken_pipelines` | boolean | false | Send notifications for broken pipelines | +| `notify_only_default_branch` | boolean | false | Send notifications only for the default branch | | `push_events` | boolean | false | Enable notifications for push events | | `issues_events` | boolean | false | Enable notifications for issue events | | `confidential_issues_events` | boolean | false | Enable notifications for confidential issue events | diff --git a/lib/api/helpers/services_helpers.rb b/lib/api/helpers/services_helpers.rb index 44c577204b8..cf2e9d01356 100644 --- a/lib/api/helpers/services_helpers.rb +++ b/lib/api/helpers/services_helpers.rb @@ -683,8 +683,9 @@ module API name: :webhook, type: String, desc: 'The Microsoft Teams webhook. e.g. https://outlook.office.com/webhook/…' - } - ], + }, + chat_notification_flags + ].flatten, 'mattermost' => [ chat_notification_settings, chat_notification_flags, diff --git a/spec/models/project_services/microsoft_teams_service_spec.rb b/spec/models/project_services/microsoft_teams_service_spec.rb index c025d7c882e..3ffe633868f 100644 --- a/spec/models/project_services/microsoft_teams_service_spec.rb +++ b/spec/models/project_services/microsoft_teams_service_spec.rb @@ -289,6 +289,18 @@ describe MicrosoftTeamsService do expect(result).to be_falsy end end + + context 'when disabled' do + let(:pipeline) do + create(:ci_pipeline, :failed, project: project, ref: 'not-the-default-branch') + end + + before do + chat_service.notify_only_default_branch = false + end + + it_behaves_like 'call Microsoft Teams API' + end end end end -- GitLab From 2d545957031ac51d6994014850b72edc05779d1c Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Fri, 21 Jun 2019 07:51:58 +0000 Subject: [PATCH 04/15] Merge branch 'bug/63162-duplicate_path_in_links' into 'master' Do not rewrite relative links for system notes Closes #63162 See merge request gitlab-org/gitlab-ce!29825 (cherry picked from commit 51df2ca5c5a1b18155b7bba9bdc26c165533428b) 35a39c1d Do not rewrite relative links for system notes --- app/models/note.rb | 2 +- .../unreleased/bug-63162-duplicate_path_in_links.yml | 5 +++++ lib/banzai/filter/relative_link_filter.rb | 2 ++ spec/lib/banzai/filter/relative_link_filter_spec.rb | 7 +++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/bug-63162-duplicate_path_in_links.yml diff --git a/app/models/note.rb b/app/models/note.rb index 15271c68a9e..b55af7d9b5e 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -457,7 +457,7 @@ class Note < ApplicationRecord end def banzai_render_context(field) - super.merge(noteable: noteable) + super.merge(noteable: noteable, system_note: system?) end def retrieve_upload(_identifier, paths) diff --git a/changelogs/unreleased/bug-63162-duplicate_path_in_links.yml b/changelogs/unreleased/bug-63162-duplicate_path_in_links.yml new file mode 100644 index 00000000000..d3f246492fb --- /dev/null +++ b/changelogs/unreleased/bug-63162-duplicate_path_in_links.yml @@ -0,0 +1,5 @@ +--- +title: Fixed 'diff version changes' link not working +merge_request: 29825 +author: +type: fixed diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index 199b3533cf4..80c84c0f622 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -17,6 +17,8 @@ module Banzai include Gitlab::Utils::StrongMemoize def call + return doc if context[:system_note] + @uri_types = {} clear_memoization(:linkable_files) diff --git a/spec/lib/banzai/filter/relative_link_filter_spec.rb b/spec/lib/banzai/filter/relative_link_filter_spec.rb index dad0a5535c0..8ff971114d6 100644 --- a/spec/lib/banzai/filter/relative_link_filter_spec.rb +++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb @@ -101,6 +101,13 @@ describe Banzai::Filter::RelativeLinkFilter do .to eq "/#{project_path}/blob/#{ref}/doc/api/README.md" end + it 'does not modify relative URLs in system notes' do + path = "#{project_path}/merge_requests/1/diffs" + doc = filter(link(path), system_note: true) + + expect(doc.at_css('a')['href']).to eq path + end + it 'ignores absolute URLs with two leading slashes' do doc = filter(link('//doc/api/README.md')) expect(doc.at_css('a')['href']).to eq '//doc/api/README.md' -- GitLab From 760f806fd3dc934026bf3a955356b999128b71db Mon Sep 17 00:00:00 2001 From: Ash McKenzie Date: Mon, 24 Jun 2019 10:56:19 +0000 Subject: [PATCH 05/15] Merge branch 'fix-labels-in-hooks' into 'master' Fix label serialisation in issue and note hooks Closes #63473 See merge request gitlab-org/gitlab-ce!29850 (cherry picked from commit 88c8d177f835983a0a47796529906c69376d159d) da470249 Fix label serialisation in issue and note hooks 4189ffe2 Added labels_hook_attrs method --- app/models/issue.rb | 4 ++++ changelogs/unreleased/fix-labels-in-hooks.yml | 5 +++++ lib/gitlab/data_builder/note.rb | 2 +- lib/gitlab/hook_data/issue_builder.rb | 2 +- spec/lib/gitlab/data_builder/note_spec.rb | 19 ++++++++++++------- .../gitlab/hook_data/issue_builder_spec.rb | 4 +++- spec/models/issue_spec.rb | 9 +++++++++ 7 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 changelogs/unreleased/fix-labels-in-hooks.yml diff --git a/app/models/issue.rb b/app/models/issue.rb index 6da6fbe55cb..30e29911758 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -254,6 +254,10 @@ class Issue < ApplicationRecord merge_requests_closing_issues.count end + def labels_hook_attrs + labels.map(&:hook_attrs) + end + private def ensure_metrics diff --git a/changelogs/unreleased/fix-labels-in-hooks.yml b/changelogs/unreleased/fix-labels-in-hooks.yml new file mode 100644 index 00000000000..c0904a860c5 --- /dev/null +++ b/changelogs/unreleased/fix-labels-in-hooks.yml @@ -0,0 +1,5 @@ +--- +title: Fix label serialization in issue and note hooks +merge_request: 29850 +author: +type: fixed diff --git a/lib/gitlab/data_builder/note.rb b/lib/gitlab/data_builder/note.rb index 16e62622ed4..2c4ef73a688 100644 --- a/lib/gitlab/data_builder/note.rb +++ b/lib/gitlab/data_builder/note.rb @@ -44,7 +44,7 @@ module Gitlab data[:commit] = build_data_for_commit(project, user, note) elsif note.for_issue? data[:issue] = note.noteable.hook_attrs - data[:issue][:labels] = note.noteable.labels(&:hook_attrs) + data[:issue][:labels] = note.noteable.labels_hook_attrs elsif note.for_merge_request? data[:merge_request] = note.noteable.hook_attrs elsif note.for_snippet? diff --git a/lib/gitlab/hook_data/issue_builder.rb b/lib/gitlab/hook_data/issue_builder.rb index cfc9ebe4f92..e5f86ca02b5 100644 --- a/lib/gitlab/hook_data/issue_builder.rb +++ b/lib/gitlab/hook_data/issue_builder.rb @@ -45,7 +45,7 @@ module Gitlab human_time_estimate: issue.human_time_estimate, assignee_ids: issue.assignee_ids, assignee_id: issue.assignee_ids.first, # This key is deprecated - labels: issue.labels + labels: issue.labels_hook_attrs } issue.attributes.with_indifferent_access.slice(*self.class.safe_hook_attributes) diff --git a/spec/lib/gitlab/data_builder/note_spec.rb b/spec/lib/gitlab/data_builder/note_spec.rb index ed9a1e23529..1b5dd2538e0 100644 --- a/spec/lib/gitlab/data_builder/note_spec.rb +++ b/spec/lib/gitlab/data_builder/note_spec.rb @@ -38,9 +38,11 @@ describe Gitlab::DataBuilder::Note do end describe 'When asking for a note on issue' do + let(:label) { create(:label, project: project) } + let(:issue) do - create(:issue, created_at: fixed_time, updated_at: fixed_time, - project: project) + create(:labeled_issue, created_at: fixed_time, updated_at: fixed_time, + project: project, labels: [label]) end let(:note) do @@ -48,13 +50,16 @@ describe Gitlab::DataBuilder::Note do end it 'returns the note and issue-specific data' do + without_timestamps = lambda { |label| label.except('created_at', 'updated_at') } + hook_attrs = issue.reload.hook_attrs + expect(data).to have_key(:issue) - expect(data[:issue].except('updated_at')) - .to eq(issue.reload.hook_attrs.except('updated_at')) + expect(data[:issue].except('updated_at', 'labels')) + .to eq(hook_attrs.except('updated_at', 'labels')) expect(data[:issue]['updated_at']) - .to be >= issue.hook_attrs['updated_at'] - expect(data[:issue]['labels']) - .to eq(issue.hook_attrs['labels']) + .to be >= hook_attrs['updated_at'] + expect(data[:issue]['labels'].map(&without_timestamps)) + .to eq(hook_attrs['labels'].map(&without_timestamps)) end context 'with confidential issue' do diff --git a/spec/lib/gitlab/hook_data/issue_builder_spec.rb b/spec/lib/gitlab/hook_data/issue_builder_spec.rb index f066c0e3813..b06d05c1c7f 100644 --- a/spec/lib/gitlab/hook_data/issue_builder_spec.rb +++ b/spec/lib/gitlab/hook_data/issue_builder_spec.rb @@ -1,7 +1,8 @@ require 'spec_helper' describe Gitlab::HookData::IssueBuilder do - set(:issue) { create(:issue) } + set(:label) { create(:label) } + set(:issue) { create(:labeled_issue, labels: [label], project: label.project) } let(:builder) { described_class.new(issue) } describe '#build' do @@ -39,6 +40,7 @@ describe Gitlab::HookData::IssueBuilder do expect(data).to include(:human_time_estimate) expect(data).to include(:human_total_time_spent) expect(data).to include(:assignee_ids) + expect(data).to include('labels' => [label.hook_attrs]) end context 'when the issue has an image in the description' do diff --git a/spec/models/issue_spec.rb b/spec/models/issue_spec.rb index a5c7e9db2a1..d5b016dc8f6 100644 --- a/spec/models/issue_spec.rb +++ b/spec/models/issue_spec.rb @@ -862,4 +862,13 @@ describe Issue do end end end + + describe "#labels_hook_attrs" do + let(:label) { create(:label) } + let(:issue) { create(:labeled_issue, labels: [label]) } + + it "returns a list of label hook attributes" do + expect(issue.labels_hook_attrs).to eq([label.hook_attrs]) + end + end end -- GitLab From c1393ca087969a2354b686967afc5d6293ac6b4f Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Thu, 20 Jun 2019 17:24:13 +0000 Subject: [PATCH 06/15] Merge branch '12174-add-remove-child-epic-quick-actions-doc-ce' into 'master' Add documentation on epic add/remove child relations quick actions See merge request gitlab-org/gitlab-ce!29860 (cherry picked from commit 2b58712527ee8f47c1c1818511e4f0516c933fa4) a15e6206 Add documentation on epic add/remove child relations quick actions --- doc/user/project/quick_actions.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/user/project/quick_actions.md b/doc/user/project/quick_actions.md index 1d640966013..6c430ff7cd9 100644 --- a/doc/user/project/quick_actions.md +++ b/doc/user/project/quick_actions.md @@ -35,7 +35,7 @@ discussions, and descriptions: | `/label ~label1 ~label2` | Add label(s). Label names can also start without ~ but mixed syntax is not supported. | ✓ | ✓ | | `/unlabel ~label1 ~label2` | Remove all or specific label(s)| ✓ | ✓ | | `/relabel ~label1 ~label2` | Replace label | ✓ | ✓ | -| /copy_metadata #issue | !merge_request | Copy labels and milestone from other issue or merge request in the project | ✓ | ✓ | +| /copy_metadata <#issue | !merge_request> | Copy labels and milestone from other issue or merge request in the project | ✓ | ✓ | | /estimate <1w 3d 2h 14m> | Set time estimate | ✓ | ✓ | | `/remove_estimate` | Remove time estimate | ✓ | ✓ | | /spend <time(1h 30m | -1h 5m)> <date(YYYY-MM-DD)> | Add or subtract spent time; optionally, specify the date that time was spent on | ✓ | ✓ | @@ -44,14 +44,14 @@ discussions, and descriptions: | `/unlock` | Unlock the discussion | ✓ | ✓ | | /due <in 2 days | this Friday | December 31st>| Set due date | ✓ | | | `/remove_due_date` | Remove due date | ✓ | | -| `/weight 0,1,2, ...` | Set weight **[STARTER]** | ✓ | | +| /weight <0 | 1 | 2 | ...> | Set weight **[STARTER]** | ✓ | | | `/clear_weight` | Clears weight **[STARTER]** | ✓ | | -| `/epic <&epic | group&epic | Epic URL>` | Add to epic **[ULTIMATE]** | ✓ | | +| /epic <&epic | group&epic | Epic URL> | Add to epic **[ULTIMATE]** | ✓ | | | `/remove_epic` | Removes from epic **[ULTIMATE]** | ✓ | | | `/promote` | Promote issue to epic **[ULTIMATE]** | ✓ | | | `/confidential` | Make confidential | ✓ | | -| `/duplicate #issue` | Mark this issue as a duplicate of another issue | ✓ | -| `/move path/to/project` | Move this issue to another project | ✓ | | +| `/duplicate <#issue>` | Mark this issue as a duplicate of another issue | ✓ | +| `/move ` | Move this issue to another project | ✓ | | | `/target_branch ` | Set target branch | | ✓ | | `/wip` | Toggle the Work In Progress status | | ✓ | | `/approve` | Approve the merge request | | ✓ | @@ -85,3 +85,5 @@ The following quick actions are applicable for epics threads and description: | `/label ~label1 ~label2` | Add label(s) | | `/unlabel ~label1 ~label2` | Remove all or specific label(s) | | `/relabel ~label1 ~label2` | Replace label | +| /child_epic <&epic | group&epic | Epic URL> | Adds child epic to epic ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab-ee/issues/7330)) | +| /remove_child_epic <&epic | group&epic | Epic URL> | Removes child epic from epic ([introduced in GitLab 12.0](https://gitlab.com/gitlab-org/gitlab-ee/issues/7330)) | -- GitLab From aec887ab85353f16e987846dc1012bd3ae303f06 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 24 Jun 2019 08:47:39 +0000 Subject: [PATCH 07/15] Merge branch 'docs/add-to-list-of-access-control-functions' into 'master' Add to list of functionality See merge request gitlab-org/gitlab-ce!29876 (cherry picked from commit ef2bd684b0a7afd1981d9d3bcc63211a63e4eca3) 0dc21bf2 Add to list of functionality --- .../admin_area/settings/visibility_and_access_controls.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/user/admin_area/settings/visibility_and_access_controls.md b/doc/user/admin_area/settings/visibility_and_access_controls.md index a1229484388..63879935fd8 100644 --- a/doc/user/admin_area/settings/visibility_and_access_controls.md +++ b/doc/user/admin_area/settings/visibility_and_access_controls.md @@ -4,12 +4,15 @@ type: reference # Visibility and access controls -GitLab allows admins to: +GitLab allows administrators to: - Control access and visibility to GitLab resources including branches and projects. - Select from which hosting sites code can be imported into GitLab. - Select the protocols permitted to access GitLab. - Enable or disable repository mirroring. +- Prevent non-administrators from deleting projects + ([introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/5615) in GitLab 12.0). + **[PREMIUM ONLY]** To access the visibility and access control options: -- GitLab From 394a39f82c8063b7c1660faa291200c3d15b783f Mon Sep 17 00:00:00 2001 From: Ash McKenzie Date: Thu, 20 Jun 2019 12:00:51 +0000 Subject: [PATCH 08/15] Merge branch '63510-error-parsing-true-boolean-in-gitlab-jsoncache' into 'master' Gitlab::JsonCache#parse_value ensure string Closes #63510 See merge request gitlab-org/gitlab-ce!29885 (cherry picked from commit 788690304a495aa6c4d3e2fa163753f28fbdb82f) 03220c00 Gitlab::JsonCache#parse_value ensure string --- lib/gitlab/json_cache.rb | 2 +- spec/lib/gitlab/json_cache_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/json_cache.rb b/lib/gitlab/json_cache.rb index e4bc437d787..9a0b2b35112 100644 --- a/lib/gitlab/json_cache.rb +++ b/lib/gitlab/json_cache.rb @@ -58,7 +58,7 @@ module Gitlab private def parse_value(raw, klass) - value = ActiveSupport::JSON.decode(raw) + value = ActiveSupport::JSON.decode(raw.to_s) case value when Hash then parse_entry(value, klass) diff --git a/spec/lib/gitlab/json_cache_spec.rb b/spec/lib/gitlab/json_cache_spec.rb index b82c09af306..c6a6042c65c 100644 --- a/spec/lib/gitlab/json_cache_spec.rb +++ b/spec/lib/gitlab/json_cache_spec.rb @@ -106,6 +106,16 @@ describe Gitlab::JsonCache do expect(cache.read(key)).to be_nil end + context 'when the cached value is a boolean' do + it 'parses the cached value' do + allow(backend).to receive(:read) + .with(expanded_key) + .and_return(true) + + expect(cache.read(key, BroadcastMessage)).to eq(true) + end + end + context 'when the cached value is a hash' do it 'parses the cached value' do allow(backend).to receive(:read) -- GitLab From 46c74227b6eb4646560944d7711fa071b9150f22 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 24 Jun 2019 09:20:11 +0000 Subject: [PATCH 09/15] Merge branch 'fix-notes-emails-with-group-settings' into 'master' Fix notes email with group-level notification email Closes #63355 See merge request gitlab-org/gitlab-ce!29889 (cherry picked from commit 480eb370a477c3a230cec1ff43a71066ab5be6f9) bf73ecd7 Fix notes email with group-level notification email 8eb2d7bb Apply suggestion to spec/support/helpers/email_helpers.rb --- app/mailers/emails/notes.rb | 2 +- .../fix-notes-emails-with-group-settings.yml | 5 ++++ spec/mailers/emails/pages_domains_spec.rb | 2 +- spec/mailers/notify_spec.rb | 30 ++++++++++--------- spec/support/helpers/email_helpers.rb | 15 ++++++++-- .../shared_examples/notify_shared_examples.rb | 16 +++++----- 6 files changed, 44 insertions(+), 26 deletions(-) create mode 100644 changelogs/unreleased/fix-notes-emails-with-group-settings.yml diff --git a/app/mailers/emails/notes.rb b/app/mailers/emails/notes.rb index 70d296fe3b8..506c8d251b7 100644 --- a/app/mailers/emails/notes.rb +++ b/app/mailers/emails/notes.rb @@ -60,7 +60,7 @@ module Emails # `note_id` is a `Note` when originating in `NotifyPreview` @note = note_id.is_a?(Note) ? note_id : Note.find(note_id) @project = @note.project - @group = @note.noteable.try(:group) + @group = @project.try(:group) || @note.noteable.try(:group) if (@project || @group) && @note.persisted? @sent_notification = SentNotification.record_note(@note, recipient_id, reply_key) diff --git a/changelogs/unreleased/fix-notes-emails-with-group-settings.yml b/changelogs/unreleased/fix-notes-emails-with-group-settings.yml new file mode 100644 index 00000000000..77dae8418a8 --- /dev/null +++ b/changelogs/unreleased/fix-notes-emails-with-group-settings.yml @@ -0,0 +1,5 @@ +--- +title: Fix comment emails not respecting group-level notification email +merge_request: +author: +type: fixed diff --git a/spec/mailers/emails/pages_domains_spec.rb b/spec/mailers/emails/pages_domains_spec.rb index 2f594dbf9d1..eae83cd64d3 100644 --- a/spec/mailers/emails/pages_domains_spec.rb +++ b/spec/mailers/emails/pages_domains_spec.rb @@ -9,7 +9,7 @@ describe Emails::PagesDomains do set(:user) { project.creator } shared_examples 'a pages domain email' do - let(:test_recipient) { user } + let(:recipient) { user } it_behaves_like 'an email sent to a user' it_behaves_like 'an email sent from GitLab' diff --git a/spec/mailers/notify_spec.rb b/spec/mailers/notify_spec.rb index cbbb22ad78c..a190f29d677 100644 --- a/spec/mailers/notify_spec.rb +++ b/spec/mailers/notify_spec.rb @@ -45,7 +45,7 @@ describe Notify do context 'for a project' do shared_examples 'an assignee email' do - let(:test_recipient) { assignee } + let(:recipient) { assignee } it_behaves_like 'an email sent to a user' @@ -55,7 +55,7 @@ describe Notify do aggregate_failures do expect(sender.display_name).to eq(current_user.name) expect(sender.address).to eq(gitlab_sender) - expect(subject).to deliver_to(assignee.email) + expect(subject).to deliver_to(recipient.notification_email) end end end @@ -559,12 +559,13 @@ describe Notify do let(:host) { Gitlab.config.gitlab.host } context 'in discussion' do - set(:first_note) { create(:discussion_note_on_issue) } - set(:second_note) { create(:discussion_note_on_issue, in_reply_to: first_note) } - set(:third_note) { create(:discussion_note_on_issue, in_reply_to: second_note) } + set(:first_note) { create(:discussion_note_on_issue, project: project) } + set(:second_note) { create(:discussion_note_on_issue, in_reply_to: first_note, project: project) } + set(:third_note) { create(:discussion_note_on_issue, in_reply_to: second_note, project: project) } subject { described_class.note_issue_email(recipient.id, third_note.id) } + it_behaves_like 'an email sent to a user' it_behaves_like 'appearance header and footer enabled' it_behaves_like 'appearance header and footer not enabled' @@ -584,10 +585,11 @@ describe Notify do end context 'individual issue comments' do - set(:note) { create(:note_on_issue) } + set(:note) { create(:note_on_issue, project: project) } subject { described_class.note_issue_email(recipient.id, note.id) } + it_behaves_like 'an email sent to a user' it_behaves_like 'appearance header and footer enabled' it_behaves_like 'appearance header and footer not enabled' @@ -616,13 +618,13 @@ describe Notify do it_behaves_like 'a user cannot unsubscribe through footer link' it 'has the correct subject and body' do - is_expected.to have_referable_subject(project_snippet, reply: true) + is_expected.to have_referable_subject(project_snippet, include_group: true, reply: true) is_expected.to have_body_text project_snippet_note.note end end describe 'project was moved' do - let(:test_recipient) { user } + let(:recipient) { user } subject { described_class.project_was_moved_email(project.id, user.id, "gitlab/gitlab") } it_behaves_like 'an email sent to a user' @@ -823,7 +825,7 @@ describe Notify do it 'has the correct subject and body' do aggregate_failures do - is_expected.to have_subject("Re: #{project.name} | #{commit.title} (#{commit.short_id})") + is_expected.to have_subject("Re: #{project.name} | #{project.group.name} | #{commit.title} (#{commit.short_id})") is_expected.to have_body_text(commit.short_id) end end @@ -849,7 +851,7 @@ describe Notify do it 'has the correct subject and body' do aggregate_failures do - is_expected.to have_referable_subject(merge_request, reply: true) + is_expected.to have_referable_subject(merge_request, include_group: true, reply: true) is_expected.to have_body_text note_on_merge_request_path end end @@ -875,7 +877,7 @@ describe Notify do it 'has the correct subject and body' do aggregate_failures do - is_expected.to have_referable_subject(issue, reply: true) + is_expected.to have_referable_subject(issue, include_group: true, reply: true) is_expected.to have_body_text(note_on_issue_path) end end @@ -939,7 +941,7 @@ describe Notify do it_behaves_like 'appearance header and footer not enabled' it 'has the correct subject' do - is_expected.to have_subject "Re: #{project.name} | #{commit.title} (#{commit.short_id})" + is_expected.to have_subject "Re: #{project.name} | #{project.group.name} | #{commit.title} (#{commit.short_id})" end it 'contains a link to the commit' do @@ -967,7 +969,7 @@ describe Notify do it_behaves_like 'appearance header and footer not enabled' it 'has the correct subject' do - is_expected.to have_referable_subject(merge_request, reply: true) + is_expected.to have_referable_subject(merge_request, include_group: true, reply: true) end it 'contains a link to the merge request note' do @@ -995,7 +997,7 @@ describe Notify do it_behaves_like 'appearance header and footer not enabled' it 'has the correct subject' do - is_expected.to have_referable_subject(issue, reply: true) + is_expected.to have_referable_subject(issue, include_group: true, reply: true) end it 'contains a link to the issue note' do diff --git a/spec/support/helpers/email_helpers.rb b/spec/support/helpers/email_helpers.rb index ed049daba80..a7175491fa0 100644 --- a/spec/support/helpers/email_helpers.rb +++ b/spec/support/helpers/email_helpers.rb @@ -37,8 +37,19 @@ module EmailHelpers ActionMailer::Base.deliveries.find { |d| d.to.include?(user.notification_email) } end - def have_referable_subject(referable, include_project: true, reply: false) - prefix = (include_project && referable.project ? "#{referable.project.name} | " : '').freeze + def have_referable_subject(referable, include_project: true, include_group: false, reply: false) + context = [] + + context << referable.project.name if include_project && referable.project + context << referable.project.group.name if include_group && referable.project.group + + prefix = + if context.any? + context.join(' | ') + ' | ' + else + '' + end + prefix = "Re: #{prefix}" if reply suffix = "#{referable.title} (#{referable.to_reference})" diff --git a/spec/support/shared_examples/notify_shared_examples.rb b/spec/support/shared_examples/notify_shared_examples.rb index 897c9106d77..4d43317e17e 100644 --- a/spec/support/shared_examples/notify_shared_examples.rb +++ b/spec/support/shared_examples/notify_shared_examples.rb @@ -45,18 +45,18 @@ shared_examples 'an email sent to a user' do let(:group_notification_email) { 'user+group@example.com' } it 'is sent to user\'s global notification email address' do - expect(subject).to deliver_to(test_recipient.notification_email) + expect(subject).to deliver_to(recipient.notification_email) end context 'that is part of a project\'s group' do it 'is sent to user\'s group notification email address when set' do - create(:notification_setting, user: test_recipient, source: project.group, notification_email: group_notification_email) + create(:notification_setting, user: recipient, source: project.group, notification_email: group_notification_email) expect(subject).to deliver_to(group_notification_email) end it 'is sent to user\'s global notification email address when no group email set' do - create(:notification_setting, user: test_recipient, source: project.group, notification_email: '') - expect(subject).to deliver_to(test_recipient.notification_email) + create(:notification_setting, user: recipient, source: project.group, notification_email: '') + expect(subject).to deliver_to(recipient.notification_email) end end @@ -67,17 +67,17 @@ shared_examples 'an email sent to a user' do it 'is sent to user\'s subgroup notification email address when set' do # Set top-level group notification email address to make sure it doesn't get selected - create(:notification_setting, user: test_recipient, source: group, notification_email: group_notification_email) + create(:notification_setting, user: recipient, source: group, notification_email: group_notification_email) subgroup_notification_email = 'user+subgroup@example.com' - create(:notification_setting, user: test_recipient, source: subgroup, notification_email: subgroup_notification_email) + create(:notification_setting, user: recipient, source: subgroup, notification_email: subgroup_notification_email) expect(subject).to deliver_to(subgroup_notification_email) end it 'is sent to user\'s group notification email address when set and subgroup email address not set' do - create(:notification_setting, user: test_recipient, source: subgroup, notification_email: '') - expect(subject).to deliver_to(test_recipient.notification_email) + create(:notification_setting, user: recipient, source: subgroup, notification_email: '') + expect(subject).to deliver_to(recipient.notification_email) end end end -- GitLab From 119c8d648e6a622dc05ccfa0cebe4cf093092937 Mon Sep 17 00:00:00 2001 From: Mayra Cabrera Date: Fri, 21 Jun 2019 00:10:49 +0000 Subject: [PATCH 10/15] Merge branch 'sh-omit-issues-links-on-poll' into 'master' Omit issues links in merge request entity API response Closes #63546 See merge request gitlab-org/gitlab-ce!29917 (cherry picked from commit f47e4d025247509ab73e16c3db248b0f9ccb662c) 1b7ab11f Omit issues links in merge request entity API response --- app/helpers/issuables_helper.rb | 4 ++-- app/serializers/merge_request_widget_entity.rb | 5 ++++- app/views/projects/merge_requests/show.html.haml | 2 +- .../unreleased/sh-omit-issues-links-on-poll.yml | 5 +++++ .../serializers/merge_request_widget_entity_spec.rb | 13 +++++++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 changelogs/unreleased/sh-omit-issues-links-on-poll.yml diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 9a12db258d5..150f24a5d5b 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -74,7 +74,7 @@ module IssuablesHelper end end - def serialize_issuable(issuable, serializer: nil) + def serialize_issuable(issuable, opts = {}) serializer_klass = case issuable when Issue IssueSerializer @@ -84,7 +84,7 @@ module IssuablesHelper serializer_klass .new(current_user: current_user, project: issuable.project) - .represent(issuable, serializer: serializer) + .represent(issuable, opts) .to_json end diff --git a/app/serializers/merge_request_widget_entity.rb b/app/serializers/merge_request_widget_entity.rb index a428930dbbf..43aced598a9 100644 --- a/app/serializers/merge_request_widget_entity.rb +++ b/app/serializers/merge_request_widget_entity.rb @@ -114,7 +114,10 @@ class MergeRequestWidgetEntity < IssuableEntity presenter(merge_request).ci_status end - expose :issues_links do + # Rendering and redacting Markdown can be expensive. These links are + # just nice to have in the merge request widget, so only + # include them if they are explicitly requested on first load. + expose :issues_links, if: -> (_, opts) { opts[:issues_links] } do expose :assign_to_closing do |merge_request| presenter(merge_request).assign_to_closing_issues_link end diff --git a/app/views/projects/merge_requests/show.html.haml b/app/views/projects/merge_requests/show.html.haml index f593f4e049e..2084ca6f905 100644 --- a/app/views/projects/merge_requests/show.html.haml +++ b/app/views/projects/merge_requests/show.html.haml @@ -19,7 +19,7 @@ -# haml-lint:disable InlineJavaScript :javascript window.gl = window.gl || {}; - window.gl.mrWidgetData = #{serialize_issuable(@merge_request, serializer: 'widget')} + window.gl.mrWidgetData = #{serialize_issuable(@merge_request, serializer: 'widget', issues_links: true)} window.gl.mrWidgetData.squash_before_merge_help_path = '#{help_page_path("user/project/merge_requests/squash_and_merge")}'; window.gl.mrWidgetData.troubleshooting_docs_path = '#{help_page_path('user/project/merge_requests/index.md', anchor: 'troubleshooting')}'; diff --git a/changelogs/unreleased/sh-omit-issues-links-on-poll.yml b/changelogs/unreleased/sh-omit-issues-links-on-poll.yml new file mode 100644 index 00000000000..21e51d3534f --- /dev/null +++ b/changelogs/unreleased/sh-omit-issues-links-on-poll.yml @@ -0,0 +1,5 @@ +--- +title: Omit issues links in merge request entity API response +merge_request: 29917 +author: +type: performance diff --git a/spec/serializers/merge_request_widget_entity_spec.rb b/spec/serializers/merge_request_widget_entity_spec.rb index a27c22191f4..ffbfac9b326 100644 --- a/spec/serializers/merge_request_widget_entity_spec.rb +++ b/spec/serializers/merge_request_widget_entity_spec.rb @@ -32,6 +32,19 @@ describe MergeRequestWidgetEntity do end end + describe 'issues links' do + it 'includes issues links when requested' do + data = described_class.new(resource, request: request, issues_links: true).as_json + + expect(data).to include(:issues_links) + expect(data[:issues_links]).to include(:assign_to_closing, :closing, :mentioned_but_not_closing) + end + + it 'omits issue links by default' do + expect(subject).not_to include(:issues_links) + end + end + describe 'pipeline' do let(:pipeline) { create(:ci_empty_pipeline, project: project, ref: resource.source_branch, sha: resource.source_branch_sha, head_pipeline_of: resource) } -- GitLab From f24e8f41d08b70b6aba9c7f42019aad56450ca8d Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Fri, 21 Jun 2019 20:39:05 +0000 Subject: [PATCH 11/15] Merge branch '63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key' into 'master' Include the GitLab version in the cache key for Gitlab::JsonCache See merge request gitlab-org/gitlab-ce!29938 (cherry picked from commit c6f54ab12b5b276dadda0639ea647e9a2b4c1781) 94d9e335 Include the GitLab version in the cache key for Gitlab::JsonCache 1b7e7dde Add CHANGELOG entry --- ...es-the-gitlab-version-in-the-cache-key.yml | 5 ++ lib/gitlab/json_cache.rb | 4 +- spec/lib/gitlab/json_cache_spec.rb | 68 +++++++++++++------ 3 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 changelogs/unreleased/63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key.yml diff --git a/changelogs/unreleased/63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key.yml b/changelogs/unreleased/63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key.yml new file mode 100644 index 00000000000..b5715902630 --- /dev/null +++ b/changelogs/unreleased/63513-ensure-gitlab-jsoncache-includes-the-gitlab-version-in-the-cache-key.yml @@ -0,0 +1,5 @@ +--- +title: Include the GitLab version in the cache key for Gitlab::JsonCache +merge_request: 29938 +author: +type: fixed diff --git a/lib/gitlab/json_cache.rb b/lib/gitlab/json_cache.rb index 9a0b2b35112..d01183d7845 100644 --- a/lib/gitlab/json_cache.rb +++ b/lib/gitlab/json_cache.rb @@ -22,10 +22,10 @@ module Gitlab expanded_cache_key = [namespace, key].compact if cache_key_with_version - expanded_cache_key << Rails.version + expanded_cache_key << [Gitlab::VERSION, Rails.version] end - expanded_cache_key.join(':') + expanded_cache_key.flatten.join(':').freeze end def expire(key) diff --git a/spec/lib/gitlab/json_cache_spec.rb b/spec/lib/gitlab/json_cache_spec.rb index c6a6042c65c..59160741c45 100644 --- a/spec/lib/gitlab/json_cache_spec.rb +++ b/spec/lib/gitlab/json_cache_spec.rb @@ -6,7 +6,7 @@ describe Gitlab::JsonCache do let(:backend) { double('backend').as_null_object } let(:namespace) { 'geo' } let(:key) { 'foo' } - let(:expanded_key) { "#{namespace}:#{key}:#{Rails.version}" } + let(:expanded_key) { "#{namespace}:#{key}:#{Gitlab::VERSION}:#{Rails.version}" } set(:broadcast_message) { create(:broadcast_message) } subject(:cache) { described_class.new(namespace: namespace, backend: backend) } @@ -35,42 +35,68 @@ describe Gitlab::JsonCache do describe '#cache_key' do context 'when namespace is not defined' do - it 'expands out the key with Rails version' do - cache = described_class.new(cache_key_with_version: true) + context 'when cache_key_with_version is true' do + it 'expands out the key with GitLab, and Rails versions' do + cache = described_class.new(cache_key_with_version: true) - cache_key = cache.cache_key(key) + cache_key = cache.cache_key(key) - expect(cache_key).to eq("#{key}:#{Rails.version}") + expect(cache_key).to eq("#{key}:#{Gitlab::VERSION}:#{Rails.version}") + end end - end - context 'when cache_key_with_version is true' do - it 'expands out the key with namespace and Rails version' do - cache = described_class.new(namespace: namespace, cache_key_with_version: true) + context 'when cache_key_with_version is false' do + it 'returns the key' do + cache = described_class.new(namespace: nil, cache_key_with_version: false) - cache_key = cache.cache_key(key) + cache_key = cache.cache_key(key) - expect(cache_key).to eq("#{namespace}:#{key}:#{Rails.version}") + expect(cache_key).to eq(key) + end end end - context 'when cache_key_with_version is false' do - it 'expands out the key with namespace' do - cache = described_class.new(namespace: namespace, cache_key_with_version: false) + context 'when namespace is nil' do + context 'when cache_key_with_version is true' do + it 'expands out the key with GitLab, and Rails versions' do + cache = described_class.new(cache_key_with_version: true) - cache_key = cache.cache_key(key) + cache_key = cache.cache_key(key) - expect(cache_key).to eq("#{namespace}:#{key}") + expect(cache_key).to eq("#{key}:#{Gitlab::VERSION}:#{Rails.version}") + end + end + + context 'when cache_key_with_version is false' do + it 'returns the key' do + cache = described_class.new(namespace: nil, cache_key_with_version: false) + + cache_key = cache.cache_key(key) + + expect(cache_key).to eq(key) + end end end - context 'when namespace is nil, and cache_key_with_version is false' do - it 'returns the key' do - cache = described_class.new(namespace: nil, cache_key_with_version: false) + context 'when namespace is set' do + context 'when cache_key_with_version is true' do + it 'expands out the key with namespace and Rails version' do + cache = described_class.new(namespace: namespace, cache_key_with_version: true) + + cache_key = cache.cache_key(key) - cache_key = cache.cache_key(key) + expect(cache_key).to eq("#{namespace}:#{key}:#{Gitlab::VERSION}:#{Rails.version}") + end + end - expect(cache_key).to eq(key) + context 'when cache_key_with_version is false' do + it 'expands out the key with namespace' do + cache = described_class.new(namespace: namespace, cache_key_with_version: false) + + cache_key = cache.cache_key(key) + + expect(cache_key).to eq("#{namespace}:#{key}") + end end end end -- GitLab From 25594d4169006adc2d13a546a874636c46a5de48 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 21 Jun 2019 16:30:43 +0000 Subject: [PATCH 12/15] Merge branch 'docs/deps-gemansium' into 'master' Remove Gemnasium dead link from docs See merge request gitlab-org/gitlab-ce!29942 (cherry picked from commit 76f49de4e772c4101bcb8df801ad9b7a78adcea7) a84a7233 Remove Gemnasium dead link from docs --- .../dependency_scanning/index.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/doc/user/application_security/dependency_scanning/index.md b/doc/user/application_security/dependency_scanning/index.md index 34d4507210e..a4e5b19bdc7 100644 --- a/doc/user/application_security/dependency_scanning/index.md +++ b/doc/user/application_security/dependency_scanning/index.md @@ -346,7 +346,7 @@ the report JSON unless stated otherwise. Presence of optional fields depends on | `vulnerabilities[].scanner` | A node that describes the analyzer used to find this vulnerability. | | `vulnerabilities[].scanner.id` | Id of the scanner as a snake_case string. | | `vulnerabilities[].scanner.name` | Name of the scanner, for display purposes. | -| `vulnerabilities[].location` | A node that tells where the vulnerability is located. | +| `vulnerabilities[].location` | A node that tells where the vulnerability is located. | | `vulnerabilities[].location.file` | Path to the dependencies file (e.g., `yarn.lock`). Optional. | | `vulnerabilities[].location.dependency` | A node that describes the dependency of a project where the vulnerability is located. | | `vulnerabilities[].location.dependency.package` | A node that provides the information on the package where the vulnerability is located. | @@ -379,17 +379,17 @@ Once a vulnerability is found, you can interact with it. Read more on how to ## Dependency List -> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/10075) -in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.0. +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/10075) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.0. -An additional benefit of Dependency Scanning is the ability to get a list of your project's dependencies with their versions. +An additional benefit of Dependency Scanning is the ability to get a list of your +project's dependencies with their versions. This list can be generated only for +[languages and package managers](#supported-languages-and-package-managers) +supported by Gemnasium. -This list can be generated only for [languages and package managers](#supported-languages-and-package-managers) supported by [Gemnasium](https://gitlab.com/gitlab-org/security-products/gemnasium/general). - -To see the generated dependency list, navigate to the Dependency List page under your project's left sidebar menu **Project > Dependency List**. +To see the generated dependency list, navigate to your project's **Project > Dependency List**. ## Contributing to the vulnerability database You can search the [gemnasium-db](https://gitlab.com/gitlab-org/security-products/gemnasium-db) project to find a vulnerability in the Gemnasium database. -You can also [submit new vulnerabilities](https://gitlab.com/gitlab-org/security-products/gemnasium-db/blob/master/CONTRIBUTING.md). \ No newline at end of file +You can also [submit new vulnerabilities](https://gitlab.com/gitlab-org/security-products/gemnasium-db/blob/master/CONTRIBUTING.md). -- GitLab From 7a8868d99dcb5a60e43b0121275a2a4d6a58e4b6 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 24 Jun 2019 08:26:40 +0000 Subject: [PATCH 13/15] Merge branch 'docs/variables-doc-introduced-text' into 'master' Refactor and add version text to variable syntax See merge request gitlab-org/gitlab-ce!29964 (cherry picked from commit 4ec1720fdbf6b4fb4ae5dc91bc0f5974717e6caf) 7d93954e Refactor and add version text to variable syntax --- doc/ci/variables/README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index df455857dee..bef533c05c7 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -480,7 +480,7 @@ Below you can find supported syntax reference: > Example: `$VARIABLE == "some value"` - > Example: `$VARIABLE != "some value"` _(added in 11.11)_ + > Example: `$VARIABLE != "some value"` (introduced in GitLab 11.11) You can use equality operator `==` or `!=` to compare a variable content to a string. We support both, double quotes and single quotes to define a string @@ -491,7 +491,7 @@ Below you can find supported syntax reference: > Example: `$VARIABLE == null` - > Example: `$VARIABLE != null` _(added in 11.11)_ + > Example: `$VARIABLE != null` (introduced in GitLab 11.11) It sometimes happens that you want to check whether a variable is defined or not. To do that, you can compare a variable to `null` keyword, like @@ -502,7 +502,7 @@ Below you can find supported syntax reference: > Example: `$VARIABLE == ""` - > Example: `$VARIABLE != ""` _(added in 11.11)_ + > Example: `$VARIABLE != ""` (introduced in GitLab 11.11) If you want to check whether a variable is defined, but is empty, you can simply compare it against an empty string, like `$VAR == ''` or non-empty @@ -512,7 +512,7 @@ Below you can find supported syntax reference: > Example: `$VARIABLE_1 == $VARIABLE_2` - > Example: `$VARIABLE_1 != $VARIABLE_2` _(added in 11.11)_ + > Example: `$VARIABLE_1 != $VARIABLE_2` (introduced in GitLab 11.11) It is possible to compare two variables. This is going to compare values of these variables. @@ -528,11 +528,11 @@ Below you can find supported syntax reference: `$STAGING` value needs to a string, with length higher than zero. Variable that contains only whitespace characters is not an empty variable. -1. Pattern matching _(added in 11.0)_ +1. Pattern matching (introduced in GitLab 11.0) > Example: `$VARIABLE =~ /^content.*/` - > Example: `$VARIABLE_1 !~ /^content.*/` _(added in 11.11)_ + > Example: `$VARIABLE_1 !~ /^content.*/` (introduced in GitLab 11.11) It is possible perform pattern matching against a variable and regular expression. Expression like this evaluates to truth if matches are found @@ -541,7 +541,7 @@ Below you can find supported syntax reference: Pattern matching is case-sensitive by default. Use `i` flag modifier, like `/pattern/i` to make a pattern case-insensitive. -1. Conjunction / Disjunction +1. Conjunction / Disjunction ([introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/27925) in GitLab 12.0) > Example: `$VARIABLE1 =~ /^content.*/ && $VARIABLE2 == "something"` -- GitLab From e59b82c955294257eecd8f6c6869092b6e339e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 25 Jun 2019 14:03:54 +0000 Subject: [PATCH 14/15] Merge branch 'sh-recover-ee-schema-backport-migration-failure' into 'master' Prevent EE backport migrations from running if CE is not migrated Closes #63612 See merge request gitlab-org/gitlab-ce!30002 (cherry picked from commit 34df0b303eed0cee83d8c0ec6178d3c575a0b555) 1b063778 Prevent EE backport migrations from running if CE is not migrated --- ...r-ee-schema-backport-migration-failure.yml | 5 ++ ...190402150158_backport_enterprise_schema.rb | 48 +++++++++++++++++++ .../backport_enterprise_schema_spec.rb | 41 ++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 changelogs/unreleased/sh-recover-ee-schema-backport-migration-failure.yml create mode 100644 spec/migrations/backport_enterprise_schema_spec.rb diff --git a/changelogs/unreleased/sh-recover-ee-schema-backport-migration-failure.yml b/changelogs/unreleased/sh-recover-ee-schema-backport-migration-failure.yml new file mode 100644 index 00000000000..1695e2827eb --- /dev/null +++ b/changelogs/unreleased/sh-recover-ee-schema-backport-migration-failure.yml @@ -0,0 +1,5 @@ +--- +title: Prevent EE backport migrations from running if CE is not migrated +merge_request: 30002 +author: +type: fixed diff --git a/db/migrate/20190402150158_backport_enterprise_schema.rb b/db/migrate/20190402150158_backport_enterprise_schema.rb index 610a8808383..8762cc53ed7 100644 --- a/db/migrate/20190402150158_backport_enterprise_schema.rb +++ b/db/migrate/20190402150158_backport_enterprise_schema.rb @@ -117,6 +117,8 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] end def up + check_schema! + create_missing_tables update_appearances @@ -868,6 +870,52 @@ class BackportEnterpriseSchema < ActiveRecord::Migration[5.0] remove_column_if_exists(:geo_nodes, :internal_url) end + # Some users may have upgraded to EE at some point but downgraded to + # CE v11.11.3. As a result, their EE tables may not be in the right + # state. Here we check for these such cases and attempt to guide the + # user into recovering from this state by upgrading to v11.11.3 EE + # before installing v12.0.0 CE. + def check_schema! + # The following cases will fail later when this migration attempts + # to add a foreign key for non-existent columns. + columns_to_check = [ + [:epics, :parent_id], # Added in GitLab 11.7 + [:geo_event_log, :cache_invalidation_event_id], # Added in GitLab 11.4 + [:vulnerability_feedback, :merge_request_id] # Added in GitLab 11.9 + ].freeze + + columns_to_check.each do |table, column| + check_ee_columns!(table, column) + end + end + + def check_ee_columns!(table, column) + return unless table_exists?(table) + return if column_exists?(table, column) + + raise_ee_migration_error!(table, column) + end + + def raise_ee_migration_error!(table, column) + message = "Your database is missing the '#{column}' column from the '#{table}' table that is present for GitLab EE." + + message += + if ::Gitlab.ee? + "\nUpgrade your GitLab instance to 11.11.3 EE first!" + else + <<~MSG + + Even though it looks like you're running a CE installation, it appears + you may have installed GitLab EE at some point. To migrate to GitLab 12.0: + + 1. Install GitLab 11.11.3 EE + 2. Install GitLab 12.0.x CE + MSG + end + + raise Exception.new(message) + end + def create_missing_tables create_table_if_not_exists "approval_merge_request_rule_sources", id: :bigserial do |t| t.bigint "approval_merge_request_rule_id", null: false diff --git a/spec/migrations/backport_enterprise_schema_spec.rb b/spec/migrations/backport_enterprise_schema_spec.rb new file mode 100644 index 00000000000..8d2d9d4953a --- /dev/null +++ b/spec/migrations/backport_enterprise_schema_spec.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +require 'spec_helper' + +require Rails.root.join('db', 'migrate', '20190402150158_backport_enterprise_schema.rb') + +describe BackportEnterpriseSchema, :migration, schema: 20190329085614 do + include MigrationsHelpers + + def drop_if_exists(table) + active_record_base.connection.drop_table(table) if active_record_base.connection.table_exists?(table) + end + + describe '#up' do + it 'creates new EE tables' do + migrate! + + expect(active_record_base.connection.table_exists?(:epics)).to be true + expect(active_record_base.connection.table_exists?(:geo_nodes)).to be true + end + + context 'missing EE columns' do + before do + drop_if_exists(:epics) + + active_record_base.connection.create_table "epics" do |t| + t.integer :group_id, null: false, index: true + t.integer :author_id, null: false, index: true + end + end + + after do + drop_if_exists(:epics) + end + + it 'flags an error' do + expect { migrate! }.to raise_error(/Your database is missing.*that is present for GitLab EE/) + end + end + end +end -- GitLab From 31ea326e7670d049c32d2c251e592e5d991bbc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Tue, 25 Jun 2019 14:32:19 +0000 Subject: [PATCH 15/15] Merge branch 'sh-quiet-backup-secrets-log' into 'master' Silence backup warnings when CRON=1 in use Closes #63703 See merge request gitlab-org/gitlab-ce!30033 (cherry picked from commit d6c7d4c48db51fdc3eb479e53d40ce4358695218) ad3abd1d Silence backup warnings when CRON=1 in use --- changelogs/unreleased/sh-quiet-backup-secrets-log.yml | 5 +++++ lib/tasks/gitlab/backup.rake | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/sh-quiet-backup-secrets-log.yml diff --git a/changelogs/unreleased/sh-quiet-backup-secrets-log.yml b/changelogs/unreleased/sh-quiet-backup-secrets-log.yml new file mode 100644 index 00000000000..cf3e90c0cb1 --- /dev/null +++ b/changelogs/unreleased/sh-quiet-backup-secrets-log.yml @@ -0,0 +1,5 @@ +--- +title: Silence backup warnings when CRON=1 in use +merge_request: 30033 +author: +type: fixed diff --git a/lib/tasks/gitlab/backup.rake b/lib/tasks/gitlab/backup.rake index c531eb1d216..2bf71701b57 100644 --- a/lib/tasks/gitlab/backup.rake +++ b/lib/tasks/gitlab/backup.rake @@ -21,10 +21,10 @@ namespace :gitlab do backup.cleanup backup.remove_old - puts "Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data \n" \ + progress.puts "Warning: Your gitlab.rb and gitlab-secrets.json files contain sensitive data \n" \ "and are not included in this backup. You will need these files to restore a backup.\n" \ "Please back them up manually.".color(:red) - puts "Backup task is done." + progress.puts "Backup task is done." end # Restore backup of GitLab system -- GitLab