From 241cc25e997c08d049efd64f73c19be8ab331fbe Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Fri, 19 Jan 2018 13:23:53 +0000 Subject: Merge branch 'fix-redirect-routes-schema' into 'master' rework indexes on redirect_routes See merge request gitlab-org/gitlab-ce!16211 --- .../unreleased/fix-redirect-routes-schema.yml | 5 ++ ...0180113220114_rework_redirect_routes_indexes.rb | 68 ++++++++++++++++++++++ db/schema.rb | 4 +- lib/tasks/migrate/setup_postgresql.rake | 2 + 4 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/fix-redirect-routes-schema.yml create mode 100644 db/migrate/20180113220114_rework_redirect_routes_indexes.rb diff --git a/changelogs/unreleased/fix-redirect-routes-schema.yml b/changelogs/unreleased/fix-redirect-routes-schema.yml new file mode 100644 index 00000000000..ea2b916307a --- /dev/null +++ b/changelogs/unreleased/fix-redirect-routes-schema.yml @@ -0,0 +1,5 @@ +--- +title: rework indexes on redirect_routes +merge_request: +author: +type: performance diff --git a/db/migrate/20180113220114_rework_redirect_routes_indexes.rb b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb new file mode 100644 index 00000000000..ab9971be074 --- /dev/null +++ b/db/migrate/20180113220114_rework_redirect_routes_indexes.rb @@ -0,0 +1,68 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class ReworkRedirectRoutesIndexes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + disable_ddl_transaction! + + INDEX_NAME_UNIQUE = "index_redirect_routes_on_path_unique_text_pattern_ops" + + INDEX_NAME_PERM = "index_redirect_routes_on_path_text_pattern_ops_where_permanent" + INDEX_NAME_TEMP = "index_redirect_routes_on_path_text_pattern_ops_where_temporary" + + OLD_INDEX_NAME_PATH_TPOPS = "index_redirect_routes_on_path_text_pattern_ops" + OLD_INDEX_NAME_PATH_LOWER = "index_on_redirect_routes_lower_path" + + def up + disable_statement_timeout + + # this is a plain btree on a single boolean column. It'll never be + # selective enough to be valuable. This class is called by + # setup_postgresql.rake so it needs to be able to handle this + # index not existing. + if index_exists?(:redirect_routes, :permanent) + remove_concurrent_index(:redirect_routes, :permanent) + end + + # If we're on MySQL then the existing index on path is ok. But on + # Postgres we need to clean things up: + return unless Gitlab::Database.postgresql? + + if_not_exists = Gitlab::Database.version.to_f >= 9.5 ? "IF NOT EXISTS" : "" + + # Unique index on lower(path) across both types of redirect_routes: + execute("CREATE UNIQUE INDEX CONCURRENTLY #{if_not_exists} #{INDEX_NAME_UNIQUE} ON redirect_routes (lower(path) varchar_pattern_ops);") + + # Make two indexes on path -- one for permanent and one for temporary routes: + execute("CREATE INDEX CONCURRENTLY #{if_not_exists} #{INDEX_NAME_PERM} ON redirect_routes (lower(path) varchar_pattern_ops) where (permanent);") + execute("CREATE INDEX CONCURRENTLY #{if_not_exists} #{INDEX_NAME_TEMP} ON redirect_routes (lower(path) varchar_pattern_ops) where (not permanent or permanent is null) ;") + + # Remove the old indexes: + + # This one needed to be on lower(path) but wasn't so it's replaced with the two above + execute "DROP INDEX CONCURRENTLY IF EXISTS #{OLD_INDEX_NAME_PATH_TPOPS};" + + # This one isn't needed because we only ever do = and LIKE on this + # column so the varchar_pattern_ops index is sufficient + execute "DROP INDEX CONCURRENTLY IF EXISTS #{OLD_INDEX_NAME_PATH_LOWER};" + end + + def down + disable_statement_timeout + + add_concurrent_index(:redirect_routes, :permanent) + + return unless Gitlab::Database.postgresql? + + execute("CREATE INDEX CONCURRENTLY #{OLD_INDEX_NAME_PATH_TPOPS} ON redirect_routes (path varchar_pattern_ops);") + execute("CREATE INDEX CONCURRENTLY #{OLD_INDEX_NAME_PATH_LOWER} ON redirect_routes (LOWER(path));") + + execute("DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_UNIQUE};") + execute("DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_PERM};") + execute("DROP INDEX CONCURRENTLY IF EXISTS #{INDEX_NAME_TEMP};") + end +end diff --git a/db/schema.rb b/db/schema.rb index 4fb1078ce69..b8a29d8c046 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171230123729) do +ActiveRecord::Schema.define(version: 20180113220114) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -1535,8 +1535,6 @@ ActiveRecord::Schema.define(version: 20171230123729) do end add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path", unique: true, using: :btree - add_index "redirect_routes", ["path"], name: "index_redirect_routes_on_path_text_pattern_ops", using: :btree, opclasses: {"path"=>"varchar_pattern_ops"} - add_index "redirect_routes", ["permanent"], name: "index_redirect_routes_on_permanent", using: :btree add_index "redirect_routes", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree create_table "releases", force: :cascade do |t| diff --git a/lib/tasks/migrate/setup_postgresql.rake b/lib/tasks/migrate/setup_postgresql.rake index c9e3eed82f2..c996537cfbe 100644 --- a/lib/tasks/migrate/setup_postgresql.rake +++ b/lib/tasks/migrate/setup_postgresql.rake @@ -7,6 +7,7 @@ require Rails.root.join('db/migrate/20170317203554_index_routes_path_for_like') require Rails.root.join('db/migrate/20170724214302_add_lower_path_index_to_redirect_routes') require Rails.root.join('db/migrate/20170503185032_index_redirect_routes_path_for_like') require Rails.root.join('db/migrate/20171220191323_add_index_on_namespaces_lower_name.rb') +require Rails.root.join('db/migrate/20180113220114_rework_redirect_routes_indexes.rb') desc 'GitLab | Sets up PostgreSQL' task setup_postgresql: :environment do @@ -17,4 +18,5 @@ task setup_postgresql: :environment do AddLowerPathIndexToRedirectRoutes.new.up IndexRedirectRoutesPathForLike.new.up AddIndexOnNamespacesLowerName.new.up + ReworkRedirectRoutesIndexes.new.up end -- cgit v1.2.1 From 76720afd1f03f5cde28091dca82e7108cce22178 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 18 Jan 2018 19:16:54 +0000 Subject: Merge branch 'mk-delete-orphaned-routes-before-validation' into 'master' Delete conflicting orphaned routes before validation Closes #39551 See merge request gitlab-org/gitlab-ce!16242 --- app/models/route.rb | 12 +++++ ...mk-delete-orphaned-routes-before-validation.yml | 6 +++ spec/models/route_spec.rb | 61 ++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 changelogs/unreleased/mk-delete-orphaned-routes-before-validation.yml diff --git a/app/models/route.rb b/app/models/route.rb index 412f5fb45a5..3d4b5a8b5ee 100644 --- a/app/models/route.rb +++ b/app/models/route.rb @@ -1,4 +1,6 @@ class Route < ActiveRecord::Base + include CaseSensitivity + belongs_to :source, polymorphic: true # rubocop:disable Cop/PolymorphicAssociations validates :source, presence: true @@ -10,6 +12,7 @@ class Route < ActiveRecord::Base validate :ensure_permanent_paths, if: :path_changed? + before_validation :delete_conflicting_orphaned_routes after_create :delete_conflicting_redirects after_update :delete_conflicting_redirects, if: :path_changed? after_update :create_redirect_for_old_path @@ -78,4 +81,13 @@ class Route < ActiveRecord::Base def conflicting_redirect_exists? RedirectRoute.permanent.matching_path_and_descendants(path).exists? end + + def delete_conflicting_orphaned_routes + conflicting = self.class.iwhere(path: path) + conflicting_orphaned_routes = conflicting.select do |route| + route.source.nil? + end + + conflicting_orphaned_routes.each(&:destroy) + end end diff --git a/changelogs/unreleased/mk-delete-orphaned-routes-before-validation.yml b/changelogs/unreleased/mk-delete-orphaned-routes-before-validation.yml new file mode 100644 index 00000000000..55ab318df7d --- /dev/null +++ b/changelogs/unreleased/mk-delete-orphaned-routes-before-validation.yml @@ -0,0 +1,6 @@ +--- +title: Ensure that users can reclaim a namespace or project path that is blocked by + an orphaned route +merge_request: 16242 +author: +type: fixed diff --git a/spec/models/route_spec.rb b/spec/models/route_spec.rb index 8a3b1034f3c..88f54fd10e5 100644 --- a/spec/models/route_spec.rb +++ b/spec/models/route_spec.rb @@ -79,6 +79,13 @@ describe Route do end describe 'callbacks' do + context 'before validation' do + it 'calls #delete_conflicting_orphaned_routes' do + expect(route).to receive(:delete_conflicting_orphaned_routes) + route.valid? + end + end + context 'after update' do it 'calls #create_redirect_for_old_path' do expect(route).to receive(:create_redirect_for_old_path) @@ -378,4 +385,58 @@ describe Route do end end end + + describe '#delete_conflicting_orphaned_routes' do + context 'when there is a conflicting route' do + let!(:conflicting_group) { create(:group, path: 'foo') } + + before do + route.path = conflicting_group.route.path + end + + context 'when the route is orphaned' do + let!(:offending_route) { conflicting_group.route } + + before do + Group.delete(conflicting_group) # Orphan the route + end + + it 'deletes the orphaned route' do + expect do + route.valid? + end.to change { described_class.count }.from(2).to(1) + end + + it 'passes validation, as usual' do + expect(route.valid?).to be_truthy + end + end + + context 'when the route is not orphaned' do + it 'does not delete the conflicting route' do + expect do + route.valid? + end.not_to change { described_class.count } + end + + it 'fails validation, as usual' do + expect(route.valid?).to be_falsey + end + end + end + + context 'when there are no conflicting routes' do + it 'does not delete any routes' do + route + + expect do + route.valid? + end.not_to change { described_class.count } + end + + it 'passes validation, as usual' do + expect(route.valid?).to be_truthy + end + end + end end -- cgit v1.2.1 From 722d89068ec33a4678b333cfd950212602b59c0d Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Mon, 22 Jan 2018 14:38:53 +0000 Subject: Merge branch 'docs/refactor-k8s-cluster' into 'master' Improve Clusters documentation See merge request gitlab-org/gitlab-ce!16435 --- doc/user/project/clusters/index.md | 276 +++++++++++++++++++++++----- doc/user/project/integrations/kubernetes.md | 10 +- 2 files changed, 241 insertions(+), 45 deletions(-) diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index 130f7897b1a..e87b4403854 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -1,26 +1,28 @@ # Connecting GitLab with a Kubernetes cluster -> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/35954) in 10.1. +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/35954) in GitLab 10.1. + +Connect your project to Google Kubernetes Engine (GKE) or an existing Kubernetes +cluster in a few steps. With a cluster associated to your project, you can use Review Apps, deploy your applications, run your pipelines, and much more, in an easy way. -Connect your project to Google Kubernetes Engine (GKE) or your own Kubernetes -cluster in a few steps. - -NOTE: **Note:** -The Cluster integration will eventually supersede the -[Kubernetes integration](../integrations/kubernetes.md). For the moment, -you can create only one cluster. +There are two options when adding a new cluster to your project; either associate +your account with Google Kubernetes Engine (GKE) so that you can [create new +clusters](#adding-and-creating-a-new-gke-cluster-via-gitlab) from within GitLab, +or provide the credentials to an [existing Kubernetes cluster](#adding-an-existing-kubernetes-cluster). ## Prerequisites -In order to be able to manage your GKE cluster through GitLab, the following -prerequisites must be met: +In order to be able to manage your Kubernetes cluster through GitLab, the +following prerequisites must be met. + +**For a cluster hosted on GKE:** - The [Google authentication integration](../../../integration/google.md) must be enabled in GitLab at the instance level. If that's not the case, ask your - administrator to enable it. + GitLab administrator to enable it. - Your associated Google account must have the right privileges to manage clusters on GKE. That would mean that a [billing account](https://cloud.google.com/billing/docs/how-to/manage-billing-account) @@ -31,41 +33,88 @@ prerequisites must be met: - You must have [Resource Manager API](https://cloud.google.com/resource-manager/) -If all of the above requirements are met, you can proceed to add a new GKE +**For an existing Kubernetes cluster:** + +- Since the cluster is already created, there are no prerequisites. + +--- + +If all of the above requirements are met, you can proceed to add a new Kubernetes cluster. -## Adding a cluster +## Adding and creating a new GKE cluster via GitLab + +NOTE: **Note:** +You need Master [permissions] and above to access the Clusters page. + +Before proceeding, make sure all [prerequisites](#prerequisites) are met. +To add a new cluster hosted on GKE to your project: + +1. Navigate to your project's **CI/CD > Clusters** page. +1. Click on **Add cluster**. +1. Click on **Create with GKE**. +1. Connect your Google account if you haven't done already by clicking the + **Sign in with Google** button. +1. Fill in the requested values: + - **Cluster name** (required) - The name you wish to give the cluster. + - **GCP project ID** (required) - The ID of the project you created in your GCP + console that will host the Kubernetes cluster. This must **not** be confused + with the project name. Learn more about [Google Cloud Platform projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects). + - **Zone** - The [zone](https://cloud.google.com/compute/docs/regions-zones/) + under which the cluster will be created. + - **Number of nodes** - The number of nodes you wish the cluster to have. + - **Machine type** - The [machine type](https://cloud.google.com/compute/docs/machine-types) + of the Virtual Machine instance that the cluster will be based on. + - **Environment scope** - The [associated environment](#setting-the-environment-scope) to this cluster. +1. Finally, click the **Create cluster** button. + +After a few moments, your cluster should be created. If something goes wrong, +you will be notified. + +You can now proceed to install some pre-defined applications and then +enable the Cluster integration. + +## Adding an existing Kubernetes cluster NOTE: **Note:** -You need Master [permissions] and above to add a cluster. - -There are two options when adding a new cluster; either use Google Kubernetes -Engine (GKE) or provide the credentials to your own Kubernetes cluster. - -To add a new cluster: - -1. Navigate to your project's **CI/CD > Cluster** page -1. If you want to let GitLab create a cluster on GKE for you, go through the - following steps, otherwise skip to the next one. - 1. Click on **Create with GKE** - 1. Connect your Google account if you haven't done already by clicking the - **Sign in with Google** button - 1. Fill in the requested values: - - **Cluster name** (required) - The name you wish to give the cluster. - - **GCP project ID** (required) - The ID of the project you created in your GCP - console that will host the Kubernetes cluster. This must **not** be confused - with the project name. Learn more about [Google Cloud Platform projects](https://cloud.google.com/resource-manager/docs/creating-managing-projects). - - **Zone** - The [zone](https://cloud.google.com/compute/docs/regions-zones/) - under which the cluster will be created. - - **Number of nodes** - The number of nodes you wish the cluster to have. - - **Machine type** - The [machine type](https://cloud.google.com/compute/docs/machine-types) - of the Virtual Machine instance that the cluster will be based on. - - **Project namespace** - The unique namespace for this project. By default you - don't have to fill it in; by leaving it blank, GitLab will create one for you. -1. If you want to use your own existing Kubernetes cluster, click on - **Add an existing cluster** and fill in the details as described in the - [Kubernetes integration](../integrations/kubernetes.md) documentation. -1. Finally, click the **Create cluster** button +You need Master [permissions] and above to access the Clusters page. + +To add an existing Kubernetes cluster to your project: + +1. Navigate to your project's **CI/CD > Clusters** page. +1. Click on **Add cluster**. +1. Click on **Add an existing cluster** and fill in the details: + - **Cluster name** (required) - The name you wish to give the cluster. + - **Environment scope** (required)- The + [associated environment](#setting-the-environment-scope) to this cluster. + - **API URL** (required) - + It's the URL that GitLab uses to access the Kubernetes API. Kubernetes + exposes several APIs, we want the "base" URL that is common to all of them, + e.g., `https://kubernetes.example.com` rather than `https://kubernetes.example.com/api/v1`. + - **CA certificate** (optional) - + If the API is using a self-signed TLS certificate, you'll also need to include + the `ca.crt` contents here. + - **Token** - + GitLab authenticates against Kubernetes using service tokens, which are + scoped to a particular `namespace`. If you don't have a service token yet, + you can follow the + [Kubernetes documentation](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/) + to create one. You can also view or create service tokens in the + [Kubernetes dashboard](https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/#config) + (under **Config > Secrets**). + - **Project namespace** (optional) - The following apply: + - By default you don't have to fill it in; by leaving it blank, GitLab will + create one for you. + - Each project should have a unique namespace. + - The project namespace is not necessarily the namespace of the secret, if + you're using a secret with broader permissions, like the secret from `default`. + - You should **not** use `default` as the project namespace. + - If you or someone created a secret specifically for the project, usually + with limited permissions, the secret's namespace and project namespace may + be the same. +1. Finally, click the **Create cluster** button. + +The Kubernetes service takes the following parameters: After a few moments, your cluster should be created. If something goes wrong, you will be notified. @@ -85,6 +134,91 @@ added directly to your configured cluster. Those applications are needed for | [Ingress](https://kubernetes.io/docs/concepts/services-networking/ingress/) | 10.2+ | Ingress can provide load balancing, SSL termination, and name-based virtual hosting. It acts as a web proxy for your applications and is useful if you want to use [Auto DevOps](../../../topics/autodevops/index.md) or deploy your own web apps. | | [Prometheus](https://prometheus.io/docs/introduction/overview/) | 10.4+ | Prometheus is an open-source monitoring and alerting system useful to supervise your deployed applications | +## Setting the environment scope + +When adding more than one clusters, you need to differentiate them with an +environment scope. The environment scope associates clusters and +[environments](../../../ci/environments.md) in an 1:1 relationship similar to how the +[environment-specific variables](../../../ci/variables/README.md#limiting-environment-scopes-of-secret-variables) +work. + +The default environment scope is `*`, which means all jobs, regardless of their +environment, will use that cluster. Each scope can only be used by a single +cluster in a project, and a validation error will occur if otherwise. + +--- + +For example, let's say the following clusters exist in a project: + +| Cluster | Environment scope | +| ---------- | ------------------- | +| Development| `*` | +| Staging | `staging/*` | +| Production | `production/*` | + +And the following environments are set in [`.gitlab-ci.yml`](../../../ci/yaml/README.md): + +```yaml +stages: +- test +- deploy + +test: + stage: test + script: sh test + +deploy to staging: + stage: deploy + script: make deploy + environment: + name: staging/$CI_COMMIT_REF_NAME + url: https://staging.example.com/ + +deploy to production: + stage: deploy + script: make deploy + environment: + name: production/$CI_COMMIT_REF_NAME + url: https://example.com/ +``` + +The result will then be: + +- The development cluster will be used for the "test" job. +- The staging cluster will be used for the "deploy to staging" job. +- The production cluster will be used for the "deploy to production" job. + +## Multiple Kubernetes clusters + +> Introduced in [GitLab Enterprise Edition Premium][ee] 10.3. + +With GitLab EEP, you can associate more than one Kubernetes clusters to your +project. That way you can have different clusters for different environments, +like dev, staging, production, etc. + +To add another cluster, follow the same steps as described in [adding a +Kubernetes cluster](#adding-a-kubernetes-cluster) and make sure to +[set an environment scope](#setting-the-environment-scope) that will +differentiate the new cluster with the rest. + +## Deployment variables + +The Kubernetes cluster integration exposes the following +[deployment variables](../../../ci/variables/README.md#deployment-variables) in the +GitLab CI/CD build environment: + +- `KUBE_URL` - Equal to the API URL. +- `KUBE_TOKEN` - The Kubernetes token. +- `KUBE_NAMESPACE` - The Kubernetes namespace is auto-generated if not specified. + The default value is `-`. You can overwrite it to + use different one if needed, otherwise the `KUBE_NAMESPACE` variable will + receive the default value. +- `KUBE_CA_PEM_FILE` - Only present if a custom CA bundle was specified. Path + to a file containing PEM data. +- `KUBE_CA_PEM` (deprecated) - Only if a custom CA bundle was specified. Raw PEM data. +- `KUBECONFIG` - Path to a file containing `kubeconfig` for this deployment. + CA bundle would be embedded if specified. + ## Enabling or disabling the Cluster integration After you have successfully added your cluster information, you can enable the @@ -111,4 +245,62 @@ To remove the Cluster integration from your project, simply click on the **Remove integration** button. You will then be able to follow the procedure and [add a cluster](#adding-a-cluster) again. +## What you can get with the Kubernetes integration + +Here's what you can do with GitLab if you enable the Kubernetes integration. + +### Deploy Boards (EEP) + +> Available in [GitLab Enterprise Edition Premium][ee]. + +GitLab's Deploy Boards offer a consolidated view of the current health and +status of each CI [environment](../../../ci/environments.md) running on Kubernetes, +displaying the status of the pods in the deployment. Developers and other +teammates can view the progress and status of a rollout, pod by pod, in the +workflow they already use without any need to access Kubernetes. + +[> Read more about Deploy Boards](https://docs.gitlab.com/ee/user/project/deploy_boards.html) + +### Canary Deployments (EEP) + +> Available in [GitLab Enterprise Edition Premium][ee]. + +Leverage [Kubernetes' Canary deployments](https://kubernetes.io/docs/concepts/cluster-administration/manage-deployment/#canary-deployments) +and visualize your canary deployments right inside the Deploy Board, without +the need to leave GitLab. + +[> Read more about Canary Deployments](https://docs.gitlab.com/ee/user/project/canary_deployments.html) + +### Kubernetes monitoring + +Automatically detect and monitor Kubernetes metrics. Automatic monitoring of +[NGINX ingress](../integrations/prometheus_library/nginx.md) is also supported. + +[> Read more about Kubernetes monitoring](../integrations/prometheus_library/kubernetes.md) + +### Auto DevOps + +Auto DevOps automatically detects, builds, tests, deploys, and monitors your +applications. + +To make full use of Auto DevOps(Auto Deploy, Auto Review Apps, and Auto Monitoring) +you will need the Kubernetes project integration enabled. + +[> Read more about Auto DevOps](../../../topics/autodevops/index.md) + +### Web terminals + +NOTE: **Note:** +Introduced in GitLab 8.15. You must be the project owner or have `master` permissions +to use terminals. Support is limited to the first container in the +first pod of your environment. + +When enabled, the Kubernetes service adds [web terminal](../../../ci/environments.md#web-terminals) +support to your [environments](../../../ci/environments.md). This is based on the `exec` functionality found in +Docker and Kubernetes, so you get a new shell session within your existing +containers. To use this integration, you should deploy to Kubernetes using +the deployment variables above, ensuring any pods you create are labelled with +`app=$CI_ENVIRONMENT_SLUG`. GitLab will do the rest! + [permissions]: ../../permissions.md +[ee]: https://about.gitlab.com/gitlab-ee/ diff --git a/doc/user/project/integrations/kubernetes.md b/doc/user/project/integrations/kubernetes.md index 710cf78e84f..543baaa81e1 100644 --- a/doc/user/project/integrations/kubernetes.md +++ b/doc/user/project/integrations/kubernetes.md @@ -2,11 +2,15 @@ last_updated: 2017-12-28 --- -CAUTION: **Warning:** -Kubernetes service integration has been deprecated in GitLab 10.3. If the service is active the cluster information still be editable, however we advised to disable and reconfigure the clusters using the new [Clusters](../clusters/index.md) page. If the service is inactive the fields will be uneditable. Read [GitLab 10.3 release post](https://about.gitlab.com/2017/12/22/gitlab-10-3-released/#kubernetes-integration-service) for more information. - # GitLab Kubernetes / OpenShift integration +CAUTION: **Warning:** +The Kubernetes service integration has been deprecated in GitLab 10.3. If the +service is active, the cluster information will still be editable, however we +advise to disable and reconfigure the clusters using the new +[Clusters](../clusters/index.md) page. If the service is inactive, the fields +will not be editable. Read [GitLab 10.3 release post](https://about.gitlab.com/2017/12/22/gitlab-10-3-released/#kubernetes-integration-service) for more information. + GitLab can be configured to interact with Kubernetes, or other systems using the Kubernetes API (such as OpenShift). -- cgit v1.2.1 From b3e3e75bfa65f45d766aa7e5c3e02d38afa1bae9 Mon Sep 17 00:00:00 2001 From: Sean McGivern Date: Thu, 18 Jan 2018 17:21:41 +0000 Subject: Merge branch 'issue_37143_2' into 'master' Remove unnecessary query from labels dropdown Closes #37143 See merge request gitlab-org/gitlab-ce!16520 --- app/finders/labels_finder.rb | 2 +- app/helpers/issuables_helper.rb | 6 ++++++ app/views/shared/issuable/_filter.html.haml | 2 +- changelogs/unreleased/issue_37143_2.yml | 5 +++++ spec/helpers/issuables_helper_spec.rb | 29 +++++++++++++++++++++++++++++ 5 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 changelogs/unreleased/issue_37143_2.yml diff --git a/app/finders/labels_finder.rb b/app/finders/labels_finder.rb index 6de9eb89468..1427cdaa382 100644 --- a/app/finders/labels_finder.rb +++ b/app/finders/labels_finder.rb @@ -71,7 +71,7 @@ class LabelsFinder < UnionFinder end def projects? - params[:project_ids].present? + params[:project_ids] end def only_group_labels? diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb index 2668cf78afe..520a875238c 100644 --- a/app/helpers/issuables_helper.rb +++ b/app/helpers/issuables_helper.rb @@ -304,6 +304,12 @@ module IssuablesHelper issuable.model_name.human.downcase end + def selected_labels + Array(params[:label_name]).map do |label_name| + Label.new(title: label_name) + end + end + private def sidebar_gutter_collapsed? diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml index 8442d7ff4a2..7704c88905b 100644 --- a/app/views/shared/issuable/_filter.html.haml +++ b/app/views/shared/issuable/_filter.html.haml @@ -22,7 +22,7 @@ = render "shared/issuable/milestone_dropdown", selected: finder.milestones.try(:first), name: :milestone_title, show_any: true, show_upcoming: true, show_started: true .filter-item.inline.labels-filter - = render "shared/issuable/label_dropdown", selected: finder.labels.select(:title).uniq, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" } + = render "shared/issuable/label_dropdown", selected: selected_labels, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" } - if issuable_filter_present? .filter-item.inline.reset-filters diff --git a/changelogs/unreleased/issue_37143_2.yml b/changelogs/unreleased/issue_37143_2.yml new file mode 100644 index 00000000000..38125f666b2 --- /dev/null +++ b/changelogs/unreleased/issue_37143_2.yml @@ -0,0 +1,5 @@ +--- +title: Remove unecessary query from labels filter +merge_request: +author: +type: performance diff --git a/spec/helpers/issuables_helper_spec.rb b/spec/helpers/issuables_helper_spec.rb index d601cbdb39b..c8d64d64cf4 100644 --- a/spec/helpers/issuables_helper_spec.rb +++ b/spec/helpers/issuables_helper_spec.rb @@ -192,4 +192,33 @@ describe IssuablesHelper do expect(JSON.parse(helper.issuable_initial_data(issue))).to eq(expected_data) end end + + describe '#selected_labels' do + context 'if label_name param is a string' do + it 'returns a new label with title' do + allow(helper).to receive(:params) + .and_return(ActionController::Parameters.new(label_name: 'test label')) + + labels = helper.selected_labels + + expect(labels).to be_an(Array) + expect(labels.size).to eq(1) + expect(labels.first.title).to eq('test label') + end + end + + context 'if label_name param is an array' do + it 'returns a new label with title for each element' do + allow(helper).to receive(:params) + .and_return(ActionController::Parameters.new(label_name: ['test label 1', 'test label 2'])) + + labels = helper.selected_labels + + expect(labels).to be_an(Array) + expect(labels.size).to eq(2) + expect(labels.first.title).to eq('test label 1') + expect(labels.second.title).to eq('test label 2') + end + end + end end -- cgit v1.2.1 From 107ac39667455d3b686f5c8ef693ff4cd408c77a Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Thu, 18 Jan 2018 19:44:51 +0000 Subject: Merge branch 'jramsay-3953-fast-ssh-ce-docs' into 'master' Add release added and release backported to CE See merge request gitlab-org/gitlab-ce!16553 --- doc/administration/operations/fast_ssh_key_lookup.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/administration/operations/fast_ssh_key_lookup.md b/doc/administration/operations/fast_ssh_key_lookup.md index b86168f935a..0c32afe9046 100644 --- a/doc/administration/operations/fast_ssh_key_lookup.md +++ b/doc/administration/operations/fast_ssh_key_lookup.md @@ -1,5 +1,11 @@ # Fast lookup of authorized SSH keys in the database +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ee/issues/1631) in +> [GitLab Enterprise Edition Standard](https://about.gitlab.com/gitlab-ee) 9.3. +> +> [Available in](https://gitlab.com/gitlab-org/gitlab-ee/issues/3953) GitLab +> Community Edition 10.4. + Regular SSH operations become slow as the number of users grows because OpenSSH searches for a key to authorize a user via a linear search. In the worst case, such as when the user is not authorized to access GitLab, OpenSSH will scan the -- cgit v1.2.1 From 15982e8e8206d6d14bbe8c0896f79cdbb6c6e2df Mon Sep 17 00:00:00 2001 From: Marcia Ramos Date: Thu, 18 Jan 2018 17:27:16 +0000 Subject: Merge branch 'docs/runners-clear-cache' into 'master' Add cache clearing documentation Closes #41940 See merge request gitlab-org/gitlab-ce!16559 --- doc/ci/runners/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/doc/ci/runners/README.md b/doc/ci/runners/README.md index df66810a838..03aa6ff8e7c 100644 --- a/doc/ci/runners/README.md +++ b/doc/ci/runners/README.md @@ -144,6 +144,28 @@ To protect/unprotect Runners: ![specific Runners edit icon](img/protected_runners_check_box.png) +## Manually clearing the Runners cache + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/41249) in GitLab 10.4. + +GitLab Runners use [cache](../yaml/README.md#cache) to speed up the execution +of your jobs by reusing existing data. This however, can sometimes lead to an +inconsistent behavior. + +To start with a fresh copy of the cache, you can easily do it via GitLab's UI: + +1. Navigate to your project's **CI/CD > Pipelines** page. +1. Click on the **Clear Runner caches** to clean up the cache. +1. On the next push, your CI/CD job will use a new cache. + +That way, you don't have to change the [cache key](../yaml/README.md#cache-key) +in your `.gitlab-ci.yml`. + +Behind the scenes, this works by increasing a counter in the database, and the +value of that counter is used to create the key for the cache. After a push, a +new key is generated and the old cache is not valid anymore. Eventually, the +Runner's garbage collector will remove it form the filesystem. + ## How shared Runners pick jobs Shared Runners abide to a process queue we call fair usage. The fair usage -- cgit v1.2.1 From f94d54fa6f9b753f3d9e6f21885317ca1e5b2edc Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Fri, 19 Jan 2018 08:44:55 +0000 Subject: Merge branch '42159-utf8-uploads' into 'master' Correctly escape UTF-8 path elements for uploads Closes #42159 See merge request gitlab-org/gitlab-ce!16560 --- changelogs/unreleased/42159-utf8-uploads.yml | 5 +++++ lib/banzai/filter/relative_link_filter.rb | 6 +++--- spec/lib/banzai/filter/relative_link_filter_spec.rb | 17 +++++++++-------- 3 files changed, 17 insertions(+), 11 deletions(-) create mode 100644 changelogs/unreleased/42159-utf8-uploads.yml diff --git a/changelogs/unreleased/42159-utf8-uploads.yml b/changelogs/unreleased/42159-utf8-uploads.yml new file mode 100644 index 00000000000..f6eba8f28f5 --- /dev/null +++ b/changelogs/unreleased/42159-utf8-uploads.yml @@ -0,0 +1,5 @@ +--- +title: Correctly escape UTF-8 path elements for uploads +merge_request: 16560 +author: +type: fixed diff --git a/lib/banzai/filter/relative_link_filter.rb b/lib/banzai/filter/relative_link_filter.rb index f6169b2c85d..9bdedeb6615 100644 --- a/lib/banzai/filter/relative_link_filter.rb +++ b/lib/banzai/filter/relative_link_filter.rb @@ -50,7 +50,7 @@ module Banzai end def process_link_to_upload_attr(html_attr) - path_parts = [html_attr.value] + path_parts = [Addressable::URI.unescape(html_attr.value)] if group path_parts.unshift(relative_url_root, 'groups', group.full_path, '-') @@ -58,13 +58,13 @@ module Banzai path_parts.unshift(relative_url_root, project.full_path) end - path = File.join(*path_parts) + path = Addressable::URI.escape(File.join(*path_parts)) html_attr.value = if context[:only_path] path else - URI.join(Gitlab.config.gitlab.base_url, path).to_s + Addressable::URI.join(Gitlab.config.gitlab.base_url, path).to_s end end diff --git a/spec/lib/banzai/filter/relative_link_filter_spec.rb b/spec/lib/banzai/filter/relative_link_filter_spec.rb index 7e17457ce70..3ca4652f7cc 100644 --- a/spec/lib/banzai/filter/relative_link_filter_spec.rb +++ b/spec/lib/banzai/filter/relative_link_filter_spec.rb @@ -278,18 +278,19 @@ describe Banzai::Filter::RelativeLinkFilter do expect(doc.at_css('a')['href']).to eq 'http://example.com' end - it 'supports Unicode filenames' do + it 'supports unescaped Unicode filenames' do path = '/uploads/한글.png' - escaped = Addressable::URI.escape(path) + doc = filter(link(path)) - # Stub these methods so the file doesn't actually need to be in the repo - allow_any_instance_of(described_class) - .to receive(:file_exists?).and_return(true) - allow_any_instance_of(described_class) - .to receive(:image?).with(path).and_return(true) + expect(doc.at_css('a')['href']).to eq("/#{project.full_path}/uploads/%ED%95%9C%EA%B8%80.png") + end + it 'supports escaped Unicode filenames' do + path = '/uploads/한글.png' + escaped = Addressable::URI.escape(path) doc = filter(image(escaped)) - expect(doc.at_css('img')['src']).to match "/#{project.full_path}/uploads/%ED%95%9C%EA%B8%80.png" + + expect(doc.at_css('img')['src']).to eq("/#{project.full_path}/uploads/%ED%95%9C%EA%B8%80.png") end end -- cgit v1.2.1 From e339695a3808fcf55aa20e7829631f50d3d23019 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 22 Jan 2018 15:42:28 +0000 Subject: Merge branch 'sh-scheduled-ci-pipeline-docs' into 'master' Add docs for playing a CI pipeline schedule See merge request gitlab-org/gitlab-ce!16568 --- .../pipelines/img/pipeline_schedule_play.png | Bin 0 -> 39142 bytes .../pipelines/img/pipeline_schedules_list.png | Bin 14665 -> 38034 bytes doc/user/project/pipelines/schedules.md | 15 +++++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 doc/user/project/pipelines/img/pipeline_schedule_play.png diff --git a/doc/user/project/pipelines/img/pipeline_schedule_play.png b/doc/user/project/pipelines/img/pipeline_schedule_play.png new file mode 100644 index 00000000000..f594ceee19d Binary files /dev/null and b/doc/user/project/pipelines/img/pipeline_schedule_play.png differ diff --git a/doc/user/project/pipelines/img/pipeline_schedules_list.png b/doc/user/project/pipelines/img/pipeline_schedules_list.png index 50d9d184b05..2ab2061db94 100644 Binary files a/doc/user/project/pipelines/img/pipeline_schedules_list.png and b/doc/user/project/pipelines/img/pipeline_schedules_list.png differ diff --git a/doc/user/project/pipelines/schedules.md b/doc/user/project/pipelines/schedules.md index 2101e3b1d58..34809a2826f 100644 --- a/doc/user/project/pipelines/schedules.md +++ b/doc/user/project/pipelines/schedules.md @@ -31,6 +31,20 @@ is installed on. ![Schedules list](img/pipeline_schedules_list.png) +### Running a scheduled pipeline manually + +> [Introduced][ce-15700] in GitLab 10.4. + +To trigger a pipeline schedule manually, click the "Play" button: + +![Play Pipeline Schedule](img/pipeline_schedule_play.png) + +This will schedule a background job to run the pipeline schedule. A flash +message will provide a link to the CI/CD Pipeline index page. + +To help avoid abuse, users are rate limited to triggering a pipeline once per +minute. + ### Making use of scheduled pipeline variables > [Introduced][ce-12328] in GitLab 9.4. @@ -90,4 +104,5 @@ don't have admin access to the server, ask your administrator. [ce-10533]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10533 [ce-10853]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10853 [ce-12328]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12328 +[ce-15700]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/15700 [settings]: https://about.gitlab.com/gitlab-com/settings/#cron-jobs -- cgit v1.2.1 From 93e17dc3e96fd0c0f24cf5cbfff2f26529448f52 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Mon, 22 Jan 2018 16:41:19 +0000 Subject: Merge branch 'bvl-parent-preloading' into 'master' Fix filtering projects & groups on group pages Closes #40785 See merge request gitlab-org/gitlab-ce!16584 --- app/controllers/concerns/group_tree.rb | 6 +++- app/finders/group_descendants_finder.rb | 41 +++++++++++++++------- changelogs/unreleased/bvl-parent-preloading.yml | 5 +++ .../dashboard/groups_controller_spec.rb | 20 +++++++++++ .../controllers/groups/children_controller_spec.rb | 24 +++++++++++++ spec/finders/group_descendants_finder_spec.rb | 20 +++++++++++ 6 files changed, 102 insertions(+), 14 deletions(-) create mode 100644 changelogs/unreleased/bvl-parent-preloading.yml diff --git a/app/controllers/concerns/group_tree.rb b/app/controllers/concerns/group_tree.rb index b10147835f3..6d564d4642c 100644 --- a/app/controllers/concerns/group_tree.rb +++ b/app/controllers/concerns/group_tree.rb @@ -2,7 +2,11 @@ module GroupTree # rubocop:disable Gitlab/ModuleWithInstanceVariables def render_group_tree(groups) @groups = if params[:filter].present? - Gitlab::GroupHierarchy.new(groups.search(params[:filter])) + # We find the ancestors by ID of the search results here. + # Otherwise the ancestors would also have filters applied, + # which would cause them not to be preloaded. + group_ids = groups.search(params[:filter]).select(:id) + Gitlab::GroupHierarchy.new(Group.where(id: group_ids)) .base_and_ancestors else # Only show root groups if no parent-id is given diff --git a/app/finders/group_descendants_finder.rb b/app/finders/group_descendants_finder.rb index 1a5f6063437..9e6cdd3c5a5 100644 --- a/app/finders/group_descendants_finder.rb +++ b/app/finders/group_descendants_finder.rb @@ -27,12 +27,16 @@ class GroupDescendantsFinder end def execute - # The children array might be extended with the ancestors of projects when - # filtering. In that case, take the maximum so the array does not get limited - # Otherwise, allow paginating through all results + # The children array might be extended with the ancestors of projects and + # subgroups when filtering. In that case, take the maximum so the array does + # not get limited otherwise, allow paginating through all results. # all_required_elements = children - all_required_elements |= ancestors_for_projects if params[:filter] + if params[:filter] + all_required_elements |= ancestors_of_filtered_subgroups + all_required_elements |= ancestors_of_filtered_projects + end + total_count = [all_required_elements.size, paginator.total_count].max Kaminari.paginate_array(all_required_elements, total_count: total_count) @@ -49,8 +53,11 @@ class GroupDescendantsFinder end def paginator - @paginator ||= Gitlab::MultiCollectionPaginator.new(subgroups, projects, - per_page: params[:per_page]) + @paginator ||= Gitlab::MultiCollectionPaginator.new( + subgroups, + projects.with_route, + per_page: params[:per_page] + ) end def direct_child_groups @@ -93,15 +100,21 @@ class GroupDescendantsFinder # # So when searching 'project', on the 'subgroup' page we want to preload # 'nested-group' but not 'subgroup' or 'root' - def ancestors_for_groups(base_for_ancestors) - Gitlab::GroupHierarchy.new(base_for_ancestors) + def ancestors_of_groups(base_for_ancestors) + group_ids = base_for_ancestors.except(:select, :sort).select(:id) + Gitlab::GroupHierarchy.new(Group.where(id: group_ids)) .base_and_ancestors(upto: parent_group.id) end - def ancestors_for_projects + def ancestors_of_filtered_projects projects_to_load_ancestors_of = projects.where.not(namespace: parent_group) groups_to_load_ancestors_of = Group.where(id: projects_to_load_ancestors_of.select(:namespace_id)) - ancestors_for_groups(groups_to_load_ancestors_of) + ancestors_of_groups(groups_to_load_ancestors_of) + .with_selects_for_list(archived: params[:archived]) + end + + def ancestors_of_filtered_subgroups + ancestors_of_groups(subgroups) .with_selects_for_list(archived: params[:archived]) end @@ -111,7 +124,7 @@ class GroupDescendantsFinder # When filtering subgroups, we want to find all matches withing the tree of # descendants to show to the user groups = if params[:filter] - ancestors_for_groups(subgroups_matching_filter) + subgroups_matching_filter else direct_child_groups end @@ -119,8 +132,10 @@ class GroupDescendantsFinder end def direct_child_projects - GroupProjectsFinder.new(group: parent_group, current_user: current_user, params: params) - .execute + GroupProjectsFinder.new(group: parent_group, + current_user: current_user, + options: { only_owned: true }, + params: params).execute end # Finds all projects nested under `parent_group` or any of its descendant diff --git a/changelogs/unreleased/bvl-parent-preloading.yml b/changelogs/unreleased/bvl-parent-preloading.yml new file mode 100644 index 00000000000..97c7bbb2a2a --- /dev/null +++ b/changelogs/unreleased/bvl-parent-preloading.yml @@ -0,0 +1,5 @@ +--- +title: Fix issues when rendering groups and their children +merge_request: 16584 +author: +type: fixed diff --git a/spec/controllers/dashboard/groups_controller_spec.rb b/spec/controllers/dashboard/groups_controller_spec.rb index fb9d3efbac0..7f2eaf95165 100644 --- a/spec/controllers/dashboard/groups_controller_spec.rb +++ b/spec/controllers/dashboard/groups_controller_spec.rb @@ -20,4 +20,24 @@ describe Dashboard::GroupsController do expect(assigns(:groups)).to contain_exactly(member_of_group) end + + context 'when rendering an expanded hierarchy with public groups you are not a member of', :nested_groups do + let!(:top_level_result) { create(:group, name: 'chef-top') } + let!(:top_level_a) { create(:group, name: 'top-a') } + let!(:sub_level_result_a) { create(:group, name: 'chef-sub-a', parent: top_level_a) } + let!(:other_group) { create(:group, name: 'other') } + + before do + top_level_result.add_master(user) + top_level_a.add_master(user) + end + + it 'renders only groups the user is a member of when searching hierarchy correctly' do + get :index, filter: 'chef', format: :json + + expect(response).to have_gitlab_http_status(200) + all_groups = [top_level_result, top_level_a, sub_level_result_a] + expect(assigns(:groups)).to contain_exactly(*all_groups) + end + end end diff --git a/spec/controllers/groups/children_controller_spec.rb b/spec/controllers/groups/children_controller_spec.rb index cb1b460fc0e..22d3076c269 100644 --- a/spec/controllers/groups/children_controller_spec.rb +++ b/spec/controllers/groups/children_controller_spec.rb @@ -160,6 +160,30 @@ describe Groups::ChildrenController do expect(json_response).to eq([]) end + it 'succeeds if multiple pages contain matching subgroups' do + create(:group, parent: group, name: 'subgroup-filter-1') + create(:group, parent: group, name: 'subgroup-filter-2') + + # Creating the group-to-nest first so it would be loaded into the + # relation first before it's parents, this is what would cause the + # crash in: https://gitlab.com/gitlab-org/gitlab-ce/issues/40785. + # + # If we create the parent groups first, those would be loaded into the + # collection first, and the pagination would cut off the actual search + # result. In this case the hierarchy can be rendered without crashing, + # it's just incomplete. + group_to_nest = create(:group, parent: group, name: 'subsubgroup-filter-3') + subgroup = create(:group, parent: group) + 3.times do |i| + subgroup = create(:group, parent: subgroup) + end + group_to_nest.update!(parent: subgroup) + + get :index, group_id: group.to_param, filter: 'filter', per_page: 3, format: :json + + expect(response).to have_gitlab_http_status(200) + end + it 'includes pagination headers' do 2.times { |i| create(:group, :public, parent: public_subgroup, name: "filterme#{i}") } diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb index ae050f36b4a..375bcc9087e 100644 --- a/spec/finders/group_descendants_finder_spec.rb +++ b/spec/finders/group_descendants_finder_spec.rb @@ -35,6 +35,15 @@ describe GroupDescendantsFinder do expect(finder.execute).to contain_exactly(project) end + it 'does not include projects shared with the group' do + project = create(:project, namespace: group) + other_project = create(:project) + other_project.project_group_links.create(group: group, + group_access: ProjectGroupLink::MASTER) + + expect(finder.execute).to contain_exactly(project) + end + context 'when archived is `true`' do let(:params) { { archived: 'true' } } @@ -189,6 +198,17 @@ describe GroupDescendantsFinder do expect(finder.execute).to contain_exactly(subgroup, matching_project) end + context 'with a small page size' do + let(:params) { { filter: 'test', per_page: 1 } } + + it 'contains all the ancestors of a matching subgroup regardless the page size' do + subgroup = create(:group, :private, parent: group) + matching = create(:group, :private, name: 'testgroup', parent: subgroup) + + expect(finder.execute).to contain_exactly(subgroup, matching) + end + end + it 'does not include the parent itself' do group.update!(name: 'test') -- cgit v1.2.1 From 31cdc7b63ac19c04eaafb2b3be5e8b11f53b14f2 Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Mon, 22 Jan 2018 08:49:09 +0000 Subject: Merge branch '42225-mr-icons' into 'master' Resolve "MR widget components have different icons in CE and EE" Closes #42225 See merge request gitlab-org/gitlab-ce!16587 --- .../components/states/mr_widget_auto_merge_failed.js | 2 +- .../components/states/mr_widget_closed.js | 2 +- .../components/states/mr_widget_conflicts.js | 2 +- .../components/states/mr_widget_failed_to_merge.js | 2 +- .../components/states/mr_widget_missing_branch.js | 2 +- .../components/states/mr_widget_pipeline_blocked.js | 2 +- .../components/states/mr_widget_pipeline_failed.js | 2 +- .../components/states/mr_widget_ready_to_merge.js | 2 +- .../components/states/mr_widget_sha_mismatch.js | 2 +- .../components/states/mr_widget_unresolved_discussions.js | 2 +- .../vue_merge_request_widget/components/states/mr_widget_wip.js | 2 +- .../components/states/mr_widget_ready_to_merge_spec.js | 8 ++++---- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js index 5648208f7b1..587de731f6e 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js @@ -24,7 +24,7 @@ export default { }, template: `
- +
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_closed.js b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_closed.js index dd8b2665b1d..dc19b20aa11 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_closed.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_closed.js @@ -12,7 +12,7 @@ export default { }, template: `
- +
diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index 343fd0a5300..b377df30837 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -38,7 +38,10 @@ export default { this.editor.createInstance(this.$refs.editor); }) .then(() => this.setupEditor()) - .catch(() => flash('Error setting up monaco. Please try again.')); + .catch((err) => { + flash('Error setting up monaco. Please try again.', 'alert', document, null, false, true); + throw err; + }); }, setupEditor() { if (!this.activeFile) return; diff --git a/app/assets/javascripts/ide/components/repo_file.vue b/app/assets/javascripts/ide/components/repo_file.vue index c8b0441d81c..f0323ff18ac 100644 --- a/app/assets/javascripts/ide/components/repo_file.vue +++ b/app/assets/javascripts/ide/components/repo_file.vue @@ -35,9 +35,12 @@ return this.file.type === 'tree'; }, levelIndentation() { - return { - marginLeft: `${this.file.level * 16}px`, - }; + if (this.file.level > 0) { + return { + marginLeft: `${this.file.level * 16}px`, + }; + } + return {}; }, shortId() { return this.file.id.substr(0, 8); @@ -111,7 +114,7 @@ :parent="file"/>