From 918177b749f86d4cdf6085af6485eb779a50589c Mon Sep 17 00:00:00 2001 From: Nikolay Date: Tue, 14 Aug 2018 00:51:27 +0000 Subject: Correct inaccurate phrase related to disable_ddl_transaction mode --- doc/development/migration_style_guide.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index 6f31e5b82e5..6a5ed54cdb7 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -134,9 +134,9 @@ should be more than enough. When removing an index make sure to use the method `remove_concurrent_index` instead of the regular `remove_index` method. The `remove_concurrent_index` method automatically drops concurrent indexes when using PostgreSQL, removing the -need for downtime. To use this method you must disable transactions by calling -the method `disable_ddl_transaction!` in the body of your migration class like -so: +need for downtime. To use this method you must disable single-transaction mode +by calling the method `disable_ddl_transaction!` in the body of your migration +class like so: ```ruby class MyMigration < ActiveRecord::Migration -- cgit v1.2.1 From 7067cbaef9528e9bfc163d9a1c07dbdb229aa93d Mon Sep 17 00:00:00 2001 From: Andrew Banchich Date: Sun, 14 Oct 2018 18:18:37 +0000 Subject: Fix punctuation error --- doc/administration/monitoring/prometheus/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/administration/monitoring/prometheus/index.md b/doc/administration/monitoring/prometheus/index.md index b1b670c3b42..1deb925e996 100644 --- a/doc/administration/monitoring/prometheus/index.md +++ b/doc/administration/monitoring/prometheus/index.md @@ -27,7 +27,7 @@ dashboard tool like [Grafana]. >**Note:** For installations from source you'll have to install and configure it yourself. -Prometheus and it's exporters are on by default, starting with GitLab 9.0. +Prometheus and its exporters are on by default, starting with GitLab 9.0. Prometheus will run as the `gitlab-prometheus` user and listen on `http://localhost:9090`. By default Prometheus is only accessible from the GitLab server itself. Each exporter will be automatically set up as a -- cgit v1.2.1 From 2a8a4897ffebd01c784c028200d0cbdfaf32695e Mon Sep 17 00:00:00 2001 From: 115100 <115100@users.noreply.github.com> Date: Wed, 24 Oct 2018 12:21:47 +0100 Subject: saml/auth_hash: Allow 2FA bypass for SAML 2.0 responses Closes gitlab-org/gitlab-ce/#53102. --- lib/gitlab/auth/saml/auth_hash.rb | 2 +- spec/fixtures/authentication/saml2_response.xml | 56 +++++++++++++++++++++++++ spec/lib/gitlab/auth/saml/auth_hash_spec.rb | 11 +++++ 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/authentication/saml2_response.xml diff --git a/lib/gitlab/auth/saml/auth_hash.rb b/lib/gitlab/auth/saml/auth_hash.rb index 316354fd50c..1af9fa40c3a 100644 --- a/lib/gitlab/auth/saml/auth_hash.rb +++ b/lib/gitlab/auth/saml/auth_hash.rb @@ -28,7 +28,7 @@ module Gitlab end def extract_authn_context(document) - REXML::XPath.first(document, "//saml:AuthnStatement/saml:AuthnContext/saml:AuthnContextClassRef/text()").to_s + REXML::XPath.first(document, "//*[name()='saml:AuthnStatement' or name()='saml2:AuthnStatement']/*[name()='saml:AuthnContext' or name()='saml2:AuthnContext']/*[name()='saml:AuthnContextClassRef' or name()='saml2:AuthnContextClassRef']/text()").to_s end end end diff --git a/spec/fixtures/authentication/saml2_response.xml b/spec/fixtures/authentication/saml2_response.xml new file mode 100644 index 00000000000..67dea7209e9 --- /dev/null +++ b/spec/fixtures/authentication/saml2_response.xml @@ -0,0 +1,56 @@ + + + https://idm.orademo.com + + + + + + + + + + + + + uHuSry39P16Yh7srS32xESmj4Lw= + + + fdghdfggfd= + + + dfghjkl + + + + + + + + https://idm.orademo.com + + someone@example.org + + + + + + + hello.com + + + + + urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport + + + + + Someone + + + Special + + + + diff --git a/spec/lib/gitlab/auth/saml/auth_hash_spec.rb b/spec/lib/gitlab/auth/saml/auth_hash_spec.rb index 76f49e778fb..3620e1afe25 100644 --- a/spec/lib/gitlab/auth/saml/auth_hash_spec.rb +++ b/spec/lib/gitlab/auth/saml/auth_hash_spec.rb @@ -82,6 +82,17 @@ describe Gitlab::Auth::Saml::AuthHash do end end + context 'with SAML 2.0 response_object' do + before do + auth_hash_data[:extra][:response_object] = { document: + saml_xml(File.read('spec/fixtures/authentication/saml2_response.xml')) } + end + + it 'can extract authn_context' do + expect(saml_auth_hash.authn_context).to eq 'urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport' + end + end + context 'without response_object' do it 'returns an empty string' do expect(saml_auth_hash.authn_context).to be_nil -- cgit v1.2.1 From 070fd2640a1987f7bab68d8547691c784bf7074a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Lafoucri=C3=A8re?= Date: Thu, 1 Nov 2018 00:54:23 +0000 Subject: Add missing `performance` to changelog type doc --- doc/development/changelog.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/doc/development/changelog.md b/doc/development/changelog.md index f06d40d1dbb..cd0a1f46d27 100644 --- a/doc/development/changelog.md +++ b/doc/development/changelog.md @@ -133,15 +133,15 @@ If you're working on the GitLab EE repository, the entry will be added to ### Arguments -| Argument | Shorthand | Purpose | -| ----------------- | --------- | ---------------------------------------------------------------------------------------------------------- | -| [`--amend`] | | Amend the previous commit | -| [`--force`] | `-f` | Overwrite an existing entry | -| [`--merge-request`] | `-m` | Set merge request ID | -| [`--dry-run`] | `-n` | Don't actually write anything, just print | -| [`--git-username`] | `-u` | Use Git user.name configuration as the author | -| [`--type`] | `-t` | The category of the change, valid options are: added, fixed, changed, deprecated, removed, security, other | -| [`--help`] | `-h` | Print help message | +| Argument | Shorthand | Purpose | +| ----------------- | --------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| [`--amend`] | | Amend the previous commit | +| [`--force`] | `-f` | Overwrite an existing entry | +| [`--merge-request`] | `-m` | Set merge request ID | +| [`--dry-run`] | `-n` | Don't actually write anything, just print | +| [`--git-username`] | `-u` | Use Git user.name configuration as the author | +| [`--type`] | `-t` | The category of the change, valid options are: `added`, `fixed`, `changed`, `deprecated`, `removed`, `security`, `performance`, `other` | +| [`--help`] | `-h` | Print help message | [`--amend`]: #-amend [`--force`]: #-force-or-f -- cgit v1.2.1 From a829dd8bd5dd64ac9f287963c1bc017712cd4ece Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Wed, 7 Nov 2018 12:16:52 -0500 Subject: add guide for creating runbook --- .../clusters/runbooks/img/authorize-jupyter.png | Bin 0 -> 334609 bytes .../project/clusters/runbooks/img/demo-runbook.png | Bin 0 -> 132436 bytes .../clusters/runbooks/img/gitlab-variables.png | Bin 0 -> 179611 bytes .../project/clusters/runbooks/img/helm-install.png | Bin 0 -> 263703 bytes .../clusters/runbooks/img/ingress-install.png | Bin 0 -> 371673 bytes .../clusters/runbooks/img/jupyter-start.png | Bin 0 -> 54270 bytes .../clusters/runbooks/img/jupyterhub-install.png | Bin 0 -> 288328 bytes .../clusters/runbooks/img/postgres-query.png | Bin 0 -> 311908 bytes .../clusters/runbooks/img/sample-runbook.png | Bin 0 -> 145728 bytes doc/user/project/clusters/runbooks/index.md | 90 +++++++++++++++++++++ 10 files changed, 90 insertions(+) create mode 100644 doc/user/project/clusters/runbooks/img/authorize-jupyter.png create mode 100644 doc/user/project/clusters/runbooks/img/demo-runbook.png create mode 100644 doc/user/project/clusters/runbooks/img/gitlab-variables.png create mode 100644 doc/user/project/clusters/runbooks/img/helm-install.png create mode 100644 doc/user/project/clusters/runbooks/img/ingress-install.png create mode 100644 doc/user/project/clusters/runbooks/img/jupyter-start.png create mode 100644 doc/user/project/clusters/runbooks/img/jupyterhub-install.png create mode 100644 doc/user/project/clusters/runbooks/img/postgres-query.png create mode 100644 doc/user/project/clusters/runbooks/img/sample-runbook.png diff --git a/doc/user/project/clusters/runbooks/img/authorize-jupyter.png b/doc/user/project/clusters/runbooks/img/authorize-jupyter.png new file mode 100644 index 00000000000..d808c4c1812 Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/authorize-jupyter.png differ diff --git a/doc/user/project/clusters/runbooks/img/demo-runbook.png b/doc/user/project/clusters/runbooks/img/demo-runbook.png new file mode 100644 index 00000000000..25c9df4126d Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/demo-runbook.png differ diff --git a/doc/user/project/clusters/runbooks/img/gitlab-variables.png b/doc/user/project/clusters/runbooks/img/gitlab-variables.png new file mode 100644 index 00000000000..f76ed21145f Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/gitlab-variables.png differ diff --git a/doc/user/project/clusters/runbooks/img/helm-install.png b/doc/user/project/clusters/runbooks/img/helm-install.png new file mode 100644 index 00000000000..b3119985c5c Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/helm-install.png differ diff --git a/doc/user/project/clusters/runbooks/img/ingress-install.png b/doc/user/project/clusters/runbooks/img/ingress-install.png new file mode 100644 index 00000000000..0a53d444380 Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/ingress-install.png differ diff --git a/doc/user/project/clusters/runbooks/img/jupyter-start.png b/doc/user/project/clusters/runbooks/img/jupyter-start.png new file mode 100644 index 00000000000..434c37b2d38 Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/jupyter-start.png differ diff --git a/doc/user/project/clusters/runbooks/img/jupyterhub-install.png b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png new file mode 100644 index 00000000000..36c5c24596f Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png differ diff --git a/doc/user/project/clusters/runbooks/img/postgres-query.png b/doc/user/project/clusters/runbooks/img/postgres-query.png new file mode 100644 index 00000000000..7c5dab7bf4b Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/postgres-query.png differ diff --git a/doc/user/project/clusters/runbooks/img/sample-runbook.png b/doc/user/project/clusters/runbooks/img/sample-runbook.png new file mode 100644 index 00000000000..c12ce8990a4 Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/sample-runbook.png differ diff --git a/doc/user/project/clusters/runbooks/index.md b/doc/user/project/clusters/runbooks/index.md index 3b81e439119..419e4ed60f3 100644 --- a/doc/user/project/clusters/runbooks/index.md +++ b/doc/user/project/clusters/runbooks/index.md @@ -47,3 +47,93 @@ an open-source python library that makes it easy to perform common DevOps tasks Tasks such as plotting Cloudwatch metrics and rolling your ECS/Kubernetes app are simplified down to a couple of lines of code. Check the [Nurtch Documentation](http://docs.nurtch.com/en/latest) for more information. + +## Configure an executable runbook with GitLab + +Follow this step-by-step guide to configure an executable runbook in GitLab using +the components outlined above and the preloaded demo runbook. + +### 1. Add a Kubernetes cluster + +Follow the steps outlined in [Adding and creating a new GKE cluster via GitLab](https://docs.gitlab.com/ee/user/project/clusters/#adding-and-creating-a-new-gke-cluster-via-gitlab) +to add a Kubernetes cluster to your project. + +### 2. Install Helm Tiller, Ingress, and JupyterHub + +Once the cluster has been provisioned in GKE, click the **"Install"** button next to the "Helm Tiller" app. + +![install helm](img/helm-install.png) + +Once Tiller has been installed successfully, click the **"Install"** button next to the "Ingress" app. + +![install ingress](img/ingress-install) + +Once Ingress has been installed successfully, click the **"Install"** button next to the "JupyterHub" app. + +![install jupyterhub](img/install-jupyterhub) + +### 3. Login to JupyterHub and start the server + +Once JupyterHub has been installed successfully, navigate to the "Jupyter Hostname" url presented and click +**"Sign in with GitLab"**. Authentication is automatically enabled for any user of GitLab server via OAuth2. This +will redirect to GitLab in order to authorize JupyterHub to use your GitLab account. Click **"Authorize"**. + +![authorize jupyter](img/authorize-jupyter.png) + +Once the application has been authorized you will taken back to the JupyterHub application. Click **"Start My Server"** + +![start jupyter](img/jupyter-start.png) + +The server will take a couple of seconds to start. + +### 4. Configure access + +In order for the runbook to access your GitLab project, you will need to enter a [GitLab Access Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) as well as your Project ID in the "Setup" +section of the demo runbook. + +Double-click on the "DevOps-Runbook-Demo" folder located on the left panel. + +![demo runbook](img/demo-runbook.png) + +Double-click on the "Nurtch-DevOps-Demo.ipynb" runbook + +![sample runbook](img/sample-runbook.png) + +The contents on the runbook will be displayed on the right side of the screen. Under the "Setup" section, you will find +entries for both your `PRIVATE_TOKEN` and your `PROJECT_ID`. Enter both these values, conserving the single quotes as follows: + +```sql +PRIVATE_TOKEN = 'abcdef123456' +PROJECT_ID = '1234567' +``` + +Update the `VARIABLE_NAME` on the last line of this section to match the name of the variable you are using for you +access token. In this example our variable name is `PRIVATE_TOKEN`. + +```sql +VARIABLE_VALUE = project.variables.get('PRIVATE_TOKEN').value +``` + +### 5. Configure an operation + +For this example we'll use the "**Run SQL queries in Notebook**" section in the sample runbook to query +a postgres database. The first 4 lines of the section define the variables that are required for this query to function. + +```sql +%env DB_USER={project.variables.get('DB_USER').value} +%env DB_PASSWORD={project.variables.get('DB_PASSWORD').value} +%env DB_ENDPOINT={project.variables.get('DB_ENDPOINT').value} +%env DB_NAME={project.variables.get('DB_NAME').value} +``` + +Create the matching variables in your project's **Settings >> CI/CD >> Variables** + +![gitlab variables](img/gitlab-variables.png) + +Back in Jupyter, click the "Run SQL queries in Notebook" heading and the click the "run" button. The results will be +displayed in-line as follows: + +![postgres query](img/postgres-query.png) + +You can try other operations such as running shell scripts or interacting with a kubernetes cluster. Visit the +[Nurtch Documentation](http://docs.nurtch.com/) for more information. \ No newline at end of file -- cgit v1.2.1 From fe2c3d4d9c5a6b45fe6e07e73bb4143e63792e8f Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Wed, 7 Nov 2018 14:36:38 -0500 Subject: update broken links --- doc/user/project/clusters/runbooks/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/project/clusters/runbooks/index.md b/doc/user/project/clusters/runbooks/index.md index 419e4ed60f3..cafc96d73ce 100644 --- a/doc/user/project/clusters/runbooks/index.md +++ b/doc/user/project/clusters/runbooks/index.md @@ -66,11 +66,11 @@ Once the cluster has been provisioned in GKE, click the **"Install"** button nex Once Tiller has been installed successfully, click the **"Install"** button next to the "Ingress" app. -![install ingress](img/ingress-install) +![install ingress](img/ingress-install.png) Once Ingress has been installed successfully, click the **"Install"** button next to the "JupyterHub" app. -![install jupyterhub](img/install-jupyterhub) +![install jupyterhub](img/install-jupyterhub.png) ### 3. Login to JupyterHub and start the server -- cgit v1.2.1 From 7b12f96c8cf861d7e25d0232fc7a040ab34677ce Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Wed, 7 Nov 2018 14:45:26 -0500 Subject: fix broken link --- doc/user/project/clusters/runbooks/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/clusters/runbooks/index.md b/doc/user/project/clusters/runbooks/index.md index cafc96d73ce..9a0fd6448fb 100644 --- a/doc/user/project/clusters/runbooks/index.md +++ b/doc/user/project/clusters/runbooks/index.md @@ -70,7 +70,7 @@ Once Tiller has been installed successfully, click the **"Install"** button next Once Ingress has been installed successfully, click the **"Install"** button next to the "JupyterHub" app. -![install jupyterhub](img/install-jupyterhub.png) +![install jupyterhub](img/jupyterhub-install.png) ### 3. Login to JupyterHub and start the server -- cgit v1.2.1 From 949cc27ac4fc0d20fc1428c3b13ba9c66abcb55f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Thu, 8 Nov 2018 13:52:19 +0100 Subject: Strictly require a pipeline to merge --- app/models/merge_request.rb | 1 - spec/models/merge_request_spec.rb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb index df5678ec2f1..92add079a02 100644 --- a/app/models/merge_request.rb +++ b/app/models/merge_request.rb @@ -966,7 +966,6 @@ class MergeRequest < ActiveRecord::Base def mergeable_ci_state? return true unless project.only_allow_merge_if_pipeline_succeeds? - return true unless head_pipeline actual_head_pipeline&.success? || actual_head_pipeline&.skipped? end diff --git a/spec/models/merge_request_spec.rb b/spec/models/merge_request_spec.rb index c7202b481d3..ad9662041f4 100644 --- a/spec/models/merge_request_spec.rb +++ b/spec/models/merge_request_spec.rb @@ -1782,7 +1782,7 @@ describe MergeRequest do allow(subject).to receive(:head_pipeline) { nil } end - it { expect(subject.mergeable_ci_state?).to be_truthy } + it { expect(subject.mergeable_ci_state?).to be_falsey } end end -- cgit v1.2.1 From bfd53b7b791e430c730557ef6f8d2563159c24df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Thu, 8 Nov 2018 13:56:22 +0100 Subject: Add CHANGELOG entry --- .../unreleased/28682-can-merge-branch-before-build-is-started.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/28682-can-merge-branch-before-build-is-started.yml diff --git a/changelogs/unreleased/28682-can-merge-branch-before-build-is-started.yml b/changelogs/unreleased/28682-can-merge-branch-before-build-is-started.yml new file mode 100644 index 00000000000..5ffd93e098f --- /dev/null +++ b/changelogs/unreleased/28682-can-merge-branch-before-build-is-started.yml @@ -0,0 +1,5 @@ +--- +title: Strictly require a pipeline to merge. +merge_request: 22911 +author: +type: changed -- cgit v1.2.1 From f44b7ac6b7b241df9b3beaf8386877852efb015b Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Fri, 9 Nov 2018 13:40:23 +1300 Subject: Switch kubernetes:active with checking $KUBECONFIG We have found an issue with `kubernetes:active` where it doesn't work with multiple clusters. Switch with the similar $KUBECONFIG variable check but this check actually gets the variable from the cluster matching the environment name. Fixes https://gitlab.com/gitlab-org/gitlab-ee/issues/8311 --- .../unreleased/auto_devops_kubernetes_active.yml | 5 ++++ lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml | 30 ++++++++++++++-------- 2 files changed, 25 insertions(+), 10 deletions(-) create mode 100644 changelogs/unreleased/auto_devops_kubernetes_active.yml diff --git a/changelogs/unreleased/auto_devops_kubernetes_active.yml b/changelogs/unreleased/auto_devops_kubernetes_active.yml new file mode 100644 index 00000000000..310d37128c9 --- /dev/null +++ b/changelogs/unreleased/auto_devops_kubernetes_active.yml @@ -0,0 +1,5 @@ +--- +title: Switch kubernetes:active with checking in Auto-DevOps.gitlab-ci.yml +merge_request: 22929 +author: +type: fixed diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index c759bb7098e..1e26d0a2d6a 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -147,7 +147,8 @@ performance: only: refs: - branches - kubernetes: active + variables: + - $KUBECONFIG except: variables: - $PERFORMANCE_DISABLED @@ -225,7 +226,8 @@ dast: only: refs: - branches - kubernetes: active + variables: + - $KUBECONFIG variables: - $GITLAB_FEATURES =~ /\bdast\b/ except: @@ -254,7 +256,8 @@ review: only: refs: - branches - kubernetes: active + variables: + - $KUBECONFIG except: refs: - master @@ -277,7 +280,8 @@ stop_review: only: refs: - branches - kubernetes: active + variables: + - $KUBECONFIG except: refs: - master @@ -306,7 +310,8 @@ staging: only: refs: - master - kubernetes: active + variables: + - $KUBECONFIG variables: - $STAGING_ENABLED @@ -331,7 +336,8 @@ canary: only: refs: - master - kubernetes: active + variables: + - $KUBECONFIG variables: - $CANARY_ENABLED @@ -359,7 +365,8 @@ production: only: refs: - master - kubernetes: active + variables: + - $KUBECONFIG except: variables: - $STAGING_ENABLED @@ -374,7 +381,8 @@ production_manual: only: refs: - master - kubernetes: active + variables: + - $KUBECONFIG variables: - $STAGING_ENABLED - $CANARY_ENABLED @@ -411,7 +419,8 @@ production_manual: only: refs: - master - kubernetes: active + variables: + - $KUBECONFIG variables: - $INCREMENTAL_ROLLOUT_MODE == "manual" - $INCREMENTAL_ROLLOUT_ENABLED @@ -426,7 +435,8 @@ production_manual: only: refs: - master - kubernetes: active + variables: + - $KUBECONFIG variables: - $INCREMENTAL_ROLLOUT_MODE == "timed" -- cgit v1.2.1 From 1e367810dc3277338f5dfdf38c27923de9eafab0 Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Fri, 9 Nov 2018 17:01:35 +1300 Subject: Use except:variables to fix multiple variable jobs As `only:variables` has the effect of being satisfied by any one of variable expression - this will create a situation where e.g. the dast job will be active even if there's no cluster. So use `except:variables which requires each and every variable expression to be satisfied. --- lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml | 36 ++++++++++------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml index 1e26d0a2d6a..e50c46f3f3f 100644 --- a/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml +++ b/lib/gitlab/ci/templates/Auto-DevOps.gitlab-ci.yml @@ -147,11 +147,10 @@ performance: only: refs: - branches - variables: - - $KUBECONFIG except: variables: - $PERFORMANCE_DISABLED + - $KUBECONFIG == null sast: stage: test @@ -226,8 +225,6 @@ dast: only: refs: - branches - variables: - - $KUBECONFIG variables: - $GITLAB_FEATURES =~ /\bdast\b/ except: @@ -235,6 +232,7 @@ dast: - master variables: - $DAST_DISABLED + - $KUBECONFIG == null review: stage: review @@ -256,13 +254,12 @@ review: only: refs: - branches - variables: - - $KUBECONFIG except: refs: - master variables: - $REVIEW_DISABLED + - $KUBECONFIG == null stop_review: stage: cleanup @@ -280,13 +277,12 @@ stop_review: only: refs: - branches - variables: - - $KUBECONFIG except: refs: - master variables: - $REVIEW_DISABLED + - $KUBECONFIG == null # Staging deploys are disabled by default since # continuous deployment to production is enabled by default @@ -310,10 +306,11 @@ staging: only: refs: - master - variables: - - $KUBECONFIG variables: - $STAGING_ENABLED + except: + variables: + - $KUBECONFIG == null # Canaries are also disabled by default, but if you want them, # and know what the downsides are, you can enable this by setting @@ -336,10 +333,11 @@ canary: only: refs: - master - variables: - - $KUBECONFIG variables: - $CANARY_ENABLED + except: + variables: + - $KUBECONFIG == null .production: &production_template stage: production @@ -365,14 +363,13 @@ production: only: refs: - master - variables: - - $KUBECONFIG except: variables: - $STAGING_ENABLED - $CANARY_ENABLED - $INCREMENTAL_ROLLOUT_ENABLED - $INCREMENTAL_ROLLOUT_MODE + - $KUBECONFIG == null production_manual: <<: *production_template @@ -381,8 +378,6 @@ production_manual: only: refs: - master - variables: - - $KUBECONFIG variables: - $STAGING_ENABLED - $CANARY_ENABLED @@ -390,6 +385,7 @@ production_manual: variables: - $INCREMENTAL_ROLLOUT_ENABLED - $INCREMENTAL_ROLLOUT_MODE + - $KUBECONFIG == null # This job implements incremental rollout on for every push to `master`. @@ -419,14 +415,13 @@ production_manual: only: refs: - master - variables: - - $KUBECONFIG variables: - $INCREMENTAL_ROLLOUT_MODE == "manual" - $INCREMENTAL_ROLLOUT_ENABLED except: variables: - $INCREMENTAL_ROLLOUT_MODE == "timed" + - $KUBECONFIG == null .timed_rollout_template: &timed_rollout_template <<: *rollout_template @@ -435,10 +430,11 @@ production_manual: only: refs: - master - variables: - - $KUBECONFIG variables: - $INCREMENTAL_ROLLOUT_MODE == "timed" + except: + variables: + - $KUBECONFIG == null timed rollout 10%: <<: *timed_rollout_template -- cgit v1.2.1 From 0cae4c5c72f8737004021075659281e974f73570 Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Fri, 9 Nov 2018 15:35:22 -0500 Subject: Initial draft for serverless page --- doc/user/project/clusters/index.md | 11 +++- .../clusters/serverless/img/install-knative.png | Bin 0 -> 102861 bytes doc/user/project/clusters/serverless/index.md | 72 +++++++++++++++++++++ .../serverless/serverless_ci_yml_template.yml | 25 +++++++ 4 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 doc/user/project/clusters/serverless/img/install-knative.png create mode 100644 doc/user/project/clusters/serverless/index.md create mode 100644 doc/user/project/clusters/serverless/serverless_ci_yml_template.yml diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index 233ed205790..9b9864abe3a 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -271,7 +271,8 @@ kubectl get svc --namespace=gitlab-managed-apps ingress-nginx-ingress-controller ``` NOTE: **Note:** -For Istio/Knative, the command will be different: +For Istio/Knative, use the following command: + ```bash kubectl get svc --namespace=istio-system knative-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` @@ -485,7 +486,13 @@ the deployment variables above, ensuring any pods you create are labelled with ## Read more -- [Connecting and deploying to an Amazon EKS cluster](eks_and_gitlab/index.md) +### Integrating Amazon EKS cluster with GitLab + +- Learn how to [connect and deploy to an Amazon EKS cluster.](eks_and_gitlab/index.md) + +### Serverless + +- [Run serverless workloads on Kubernetes with Knative.](serverless/index.md) [permissions]: ../../permissions.md [ee]: https://about.gitlab.com/pricing/ diff --git a/doc/user/project/clusters/serverless/img/install-knative.png b/doc/user/project/clusters/serverless/img/install-knative.png new file mode 100644 index 00000000000..dd576a9df35 Binary files /dev/null and b/doc/user/project/clusters/serverless/img/install-knative.png differ diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md new file mode 100644 index 00000000000..b1730868c39 --- /dev/null +++ b/doc/user/project/clusters/serverless/index.md @@ -0,0 +1,72 @@ +# Serverless + +> Introduced in GitLab 11.5. + +Run serverless workloads on Kubernetes using [Knative](https://cloud.google.com/knative/). + +## Overview + +Knative extends Kubernetes to provide a set of middleware components that are useful to build modern, source-centric, and container-based applications. Knative brings some significant benefits out of the box through its main components: + +- [Build:](https://github.com/knative/build) Source-to-container build orchestration +- [Eventing:](https://github.com/knative/eventing) Management and delivery of events +- [Serving:](https://github.com/knative/serving) Request-driven compute that can scale to zero + +For more information on Knative, visit the [Knative docs repo](https://github.com/knative/docs). + +## Requirements + +To run Knative on Gitlab, you will need: + +1. **Kubernetes:** An RBAC-enabled Kubernetes cluster is required to deploy Knative. + The simplest way to get started is to add a cluster using [GitLab's GKE integration](https://docs.gitlab.com/ee/user/project/clusters/#adding-and-creating-a-new-gke-cluster-via-gitlab). + GitLab recommends +1. **Helm Tiller:** Helm is a package manager for Kubernetes and is required to install + all the other applications. It is installed in its own pod inside the cluster which + can run the helm CLI in a safe environment. +1. **Domain Name:** Knative will provide its own load balancer using Istio. It will provide an + external IP address for all the applications served by Knative. You will be prompted to enter a + wildcard domain where your applications will be served. Configure your DNS server to use the + external IP address for that domain. +1. **Serverless `gitlab-ci.yml` Template:** GitLab uses the [TriggerMesh CLI](https://github.com/triggermesh/tm), + a serverless resource management utilty to work with knative objects. The `gitlab-ci.yml` template uses it + to build and deploy knative services and functions. [Access the template here](serverless_ci_yml_template.yml). +1. **Docker File:** Knative requires a docker file in order to build your application. It should be included + at the root of your project's repo. + +## Installing Knative via GitLab's Kubernetes integration + +NOTE: **Note:** +Minimum recommended cluster size to run Knative is 3-nodes, 6 vCPUs, and 22.50 GB memory. RBAC must be enabled. + +You may download the sample [Knative Ruby App](https://gitlab.com/knative-examples/knative-ruby-app) to get started. + +1. [Add a Kubernetes cluster](https://docs.gitlab.com/ce/user/project/clusters/) and install Helm. + +1. Once Helm has been successfully installed, on the Knative app section, enter the domain to be used with + your application and click "Install". + + ![install-knative](img/install-knative.png) + +1. After the Knative installation has finished, retrieve the Istio Ingress IP address by running the following command: + + ```bash + kubectl get svc --namespace=istio-system knative-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' + ``` + +1. The ingress is now available at this address and will route incoming requests to the proper service based on the DNS + name in the request. To support this, a wildcard DNS A record should be created for the desired domain name. + + ![dns entry](img/dns-entry) + +## Deploying the GitLab Runner (optional) + +If the project is on GitLab.com, free shared runners are available and you do not have to deploy one. If a project specific runner is desired, or there are no shared runners, it is easy to deploy one. + +Simply click on the "**Install**" button for the GitLab Runner. It is important to note that the runner deployed is set as privileged, which means it essentially has root access to the underlying machine. This is required to build docker images, and so is on by default. + +## Deploy the application with Knative + +With all the pieces in place, you can simply create a new CI pipeline to deploy the Knative application. Navigate to +**CI/CD >> Pipelines** and click on the "**Run Pipeline"** button on the upper right hand side of the screen. On the +Pipelines page now click "**Create pipeline**". \ No newline at end of file diff --git a/doc/user/project/clusters/serverless/serverless_ci_yml_template.yml b/doc/user/project/clusters/serverless/serverless_ci_yml_template.yml new file mode 100644 index 00000000000..31f68f223ca --- /dev/null +++ b/doc/user/project/clusters/serverless/serverless_ci_yml_template.yml @@ -0,0 +1,25 @@ +stages: + - build + - deploy + +variables: + DOCKER_DRIVER: overlay2 + +build: + stage: build + image: docker:stable-git + services: + - docker:stable-dind + before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" + script: + - docker build --pull -t "$CI_REGISTRY_IMAGE" . + - docker push "$CI_REGISTRY_IMAGE" + +deploy: + stage: deploy + image: gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 + environment: production + script: + - echo "$CI_REGISTRY_IMAGE" + - tm -n "$KUBE_NAMESPACE" --config "$KUBECONFIG" deploy service "$CI_PROJECT_NAME" --from-image "$CI_REGISTRY_IMAGE" --wait -- cgit v1.2.1 From 417bc01dd347e65c09af7f5fbb272389a67a122d Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Fri, 9 Nov 2018 16:48:46 -0500 Subject: add images and url retrieval section --- .../clusters/serverless/img/deploy-stage.png | Bin 0 -> 34472 bytes .../project/clusters/serverless/img/dns-entry.png | Bin 0 -> 103867 bytes .../clusters/serverless/img/knative-app.png | Bin 0 -> 28998 bytes doc/user/project/clusters/serverless/index.md | 35 ++++++++++++++++++++- 4 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 doc/user/project/clusters/serverless/img/deploy-stage.png create mode 100644 doc/user/project/clusters/serverless/img/dns-entry.png create mode 100644 doc/user/project/clusters/serverless/img/knative-app.png diff --git a/doc/user/project/clusters/serverless/img/deploy-stage.png b/doc/user/project/clusters/serverless/img/deploy-stage.png new file mode 100644 index 00000000000..eed5f948ba0 Binary files /dev/null and b/doc/user/project/clusters/serverless/img/deploy-stage.png differ diff --git a/doc/user/project/clusters/serverless/img/dns-entry.png b/doc/user/project/clusters/serverless/img/dns-entry.png new file mode 100644 index 00000000000..f72ae57718d Binary files /dev/null and b/doc/user/project/clusters/serverless/img/dns-entry.png differ diff --git a/doc/user/project/clusters/serverless/img/knative-app.png b/doc/user/project/clusters/serverless/img/knative-app.png new file mode 100644 index 00000000000..54301e1786f Binary files /dev/null and b/doc/user/project/clusters/serverless/img/knative-app.png differ diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index b1730868c39..74c081531a3 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -69,4 +69,37 @@ Simply click on the "**Install**" button for the GitLab Runner. It is important With all the pieces in place, you can simply create a new CI pipeline to deploy the Knative application. Navigate to **CI/CD >> Pipelines** and click on the "**Run Pipeline"** button on the upper right hand side of the screen. On the -Pipelines page now click "**Create pipeline**". \ No newline at end of file +Pipelines page now click "**Create pipeline**". + +## Obtain the URL for the Knative deployment + +Once all the stages of the pipeline finish, click on the "deploy" stage + +![deploy stage](img/deploy-stage.png) + +The output will look like this: + +```bash +Running with gitlab-runner 11.5.0~beta.844.g96d88322 (96d88322) + on docker-auto-scale 72989761 +Using Docker executor with image gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 ... +Pulling docker image gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 ... +Using docker image sha256:6b3f6590a9b30bd7aafb9573f047d930c70066e43955b4beb18a1eee175f6de1 for gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 ... +Running on runner-72989761-project-4342902-concurrent-0 via runner-72989761-stg-srm-1541795796-27929c96... +Cloning repository... +Cloning into '/builds/danielgruesso/knative'... +Checking out 8671ad20 as master... +Skipping Git submodules setup +$ echo "$CI_REGISTRY_IMAGE" +registry.staging.gitlab.com/danielgruesso/knative +$ tm -n "$KUBE_NAMESPACE" --config "$KUBECONFIG" deploy service "$CI_PROJECT_NAME" --from-image "$CI_REGISTRY_IMAGE" --wait +Deployment started. Run "tm -n knative-4342902 describe service knative" to see the details +Waiting for ready state....... +Service domain: knative.knative-4342902.knative.info +Job succeeded +``` + +The second to last line, labeled "**Service domain**" contains the URL for the deployment. Copy and paste the domain into your +browser to see the app live. + +![knative app](img/knative-app.png) \ No newline at end of file -- cgit v1.2.1 From 385576df5784a738634ef44868c5813739099320 Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Fri, 9 Nov 2018 16:52:51 -0500 Subject: fix broken links --- doc/user/project/clusters/serverless/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index 74c081531a3..c67ee25c109 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -57,7 +57,7 @@ You may download the sample [Knative Ruby App](https://gitlab.com/knative-exampl 1. The ingress is now available at this address and will route incoming requests to the proper service based on the DNS name in the request. To support this, a wildcard DNS A record should be created for the desired domain name. - ![dns entry](img/dns-entry) + ![dns entry](img/dns-entry.png) ## Deploying the GitLab Runner (optional) -- cgit v1.2.1 From e1bfde7181e7fdaa1a680a2ac2d3b2dba78ca29a Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 9 Nov 2018 22:54:09 +0000 Subject: Minor edits --- doc/user/project/clusters/runbooks/index.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/user/project/clusters/runbooks/index.md b/doc/user/project/clusters/runbooks/index.md index 9a0fd6448fb..00f920fe771 100644 --- a/doc/user/project/clusters/runbooks/index.md +++ b/doc/user/project/clusters/runbooks/index.md @@ -10,8 +10,8 @@ Historically, runbooks took the form of a decision tree or a detailed step-by-step guide depending on the condition or system. Modern implementations have introduced the concept of an "executable -runbooks", where along with a well define process, operators can execute -code blocks or database queries against a given environment. +runbooks", where, along with a well-defined process, operators can execute +pre-written code blocks or database queries against a given environment. ## Nurtch Executable Runbooks @@ -45,7 +45,7 @@ To create an executable runbook, you will need: Nurtch is the company behind the [Rubix library](https://github.com/Nurtch/rubix). Rubix is an open-source python library that makes it easy to perform common DevOps tasks inside Jupyter Notebooks. Tasks such as plotting Cloudwatch metrics and rolling your ECS/Kubernetes app are simplified -down to a couple of lines of code. Check the [Nurtch Documentation](http://docs.nurtch.com/en/latest) +down to a couple of lines of code. See the [Nurtch Documentation](http://docs.nurtch.com/en/latest) for more information. ## Configure an executable runbook with GitLab @@ -74,13 +74,13 @@ Once Ingress has been installed successfully, click the **"Install"** button nex ### 3. Login to JupyterHub and start the server -Once JupyterHub has been installed successfully, navigate to the "Jupyter Hostname" url presented and click +Once JupyterHub has been installed successfully, navigate to the displayed **Jupyter Hostname** URL and click **"Sign in with GitLab"**. Authentication is automatically enabled for any user of GitLab server via OAuth2. This -will redirect to GitLab in order to authorize JupyterHub to use your GitLab account. Click **"Authorize"**. +will redirect to GitLab in order to authorize JupyterHub to use your GitLab account. Click **Authorize**. ![authorize jupyter](img/authorize-jupyter.png) -Once the application has been authorized you will taken back to the JupyterHub application. Click **"Start My Server"** +Once the application has been authorized you will taken back to the JupyterHub application. Click **Start My Server** ![start jupyter](img/jupyter-start.png) @@ -91,11 +91,11 @@ The server will take a couple of seconds to start. In order for the runbook to access your GitLab project, you will need to enter a [GitLab Access Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) as well as your Project ID in the "Setup" section of the demo runbook. -Double-click on the "DevOps-Runbook-Demo" folder located on the left panel. +Double-click the **DevOps-Runbook-Demo** folder located on the left panel. ![demo runbook](img/demo-runbook.png) -Double-click on the "Nurtch-DevOps-Demo.ipynb" runbook +Double-click the "Nurtch-DevOps-Demo.ipynb" runbook. ![sample runbook](img/sample-runbook.png) @@ -107,7 +107,7 @@ PRIVATE_TOKEN = 'abcdef123456' PROJECT_ID = '1234567' ``` -Update the `VARIABLE_NAME` on the last line of this section to match the name of the variable you are using for you +Update the `VARIABLE_NAME` on the last line of this section to match the name of the variable you are using for your access token. In this example our variable name is `PRIVATE_TOKEN`. ```sql @@ -130,10 +130,10 @@ Create the matching variables in your project's **Settings >> CI/CD >> Variables ![gitlab variables](img/gitlab-variables.png) -Back in Jupyter, click the "Run SQL queries in Notebook" heading and the click the "run" button. The results will be +Back in Jupyter, click the "Run SQL queries in Notebook" heading and the click *Run*. The results will be displayed in-line as follows: ![postgres query](img/postgres-query.png) -You can try other operations such as running shell scripts or interacting with a kubernetes cluster. Visit the +You can try other operations such as running shell scripts or interacting with a Kubernetes cluster. Visit the [Nurtch Documentation](http://docs.nurtch.com/) for more information. \ No newline at end of file -- cgit v1.2.1 From fa323557a4b426ecbc73cdced5dec3491ff6ae04 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 9 Nov 2018 22:59:11 +0000 Subject: Remove quotes and bold UI item names --- doc/user/project/clusters/runbooks/index.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/doc/user/project/clusters/runbooks/index.md b/doc/user/project/clusters/runbooks/index.md index 00f920fe771..cb49e39eff2 100644 --- a/doc/user/project/clusters/runbooks/index.md +++ b/doc/user/project/clusters/runbooks/index.md @@ -60,22 +60,22 @@ to add a Kubernetes cluster to your project. ### 2. Install Helm Tiller, Ingress, and JupyterHub -Once the cluster has been provisioned in GKE, click the **"Install"** button next to the "Helm Tiller" app. +Once the cluster has been provisioned in GKE, click the **Install** button next to the **Helm Tiller** app. ![install helm](img/helm-install.png) -Once Tiller has been installed successfully, click the **"Install"** button next to the "Ingress" app. +Once Tiller has been installed successfully, click the **Install** button next to the **Ingress** app. ![install ingress](img/ingress-install.png) -Once Ingress has been installed successfully, click the **"Install"** button next to the "JupyterHub" app. +Once Ingress has been installed successfully, click the **Install** button next to the **JupyterHub** app. ![install jupyterhub](img/jupyterhub-install.png) ### 3. Login to JupyterHub and start the server Once JupyterHub has been installed successfully, navigate to the displayed **Jupyter Hostname** URL and click -**"Sign in with GitLab"**. Authentication is automatically enabled for any user of GitLab server via OAuth2. This +**Sign in with GitLab**. Authentication is automatically enabled for any user of GitLab server via OAuth2. This will redirect to GitLab in order to authorize JupyterHub to use your GitLab account. Click **Authorize**. ![authorize jupyter](img/authorize-jupyter.png) @@ -88,8 +88,9 @@ The server will take a couple of seconds to start. ### 4. Configure access -In order for the runbook to access your GitLab project, you will need to enter a [GitLab Access Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) as well as your Project ID in the "Setup" -section of the demo runbook. +In order for the runbook to access your GitLab project, you will need to enter a +[GitLab Access Token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) +as well as your Project ID in the **Setup** section of the demo runbook. Double-click the **DevOps-Runbook-Demo** folder located on the left panel. -- cgit v1.2.1 From 117072d45f7fbcc375bec66758f5187f2a0de3ea Mon Sep 17 00:00:00 2001 From: Kushal Pandya Date: Mon, 12 Nov 2018 14:51:25 +0530 Subject: Fix user name autocomplete XSS when name contains HTML --- app/assets/javascripts/gfm_auto_complete.js | 15 ++++++++++---- spec/features/issues/gfm_autocomplete_spec.rb | 29 +++++++++++++++++++++------ 2 files changed, 34 insertions(+), 10 deletions(-) diff --git a/app/assets/javascripts/gfm_auto_complete.js b/app/assets/javascripts/gfm_auto_complete.js index 00b3d283570..6f8b73564d0 100644 --- a/app/assets/javascripts/gfm_auto_complete.js +++ b/app/assets/javascripts/gfm_auto_complete.js @@ -151,10 +151,16 @@ class GfmAutoComplete { // Team Members $input.atwho({ at: '@', + alias: 'users', displayTpl(value) { let tmpl = GfmAutoComplete.Loading.template; - if (value.username != null) { - tmpl = GfmAutoComplete.Members.template; + const { avatarTag, username, title } = value; + if (username != null) { + tmpl = GfmAutoComplete.Members.templateFunction({ + avatarTag, + username, + title, + }); } return tmpl; }, @@ -565,8 +571,9 @@ GfmAutoComplete.Emoji = { }; // Team Members GfmAutoComplete.Members = { - // eslint-disable-next-line no-template-curly-in-string - template: '
  • ${avatarTag} ${username} ${title}
  • ', + templateFunction({ avatarTag, username, title }) { + return `
  • ${avatarTag} ${username} ${_.escape(title)}
  • `; + }, }; GfmAutoComplete.Labels = { template: diff --git a/spec/features/issues/gfm_autocomplete_spec.rb b/spec/features/issues/gfm_autocomplete_spec.rb index 605860b90cd..7c591dacce5 100644 --- a/spec/features/issues/gfm_autocomplete_spec.rb +++ b/spec/features/issues/gfm_autocomplete_spec.rb @@ -1,6 +1,10 @@ require 'rails_helper' describe 'GFM autocomplete', :js do + let(:issue_xss_title) { 'This will execute alert Date: Mon, 12 Nov 2018 14:59:59 +0530 Subject: Add changelog entry --- changelogs/unreleased/security-2717-xss-username-autocomplete.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/security-2717-xss-username-autocomplete.yml diff --git a/changelogs/unreleased/security-2717-xss-username-autocomplete.yml b/changelogs/unreleased/security-2717-xss-username-autocomplete.yml new file mode 100644 index 00000000000..d9b1015eeb4 --- /dev/null +++ b/changelogs/unreleased/security-2717-xss-username-autocomplete.yml @@ -0,0 +1,5 @@ +--- +title: Escape user fullname while rendering autocomplete template to prevent XSS +merge_request: +author: +type: security -- cgit v1.2.1 From f3cd24a9f3f581488d621475e55e3a81bbd9e67c Mon Sep 17 00:00:00 2001 From: Imre Farkas Date: Thu, 8 Nov 2018 16:03:56 +0100 Subject: Display impersonation token value only after creation Since we migrated all PersonlAccessTokens to store only its hash in the DB, the token value can no longer be shown to the user. --- app/controllers/admin/impersonation_tokens_controller.rb | 3 +++ app/views/admin/impersonation_tokens/index.html.haml | 5 +++++ app/views/profiles/personal_access_tokens/index.html.haml | 12 +----------- .../_personal_access_tokens_created_container.html.haml | 14 ++++++++++++++ app/views/shared/_personal_access_tokens_table.html.haml | 6 ------ .../unreleased/ce-53347_fix_impersonation_tokens.yml | 5 +++++ doc/api/users.md | 5 ++--- lib/api/entities.rb | 6 +++++- lib/api/users.rb | 4 ++-- qa/qa/page/profile/personal_access_tokens.rb | 2 +- .../profiles/personal_access_tokens_controller_spec.rb | 6 ++++++ .../admin/admin_users_impersonation_tokens_spec.rb | 5 +++++ spec/features/profiles/personal_access_tokens_spec.rb | 3 +++ spec/requests/api/users_spec.rb | 4 ++-- 14 files changed, 54 insertions(+), 26 deletions(-) create mode 100644 app/views/shared/_personal_access_tokens_created_container.html.haml create mode 100644 changelogs/unreleased/ce-53347_fix_impersonation_tokens.yml diff --git a/app/controllers/admin/impersonation_tokens_controller.rb b/app/controllers/admin/impersonation_tokens_controller.rb index f5825ecb19a..706bcc1e549 100644 --- a/app/controllers/admin/impersonation_tokens_controller.rb +++ b/app/controllers/admin/impersonation_tokens_controller.rb @@ -11,6 +11,7 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController @impersonation_token = finder.build(impersonation_token_params) if @impersonation_token.save + PersonalAccessToken.redis_store!(current_user.id, @impersonation_token.token) redirect_to admin_user_impersonation_tokens_path, notice: "A new impersonation token has been created." else set_index_vars @@ -53,6 +54,8 @@ class Admin::ImpersonationTokensController < Admin::ApplicationController @impersonation_token ||= finder.build @inactive_impersonation_tokens = finder(state: 'inactive').execute @active_impersonation_tokens = finder(state: 'active').execute.order(:expires_at) + + @new_impersonation_token = PersonalAccessToken.redis_getdel(current_user.id) end # rubocop: enable CodeReuse/ActiveRecord end diff --git a/app/views/admin/impersonation_tokens/index.html.haml b/app/views/admin/impersonation_tokens/index.html.haml index 9e490713ef3..8e869fb4b71 100644 --- a/app/views/admin/impersonation_tokens/index.html.haml +++ b/app/views/admin/impersonation_tokens/index.html.haml @@ -5,6 +5,11 @@ .row.prepend-top-default .col-lg-12 + - if @new_impersonation_token + = render "shared/personal_access_tokens_created_container", new_token_value: @new_impersonation_token, + container_title: 'Your New Impersonation Token', + clipboard_button_title: 'Copy impersonation token to clipboard' + = render "shared/personal_access_tokens_form", path: admin_user_impersonation_tokens_path, impersonation: true, token: @impersonation_token, scopes: @scopes = render "shared/personal_access_tokens_table", impersonation: true, active_tokens: @active_impersonation_tokens, inactive_tokens: @inactive_impersonation_tokens diff --git a/app/views/profiles/personal_access_tokens/index.html.haml b/app/views/profiles/personal_access_tokens/index.html.haml index c10d4ea1a4d..c1e1eaff942 100644 --- a/app/views/profiles/personal_access_tokens/index.html.haml +++ b/app/views/profiles/personal_access_tokens/index.html.haml @@ -14,17 +14,7 @@ .col-lg-8 - if @new_personal_access_token - .created-personal-access-token-container - %h5.prepend-top-0 - Your New Personal Access Token - .form-group - .input-group - = text_field_tag 'created-personal-access-token', @new_personal_access_token, readonly: true, class: "form-control js-select-on-focus", 'aria-describedby' => "created-personal-access-token-help-block" - %span.input-group-append - = clipboard_button(text: @new_personal_access_token, title: "Copy personal access token to clipboard", placement: "left", class: "input-group-text btn-default btn-clipboard") - %span#created-personal-access-token-help-block.form-text.text-muted.text-danger Make sure you save it - you won't be able to access it again. - - %hr + = render "shared/personal_access_tokens_created_container", new_token_value: @new_personal_access_token = render "shared/personal_access_tokens_form", path: profile_personal_access_tokens_path, impersonation: false, token: @personal_access_token, scopes: @scopes diff --git a/app/views/shared/_personal_access_tokens_created_container.html.haml b/app/views/shared/_personal_access_tokens_created_container.html.haml new file mode 100644 index 00000000000..3150d39b84a --- /dev/null +++ b/app/views/shared/_personal_access_tokens_created_container.html.haml @@ -0,0 +1,14 @@ +- container_title = local_assigns.fetch(:container_title, 'Your New Personal Access Token') +- clipboard_button_title = local_assigns.fetch(:clipboard_button_title, 'Copy personal access token to clipboard') + +.created-personal-access-token-container + %h5.prepend-top-0 + = container_title + .form-group + .input-group + = text_field_tag 'created-personal-access-token', new_token_value, readonly: true, class: "form-control js-select-on-focus", 'aria-describedby' => "created-token-help-block" + %span.input-group-append + = clipboard_button(text: new_token_value, title: clipboard_button_title, placement: "left", class: "input-group-text btn-default btn-clipboard") + %span#created-token-help-block.form-text.text-muted.text-danger Make sure you save it - you won't be able to access it again. + +%hr diff --git a/app/views/shared/_personal_access_tokens_table.html.haml b/app/views/shared/_personal_access_tokens_table.html.haml index cadac1cc99d..2efd03d4867 100644 --- a/app/views/shared/_personal_access_tokens_table.html.haml +++ b/app/views/shared/_personal_access_tokens_table.html.haml @@ -15,8 +15,6 @@ %th Created %th Expires %th Scopes - - if impersonation - %th Token %th %tbody - active_tokens.each do |token| @@ -30,10 +28,6 @@ - else %span.token-never-expires-label Never %td= token.scopes.present? ? token.scopes.join(", ") : "" - - if impersonation - %td.token-token-container - = text_field_tag 'impersonation-token-token', token.token, readonly: true, class: "form-control" - = clipboard_button(text: token.token) - path = impersonation ? revoke_admin_user_impersonation_token_path(token.user, token) : revoke_profile_personal_access_token_path(token) %td= link_to "Revoke", path, method: :put, class: "btn btn-danger float-right", data: { confirm: "Are you sure you want to revoke this #{type} Token? This action cannot be undone." } - else diff --git a/changelogs/unreleased/ce-53347_fix_impersonation_tokens.yml b/changelogs/unreleased/ce-53347_fix_impersonation_tokens.yml new file mode 100644 index 00000000000..6cc743d6f3a --- /dev/null +++ b/changelogs/unreleased/ce-53347_fix_impersonation_tokens.yml @@ -0,0 +1,5 @@ +--- +title: Display impersonation token value only after creation +merge_request: 22916 +author: +type: fixed diff --git a/doc/api/users.md b/doc/api/users.md index ee24aa09156..e3633c46041 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -1072,7 +1072,6 @@ Example response: [ { "active" : true, - "token" : "EsMo-vhKfXGwX9RKrwiy", "scopes" : [ "api" ], @@ -1089,7 +1088,6 @@ Example response: "read_user" ], "revoked" : true, - "token" : "ZcZRpLeEuQRprkRjYydY", "name" : "mytoken2", "created_at" : "2017-03-17T17:19:28.697Z", "id" : 3, @@ -1125,7 +1123,6 @@ Example response: ```json { "active" : true, - "token" : "EsMo-vhKfXGwX9RKrwiy", "scopes" : [ "api" ], @@ -1142,6 +1139,8 @@ Example response: > Requires admin permissions. +> Token values are returned once. Make sure you save it - you won't be able to access it again. + It creates a new impersonation token. Note that only administrators can do this. You are only able to create impersonation tokens to impersonate the user and perform both API calls and Git reads and writes. The user will not see these tokens in their profile diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 61d57c643f0..5572e86985c 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1263,7 +1263,11 @@ module API expose :token end - class ImpersonationToken < PersonalAccessTokenWithToken + class ImpersonationToken < PersonalAccessToken + expose :impersonation + end + + class ImpersonationTokenWithToken < PersonalAccessTokenWithToken expose :impersonation end diff --git a/lib/api/users.rb b/lib/api/users.rb index 2a56506f3a5..b41fce76df0 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -531,7 +531,7 @@ module API desc 'Create a impersonation token. Available only for admins.' do detail 'This feature was introduced in GitLab 9.0' - success Entities::ImpersonationToken + success Entities::ImpersonationTokenWithToken end params do requires :name, type: String, desc: 'The name of the impersonation token' @@ -542,7 +542,7 @@ module API impersonation_token = finder.build(declared_params(include_missing: false)) if impersonation_token.save - present impersonation_token, with: Entities::ImpersonationToken + present impersonation_token, with: Entities::ImpersonationTokenWithToken else render_validation_error!(impersonation_token) end diff --git a/qa/qa/page/profile/personal_access_tokens.rb b/qa/qa/page/profile/personal_access_tokens.rb index 2f0202951bb..9191dbe9cf3 100644 --- a/qa/qa/page/profile/personal_access_tokens.rb +++ b/qa/qa/page/profile/personal_access_tokens.rb @@ -8,7 +8,7 @@ module QA element :scopes_api_radios, "label :scopes" # rubocop:disable QA/ElementWithPattern end - view 'app/views/profiles/personal_access_tokens/index.html.haml' do + view 'app/views/shared/_personal_access_tokens_created_container.html.haml' do element :create_token_field, "text_field_tag 'created-personal-access-token'" # rubocop:disable QA/ElementWithPattern end diff --git a/spec/controllers/profiles/personal_access_tokens_controller_spec.rb b/spec/controllers/profiles/personal_access_tokens_controller_spec.rb index ed08a4c1bf2..f5860d4296b 100644 --- a/spec/controllers/profiles/personal_access_tokens_controller_spec.rb +++ b/spec/controllers/profiles/personal_access_tokens_controller_spec.rb @@ -39,8 +39,10 @@ describe Profiles::PersonalAccessTokensController do let!(:active_personal_access_token) { create(:personal_access_token, user: user) } let!(:inactive_personal_access_token) { create(:personal_access_token, :revoked, user: user) } let!(:impersonation_personal_access_token) { create(:personal_access_token, :impersonation, user: user) } + let(:token_value) { 's3cr3t' } before do + PersonalAccessToken.redis_store!(user.id, token_value) get :index end @@ -56,5 +58,9 @@ describe Profiles::PersonalAccessTokensController do expect(assigns(:active_personal_access_tokens)).not_to include(impersonation_personal_access_token) expect(assigns(:inactive_personal_access_tokens)).not_to include(impersonation_personal_access_token) end + + it "retrieves newly created personal access token value" do + expect(assigns(:new_personal_access_token)).to eql(token_value) + end end end diff --git a/spec/features/admin/admin_users_impersonation_tokens_spec.rb b/spec/features/admin/admin_users_impersonation_tokens_spec.rb index e16eae219a4..c7860bebb06 100644 --- a/spec/features/admin/admin_users_impersonation_tokens_spec.rb +++ b/spec/features/admin/admin_users_impersonation_tokens_spec.rb @@ -12,6 +12,10 @@ describe 'Admin > Users > Impersonation Tokens', :js do find(".settings-message") end + def created_impersonation_token + find("#created-personal-access-token").value + end + before do sign_in(admin) end @@ -39,6 +43,7 @@ describe 'Admin > Users > Impersonation Tokens', :js do expect(active_impersonation_tokens).to have_text('api') expect(active_impersonation_tokens).to have_text('read_user') expect(PersonalAccessTokensFinder.new(impersonation: true).execute.count).to equal(1) + expect(created_impersonation_token).not_to be_empty end end diff --git a/spec/features/profiles/personal_access_tokens_spec.rb b/spec/features/profiles/personal_access_tokens_spec.rb index 8461cd0027c..dee213a11d4 100644 --- a/spec/features/profiles/personal_access_tokens_spec.rb +++ b/spec/features/profiles/personal_access_tokens_spec.rb @@ -43,10 +43,12 @@ describe 'Profile > Personal Access Tokens', :js do check "read_user" click_on "Create personal access token" + expect(active_personal_access_tokens).to have_text(name) expect(active_personal_access_tokens).to have_text('In') expect(active_personal_access_tokens).to have_text('api') expect(active_personal_access_tokens).to have_text('read_user') + expect(created_personal_access_token).not_to be_empty end context "when creation fails" do @@ -57,6 +59,7 @@ describe 'Profile > Personal Access Tokens', :js do expect { click_on "Create personal access token" }.not_to change { PersonalAccessToken.count } expect(page).to have_content("Name cannot be nil") + expect(page).not_to have_selector("#created-personal-access-token") end end end diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb index e6d01c9689f..bb913ae0e79 100644 --- a/spec/requests/api/users_spec.rb +++ b/spec/requests/api/users_spec.rb @@ -2018,11 +2018,11 @@ describe API::Users do expect(json_response['message']).to eq('403 Forbidden') end - it 'returns a personal access token' do + it 'returns an impersonation token' do get api("/users/#{user.id}/impersonation_tokens/#{impersonation_token.id}", admin) expect(response).to have_gitlab_http_status(200) - expect(json_response['token']).to be_present + expect(json_response['token']).not_to be_present expect(json_response['impersonation']).to be_truthy end end -- cgit v1.2.1 From 5b45cd246373f18bf678dbdecad589733cfec8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Mon, 12 Nov 2018 16:27:28 +0100 Subject: Implement MVC for Pipeline deletion API --- lib/api/pipelines.rb | 15 ++++++++++++ spec/requests/api/pipelines_spec.rb | 47 +++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 1cfb982c04b..d4bd4e71343 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -81,6 +81,21 @@ module API present pipeline, with: Entities::Pipeline end + desc 'Deletes a pipeline' do + detail 'This feature was introduced in GitLab 11.6' + http_codes [[204, 'Pipeline was deleted'], [403, 'Forbidden']] + end + params do + requires :pipeline_id, type: Integer, desc: 'The pipeline ID' + end + delete ':id/pipelines/:pipeline_id' do + authorize! :admin_pipeline, user_project + + AuditEventService.new(current_user, user_project).security_event + + destroy_conditionally!(pipeline) + end + desc 'Retry builds in the pipeline' do detail 'This feature was introduced in GitLab 8.11.' success Entities::Pipeline diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index f0e1992bccd..68de3068568 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -438,6 +438,53 @@ describe API::Pipelines do end end + describe 'DELETE /projects/:id/pipelines/:pipeline_id' do + context 'authorized user' do + it 'deletes the pipeline' do + delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", user) + + expect(response).to have_gitlab_http_status(204) + expect { pipeline.reload }.to raise_error(ActiveRecord::RecordNotFound) + end + + it 'returns 404 when it does not exist' do + delete api("/projects/#{project.id}/pipelines/123456", user) + + expect(response).to have_gitlab_http_status(404) + expect(json_response['message']).to eq '404 Not found' + end + + it 'logs an audit event' do + expect { delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", user) }.to change { SecurityEvent.count }.by(1) + end + + context 'when the pipeline has jobs' do + let!(:pipeline) do + create(:ci_pipeline, project: project, sha: project.commit.id, + ref: project.default_branch, user: user) + end + + let!(:build) { create(:ci_build, project: project, pipeline: pipeline) } + + it 'deletes associated jobs' do + delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", user) + + expect(response).to have_gitlab_http_status(204) + expect { build.reload }.to raise_error(ActiveRecord::RecordNotFound) + end + end + end + + context 'unauthorized user' do + it 'should not return a project pipeline' do + get api("/projects/#{project.id}/pipelines/#{pipeline.id}", non_member) + + expect(response).to have_gitlab_http_status(404) + expect(json_response['message']).to eq '404 Project Not Found' + end + end + end + describe 'POST /projects/:id/pipelines/:pipeline_id/retry' do context 'authorized user' do let!(:pipeline) do -- cgit v1.2.1 From afad9211b30054a312530fe4409e349c03e383f3 Mon Sep 17 00:00:00 2001 From: Daniel Gruesso Date: Mon, 12 Nov 2018 15:48:29 +0000 Subject: Remove start server image, clarify instance auth, use fake token. --- .../clusters/runbooks/img/jupyterhub-install.png | Bin 288328 -> 0 bytes doc/user/project/clusters/runbooks/index.md | 9 +++------ 2 files changed, 3 insertions(+), 6 deletions(-) delete mode 100644 doc/user/project/clusters/runbooks/img/jupyterhub-install.png diff --git a/doc/user/project/clusters/runbooks/img/jupyterhub-install.png b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png deleted file mode 100644 index 36c5c24596f..00000000000 Binary files a/doc/user/project/clusters/runbooks/img/jupyterhub-install.png and /dev/null differ diff --git a/doc/user/project/clusters/runbooks/index.md b/doc/user/project/clusters/runbooks/index.md index cb49e39eff2..e1b8dc07b50 100644 --- a/doc/user/project/clusters/runbooks/index.md +++ b/doc/user/project/clusters/runbooks/index.md @@ -75,15 +75,12 @@ Once Ingress has been installed successfully, click the **Install** button next ### 3. Login to JupyterHub and start the server Once JupyterHub has been installed successfully, navigate to the displayed **Jupyter Hostname** URL and click -**Sign in with GitLab**. Authentication is automatically enabled for any user of GitLab server via OAuth2. This +**Sign in with GitLab**. Authentication is automatically enabled for any user of the GitLab instance via OAuth2. This will redirect to GitLab in order to authorize JupyterHub to use your GitLab account. Click **Authorize**. ![authorize jupyter](img/authorize-jupyter.png) -Once the application has been authorized you will taken back to the JupyterHub application. Click **Start My Server** - -![start jupyter](img/jupyter-start.png) - +Once the application has been authorized you will taken back to the JupyterHub application. Click **Start My Server**. The server will take a couple of seconds to start. ### 4. Configure access @@ -104,7 +101,7 @@ The contents on the runbook will be displayed on the right side of the screen. U entries for both your `PRIVATE_TOKEN` and your `PROJECT_ID`. Enter both these values, conserving the single quotes as follows: ```sql -PRIVATE_TOKEN = 'abcdef123456' +PRIVATE_TOKEN = 'n671WNGecHugsdEDPsyo' PROJECT_ID = '1234567' ``` -- cgit v1.2.1 From bffcc5c05790db92bf29e4afd66cdb102e20aeab Mon Sep 17 00:00:00 2001 From: Daniel Gruesso Date: Mon, 12 Nov 2018 15:56:11 +0000 Subject: Upload New File --- .../clusters/runbooks/img/jupyterhub-install.png | Bin 0 -> 288328 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 doc/user/project/clusters/runbooks/img/jupyterhub-install.png diff --git a/doc/user/project/clusters/runbooks/img/jupyterhub-install.png b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png new file mode 100644 index 00000000000..36c5c24596f Binary files /dev/null and b/doc/user/project/clusters/runbooks/img/jupyterhub-install.png differ -- cgit v1.2.1 From cc451b5402c7ebe8b44d056ef47db9fc6aec14e6 Mon Sep 17 00:00:00 2001 From: Daniel Gruesso Date: Mon, 12 Nov 2018 15:56:27 +0000 Subject: Delete jupyter-start.png --- .../project/clusters/runbooks/img/jupyter-start.png | Bin 54270 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 doc/user/project/clusters/runbooks/img/jupyter-start.png diff --git a/doc/user/project/clusters/runbooks/img/jupyter-start.png b/doc/user/project/clusters/runbooks/img/jupyter-start.png deleted file mode 100644 index 434c37b2d38..00000000000 Binary files a/doc/user/project/clusters/runbooks/img/jupyter-start.png and /dev/null differ -- cgit v1.2.1 From 99203bfe23975b8dbbaa5daa613fbc90fd39178f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Mon, 12 Nov 2018 19:18:57 +0100 Subject: Destroy pipeline in service Move all logic for destroying a Pipeline into a service so it's easily reusable. --- app/policies/project_policy.rb | 1 + app/services/ci/destroy_pipeline_service.rb | 13 +++++ lib/api/pipelines.rb | 8 +-- spec/requests/api/pipelines_spec.rb | 21 ++++---- spec/services/ci/destroy_pipeline_service_spec.rb | 66 +++++++++++++++++++++++ 5 files changed, 93 insertions(+), 16 deletions(-) create mode 100644 app/services/ci/destroy_pipeline_service.rb create mode 100644 spec/services/ci/destroy_pipeline_service_spec.rb diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 1c082945299..221826121da 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -144,6 +144,7 @@ class ProjectPolicy < BasePolicy enable :destroy_merge_request enable :destroy_issue enable :remove_pages + enable :destroy_pipeline enable :set_issue_iid enable :set_issue_created_at diff --git a/app/services/ci/destroy_pipeline_service.rb b/app/services/ci/destroy_pipeline_service.rb new file mode 100644 index 00000000000..059e871f20e --- /dev/null +++ b/app/services/ci/destroy_pipeline_service.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Ci + class DestroyPipelineService < BaseService + def execute(pipeline) + return false unless can?(current_user, :destroy_pipeline, project) + + AuditEventService.new(current_user, pipeline).security_event + + pipeline.destroy + end + end +end diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index d4bd4e71343..39d693bb9e9 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -89,11 +89,11 @@ module API requires :pipeline_id, type: Integer, desc: 'The pipeline ID' end delete ':id/pipelines/:pipeline_id' do - authorize! :admin_pipeline, user_project + authorize! :destroy_pipeline, user_project - AuditEventService.new(current_user, user_project).security_event - - destroy_conditionally!(pipeline) + destroy_conditionally!(pipeline) do + ::Ci::DestroyPipelineService.new(user_project, current_user).execute(pipeline) + end end desc 'Retry builds in the pipeline' do diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index 68de3068568..e786b7531a9 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -440,34 +440,31 @@ describe API::Pipelines do describe 'DELETE /projects/:id/pipelines/:pipeline_id' do context 'authorized user' do - it 'deletes the pipeline' do - delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", user) + let(:owner) { project.owner } + + it 'destroys the pipeline' do + delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", owner) expect(response).to have_gitlab_http_status(204) expect { pipeline.reload }.to raise_error(ActiveRecord::RecordNotFound) end it 'returns 404 when it does not exist' do - delete api("/projects/#{project.id}/pipelines/123456", user) + delete api("/projects/#{project.id}/pipelines/123456", owner) expect(response).to have_gitlab_http_status(404) expect(json_response['message']).to eq '404 Not found' end it 'logs an audit event' do - expect { delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", user) }.to change { SecurityEvent.count }.by(1) + expect { delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", owner) }.to change { SecurityEvent.count }.by(1) end context 'when the pipeline has jobs' do - let!(:pipeline) do - create(:ci_pipeline, project: project, sha: project.commit.id, - ref: project.default_branch, user: user) - end - let!(:build) { create(:ci_build, project: project, pipeline: pipeline) } - it 'deletes associated jobs' do - delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", user) + it 'destroys associated jobs' do + delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", owner) expect(response).to have_gitlab_http_status(204) expect { build.reload }.to raise_error(ActiveRecord::RecordNotFound) @@ -476,7 +473,7 @@ describe API::Pipelines do end context 'unauthorized user' do - it 'should not return a project pipeline' do + it 'should return a 404' do get api("/projects/#{project.id}/pipelines/#{pipeline.id}", non_member) expect(response).to have_gitlab_http_status(404) diff --git a/spec/services/ci/destroy_pipeline_service_spec.rb b/spec/services/ci/destroy_pipeline_service_spec.rb new file mode 100644 index 00000000000..9f449dd73e8 --- /dev/null +++ b/spec/services/ci/destroy_pipeline_service_spec.rb @@ -0,0 +1,66 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe ::Ci::DestroyPipelineService do + let(:project) { create(:project) } + let!(:pipeline) { create(:ci_pipeline, project: project) } + + subject { described_class.new(project, user).execute(pipeline) } + + context 'user is owner' do + let(:user) { project.owner } + + it 'destroys the pipeline' do + subject + + expect { pipeline.reload }.to raise_error(ActiveRecord::RecordNotFound) + end + + it 'logs an audit event' do + expect { subject }.to change { SecurityEvent.count }.by(1) + end + + context 'when the pipeline has jobs' do + let!(:build) { create(:ci_build, project: project, pipeline: pipeline) } + + it 'destroys associated jobs' do + subject + + expect { build.reload }.to raise_error(ActiveRecord::RecordNotFound) + end + + it 'destroys associated stages' do + stages = pipeline.stages + + subject + + expect(stages).to all(raise_error(ActiveRecord::RecordNotFound)) + end + + context 'when job has artifacts' do + let!(:artifact) { create(:ci_job_artifact, :archive, job: build) } + + it 'destroys associated artifacts' do + subject + + expect { artifact.reload }.to raise_error(ActiveRecord::RecordNotFound) + end + end + end + end + + context 'user is not owner' do + let(:user) { create(:user) } + + it 'returns false' do + is_expected.to eq(false) + end + + it 'does not destroy the pipeline' do + subject + + expect { pipeline.reload }.not_to raise_error + end + end +end -- cgit v1.2.1 From de1a3a3e18c452d0eeffafdc5e7a8a555ef582f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Mon, 12 Nov 2018 19:23:33 +0100 Subject: Add CHANGELOG entry --- .../41875-allow-pipelines-to-be-deleted-by-project-owners.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/41875-allow-pipelines-to-be-deleted-by-project-owners.yml diff --git a/changelogs/unreleased/41875-allow-pipelines-to-be-deleted-by-project-owners.yml b/changelogs/unreleased/41875-allow-pipelines-to-be-deleted-by-project-owners.yml new file mode 100644 index 00000000000..0662ff6f523 --- /dev/null +++ b/changelogs/unreleased/41875-allow-pipelines-to-be-deleted-by-project-owners.yml @@ -0,0 +1,5 @@ +--- +title: Allow deleting a Pipeline via the API. +merge_request: 22988 +author: +type: added -- cgit v1.2.1 From 22aa5c5594745fe0ea92716f12b4a001b934f5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Mon, 12 Nov 2018 19:40:56 +0100 Subject: Add docs for deleting a pipeline via API --- doc/api/pipelines.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/api/pipelines.md b/doc/api/pipelines.md index 574be52801c..c91875fd2db 100644 --- a/doc/api/pipelines.md +++ b/doc/api/pipelines.md @@ -93,6 +93,23 @@ Example of response } ``` +## Delete a pipeline + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22988) in GitLab 11.6 + +``` +DELETE /projects/:id/pipelines/:pipeline_id +``` + +| Attribute | Type | Required | Description | +|------------|---------|----------|---------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `pipeline_id` | integer | yes | The ID of a pipeline | + +``` +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --request "DELETE" "https://gitlab.example.com/api/v4/projects/1/pipelines/46" +``` + ## Create a new pipeline > [Introduced][ce-7209] in GitLab 8.14 -- cgit v1.2.1 From ddda4f5bd072b043a964c861d6950df20c5a3c4d Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Mon, 12 Nov 2018 15:58:32 -0500 Subject: include ci-yml in body --- doc/user/project/clusters/index.md | 3 +- .../project/clusters/serverless/img/dns-entry.png | Bin 103867 -> 56600 bytes doc/user/project/clusters/serverless/index.md | 56 ++++++++++++++++----- .../serverless/serverless_ci_yml_template.yml | 25 --------- 4 files changed, 46 insertions(+), 38 deletions(-) delete mode 100644 doc/user/project/clusters/serverless/serverless_ci_yml_template.yml diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index 9b9864abe3a..ebbabf4e997 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -227,7 +227,7 @@ twice, which can lead to confusion during deployments. | [Prometheus](https://prometheus.io/docs/introduction/overview/) | 10.4+ | Prometheus is an open-source monitoring and alerting system useful to supervise your deployed applications. | [stable/prometheus](https://github.com/helm/charts/tree/master/stable/prometheus) | | [GitLab Runner](https://docs.gitlab.com/runner/) | 10.6+ | GitLab Runner is the open source project that is used to run your jobs and send the results back to GitLab. It is used in conjunction with [GitLab CI/CD](https://about.gitlab.com/features/gitlab-ci-cd/), the open-source continuous integration service included with GitLab that coordinates the jobs. When installing the GitLab Runner via the applications, it will run in **privileged mode** by default. Make sure you read the [security implications](#security-implications) before doing so. | [runner/gitlab-runner](https://gitlab.com/charts/gitlab-runner) | | [JupyterHub](http://jupyter.org/) | 11.0+ | [JupyterHub](https://jupyterhub.readthedocs.io/en/stable/) is a multi-user service for managing notebooks across a team. [Jupyter Notebooks](https://jupyter-notebook.readthedocs.io/en/latest/) provide a web-based interactive programming environment used for data analysis, visualization, and machine learning. We use [this](https://gitlab.com/gitlab-org/jupyterhub-user-image/blob/master/Dockerfile) custom Jupyter image that installs additional useful packages on top of the base Jupyter. You will also see ready-to-use DevOps Runbooks built with Nurtch's [Rubix library](https://github.com/amit1rrr/rubix). More information on creating executable runbooks can be found at [Nurtch Documentation](http://docs.nurtch.com/en/latest). **Note**: Authentication will be enabled for any user of the GitLab server via OAuth2. HTTPS will be supported in a future release. | [jupyter/jupyterhub](https://jupyterhub.github.io/helm-chart/) | -| [Knative](https://cloud.google.com/knative) | 0.1.2 | Knative provides a platform to create, deploy, and manage serverless workloads from a Kubernetes cluster. It is used in conjunction with, and includes [Istio](https://istio.io) to provide an external IP address for all programs hosted by Knative. You will be prompted to enter a wildcard domain where your applications will be exposed. Configure your DNS server to use the external IP address for that domain. For any application created and installed, they will be accessible as ... **Note**: This will require your kubernetes cluster to have RBAC enabled. | [knative/knative](https://storage.googleapis.com/triggermesh-charts) +| [Knative](https://cloud.google.com/knative) | 0.1.2 | Knative provides a platform to create, deploy, and manage serverless workloads from a Kubernetes cluster. It is used in conjunction with, and includes [Istio](https://istio.io) to provide an external IP address for all programs hosted by Knative. You will be prompted to enter a wildcard domain where your applications will be exposed. Configure your DNS server to use the external IP address for that domain. For any application created and installed, they will be accessible as `..`. **Note**: This will require your kubernetes cluster to have RBAC enabled. | [knative/knative](https://storage.googleapis.com/triggermesh-charts) ## Getting the external IP address @@ -284,6 +284,7 @@ kubectl get svc --all-namespaces -o jsonpath='{range.items[?(@.status.loadBalanc ``` > **Note**: Some Kubernetes clusters return a hostname instead, like [Amazon EKS](https://aws.amazon.com/eks/). For these platforms, run: + > ```bash > kubectl get service ingress-nginx-ingress-controller -n gitlab-managed-apps -o jsonpath="{.status.loadBalancer.ingress[0].hostname}". > ``` diff --git a/doc/user/project/clusters/serverless/img/dns-entry.png b/doc/user/project/clusters/serverless/img/dns-entry.png index f72ae57718d..2e7655c6041 100644 Binary files a/doc/user/project/clusters/serverless/img/dns-entry.png and b/doc/user/project/clusters/serverless/img/dns-entry.png differ diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index c67ee25c109..3099504ce4a 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -22,15 +22,45 @@ To run Knative on Gitlab, you will need: The simplest way to get started is to add a cluster using [GitLab's GKE integration](https://docs.gitlab.com/ee/user/project/clusters/#adding-and-creating-a-new-gke-cluster-via-gitlab). GitLab recommends 1. **Helm Tiller:** Helm is a package manager for Kubernetes and is required to install - all the other applications. It is installed in its own pod inside the cluster which - can run the helm CLI in a safe environment. + all the other applications. 1. **Domain Name:** Knative will provide its own load balancer using Istio. It will provide an external IP address for all the applications served by Knative. You will be prompted to enter a wildcard domain where your applications will be served. Configure your DNS server to use the external IP address for that domain. -1. **Serverless `gitlab-ci.yml` Template:** GitLab uses the [TriggerMesh CLI](https://github.com/triggermesh/tm), - a serverless resource management utilty to work with knative objects. The `gitlab-ci.yml` template uses it - to build and deploy knative services and functions. [Access the template here](serverless_ci_yml_template.yml). +1. **Serverless `gitlab-ci.yml` Template:** GitLab uses [Kaniko](https://github.com/GoogleContainerTools/kaniko) + to build the application and the [TriggerMesh CLI](https://github.com/triggermesh/tm), to simplify the + deployment of knative services and functions. + + Add the following `.gitlab-ci.yml` to the root of your repository (you may skip this step if using the sample + [Knative Ruby App](https://gitlab.com/knative-examples/knative-ruby-app) mentioned below). + + ```yaml + stages: + - build + - deploy + + build: + stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] + only: + - master + script: + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json + - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE + + deploy: + stage: deploy + image: gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 + only: + - master + environment: production + script: + - echo "$CI_REGISTRY_IMAGE" + - tm -n "$KUBE_NAMESPACE" --config "$KUBECONFIG" deploy service "$CI_PROJECT_NAME" --from-image "$CI_REGISTRY_IMAGE" --wait + ``` + 1. **Docker File:** Knative requires a docker file in order to build your application. It should be included at the root of your project's repo. @@ -54,16 +84,18 @@ You may download the sample [Knative Ruby App](https://gitlab.com/knative-exampl kubectl get svc --namespace=istio-system knative-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` -1. The ingress is now available at this address and will route incoming requests to the proper service based on the DNS - name in the request. To support this, a wildcard DNS A record should be created for the desired domain name. - - ![dns entry](img/dns-entry.png) + Output: -## Deploying the GitLab Runner (optional) + ```bash + 35.161.143.124 my-machine-name:~ my-user$ + ``` -If the project is on GitLab.com, free shared runners are available and you do not have to deploy one. If a project specific runner is desired, or there are no shared runners, it is easy to deploy one. +1. The ingress is now available at this address and will route incoming requests to the proper service based on the DNS + name in the request. To support this, a wildcard DNS A record should be created for the desired domain name. For example, + if your Knative base domain is `knative.example.com` then you need to create an A record with domain `*.knative.example.com` + pointing the ip address of the ingress. -Simply click on the "**Install**" button for the GitLab Runner. It is important to note that the runner deployed is set as privileged, which means it essentially has root access to the underlying machine. This is required to build docker images, and so is on by default. + ![dns entry](img/dns-entry.png) ## Deploy the application with Knative diff --git a/doc/user/project/clusters/serverless/serverless_ci_yml_template.yml b/doc/user/project/clusters/serverless/serverless_ci_yml_template.yml deleted file mode 100644 index 31f68f223ca..00000000000 --- a/doc/user/project/clusters/serverless/serverless_ci_yml_template.yml +++ /dev/null @@ -1,25 +0,0 @@ -stages: - - build - - deploy - -variables: - DOCKER_DRIVER: overlay2 - -build: - stage: build - image: docker:stable-git - services: - - docker:stable-dind - before_script: - - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY" - script: - - docker build --pull -t "$CI_REGISTRY_IMAGE" . - - docker push "$CI_REGISTRY_IMAGE" - -deploy: - stage: deploy - image: gcr.io/triggermesh/tm@sha256:e3ee74db94d215bd297738d93577481f3e4db38013326c90d57f873df7ab41d5 - environment: production - script: - - echo "$CI_REGISTRY_IMAGE" - - tm -n "$KUBE_NAMESPACE" --config "$KUBECONFIG" deploy service "$CI_PROJECT_NAME" --from-image "$CI_REGISTRY_IMAGE" --wait -- cgit v1.2.1 From 632d9b26935458259ddcf0c56b0f6d098afd9337 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Mon, 12 Nov 2018 10:38:39 +0900 Subject: Drop default value on status column in deployments table --- ...2103239_drop_default_value_on_status_deployments.rb | 18 ++++++++++++++++++ db/schema.rb | 5 +++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20181112103239_drop_default_value_on_status_deployments.rb diff --git a/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb new file mode 100644 index 00000000000..9663095c55f --- /dev/null +++ b/db/migrate/20181112103239_drop_default_value_on_status_deployments.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class DropDefaultValueOnStatusDeployments < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + DEPLOYMENT_STATUS_SUCCESS = 2 # Equivalent to Deployment.state_machine.states['success'].value + + disable_ddl_transaction! + + def up + change_column_default :deployments, :status, :nil + end + + def down + change_column_default :deployments, :status, DEPLOYMENT_STATUS_SUCCESS + end +end diff --git a/db/schema.rb b/db/schema.rb index 56137caf1d7..1c941649e2d 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: 20181107054254) do +ActiveRecord::Schema.define(version: 20181112103239) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -836,7 +836,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime "created_at" t.datetime "updated_at" t.string "on_stop" - t.integer "status", limit: 2, default: 2, null: false + t.integer "status", limit: 2, null: false t.datetime_with_timezone "finished_at" end @@ -1865,6 +1865,7 @@ ActiveRecord::Schema.define(version: 20181107054254) 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", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree create_table "releases", force: :cascade do |t| -- cgit v1.2.1 From b3795b771486b80876d6115d583c9ec2a54177cd Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Tue, 13 Nov 2018 15:24:12 +0900 Subject: Remove unnecessary line in schema.rb --- db/schema.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/db/schema.rb b/db/schema.rb index 1c941649e2d..268901baece 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1865,7 +1865,6 @@ ActiveRecord::Schema.define(version: 20181112103239) 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", ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree create_table "releases", force: :cascade do |t| -- cgit v1.2.1 From 2da77592717cea469785381b15c53b1eafdc2afa Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Sun, 28 Oct 2018 01:24:30 +0800 Subject: Apply new search bar on issues and merge request dashboards --- app/assets/javascripts/pages/dashboard/issues/index.js | 10 ++++++++-- app/assets/javascripts/pages/dashboard/merge_requests/index.js | 10 ++++++++-- app/controllers/dashboard_controller.rb | 7 ++++--- app/helpers/dashboard_helper.rb | 4 ++-- app/helpers/search_helper.rb | 5 +++-- app/views/dashboard/issues.html.haml | 2 +- app/views/dashboard/merge_requests.html.haml | 2 +- app/views/shared/issuable/_search_bar.html.haml | 2 +- 8 files changed, 28 insertions(+), 14 deletions(-) diff --git a/app/assets/javascripts/pages/dashboard/issues/index.js b/app/assets/javascripts/pages/dashboard/issues/index.js index c4901dd1cb6..9055738f86e 100644 --- a/app/assets/javascripts/pages/dashboard/issues/index.js +++ b/app/assets/javascripts/pages/dashboard/issues/index.js @@ -1,7 +1,13 @@ import projectSelect from '~/project_select'; -import initLegacyFilters from '~/init_legacy_filters'; +import initFilteredSearch from '~/pages/search/init_filtered_search'; +import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; +import { FILTERED_SEARCH } from '~/pages/constants'; document.addEventListener('DOMContentLoaded', () => { + initFilteredSearch({ + page: FILTERED_SEARCH.ISSUES, + filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, + }); + projectSelect(); - initLegacyFilters(); }); diff --git a/app/assets/javascripts/pages/dashboard/merge_requests/index.js b/app/assets/javascripts/pages/dashboard/merge_requests/index.js index c4901dd1cb6..9055738f86e 100644 --- a/app/assets/javascripts/pages/dashboard/merge_requests/index.js +++ b/app/assets/javascripts/pages/dashboard/merge_requests/index.js @@ -1,7 +1,13 @@ import projectSelect from '~/project_select'; -import initLegacyFilters from '~/init_legacy_filters'; +import initFilteredSearch from '~/pages/search/init_filtered_search'; +import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; +import { FILTERED_SEARCH } from '~/pages/constants'; document.addEventListener('DOMContentLoaded', () => { + initFilteredSearch({ + page: FILTERED_SEARCH.ISSUES, + filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, + }); + projectSelect(); - initLegacyFilters(); }); diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index c032fb2efb5..714f0c0b545 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -5,10 +5,11 @@ class DashboardController < Dashboard::ApplicationController include MergeRequestsAction FILTER_PARAMS = [ - :author_id, - :assignee_id, + :author_username, + :assignee_username, :milestone_title, - :label_name + :label_name, + :my_reaction_emoji ].freeze before_action :event_filter, only: :activity diff --git a/app/helpers/dashboard_helper.rb b/app/helpers/dashboard_helper.rb index 463f4145bdd..d90ef8903a7 100644 --- a/app/helpers/dashboard_helper.rb +++ b/app/helpers/dashboard_helper.rb @@ -2,11 +2,11 @@ module DashboardHelper def assigned_issues_dashboard_path - issues_dashboard_path(assignee_id: current_user.id) + issues_dashboard_path(assignee_username: current_user.username) end def assigned_mrs_dashboard_path - merge_requests_dashboard_path(assignee_id: current_user.id) + merge_requests_dashboard_path(assignee_username: current_user.username) end def dashboard_nav_links diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 4f9e1322b56..70c02107b34 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -163,10 +163,11 @@ module SearchHelper if @project.present? opts[:data]['project-id'] = @project.id opts[:data]['base-endpoint'] = project_path(@project) - else - # Group context + elsif @group.present? opts[:data]['group-id'] = @group.id opts[:data]['base-endpoint'] = group_canonical_path(@group) + else + opts[:data]['base-endpoint'] = root_dashboard_path end opts diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index 832ba877558..ca1ad2cd691 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -16,7 +16,7 @@ .nav-controls = render 'shared/issuable/feed_buttons' -= render 'shared/issuable/filter', type: :issues += render 'shared/issuable/search_bar', type: :issues - if current_user && @no_filters_set = render 'shared/dashboard/no_filter_selected' diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index fba8d1cf667..25c2dd6308e 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -12,7 +12,7 @@ .top-area = render 'shared/issuable/nav', type: :merge_requests, display_count: !@no_filters_set -= render 'shared/issuable/filter', type: :merge_requests += render 'shared/issuable/search_bar', type: :merge_requests - if current_user && @no_filters_set = render 'shared/dashboard/no_filter_selected' diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index 95f32bd0180..bab09838489 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -1,7 +1,7 @@ - type = local_assigns.fetch(:type) - board = local_assigns.fetch(:board, nil) - block_css_class = type != :boards_modal ? 'row-content-block second-block' : '' -- full_path = @project.present? ? @project.full_path : @group.full_path +- full_path = if @project.present? then @project.full_path elsif @group.present? then @group.full_path else request.path end - user_can_admin_list = board && can?(current_user, :admin_list, board.parent) - show_sorting_dropdown = local_assigns.fetch(:show_sorting_dropdown, true) -- cgit v1.2.1 From ee4a7811a0cdb349e4a304f01db58292ebeedbdf Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Sun, 28 Oct 2018 01:26:26 +0800 Subject: Remove unused legacy filter init --- app/assets/javascripts/init_legacy_filters.js | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 app/assets/javascripts/init_legacy_filters.js diff --git a/app/assets/javascripts/init_legacy_filters.js b/app/assets/javascripts/init_legacy_filters.js deleted file mode 100644 index b6ff97d1279..00000000000 --- a/app/assets/javascripts/init_legacy_filters.js +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable no-new */ -import LabelsSelect from './labels_select'; -import subscriptionSelect from './subscription_select'; -import UsersSelect from './users_select'; -import issueStatusSelect from './issue_status_select'; -import MilestoneSelect from './milestone_select'; - -export default () => { - new UsersSelect(); - new LabelsSelect(); - new MilestoneSelect(); - issueStatusSelect(); - subscriptionSelect(); -}; -- cgit v1.2.1 From 91f235df08a08d45ec716ddca652ccba226abb5d Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Mon, 29 Oct 2018 11:03:43 +0800 Subject: Fix tests --- app/assets/javascripts/search_autocomplete.js | 9 ++- app/controllers/dashboard_controller.rb | 3 + app/controllers/root_controller.rb | 4 +- app/helpers/application_helper.rb | 2 + app/views/dashboard/issues.html.haml | 2 +- app/views/dashboard/merge_requests.html.haml | 2 +- spec/controllers/root_controller_spec.rb | 4 +- spec/features/atom/dashboard_issues_spec.rb | 12 ++-- spec/features/dashboard/issuables_counter_spec.rb | 4 +- spec/features/dashboard/issues_filter_spec.rb | 31 +++------ spec/features/dashboard/issues_spec.rb | 27 ++------ spec/features/dashboard/label_filter_spec.rb | 15 +++-- spec/features/dashboard/merge_requests_spec.rb | 15 ++--- spec/features/dashboard/milestone_filter_spec.rb | 77 ---------------------- spec/features/issues/user_sorts_issues_spec.rb | 2 +- .../user_sorts_merge_requests_spec.rb | 4 +- .../search/user_uses_header_search_field_spec.rb | 16 +++-- spec/javascripts/search_autocomplete_spec.js | 8 +-- spec/support/helpers/filter_item_select_helper.rb | 19 ------ 19 files changed, 73 insertions(+), 183 deletions(-) delete mode 100644 spec/features/dashboard/milestone_filter_spec.rb delete mode 100644 spec/support/helpers/filter_item_select_helper.rb diff --git a/app/assets/javascripts/search_autocomplete.js b/app/assets/javascripts/search_autocomplete.js index 17def77b2d7..0a4583b5861 100644 --- a/app/assets/javascripts/search_autocomplete.js +++ b/app/assets/javascripts/search_autocomplete.js @@ -253,7 +253,6 @@ export class SearchAutocomplete { } getCategoryContents() { - const userId = gon.current_user_id; const userName = gon.current_username; const { projectOptions, groupOptions, dashboardOptions } = gl; @@ -279,21 +278,21 @@ export class SearchAutocomplete { const issueItems = [ { text: s__('SearchAutocomplete|Issues assigned to me'), - url: `${issuesPath}/?assignee_id=${userId}`, + url: `${issuesPath}/?assignee_username=${userName}`, }, { text: s__("SearchAutocomplete|Issues I've created"), - url: `${issuesPath}/?author_id=${userId}`, + url: `${issuesPath}/?author_username=${userName}`, }, ]; const mergeRequestItems = [ { text: s__('SearchAutocomplete|Merge requests assigned to me'), - url: `${mrPath}/?assignee_id=${userId}`, + url: `${mrPath}/?assignee_username=${userName}`, }, { text: s__("SearchAutocomplete|Merge requests I've created"), - url: `${mrPath}/?author_id=${userId}`, + url: `${mrPath}/?author_username=${userName}`, }, ]; diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 714f0c0b545..5076c3da324 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -5,6 +5,9 @@ class DashboardController < Dashboard::ApplicationController include MergeRequestsAction FILTER_PARAMS = [ + # author_id and assignee_id are kept so old RSS links still work + :author_id, + :assignee_id, :author_username, :assignee_username, :milestone_title, diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index ebf70f25bda..7b6657e1196 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -45,9 +45,9 @@ class RootController < Dashboard::ProjectsController when 'todos' redirect_to(dashboard_todos_path) when 'issues' - redirect_to(issues_dashboard_path(assignee_id: current_user.id)) + redirect_to(issues_dashboard_path(assignee_username: current_user.username)) when 'merge_requests' - redirect_to(merge_requests_dashboard_path(assignee_id: current_user.id)) + redirect_to(merge_requests_dashboard_path(assignee_username: current_user.username)) end end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 4f91e3e4117..2fb94de8fab 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -178,7 +178,9 @@ module ApplicationHelper scope: params[:scope], milestone_title: params[:milestone_title], assignee_id: params[:assignee_id], + assignee_username: params[:assignee_username], author_id: params[:author_id], + author_username: params[:author_username], search: params[:search], label_name: params[:label_name] } diff --git a/app/views/dashboard/issues.html.haml b/app/views/dashboard/issues.html.haml index ca1ad2cd691..fdd5c19d562 100644 --- a/app/views/dashboard/issues.html.haml +++ b/app/views/dashboard/issues.html.haml @@ -1,6 +1,6 @@ - @hide_top_links = true - page_title _("Issues") -- @breadcrumb_link = issues_dashboard_path(assignee_id: current_user.id) +- @breadcrumb_link = issues_dashboard_path(assignee_username: current_user.username) = content_for :meta_tags do = auto_discovery_link_tag(:atom, safe_params.merge(rss_url_options).to_h, title: "#{current_user.name} issues") diff --git a/app/views/dashboard/merge_requests.html.haml b/app/views/dashboard/merge_requests.html.haml index 25c2dd6308e..77cfa1271df 100644 --- a/app/views/dashboard/merge_requests.html.haml +++ b/app/views/dashboard/merge_requests.html.haml @@ -1,6 +1,6 @@ - @hide_top_links = true - page_title _("Merge Requests") -- @breadcrumb_link = merge_requests_dashboard_path(assignee_id: current_user.id) +- @breadcrumb_link = merge_requests_dashboard_path(assignee_username: current_user.username) .page-title-holder %h1.page-title= _('Merge Requests') diff --git a/spec/controllers/root_controller_spec.rb b/spec/controllers/root_controller_spec.rb index 7688538a468..995f803d757 100644 --- a/spec/controllers/root_controller_spec.rb +++ b/spec/controllers/root_controller_spec.rb @@ -98,7 +98,7 @@ describe RootController do it 'redirects to their assigned issues' do get :index - expect(response).to redirect_to issues_dashboard_path(assignee_id: user.id) + expect(response).to redirect_to issues_dashboard_path(assignee_username: user.username) end end @@ -110,7 +110,7 @@ describe RootController do it 'redirects to their assigned merge requests' do get :index - expect(response).to redirect_to merge_requests_dashboard_path(assignee_id: user.id) + expect(response).to redirect_to merge_requests_dashboard_path(assignee_username: user.username) end end diff --git a/spec/features/atom/dashboard_issues_spec.rb b/spec/features/atom/dashboard_issues_spec.rb index bd4c00d97b1..5fa1a26f1a6 100644 --- a/spec/features/atom/dashboard_issues_spec.rb +++ b/spec/features/atom/dashboard_issues_spec.rb @@ -25,35 +25,35 @@ describe "Dashboard Issues Feed" do it "renders atom feed via personal access token" do personal_access_token = create(:personal_access_token, user: user) - visit issues_dashboard_path(:atom, private_token: personal_access_token.token, assignee_id: user.id) + visit issues_dashboard_path(:atom, private_token: personal_access_token.token, assignee_username: user.username) expect(response_headers['Content-Type']).to have_content('application/atom+xml') expect(body).to have_selector('title', text: "#{user.name} issues") end it "renders atom feed via feed token" do - visit issues_dashboard_path(:atom, feed_token: user.feed_token, assignee_id: user.id) + visit issues_dashboard_path(:atom, feed_token: user.feed_token, assignee_username: user.username) expect(response_headers['Content-Type']).to have_content('application/atom+xml') expect(body).to have_selector('title', text: "#{user.name} issues") end it "renders atom feed with url parameters" do - visit issues_dashboard_path(:atom, feed_token: user.feed_token, state: 'opened', assignee_id: user.id) + visit issues_dashboard_path(:atom, feed_token: user.feed_token, state: 'opened', assignee_username: user.username) link = find('link[type="application/atom+xml"]') params = CGI.parse(URI.parse(link[:href]).query) expect(params).to include('feed_token' => [user.feed_token]) expect(params).to include('state' => ['opened']) - expect(params).to include('assignee_id' => [user.id.to_s]) + expect(params).to include('assignee_username' => [user.username.to_s]) end context "issue with basic fields" do let!(:issue2) { create(:issue, author: user, assignees: [assignee], project: project2, description: 'test desc') } it "renders issue fields" do - visit issues_dashboard_path(:atom, feed_token: user.feed_token, assignee_id: assignee.id) + visit issues_dashboard_path(:atom, feed_token: user.feed_token, assignee_username: assignee.username) entry = find(:xpath, "//feed/entry[contains(summary/text(),'#{issue2.title}')]") @@ -76,7 +76,7 @@ describe "Dashboard Issues Feed" do end it "renders issue label and milestone info" do - visit issues_dashboard_path(:atom, feed_token: user.feed_token, assignee_id: assignee.id) + visit issues_dashboard_path(:atom, feed_token: user.feed_token, assignee_username: assignee.username) entry = find(:xpath, "//feed/entry[contains(summary/text(),'#{issue1.title}')]") diff --git a/spec/features/dashboard/issuables_counter_spec.rb b/spec/features/dashboard/issuables_counter_spec.rb index b431f72fcc9..fbc2e5cc3d3 100644 --- a/spec/features/dashboard/issuables_counter_spec.rb +++ b/spec/features/dashboard/issuables_counter_spec.rb @@ -45,11 +45,11 @@ describe 'Navigation bar counter', :use_clean_rails_memory_store_caching do end def issues_path - issues_dashboard_path(assignee_id: user.id) + issues_dashboard_path(assignee_username: user.username) end def merge_requests_path - merge_requests_dashboard_path(assignee_id: user.id) + merge_requests_dashboard_path(assignee_username: user.username) end def expect_counters(issuable_type, count) diff --git a/spec/features/dashboard/issues_filter_spec.rb b/spec/features/dashboard/issues_filter_spec.rb index 95e2610dd4a..c0434f767bb 100644 --- a/spec/features/dashboard/issues_filter_spec.rb +++ b/spec/features/dashboard/issues_filter_spec.rb @@ -2,6 +2,7 @@ require 'spec_helper' describe 'Dashboard Issues filtering', :js do include Spec::Support::Helpers::Features::SortingHelpers + include FilteredSearchHelpers let(:user) { create(:user) } let(:project) { create(:project) } @@ -25,27 +26,21 @@ describe 'Dashboard Issues filtering', :js do context 'filtering by milestone' do it 'shows all issues with no milestone' do - show_milestone_dropdown - - click_link 'No Milestone' + input_filtered_search("milestone:none") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) end it 'shows all issues with the selected milestone' do - show_milestone_dropdown - - page.within '.dropdown-content' do - click_link milestone.title - end + input_filtered_search("milestone:%\"#{milestone.title}\"") expect(page).to have_issuable_counts(open: 1, closed: 0, all: 1) expect(page).to have_selector('.issue', count: 1) end it 'updates atom feed link' do - visit_issues(milestone_title: '', assignee_id: user.id) + visit_issues(milestone_title: '', assignee_username: user.username) link = find('.nav-controls a[title="Subscribe to RSS feed"]') params = CGI.parse(URI.parse(link[:href]).query) @@ -54,10 +49,10 @@ describe 'Dashboard Issues filtering', :js do expect(params).to include('feed_token' => [user.feed_token]) expect(params).to include('milestone_title' => ['']) - expect(params).to include('assignee_id' => [user.id.to_s]) + expect(params).to include('assignee_username' => [user.username.to_s]) expect(auto_discovery_params).to include('feed_token' => [user.feed_token]) expect(auto_discovery_params).to include('milestone_title' => ['']) - expect(auto_discovery_params).to include('assignee_id' => [user.id.to_s]) + expect(auto_discovery_params).to include('assignee_username' => [user.username.to_s]) end end @@ -66,10 +61,7 @@ describe 'Dashboard Issues filtering', :js do let!(:label_link) { create(:label_link, label: label, target: issue) } it 'shows all issues with the selected label' do - page.within '.labels-filter' do - find('.dropdown').click - click_link label.title - end + input_filtered_search("label:~#{label.title}") page.within 'ul.content-list' do expect(page).to have_content issue.title @@ -80,12 +72,12 @@ describe 'Dashboard Issues filtering', :js do context 'sorting' do before do - visit_issues(assignee_id: user.id) + visit_issues(assignee_username: user.username) end it 'remembers last sorting value' do sort_by('Created date') - visit_issues(assignee_id: user.id) + visit_issues(assignee_username: user.username) expect(find('.issues-filters')).to have_content('Created date') end @@ -98,11 +90,6 @@ describe 'Dashboard Issues filtering', :js do end end - def show_milestone_dropdown - click_button 'Milestone' - expect(page).to have_selector('.dropdown-content', visible: true) - end - def visit_issues(*args) visit issues_dashboard_path(*args) end diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index 4ae062f242a..9957bec0f0b 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -1,6 +1,8 @@ require 'spec_helper' RSpec.describe 'Dashboard Issues' do + include FilteredSearchHelpers + let(:current_user) { create :user } let(:user) { current_user } # Shared examples depend on this being available let!(:public_project) { create(:project, :public) } @@ -14,7 +16,7 @@ RSpec.describe 'Dashboard Issues' do before do [project, project_with_issues_disabled].each { |project| project.add_maintainer(current_user) } sign_in(current_user) - visit issues_dashboard_path(assignee_id: current_user.id) + visit issues_dashboard_path(assignee_username: current_user.username) end describe 'issues' do @@ -24,26 +26,9 @@ RSpec.describe 'Dashboard Issues' do expect(page).not_to have_content(other_issue.title) end - it 'shows checkmark when unassigned is selected for assignee', :js do - find('.js-assignee-search').click - find('li', text: 'Unassigned').click - find('.js-assignee-search').click - - expect(find('li[data-user-id="0"] a.is-active')).to be_visible - end - it 'shows issues when current user is author', :js do - execute_script("document.querySelector('#assignee_id').value=''") - find('.js-author-search', match: :first).click - - expect(find('li[data-user-id="null"] a.is-active')).to be_visible - - find('.dropdown-menu-author li a', match: :first, text: current_user.to_reference).click - find('.js-author-search', match: :first).click - - page.within '.dropdown-menu-user' do - expect(find('.dropdown-menu-author li a.is-active', match: :first, text: current_user.to_reference)).to be_visible - end + reset_filters + input_filtered_search("author:#{current_user.to_reference}") expect(page).to have_content(authored_issue.title) expect(page).to have_content(authored_issue_on_public_project.title) @@ -53,7 +38,7 @@ RSpec.describe 'Dashboard Issues' do it 'state filter tabs work' do find('#state-closed').click - expect(page).to have_current_path(issues_dashboard_url(assignee_id: current_user.id, state: 'closed'), url: true) + expect(page).to have_current_path(issues_dashboard_url(assignee_username: current_user.username, state: 'closed'), url: true) end it_behaves_like "it has an RSS button with current_user's feed token" diff --git a/spec/features/dashboard/label_filter_spec.rb b/spec/features/dashboard/label_filter_spec.rb index 6802974c2ee..2d4659d380f 100644 --- a/spec/features/dashboard/label_filter_spec.rb +++ b/spec/features/dashboard/label_filter_spec.rb @@ -1,6 +1,11 @@ require 'spec_helper' describe 'Dashboard > label filter', :js do + include FilteredSearchHelpers + + let(:filtered_search) { find('.filtered-search') } + let(:filter_dropdown) { find("#js-dropdown-label .filter-dropdown") } + let(:user) { create(:user) } let(:project) { create(:project, name: 'test', namespace: user.namespace) } let(:project2) { create(:project, name: 'test2', path: 'test2', namespace: user.namespace) } @@ -13,17 +18,15 @@ describe 'Dashboard > label filter', :js do sign_in(user) visit issues_dashboard_path + + init_label_search end context 'duplicate labels' do it 'removes duplicate labels' do - page.within('.labels-filter') do - click_button 'Label' - end + filtered_search.send_keys('bu') - page.within('.dropdown-menu-labels') do - expect(page).to have_selector('.dropdown-content a', text: 'bug', count: 1) - end + expect(filter_dropdown).to have_selector('.filter-dropdown-item', text: 'bug', count: 1) end end end diff --git a/spec/features/dashboard/merge_requests_spec.rb b/spec/features/dashboard/merge_requests_spec.rb index f51142f5790..282bf542e77 100644 --- a/spec/features/dashboard/merge_requests_spec.rb +++ b/spec/features/dashboard/merge_requests_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' describe 'Dashboard Merge Requests' do include Spec::Support::Helpers::Features::SortingHelpers - include FilterItemSelectHelper + include FilteredSearchHelpers include ProjectForksHelper let(:current_user) { create :user } @@ -36,7 +36,7 @@ describe 'Dashboard Merge Requests' do context 'no merge requests exist' do it 'shows an empty state' do - visit merge_requests_dashboard_path(assignee_id: current_user.id) + visit merge_requests_dashboard_path(assignee_username: current_user.username) expect(page).to have_selector('.empty-state') end @@ -79,7 +79,7 @@ describe 'Dashboard Merge Requests' do end before do - visit merge_requests_dashboard_path(assignee_id: current_user.id) + visit merge_requests_dashboard_path(assignee_username: current_user.username) end it 'shows assigned merge requests' do @@ -92,8 +92,8 @@ describe 'Dashboard Merge Requests' do end it 'shows authored merge requests', :js do - filter_item_select('Any Assignee', '.js-assignee-search') - filter_item_select(current_user.to_reference, '.js-author-search') + reset_filters + input_filtered_search("author:#{current_user.to_reference}") expect(page).to have_content(authored_merge_request.title) expect(page).to have_content(authored_merge_request_from_fork.title) @@ -104,8 +104,7 @@ describe 'Dashboard Merge Requests' do end it 'shows error message without filter', :js do - filter_item_select('Any Assignee', '.js-assignee-search') - filter_item_select('Any Author', '.js-author-search') + reset_filters expect(page).to have_content('Please select at least one filter to see results') end @@ -113,7 +112,7 @@ describe 'Dashboard Merge Requests' do it 'shows sorted merge requests' do sort_by('Created date') - visit merge_requests_dashboard_path(assignee_id: current_user.id) + visit merge_requests_dashboard_path(assignee_username: current_user.username) expect(find('.issues-filters')).to have_content('Created date') end diff --git a/spec/features/dashboard/milestone_filter_spec.rb b/spec/features/dashboard/milestone_filter_spec.rb deleted file mode 100644 index 00373050aeb..00000000000 --- a/spec/features/dashboard/milestone_filter_spec.rb +++ /dev/null @@ -1,77 +0,0 @@ -require 'spec_helper' - -describe 'Dashboard > milestone filter', :js do - include FilterItemSelectHelper - - let(:user) { create(:user) } - let(:project) { create(:project, name: 'test', namespace: user.namespace) } - let(:milestone) { create(:milestone, title: 'v1.0', project: project) } - let(:milestone2) { create(:milestone, title: 'v2.0', project: project) } - let!(:issue) { create :issue, author: user, project: project, milestone: milestone } - let!(:issue2) { create :issue, author: user, project: project, milestone: milestone2 } - - dropdown_toggle_button = '.js-milestone-select' - - before do - sign_in(user) - end - - context 'default state' do - it 'shows issues with Any Milestone' do - visit issues_dashboard_path(author_id: user.id) - - page.all('.issue-info').each do |issue_info| - expect(issue_info.text).to match(/v\d.0/) - end - end - end - - context 'filtering by milestone' do - before do - visit issues_dashboard_path(author_id: user.id) - filter_item_select('v1.0', dropdown_toggle_button) - find(dropdown_toggle_button).click - wait_for_requests - end - - it 'shows issues with Milestone v1.0' do - expect(find('.issues-list')).to have_selector('.issue', count: 1) - expect(find('.milestone-filter .dropdown-content')).to have_selector('a.is-active', count: 1) - end - - it 'should not change active Milestone unless clicked' do - page.within '.milestone-filter' do - expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1) - - find('.dropdown-menu-close').click - - expect(page).not_to have_selector('.dropdown.open') - - find(dropdown_toggle_button).click - - expect(find('.dropdown-content')).to have_selector('a.is-active', count: 1) - expect(find('.dropdown-content a.is-active')).to have_content('v1.0') - end - end - end - - context 'with milestone filter in URL' do - before do - visit issues_dashboard_path(author_id: user.id, milestone_title: milestone.title) - find(dropdown_toggle_button).click - wait_for_requests - end - - it 'has milestone selected' do - expect(find('.milestone-filter .dropdown-content')).to have_css('.is-active', text: milestone.title) - end - - it 'removes milestone filter from URL after clicking "Any Milestone"' do - expect(current_url).to include("milestone_title=#{milestone.title}") - - find('.milestone-filter .dropdown-content li', text: 'Any Milestone').click - - expect(current_url).not_to include('milestone_title') - end - end -end diff --git a/spec/features/issues/user_sorts_issues_spec.rb b/spec/features/issues/user_sorts_issues_spec.rb index 7d261ec7dae..4771d2c6d28 100644 --- a/spec/features/issues/user_sorts_issues_spec.rb +++ b/spec/features/issues/user_sorts_issues_spec.rb @@ -26,7 +26,7 @@ describe "User sorts issues" do click_link('Milestone') end - visit(issues_dashboard_path(assignee_id: user.id)) + visit(issues_dashboard_path(assignee_username: user.username)) expect(find('.issues-filters a.is-active')).to have_content('Milestone') diff --git a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb index 82cfe600d52..e163868e8e7 100644 --- a/spec/features/merge_requests/user_sorts_merge_requests_spec.rb +++ b/spec/features/merge_requests/user_sorts_merge_requests_spec.rb @@ -25,7 +25,7 @@ describe 'User sorts merge requests' do click_link('Milestone') end - visit(merge_requests_dashboard_path(assignee_id: user.id)) + visit(merge_requests_dashboard_path(assignee_username: user.username)) expect(find('.issues-filters a.is-active')).to have_content('Milestone') @@ -41,7 +41,7 @@ describe 'User sorts merge requests' do it 'fallbacks to issuable_sort cookie key when remembering the sorting option' do set_cookie('issuable_sort', 'milestone') - visit(merge_requests_dashboard_path(assignee_id: user.id)) + visit(merge_requests_dashboard_path(assignee_username: user.username)) expect(find('.issues-filters a.is-active')).to have_content('Milestone') end diff --git a/spec/features/search/user_uses_header_search_field_spec.rb b/spec/features/search/user_uses_header_search_field_spec.rb index af38f77c0c6..444de26733f 100644 --- a/spec/features/search/user_uses_header_search_field_spec.rb +++ b/spec/features/search/user_uses_header_search_field_spec.rb @@ -21,13 +21,17 @@ describe 'User uses header search field' do it 'shows assigned issues' do find('.search-input-container .dropdown-menu').click_link('Issues assigned to me') - expect(find('.js-assignee-search')).to have_content(user.name) + expect(page).to have_selector('.filtered-search') + expect_tokens([assignee_token(user.name)]) + expect_filtered_search_input_empty end it 'shows created issues' do find('.search-input-container .dropdown-menu').click_link("Issues I've created") - expect(find('.js-author-search')).to have_content(user.name) + expect(page).to have_selector('.filtered-search') + expect_tokens([author_token(user.name)]) + expect_filtered_search_input_empty end end @@ -37,13 +41,17 @@ describe 'User uses header search field' do it 'shows assigned merge requests' do find('.search-input-container .dropdown-menu').click_link('Merge requests assigned to me') - expect(find('.js-assignee-search')).to have_content(user.name) + expect(page).to have_selector('.filtered-search') + expect_tokens([assignee_token(user.name)]) + expect_filtered_search_input_empty end it 'shows created merge requests' do find('.search-input-container .dropdown-menu').click_link("Merge requests I've created") - expect(find('.js-author-search')).to have_content(user.name) + expect(page).to have_selector('.filtered-search') + expect_tokens([author_token(user.name)]) + expect_filtered_search_input_empty end end end diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index 7530fd2a43b..300439f7038 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -109,16 +109,16 @@ describe('Search autocomplete dropdown', () => { assertLinks = function(list, issuesPath, mrsPath) { if (issuesPath) { - const issuesAssignedToMeLink = `a[href="${issuesPath}/?assignee_id=${userId}"]`; - const issuesIHaveCreatedLink = `a[href="${issuesPath}/?author_id=${userId}"]`; + const issuesAssignedToMeLink = `a[href="${issuesPath}/?assignee_username=${userName}"]`; + const issuesIHaveCreatedLink = `a[href="${issuesPath}/?author_username=${userName}"]`; expect(list.find(issuesAssignedToMeLink).length).toBe(1); expect(list.find(issuesAssignedToMeLink).text()).toBe('Issues assigned to me'); expect(list.find(issuesIHaveCreatedLink).length).toBe(1); expect(list.find(issuesIHaveCreatedLink).text()).toBe("Issues I've created"); } - const mrsAssignedToMeLink = `a[href="${mrsPath}/?assignee_id=${userId}"]`; - const mrsIHaveCreatedLink = `a[href="${mrsPath}/?author_id=${userId}"]`; + const mrsAssignedToMeLink = `a[href="${mrsPath}/?assignee_username=${userName}"]`; + const mrsIHaveCreatedLink = `a[href="${mrsPath}/?author_username=${userName}"]`; expect(list.find(mrsAssignedToMeLink).length).toBe(1); expect(list.find(mrsAssignedToMeLink).text()).toBe('Merge requests assigned to me'); diff --git a/spec/support/helpers/filter_item_select_helper.rb b/spec/support/helpers/filter_item_select_helper.rb deleted file mode 100644 index 519e84d359e..00000000000 --- a/spec/support/helpers/filter_item_select_helper.rb +++ /dev/null @@ -1,19 +0,0 @@ -# Helper allows you to select value from filter-items -# -# Params -# value - value for select -# selector - css selector of item -# -# Usage: -# -# filter_item_select('Any Author', '.js-author-search') -# -module FilterItemSelectHelper - def filter_item_select(value, selector) - find(selector).click - wait_for_requests - page.within('.dropdown-content') do - click_link value - end - end -end -- cgit v1.2.1 From f8ef68af57014232a7b3053b3e031c441195e30d Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Mon, 29 Oct 2018 16:00:32 +0800 Subject: Add changelog entry --- changelogs/unreleased/52385-search-bar-for-dashboard-list.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 changelogs/unreleased/52385-search-bar-for-dashboard-list.yml diff --git a/changelogs/unreleased/52385-search-bar-for-dashboard-list.yml b/changelogs/unreleased/52385-search-bar-for-dashboard-list.yml new file mode 100644 index 00000000000..a437ae560cb --- /dev/null +++ b/changelogs/unreleased/52385-search-bar-for-dashboard-list.yml @@ -0,0 +1,5 @@ +--- +title: Use search bar for filtering in dashboard issues / MRs +merge_request: 22641 +author: Heinrich Lee Yu +type: changed -- cgit v1.2.1 From 13a8eb1d389b32b0c483786c52978dd1807ac3f3 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Mon, 29 Oct 2018 16:30:10 +0800 Subject: Update documentation --- doc/user/search/img/dashboard_links.png | Bin 0 -> 27164 bytes doc/user/search/img/issues_assigned_to_you.png | Bin 49079 -> 50433 bytes doc/user/search/img/left_menu_bar.png | Bin 37433 -> 0 bytes doc/user/search/index.md | 16 ++++++++-------- spec/javascripts/search_autocomplete_spec.js | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 doc/user/search/img/dashboard_links.png delete mode 100644 doc/user/search/img/left_menu_bar.png diff --git a/doc/user/search/img/dashboard_links.png b/doc/user/search/img/dashboard_links.png new file mode 100644 index 00000000000..2c472c7e464 Binary files /dev/null and b/doc/user/search/img/dashboard_links.png differ diff --git a/doc/user/search/img/issues_assigned_to_you.png b/doc/user/search/img/issues_assigned_to_you.png index 36c670eedd5..d2fff5e9a67 100644 Binary files a/doc/user/search/img/issues_assigned_to_you.png and b/doc/user/search/img/issues_assigned_to_you.png differ diff --git a/doc/user/search/img/left_menu_bar.png b/doc/user/search/img/left_menu_bar.png deleted file mode 100644 index d68a71cba8e..00000000000 Binary files a/doc/user/search/img/left_menu_bar.png and /dev/null differ diff --git a/doc/user/search/index.md b/doc/user/search/index.md index 3f9d07dacaa..78c1294346b 100644 --- a/doc/user/search/index.md +++ b/doc/user/search/index.md @@ -2,27 +2,27 @@ ## Issues and merge requests -To search through issues and merge requests in multiple projects, you can use the left-sidebar. +To search through issues and merge requests in multiple projects, you can use the **Issues** or **Merge Requests** links +in the top-right part of your screen. -Click the menu bar, then **Issues** or **Merge Requests**, which work in the same way, -therefore, the following notes are valid for both. +Both of them work in the same way, therefore, the following notes are valid for both. The number displayed on their right represents the number of issues and merge requests assigned to you. -![menu bar - issues and MRs assigned to you](img/left_menu_bar.png) +![issues and MRs dashboard links](img/dashboard_links.png) When you click **Issues**, you'll see the opened issues assigned to you straight away: ![Issues assigned to you](img/issues_assigned_to_you.png) -You can filter them by **Author**, **Assignee**, **Milestone**, and **Labels**, -searching through **Open**, **Closed**, and **All** issues. +You can search through **Open**, **Closed**, or **All** issues. -Of course, you can combine all filters together. +You can also filter the results using the search and filter field. This works in the same way as the ones found in the +per project pages described below. ### Issues and MRs assigned to you or created by you -You'll find a shortcut to issues and merge requests create by you or assigned to you +You'll also find shortcuts to issues and merge requests created by you or assigned to you on the search field on the top-right of your screen: ![shortcut to your issues and mrs](img/issues_mrs_shortcut.png) diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index 300439f7038..6ef265b130f 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -186,7 +186,7 @@ describe('Search autocomplete dropdown', () => { widget.searchInput.val('help'); widget.searchInput.triggerHandler('focus'); list = widget.wrap.find('.dropdown-menu').find('ul'); - link = "a[href='" + projectIssuesPath + '/?assignee_id=' + userId + "']"; + link = "a[href='" + projectIssuesPath + '/?assignee_username=' + userName + "']"; expect(list.find(link).length).toBe(0); }); -- cgit v1.2.1 From f2371988bf173db78b6d31f66d8449941db42dd5 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Mon, 29 Oct 2018 20:37:58 +0800 Subject: Change string concat to template string --- spec/javascripts/search_autocomplete_spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/javascripts/search_autocomplete_spec.js b/spec/javascripts/search_autocomplete_spec.js index 6ef265b130f..7a4ca587313 100644 --- a/spec/javascripts/search_autocomplete_spec.js +++ b/spec/javascripts/search_autocomplete_spec.js @@ -1,4 +1,4 @@ -/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, object-shorthand, prefer-template, vars-on-top */ +/* eslint-disable no-var, one-var, no-unused-expressions, consistent-return, no-param-reassign, default-case, no-return-assign, object-shorthand, vars-on-top */ import $ from 'jquery'; import '~/gl_dropdown'; @@ -186,7 +186,7 @@ describe('Search autocomplete dropdown', () => { widget.searchInput.val('help'); widget.searchInput.triggerHandler('focus'); list = widget.wrap.find('.dropdown-menu').find('ul'); - link = "a[href='" + projectIssuesPath + '/?assignee_username=' + userName + "']"; + link = `a[href='${projectIssuesPath}/?assignee_username=${userName}']`; expect(list.find(link).length).toBe(0); }); -- cgit v1.2.1 From 91d88d10c7a5608309e83969723409d95d1a34b5 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Thu, 1 Nov 2018 22:43:43 +0800 Subject: Clean up page_filter_path --- .../pages/dashboard/merge_requests/index.js | 4 ++- app/helpers/application_helper.rb | 5 ++-- app/helpers/search_helper.rb | 10 +++++++ app/views/shared/issuable/_filter.html.haml | 32 ---------------------- app/views/shared/issuable/_search_bar.html.haml | 5 ++-- 5 files changed, 17 insertions(+), 39 deletions(-) delete mode 100644 app/views/shared/issuable/_filter.html.haml diff --git a/app/assets/javascripts/pages/dashboard/merge_requests/index.js b/app/assets/javascripts/pages/dashboard/merge_requests/index.js index 9055738f86e..260484726f3 100644 --- a/app/assets/javascripts/pages/dashboard/merge_requests/index.js +++ b/app/assets/javascripts/pages/dashboard/merge_requests/index.js @@ -4,8 +4,10 @@ import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered import { FILTERED_SEARCH } from '~/pages/constants'; document.addEventListener('DOMContentLoaded', () => { + IssuableFilteredSearchTokenKeys.addExtraTokensForMergeRequests(); + initFilteredSearch({ - page: FILTERED_SEARCH.ISSUES, + page: FILTERED_SEARCH.MERGE_REQUESTS, filteredSearchTokenKeys: IssuableFilteredSearchTokenKeys, }); diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 2fb94de8fab..9f208549ec7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -177,12 +177,11 @@ module ApplicationHelper state: params[:state], scope: params[:scope], milestone_title: params[:milestone_title], - assignee_id: params[:assignee_id], assignee_username: params[:assignee_username], - author_id: params[:author_id], author_username: params[:author_username], search: params[:search], - label_name: params[:label_name] + label_name: params[:label_name], + my_reaction_emoji: params[:my_reaction_emoji] } options = exist_opts.merge(options) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index 70c02107b34..c46516e463b 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -173,6 +173,16 @@ module SearchHelper opts end + def search_history_storage_prefix + if @project.present? + @project.full_path + elsif @group.present? + @group.full_path + else + root_dashboard_path + end + end + # Sanitize a HTML field for search display. Most tags are stripped out and the # maximum length is set to 200 characters. def search_md_sanitize(object, field) diff --git a/app/views/shared/issuable/_filter.html.haml b/app/views/shared/issuable/_filter.html.haml deleted file mode 100644 index c7037335866..00000000000 --- a/app/views/shared/issuable/_filter.html.haml +++ /dev/null @@ -1,32 +0,0 @@ -.issues-filters - .issues-details-filters.row-content-block.second-block - = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :search]), method: :get, class: 'filter-form js-filter-form' do - - if params[:search].present? - = hidden_field_tag :search, params[:search] - .issues-other-filters - .filter-item.inline - - if params[:author_id].present? - = hidden_field_tag(:author_id, params[:author_id]) - = dropdown_tag(user_dropdown_label(params[:author_id], "Author"), options: { toggle_class: "js-user-search js-filter-submit js-author-search", title: "Filter by author", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-author js-filter-submit", - placeholder: "Search authors", data: { any_user: "Any Author", first_user: current_user&.username, current_user: true, project_id: @project&.id, group_id: @group&.id, selected: params[:author_id], field_name: "author_id", default_label: "Author" } }) - - .filter-item.inline - - if params[:assignee_id].present? - = hidden_field_tag(:assignee_id, params[:assignee_id]) - = dropdown_tag(user_dropdown_label(params[:assignee_id], "Assignee"), options: { toggle_class: "js-user-search js-filter-submit js-assignee-search", title: "Filter by assignee", filter: true, dropdown_class: "dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit", - placeholder: "Search assignee", data: { any_user: "Any Assignee", first_user: current_user&.username, null_user: true, current_user: true, project_id: @project&.id, group_id: @group&.id, selected: params[:assignee_id], field_name: "assignee_id", default_label: "Assignee" } }) - - .filter-item.inline.milestone-filter - = 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: selected_labels, use_id: false, selected_toggle: params[:label_name], data_options: { field_name: "label_name[]" } - - - unless @no_filters_set - .float-right - = render 'shared/sort_dropdown' - - - has_labels = @labels && @labels.any? - .row-content-block.second-block.filtered-labels{ class: ("hidden" unless has_labels) } - - if has_labels - = render 'shared/labels_row', labels: @labels diff --git a/app/views/shared/issuable/_search_bar.html.haml b/app/views/shared/issuable/_search_bar.html.haml index bab09838489..824bbe3524b 100644 --- a/app/views/shared/issuable/_search_bar.html.haml +++ b/app/views/shared/issuable/_search_bar.html.haml @@ -1,7 +1,6 @@ - type = local_assigns.fetch(:type) - board = local_assigns.fetch(:board, nil) - block_css_class = type != :boards_modal ? 'row-content-block second-block' : '' -- full_path = if @project.present? then @project.full_path elsif @group.present? then @group.full_path else request.path end - user_can_admin_list = board && can?(current_user, :admin_list, board.parent) - show_sorting_dropdown = local_assigns.fetch(:show_sorting_dropdown, true) @@ -10,7 +9,7 @@ - if type == :boards #js-multiple-boards-switcher.inline.boards-switcher{ "v-cloak" => true } = render_if_exists "shared/boards/switcher", board: board - = form_tag page_filter_path(without: [:assignee_id, :author_id, :milestone_title, :label_name, :search]), method: :get, class: 'filter-form js-filter-form' do + = form_tag page_filter_path, method: :get, class: 'filter-form js-filter-form' do - if params[:search].present? = hidden_field_tag :search, params[:search] - if @can_bulk_update @@ -25,7 +24,7 @@ dropdown_class: "filtered-search-history-dropdown", content_class: "filtered-search-history-dropdown-content", title: "Recent searches" }) do - .js-filtered-search-history-dropdown{ data: { full_path: full_path } } + .js-filtered-search-history-dropdown{ data: { full_path: search_history_storage_prefix } } .filtered-search-box-input-container.droplab-dropdown .scroll-container %ul.tokens-container.list-unstyled -- cgit v1.2.1 From 26b9d8fe25e83ac36fe8b397addc40b986a965c0 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Wed, 7 Nov 2018 13:25:08 +0800 Subject: Add helper tests --- app/helpers/search_helper.rb | 2 +- spec/helpers/search_helper_spec.rb | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/app/helpers/search_helper.rb b/app/helpers/search_helper.rb index c46516e463b..80cc568820a 100644 --- a/app/helpers/search_helper.rb +++ b/app/helpers/search_helper.rb @@ -179,7 +179,7 @@ module SearchHelper elsif @group.present? @group.full_path else - root_dashboard_path + 'dashboard' end end diff --git a/spec/helpers/search_helper_spec.rb b/spec/helpers/search_helper_spec.rb index 8bfd520528f..4945749f524 100644 --- a/spec/helpers/search_helper_spec.rb +++ b/spec/helpers/search_helper_spec.rb @@ -135,5 +135,40 @@ describe SearchHelper do expect(search_filter_input_options('')[:data]['base-endpoint']).to eq("/groups#{group_path(@group)}") end end + + context 'dashboard' do + it 'does not include group-id and project-id' do + expect(search_filter_input_options('')[:data]['project-id']).to eq(nil) + expect(search_filter_input_options('')[:data]['group-id']).to eq(nil) + end + + it 'includes dashboard base-endpoint' do + expect(search_filter_input_options('')[:data]['base-endpoint']).to eq("/dashboard") + end + end + end + + describe 'search_history_storage_prefix' do + context 'project' do + it 'returns project full_path' do + @project = create(:project, :repository) + + expect(search_history_storage_prefix).to eq(@project.full_path) + end + end + + context 'group' do + it 'returns group full_path' do + @group = create(:group, :nested, name: 'group-name') + + expect(search_history_storage_prefix).to eq(@group.full_path) + end + end + + context 'dashboard' do + it 'returns dashboard' do + expect(search_history_storage_prefix).to eq("dashboard") + end + end end end -- cgit v1.2.1 From 2ade9b4479d7ce1f9b1bebd1e9ca47efb4b6f423 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Thu, 8 Nov 2018 21:43:13 +0800 Subject: Added wip param in filter path options --- app/helpers/application_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9f208549ec7..61d4386fb9f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -181,7 +181,8 @@ module ApplicationHelper author_username: params[:author_username], search: params[:search], label_name: params[:label_name], - my_reaction_emoji: params[:my_reaction_emoji] + my_reaction_emoji: params[:my_reaction_emoji], + wip: params[:wip] } options = exist_opts.merge(options) -- cgit v1.2.1 From 6173d4639a388f59872291657a2528256c90a846 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Tue, 13 Nov 2018 13:58:24 +0100 Subject: Move pipeline delete docs to end --- doc/api/pipelines.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/doc/api/pipelines.md b/doc/api/pipelines.md index c91875fd2db..7b4c9a8fbb3 100644 --- a/doc/api/pipelines.md +++ b/doc/api/pipelines.md @@ -93,23 +93,6 @@ Example of response } ``` -## Delete a pipeline - -> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22988) in GitLab 11.6 - -``` -DELETE /projects/:id/pipelines/:pipeline_id -``` - -| Attribute | Type | Required | Description | -|------------|---------|----------|---------------------| -| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -| `pipeline_id` | integer | yes | The ID of a pipeline | - -``` -curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --request "DELETE" "https://gitlab.example.com/api/v4/projects/1/pipelines/46" -``` - ## Create a new pipeline > [Introduced][ce-7209] in GitLab 8.14 @@ -252,5 +235,22 @@ Response: } ``` +## Delete a pipeline + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22988) in GitLab 11.6. + +``` +DELETE /projects/:id/pipelines/:pipeline_id +``` + +| Attribute | Type | Required | Description | +|------------|---------|----------|---------------------| +| `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | +| `pipeline_id` | integer | yes | The ID of a pipeline | + +``` +curl --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --request "DELETE" "https://gitlab.example.com/api/v4/projects/1/pipelines/46" +``` + [ce-5837]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5837 [ce-7209]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/7209 -- cgit v1.2.1 From 9f400c085969855891b92c1aa7d5cfaaaf8c969b Mon Sep 17 00:00:00 2001 From: Daniel Gruesso Date: Tue, 13 Nov 2018 15:10:56 +0000 Subject: trigger build for docs --- doc/user/project/clusters/serverless/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index 3099504ce4a..b44d14d2294 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -6,7 +6,7 @@ Run serverless workloads on Kubernetes using [Knative](https://cloud.google.com/ ## Overview -Knative extends Kubernetes to provide a set of middleware components that are useful to build modern, source-centric, and container-based applications. Knative brings some significant benefits out of the box through its main components: +Knative extends Kubernetes to provide a set of middleware components that are useful to build modern, source-centric, container-based applications. Knative brings some significant benefits out of the box through its main components: - [Build:](https://github.com/knative/build) Source-to-container build orchestration - [Eventing:](https://github.com/knative/eventing) Management and delivery of events -- cgit v1.2.1 From 0bc14b452218277a55f71ab22bed724b696ecf28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Tue, 13 Nov 2018 17:17:01 +0100 Subject: Authorize DestroyPipelineService against pipeline --- app/policies/ci/pipeline_policy.rb | 4 ++++ app/policies/project_policy.rb | 1 - app/services/ci/destroy_pipeline_service.rb | 4 ++-- lib/api/pipelines.rb | 2 +- spec/policies/ci/pipeline_policy_spec.rb | 18 ++++++++++++++++++ 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/policies/ci/pipeline_policy.rb b/app/policies/ci/pipeline_policy.rb index f9623587957..e42d78f47c5 100644 --- a/app/policies/ci/pipeline_policy.rb +++ b/app/policies/ci/pipeline_policy.rb @@ -16,6 +16,10 @@ module Ci enable :update_pipeline end + rule { can?(:owner_access) }.policy do + enable :destroy_pipeline + end + def ref_protected?(user, project, tag, ref) access = ::Gitlab::UserAccess.new(user, project: project) diff --git a/app/policies/project_policy.rb b/app/policies/project_policy.rb index 221826121da..1c082945299 100644 --- a/app/policies/project_policy.rb +++ b/app/policies/project_policy.rb @@ -144,7 +144,6 @@ class ProjectPolicy < BasePolicy enable :destroy_merge_request enable :destroy_issue enable :remove_pages - enable :destroy_pipeline enable :set_issue_iid enable :set_issue_created_at diff --git a/app/services/ci/destroy_pipeline_service.rb b/app/services/ci/destroy_pipeline_service.rb index 059e871f20e..f40e73b3efb 100644 --- a/app/services/ci/destroy_pipeline_service.rb +++ b/app/services/ci/destroy_pipeline_service.rb @@ -3,11 +3,11 @@ module Ci class DestroyPipelineService < BaseService def execute(pipeline) - return false unless can?(current_user, :destroy_pipeline, project) + return false unless can?(current_user, :destroy_pipeline, pipeline) AuditEventService.new(current_user, pipeline).security_event - pipeline.destroy + pipeline.destroy! end end end diff --git a/lib/api/pipelines.rb b/lib/api/pipelines.rb index 39d693bb9e9..cba1e3a6684 100644 --- a/lib/api/pipelines.rb +++ b/lib/api/pipelines.rb @@ -89,7 +89,7 @@ module API requires :pipeline_id, type: Integer, desc: 'The pipeline ID' end delete ':id/pipelines/:pipeline_id' do - authorize! :destroy_pipeline, user_project + authorize! :destroy_pipeline, pipeline destroy_conditionally!(pipeline) do ::Ci::DestroyPipelineService.new(user_project, current_user).execute(pipeline) diff --git a/spec/policies/ci/pipeline_policy_spec.rb b/spec/policies/ci/pipeline_policy_spec.rb index bd32faf06ef..8022f61e67d 100644 --- a/spec/policies/ci/pipeline_policy_spec.rb +++ b/spec/policies/ci/pipeline_policy_spec.rb @@ -74,5 +74,23 @@ describe Ci::PipelinePolicy, :models do expect(policy).to be_allowed :update_pipeline end end + + describe 'destroy_pipeline' do + let(:project) { create(:project, :public) } + + context 'when user has owner access' do + let(:user) { project.owner } + + it 'is enabled' do + expect(policy).to be_allowed :destroy_pipeline + end + end + + context 'when user is not owner' do + it 'is disabled' do + expect(policy).not_to be_allowed :destroy_pipeline + end + end + end end end -- cgit v1.2.1 From b7e5f73cd7dca105d2bd0dbab559439ee00aa91a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Tue, 13 Nov 2018 17:27:00 +0100 Subject: Raise exception when user is not authorized --- app/services/ci/destroy_pipeline_service.rb | 2 +- spec/services/ci/destroy_pipeline_service_spec.rb | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/app/services/ci/destroy_pipeline_service.rb b/app/services/ci/destroy_pipeline_service.rb index f40e73b3efb..13f892aabb8 100644 --- a/app/services/ci/destroy_pipeline_service.rb +++ b/app/services/ci/destroy_pipeline_service.rb @@ -3,7 +3,7 @@ module Ci class DestroyPipelineService < BaseService def execute(pipeline) - return false unless can?(current_user, :destroy_pipeline, pipeline) + raise Gitlab::Access::AccessDeniedError unless can?(current_user, :destroy_pipeline, pipeline) AuditEventService.new(current_user, pipeline).security_event diff --git a/spec/services/ci/destroy_pipeline_service_spec.rb b/spec/services/ci/destroy_pipeline_service_spec.rb index 9f449dd73e8..097daf67feb 100644 --- a/spec/services/ci/destroy_pipeline_service_spec.rb +++ b/spec/services/ci/destroy_pipeline_service_spec.rb @@ -53,14 +53,8 @@ describe ::Ci::DestroyPipelineService do context 'user is not owner' do let(:user) { create(:user) } - it 'returns false' do - is_expected.to eq(false) - end - - it 'does not destroy the pipeline' do - subject - - expect { pipeline.reload }.not_to raise_error + it 'raises an exception' do + expect { subject }.to raise_error(Gitlab::Access::AccessDeniedError) end end end -- cgit v1.2.1 From de605ad1437e8e0beb5da76c900623dd541e1f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matija=20=C4=8Cupi=C4=87?= Date: Tue, 13 Nov 2018 19:32:10 +0100 Subject: Add spec for Pipeline DELETE for developers --- spec/requests/api/pipelines_spec.rb | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/spec/requests/api/pipelines_spec.rb b/spec/requests/api/pipelines_spec.rb index e786b7531a9..638cc9767d4 100644 --- a/spec/requests/api/pipelines_spec.rb +++ b/spec/requests/api/pipelines_spec.rb @@ -473,11 +473,28 @@ describe API::Pipelines do end context 'unauthorized user' do - it 'should return a 404' do - get api("/projects/#{project.id}/pipelines/#{pipeline.id}", non_member) + context 'when user is not member' do + it 'should return a 404' do + delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", non_member) - expect(response).to have_gitlab_http_status(404) - expect(json_response['message']).to eq '404 Project Not Found' + expect(response).to have_gitlab_http_status(404) + expect(json_response['message']).to eq '404 Project Not Found' + end + end + + context 'when user is developer' do + let(:developer) { create(:user) } + + before do + project.add_developer(developer) + end + + it 'should return a 403' do + delete api("/projects/#{project.id}/pipelines/#{pipeline.id}", developer) + + expect(response).to have_gitlab_http_status(403) + expect(json_response['message']).to eq '403 Forbidden' + end end end end -- cgit v1.2.1 From 37582015977ef6a71f23a1cbb131160aaf9c28f5 Mon Sep 17 00:00:00 2001 From: danielgruesso Date: Tue, 13 Nov 2018 14:38:05 -0500 Subject: correct dockerfile term and update port --- doc/user/project/clusters/serverless/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index b44d14d2294..046564d6015 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -61,8 +61,8 @@ To run Knative on Gitlab, you will need: - tm -n "$KUBE_NAMESPACE" --config "$KUBECONFIG" deploy service "$CI_PROJECT_NAME" --from-image "$CI_REGISTRY_IMAGE" --wait ``` -1. **Docker File:** Knative requires a docker file in order to build your application. It should be included - at the root of your project's repo. +1. **Dockerfile:** Knative requires a Dockerfile in order to build your application. It should be included + at the root of your project's repo and expose port 8080. ## Installing Knative via GitLab's Kubernetes integration -- cgit v1.2.1 From ebf98f27c4eacd519c06c7f5d77fdb48c0649bb7 Mon Sep 17 00:00:00 2001 From: gfyoung Date: Fri, 9 Nov 2018 10:39:43 -0800 Subject: Enable even more frozen string in lib/gitlab Enables frozen string for the following: * lib/gitlab/fogbugz_import/**/*.rb * lib/gitlab/gfm/**/*.rb * lib/gitlab/git/**/*.rb * lib/gitlab/gitaly_client/**/*.rb * lib/gitlab/gitlab_import/**/*.rb * lib/gitlab/google_code_import/**/*.rb * lib/gitlab/gpg/**/*.rb * lib/gitlab/grape_logging/**/*.rb * lib/gitlab/graphql/**/*.rb * lib/gitlab/graphs/**/*.rb * lib/gitlab/hashed_storage/**/*.rb * lib/gitlab/health_checks/**/*.rb Partially address gitlab-org/gitlab-ce#47424. --- .../unreleased/frozen-string-lib-gitlab-even-more.yml | 5 +++++ lib/gitlab/fogbugz_import/client.rb | 2 ++ lib/gitlab/fogbugz_import/importer.rb | 2 ++ lib/gitlab/fogbugz_import/project_creator.rb | 2 ++ lib/gitlab/fogbugz_import/repository.rb | 2 ++ lib/gitlab/gfm/reference_rewriter.rb | 2 ++ lib/gitlab/gfm/uploads_rewriter.rb | 2 ++ lib/gitlab/git/attributes_at_ref_parser.rb | 2 ++ lib/gitlab/git/attributes_parser.rb | 2 ++ lib/gitlab/git/blame.rb | 2 ++ lib/gitlab/git/blob.rb | 2 ++ lib/gitlab/git/branch.rb | 2 ++ lib/gitlab/git/commit.rb | 2 ++ lib/gitlab/git/commit_stats.rb | 2 ++ lib/gitlab/git/compare.rb | 2 ++ lib/gitlab/git/conflict/file.rb | 2 ++ lib/gitlab/git/conflict/parser.rb | 2 ++ lib/gitlab/git/conflict/resolution.rb | 2 ++ lib/gitlab/git/conflict/resolver.rb | 2 ++ lib/gitlab/git/diff.rb | 2 ++ lib/gitlab/git/diff_collection.rb | 2 ++ lib/gitlab/git/gitmodules_parser.rb | 2 ++ lib/gitlab/git/hook_env.rb | 2 ++ lib/gitlab/git/index.rb | 2 ++ lib/gitlab/git/lfs_changes.rb | 2 ++ lib/gitlab/git/lfs_pointer_file.rb | 2 ++ lib/gitlab/git/operation_service.rb | 2 ++ lib/gitlab/git/path_helper.rb | 2 ++ lib/gitlab/git/pre_receive_error.rb | 2 ++ lib/gitlab/git/raw_diff_change.rb | 2 ++ lib/gitlab/git/ref.rb | 2 ++ lib/gitlab/git/remote_mirror.rb | 2 ++ lib/gitlab/git/remote_repository.rb | 2 ++ lib/gitlab/git/repository.rb | 2 ++ lib/gitlab/git/repository_mirroring.rb | 2 ++ lib/gitlab/git/tag.rb | 2 ++ lib/gitlab/git/tree.rb | 2 ++ lib/gitlab/git/user.rb | 2 ++ lib/gitlab/git/util.rb | 2 ++ lib/gitlab/git/version.rb | 2 ++ lib/gitlab/git/wiki.rb | 2 ++ lib/gitlab/git/wiki_file.rb | 2 ++ lib/gitlab/git/wiki_page.rb | 2 ++ lib/gitlab/git/wiki_page_version.rb | 2 ++ lib/gitlab/git/wraps_gitaly_errors.rb | 2 ++ lib/gitlab/gitaly_client/attributes_bag.rb | 2 ++ lib/gitlab/gitaly_client/blob_service.rb | 6 +++++- lib/gitlab/gitaly_client/blobs_stitcher.rb | 2 ++ lib/gitlab/gitaly_client/commit_service.rb | 16 +++++++++------- lib/gitlab/gitaly_client/conflict_files_stitcher.rb | 4 +++- lib/gitlab/gitaly_client/conflicts_service.rb | 2 ++ lib/gitlab/gitaly_client/diff.rb | 2 ++ lib/gitlab/gitaly_client/diff_stitcher.rb | 4 +++- lib/gitlab/gitaly_client/health_check_service.rb | 2 ++ lib/gitlab/gitaly_client/namespace_service.rb | 2 ++ lib/gitlab/gitaly_client/notification_service.rb | 2 ++ lib/gitlab/gitaly_client/operation_service.rb | 2 ++ lib/gitlab/gitaly_client/queue_enumerator.rb | 2 ++ lib/gitlab/gitaly_client/ref_service.rb | 4 +++- lib/gitlab/gitaly_client/remote_service.rb | 2 ++ lib/gitlab/gitaly_client/repository_service.rb | 6 ++++-- lib/gitlab/gitaly_client/server_service.rb | 2 ++ lib/gitlab/gitaly_client/storage_service.rb | 2 ++ lib/gitlab/gitaly_client/storage_settings.rb | 2 ++ lib/gitlab/gitaly_client/util.rb | 2 ++ lib/gitlab/gitaly_client/wiki_file.rb | 2 ++ lib/gitlab/gitaly_client/wiki_page.rb | 2 ++ lib/gitlab/gitaly_client/wiki_service.rb | 6 ++++-- lib/gitlab/gitlab_import/client.rb | 2 ++ lib/gitlab/gitlab_import/importer.rb | 12 +++++++----- lib/gitlab/gitlab_import/project_creator.rb | 2 ++ lib/gitlab/google_code_import/client.rb | 2 ++ lib/gitlab/google_code_import/importer.rb | 2 ++ lib/gitlab/google_code_import/project_creator.rb | 2 ++ lib/gitlab/google_code_import/repository.rb | 2 ++ lib/gitlab/gpg/commit.rb | 2 ++ lib/gitlab/gpg/invalid_gpg_signature_updater.rb | 2 ++ .../grape_logging/formatters/lograge_with_timestamp.rb | 2 ++ .../grape_logging/loggers/queue_duration_logger.rb | 2 ++ lib/gitlab/grape_logging/loggers/user_logger.rb | 2 ++ lib/gitlab/graphql/authorize.rb | 2 ++ lib/gitlab/graphql/authorize/authorize_resource.rb | 2 ++ lib/gitlab/graphql/authorize/instrumentation.rb | 2 ++ lib/gitlab/graphql/connections.rb | 2 ++ lib/gitlab/graphql/connections/keyset_connection.rb | 2 ++ lib/gitlab/graphql/errors.rb | 2 ++ lib/gitlab/graphql/expose_permissions.rb | 2 ++ lib/gitlab/graphql/present.rb | 2 ++ lib/gitlab/graphql/present/instrumentation.rb | 2 ++ lib/gitlab/graphql/variables.rb | 2 ++ lib/gitlab/graphs/commits.rb | 2 ++ lib/gitlab/hashed_storage/migrator.rb | 2 ++ lib/gitlab/hashed_storage/rake_helper.rb | 2 ++ lib/gitlab/health_checks/base_abstract_check.rb | 2 ++ lib/gitlab/health_checks/db_check.rb | 2 ++ lib/gitlab/health_checks/gitaly_check.rb | 2 ++ lib/gitlab/health_checks/metric.rb | 5 ++++- lib/gitlab/health_checks/prometheus_text_format.rb | 2 ++ lib/gitlab/health_checks/redis/cache_check.rb | 2 ++ lib/gitlab/health_checks/redis/queues_check.rb | 2 ++ lib/gitlab/health_checks/redis/redis_check.rb | 2 ++ lib/gitlab/health_checks/redis/shared_state_check.rb | 2 ++ lib/gitlab/health_checks/result.rb | 5 ++++- lib/gitlab/health_checks/simple_abstract_check.rb | 2 ++ 104 files changed, 237 insertions(+), 22 deletions(-) create mode 100644 changelogs/unreleased/frozen-string-lib-gitlab-even-more.yml diff --git a/changelogs/unreleased/frozen-string-lib-gitlab-even-more.yml b/changelogs/unreleased/frozen-string-lib-gitlab-even-more.yml new file mode 100644 index 00000000000..cfbc4ced635 --- /dev/null +++ b/changelogs/unreleased/frozen-string-lib-gitlab-even-more.yml @@ -0,0 +1,5 @@ +--- +title: Enable even more frozen string in lib/gitlab/**/*.rb +merge_request: +author: gfyoung +type: performance diff --git a/lib/gitlab/fogbugz_import/client.rb b/lib/gitlab/fogbugz_import/client.rb index acb000e3e23..dd747a79673 100644 --- a/lib/gitlab/fogbugz_import/client.rb +++ b/lib/gitlab/fogbugz_import/client.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'fogbugz' module Gitlab diff --git a/lib/gitlab/fogbugz_import/importer.rb b/lib/gitlab/fogbugz_import/importer.rb index 98ea5b309a1..431911d1eee 100644 --- a/lib/gitlab/fogbugz_import/importer.rb +++ b/lib/gitlab/fogbugz_import/importer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module FogbugzImport class Importer diff --git a/lib/gitlab/fogbugz_import/project_creator.rb b/lib/gitlab/fogbugz_import/project_creator.rb index 1918d5b208d..3c71031a8d9 100644 --- a/lib/gitlab/fogbugz_import/project_creator.rb +++ b/lib/gitlab/fogbugz_import/project_creator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module FogbugzImport class ProjectCreator diff --git a/lib/gitlab/fogbugz_import/repository.rb b/lib/gitlab/fogbugz_import/repository.rb index d1dc63db2b2..b958dcf6cbf 100644 --- a/lib/gitlab/fogbugz_import/repository.rb +++ b/lib/gitlab/fogbugz_import/repository.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module FogbugzImport class Repository diff --git a/lib/gitlab/gfm/reference_rewriter.rb b/lib/gitlab/gfm/reference_rewriter.rb index 641446b52a5..08d7db49ad7 100644 --- a/lib/gitlab/gfm/reference_rewriter.rb +++ b/lib/gitlab/gfm/reference_rewriter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Gfm ## diff --git a/lib/gitlab/gfm/uploads_rewriter.rb b/lib/gitlab/gfm/uploads_rewriter.rb index b767c8a278d..3f06badf5d9 100644 --- a/lib/gitlab/gfm/uploads_rewriter.rb +++ b/lib/gitlab/gfm/uploads_rewriter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'fileutils' module Gitlab diff --git a/lib/gitlab/git/attributes_at_ref_parser.rb b/lib/gitlab/git/attributes_at_ref_parser.rb index 26b5bd520d5..cbddf836ce8 100644 --- a/lib/gitlab/git/attributes_at_ref_parser.rb +++ b/lib/gitlab/git/attributes_at_ref_parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git # Parses root .gitattributes file at a given ref diff --git a/lib/gitlab/git/attributes_parser.rb b/lib/gitlab/git/attributes_parser.rb index 08f4d7d4f5c..8b9d74ae8e7 100644 --- a/lib/gitlab/git/attributes_parser.rb +++ b/lib/gitlab/git/attributes_parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git # Class for parsing Git attribute files and extracting the attributes for diff --git a/lib/gitlab/git/blame.rb b/lib/gitlab/git/blame.rb index e25e15f5c80..b118eda37f8 100644 --- a/lib/gitlab/git/blame.rb +++ b/lib/gitlab/git/blame.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Blame diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index 0bd1d3420a2..9dd1c484d59 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: seems to be completely migrated (behind feature flags). module Gitlab diff --git a/lib/gitlab/git/branch.rb b/lib/gitlab/git/branch.rb index 6351cfb83e3..9447cfa0fb6 100644 --- a/lib/gitlab/git/branch.rb +++ b/lib/gitlab/git/branch.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Branch < Ref diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 2820491b65d..4f05c4b73a1 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitlab::Git::Commit is a wrapper around Gitaly::GitCommit module Gitlab module Git diff --git a/lib/gitlab/git/commit_stats.rb b/lib/gitlab/git/commit_stats.rb index 83a9fd5f81a..8815088d23c 100644 --- a/lib/gitlab/git/commit_stats.rb +++ b/lib/gitlab/git/commit_stats.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitlab::Git::CommitStats counts the additions, deletions, and total changes # in a commit. module Gitlab diff --git a/lib/gitlab/git/compare.rb b/lib/gitlab/git/compare.rb index 7cb842256d0..ab5245ba7cb 100644 --- a/lib/gitlab/git/compare.rb +++ b/lib/gitlab/git/compare.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: no RPC's here. module Gitlab diff --git a/lib/gitlab/git/conflict/file.rb b/lib/gitlab/git/conflict/file.rb index f08dab59ce4..7ffe4a7ae81 100644 --- a/lib/gitlab/git/conflict/file.rb +++ b/lib/gitlab/git/conflict/file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module Conflict diff --git a/lib/gitlab/git/conflict/parser.rb b/lib/gitlab/git/conflict/parser.rb index fb5717dd556..20de8ebde4e 100644 --- a/lib/gitlab/git/conflict/parser.rb +++ b/lib/gitlab/git/conflict/parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module Conflict diff --git a/lib/gitlab/git/conflict/resolution.rb b/lib/gitlab/git/conflict/resolution.rb index ab9be683e15..04299a2d10c 100644 --- a/lib/gitlab/git/conflict/resolution.rb +++ b/lib/gitlab/git/conflict/resolution.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module Conflict diff --git a/lib/gitlab/git/conflict/resolver.rb b/lib/gitlab/git/conflict/resolver.rb index 307f1b8cb66..26e82643a4c 100644 --- a/lib/gitlab/git/conflict/resolver.rb +++ b/lib/gitlab/git/conflict/resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module Conflict diff --git a/lib/gitlab/git/diff.rb b/lib/gitlab/git/diff.rb index b2e2d49dd0b..74a4633424f 100644 --- a/lib/gitlab/git/diff.rb +++ b/lib/gitlab/git/diff.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Diff diff --git a/lib/gitlab/git/diff_collection.rb b/lib/gitlab/git/diff_collection.rb index 47ebca7c4a2..5c70cb6c66c 100644 --- a/lib/gitlab/git/diff_collection.rb +++ b/lib/gitlab/git/diff_collection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: no RPC's here. module Gitlab diff --git a/lib/gitlab/git/gitmodules_parser.rb b/lib/gitlab/git/gitmodules_parser.rb index 4b505312f60..575e12390cd 100644 --- a/lib/gitlab/git/gitmodules_parser.rb +++ b/lib/gitlab/git/gitmodules_parser.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: no RPC's here. module Gitlab diff --git a/lib/gitlab/git/hook_env.rb b/lib/gitlab/git/hook_env.rb index 620568d8817..892a069a3b7 100644 --- a/lib/gitlab/git/hook_env.rb +++ b/lib/gitlab/git/hook_env.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: no RPC's here. module Gitlab diff --git a/lib/gitlab/git/index.rb b/lib/gitlab/git/index.rb index c2e4274e3ee..3b9b516308f 100644 --- a/lib/gitlab/git/index.rb +++ b/lib/gitlab/git/index.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Index diff --git a/lib/gitlab/git/lfs_changes.rb b/lib/gitlab/git/lfs_changes.rb index d7148165408..8e2a925dfea 100644 --- a/lib/gitlab/git/lfs_changes.rb +++ b/lib/gitlab/git/lfs_changes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class LfsChanges diff --git a/lib/gitlab/git/lfs_pointer_file.rb b/lib/gitlab/git/lfs_pointer_file.rb index 2ae0a889590..b7019a221ac 100644 --- a/lib/gitlab/git/lfs_pointer_file.rb +++ b/lib/gitlab/git/lfs_pointer_file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class LfsPointerFile diff --git a/lib/gitlab/git/operation_service.rb b/lib/gitlab/git/operation_service.rb index 0584629ac84..8797d3dce24 100644 --- a/lib/gitlab/git/operation_service.rb +++ b/lib/gitlab/git/operation_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class OperationService diff --git a/lib/gitlab/git/path_helper.rb b/lib/gitlab/git/path_helper.rb index 57b82a37d6c..e3a2031eeca 100644 --- a/lib/gitlab/git/path_helper.rb +++ b/lib/gitlab/git/path_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: no RPC's here. module Gitlab diff --git a/lib/gitlab/git/pre_receive_error.rb b/lib/gitlab/git/pre_receive_error.rb index ac1ab7c39d5..03caace6fce 100644 --- a/lib/gitlab/git/pre_receive_error.rb +++ b/lib/gitlab/git/pre_receive_error.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git # diff --git a/lib/gitlab/git/raw_diff_change.rb b/lib/gitlab/git/raw_diff_change.rb index 98de9328071..e1002af40f6 100644 --- a/lib/gitlab/git/raw_diff_change.rb +++ b/lib/gitlab/git/raw_diff_change.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git # This class behaves like a struct with fields :blob_id, :blob_size, :operation, :old_path, :new_path diff --git a/lib/gitlab/git/ref.rb b/lib/gitlab/git/ref.rb index 31a280155bd..eec91194949 100644 --- a/lib/gitlab/git/ref.rb +++ b/lib/gitlab/git/ref.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Ref diff --git a/lib/gitlab/git/remote_mirror.rb b/lib/gitlab/git/remote_mirror.rb index 7f9520de5ce..e992d522e7f 100644 --- a/lib/gitlab/git/remote_mirror.rb +++ b/lib/gitlab/git/remote_mirror.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class RemoteMirror diff --git a/lib/gitlab/git/remote_repository.rb b/lib/gitlab/git/remote_repository.rb index f40e59a8dd0..234541d8145 100644 --- a/lib/gitlab/git/remote_repository.rb +++ b/lib/gitlab/git/remote_repository.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git # diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 1642c4c5687..716ad16fdf1 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'tempfile' require 'forwardable' require "rubygems/package" diff --git a/lib/gitlab/git/repository_mirroring.rb b/lib/gitlab/git/repository_mirroring.rb index 752a91fbb60..7e63a6dc7cb 100644 --- a/lib/gitlab/git/repository_mirroring.rb +++ b/lib/gitlab/git/repository_mirroring.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module RepositoryMirroring diff --git a/lib/gitlab/git/tag.rb b/lib/gitlab/git/tag.rb index bbf2ecdb1fa..ade708d0541 100644 --- a/lib/gitlab/git/tag.rb +++ b/lib/gitlab/git/tag.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Tag < Ref diff --git a/lib/gitlab/git/tree.rb b/lib/gitlab/git/tree.rb index b5b701699f0..51542bcaaa2 100644 --- a/lib/gitlab/git/tree.rb +++ b/lib/gitlab/git/tree.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Tree diff --git a/lib/gitlab/git/user.rb b/lib/gitlab/git/user.rb index 338e1a30c45..2c798844798 100644 --- a/lib/gitlab/git/user.rb +++ b/lib/gitlab/git/user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class User diff --git a/lib/gitlab/git/util.rb b/lib/gitlab/git/util.rb index 4708f22dcb3..03c2c1367b0 100644 --- a/lib/gitlab/git/util.rb +++ b/lib/gitlab/git/util.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Gitaly note: JV: no RPC's here. module Gitlab diff --git a/lib/gitlab/git/version.rb b/lib/gitlab/git/version.rb index 4bd91898457..64c89656167 100644 --- a/lib/gitlab/git/version.rb +++ b/lib/gitlab/git/version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module Version diff --git a/lib/gitlab/git/wiki.rb b/lib/gitlab/git/wiki.rb index 02c643d0da0..c43331bed60 100644 --- a/lib/gitlab/git/wiki.rb +++ b/lib/gitlab/git/wiki.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class Wiki diff --git a/lib/gitlab/git/wiki_file.rb b/lib/gitlab/git/wiki_file.rb index 64313bb04e8..c05a5adc00c 100644 --- a/lib/gitlab/git/wiki_file.rb +++ b/lib/gitlab/git/wiki_file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class WikiFile diff --git a/lib/gitlab/git/wiki_page.rb b/lib/gitlab/git/wiki_page.rb index c4087c9ebdc..f6cac398548 100644 --- a/lib/gitlab/git/wiki_page.rb +++ b/lib/gitlab/git/wiki_page.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class WikiPage diff --git a/lib/gitlab/git/wiki_page_version.rb b/lib/gitlab/git/wiki_page_version.rb index d5e7e70fd31..475a9d4d1b9 100644 --- a/lib/gitlab/git/wiki_page_version.rb +++ b/lib/gitlab/git/wiki_page_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git class WikiPageVersion diff --git a/lib/gitlab/git/wraps_gitaly_errors.rb b/lib/gitlab/git/wraps_gitaly_errors.rb index 4b161f7e6ce..9963bcfbf1c 100644 --- a/lib/gitlab/git/wraps_gitaly_errors.rb +++ b/lib/gitlab/git/wraps_gitaly_errors.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Git module WrapsGitalyErrors diff --git a/lib/gitlab/gitaly_client/attributes_bag.rb b/lib/gitlab/gitaly_client/attributes_bag.rb index 198a1de91c7..3f1a0ef4888 100644 --- a/lib/gitlab/gitaly_client/attributes_bag.rb +++ b/lib/gitlab/gitaly_client/attributes_bag.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient # This module expects an `ATTRS` const to be defined on the subclass diff --git a/lib/gitlab/gitaly_client/blob_service.rb b/lib/gitlab/gitaly_client/blob_service.rb index 086ce31e678..39547328210 100644 --- a/lib/gitlab/gitaly_client/blob_service.rb +++ b/lib/gitlab/gitaly_client/blob_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class BlobService @@ -15,7 +17,7 @@ module Gitlab ) response = GitalyClient.call(@gitaly_repo.storage_name, :blob_service, :get_blob, request, timeout: GitalyClient.fast_timeout) - data = '' + data = [] blob = nil response.each do |msg| if blob.nil? @@ -27,6 +29,8 @@ module Gitlab return nil if blob.oid.blank? + data = data.join + Gitlab::Git::Blob.new( id: blob.oid, size: blob.size, diff --git a/lib/gitlab/gitaly_client/blobs_stitcher.rb b/lib/gitlab/gitaly_client/blobs_stitcher.rb index 5ca592ff812..01bab854082 100644 --- a/lib/gitlab/gitaly_client/blobs_stitcher.rb +++ b/lib/gitlab/gitaly_client/blobs_stitcher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class BlobsStitcher diff --git a/lib/gitlab/gitaly_client/commit_service.rb b/lib/gitlab/gitaly_client/commit_service.rb index 085b2a127a5..4e46cb9f05c 100644 --- a/lib/gitlab/gitaly_client/commit_service.rb +++ b/lib/gitlab/gitaly_client/commit_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class CommitService @@ -93,7 +95,7 @@ module Gitlab response = GitalyClient.call(@repository.storage, :commit_service, :tree_entry, request, timeout: GitalyClient.medium_timeout) entry = nil - data = '' + data = [] response.each do |msg| if entry.nil? entry = msg @@ -103,7 +105,7 @@ module Gitlab data << msg.data end - entry.data = data + entry.data = data.join entry unless entry.oid.blank? end @@ -254,7 +256,7 @@ module Gitlab ) response = GitalyClient.call(@repository.storage, :commit_service, :raw_blame, request, timeout: GitalyClient.medium_timeout) - response.reduce("") { |memo, msg| memo << msg.data } + response.reduce([]) { |memo, msg| memo << msg.data }.join end def find_commit(revision) @@ -345,8 +347,8 @@ module Gitlab request = Gitaly::ExtractCommitSignatureRequest.new(repository: @gitaly_repo, commit_id: commit_id) response = GitalyClient.call(@repository.storage, :commit_service, :extract_commit_signature, request) - signature = ''.b - signed_text = ''.b + signature = +''.b + signed_text = +''.b response.each do |message| signature << message.signature @@ -364,7 +366,7 @@ module Gitlab request = Gitaly::GetCommitSignaturesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids) response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_signatures, request, timeout: GitalyClient.fast_timeout) - signatures = Hash.new { |h, k| h[k] = [''.b, ''.b] } + signatures = Hash.new { |h, k| h[k] = [+''.b, +''.b] } current_commit_id = nil response.each do |message| @@ -383,7 +385,7 @@ module Gitlab request = Gitaly::GetCommitMessagesRequest.new(repository: @gitaly_repo, commit_ids: commit_ids) response = GitalyClient.call(@repository.storage, :commit_service, :get_commit_messages, request, timeout: GitalyClient.fast_timeout) - messages = Hash.new { |h, k| h[k] = ''.b } + messages = Hash.new { |h, k| h[k] = +''.b } current_commit_id = nil response.each do |rpc_message| diff --git a/lib/gitlab/gitaly_client/conflict_files_stitcher.rb b/lib/gitlab/gitaly_client/conflict_files_stitcher.rb index c275a065bce..0e00f6e8c44 100644 --- a/lib/gitlab/gitaly_client/conflict_files_stitcher.rb +++ b/lib/gitlab/gitaly_client/conflict_files_stitcher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class ConflictFilesStitcher @@ -17,7 +19,7 @@ module Gitlab current_file = file_from_gitaly_header(gitaly_file.header) else - current_file.raw_content << gitaly_file.content + current_file.raw_content = "#{current_file.raw_content}#{gitaly_file.content}" end end end diff --git a/lib/gitlab/gitaly_client/conflicts_service.rb b/lib/gitlab/gitaly_client/conflicts_service.rb index aa7e03301f5..6304f998563 100644 --- a/lib/gitlab/gitaly_client/conflicts_service.rb +++ b/lib/gitlab/gitaly_client/conflicts_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class ConflictsService diff --git a/lib/gitlab/gitaly_client/diff.rb b/lib/gitlab/gitaly_client/diff.rb index af9d674535b..dd192ccde1a 100644 --- a/lib/gitlab/gitaly_client/diff.rb +++ b/lib/gitlab/gitaly_client/diff.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class Diff diff --git a/lib/gitlab/gitaly_client/diff_stitcher.rb b/lib/gitlab/gitaly_client/diff_stitcher.rb index da243ee2d1a..98d327a7329 100644 --- a/lib/gitlab/gitaly_client/diff_stitcher.rb +++ b/lib/gitlab/gitaly_client/diff_stitcher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class DiffStitcher @@ -20,7 +22,7 @@ module Gitlab current_diff = GitalyClient::Diff.new(diff_params) else - current_diff.patch += diff_msg.raw_patch_data + current_diff.patch = "#{current_diff.patch}#{diff_msg.raw_patch_data}" end if diff_msg.end_of_patch diff --git a/lib/gitlab/gitaly_client/health_check_service.rb b/lib/gitlab/gitaly_client/health_check_service.rb index 6c1213f5e20..0c495f60633 100644 --- a/lib/gitlab/gitaly_client/health_check_service.rb +++ b/lib/gitlab/gitaly_client/health_check_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class HealthCheckService diff --git a/lib/gitlab/gitaly_client/namespace_service.rb b/lib/gitlab/gitaly_client/namespace_service.rb index d4e982b649a..f0be3cbebd2 100644 --- a/lib/gitlab/gitaly_client/namespace_service.rb +++ b/lib/gitlab/gitaly_client/namespace_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class NamespaceService diff --git a/lib/gitlab/gitaly_client/notification_service.rb b/lib/gitlab/gitaly_client/notification_service.rb index 326e6f7dafc..873c3e4086d 100644 --- a/lib/gitlab/gitaly_client/notification_service.rb +++ b/lib/gitlab/gitaly_client/notification_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class NotificationService diff --git a/lib/gitlab/gitaly_client/operation_service.rb b/lib/gitlab/gitaly_client/operation_service.rb index 4c78b790ce5..c32c2c0b2fb 100644 --- a/lib/gitlab/gitaly_client/operation_service.rb +++ b/lib/gitlab/gitaly_client/operation_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class OperationService diff --git a/lib/gitlab/gitaly_client/queue_enumerator.rb b/lib/gitlab/gitaly_client/queue_enumerator.rb index b8018029552..3a412102abe 100644 --- a/lib/gitlab/gitaly_client/queue_enumerator.rb +++ b/lib/gitlab/gitaly_client/queue_enumerator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class QueueEnumerator diff --git a/lib/gitlab/gitaly_client/ref_service.rb b/lib/gitlab/gitaly_client/ref_service.rb index 8acc22e809e..d5633d167ac 100644 --- a/lib/gitlab/gitaly_client/ref_service.rb +++ b/lib/gitlab/gitaly_client/ref_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class RefService @@ -218,7 +220,7 @@ module Gitlab request = Gitaly::GetTagMessagesRequest.new(repository: @gitaly_repo, tag_ids: tag_ids) response = GitalyClient.call(@repository.storage, :ref_service, :get_tag_messages, request, timeout: GitalyClient.fast_timeout) - messages = Hash.new { |h, k| h[k] = ''.b } + messages = Hash.new { |h, k| h[k] = +''.b } current_tag_id = nil response.each do |rpc_message| diff --git a/lib/gitlab/gitaly_client/remote_service.rb b/lib/gitlab/gitaly_client/remote_service.rb index 4661448621b..24e8a5e16d3 100644 --- a/lib/gitlab/gitaly_client/remote_service.rb +++ b/lib/gitlab/gitaly_client/remote_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class RemoteService diff --git a/lib/gitlab/gitaly_client/repository_service.rb b/lib/gitlab/gitaly_client/repository_service.rb index d7b36946b65..f968ebc2cbf 100644 --- a/lib/gitlab/gitaly_client/repository_service.rb +++ b/lib/gitlab/gitaly_client/repository_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class RepositoryService @@ -56,9 +58,9 @@ module Gitlab request = Gitaly::GetInfoAttributesRequest.new(repository: @gitaly_repo) response = GitalyClient.call(@storage, :repository_service, :get_info_attributes, request, timeout: GitalyClient.fast_timeout) - response.each_with_object("") do |message, attributes| + response.each_with_object([]) do |message, attributes| attributes << message.attributes - end + end.join end def fetch_remote(remote, ssh_auth:, forced:, no_tags:, timeout:, prune: true) diff --git a/lib/gitlab/gitaly_client/server_service.rb b/lib/gitlab/gitaly_client/server_service.rb index ad898278353..0ade6942db9 100644 --- a/lib/gitlab/gitaly_client/server_service.rb +++ b/lib/gitlab/gitaly_client/server_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient # Meant for extraction of server data, and later maybe to perform misc task diff --git a/lib/gitlab/gitaly_client/storage_service.rb b/lib/gitlab/gitaly_client/storage_service.rb index 3a26dd58ff4..4edcb0b8ba9 100644 --- a/lib/gitlab/gitaly_client/storage_service.rb +++ b/lib/gitlab/gitaly_client/storage_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class StorageService diff --git a/lib/gitlab/gitaly_client/storage_settings.rb b/lib/gitlab/gitaly_client/storage_settings.rb index 26d1f53f26c..754cccb6b3f 100644 --- a/lib/gitlab/gitaly_client/storage_settings.rb +++ b/lib/gitlab/gitaly_client/storage_settings.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient # This is a chokepoint that is meant to help us stop remove all places diff --git a/lib/gitlab/gitaly_client/util.rb b/lib/gitlab/gitaly_client/util.rb index 9c19c51d412..dce5d6a8ad0 100644 --- a/lib/gitlab/gitaly_client/util.rb +++ b/lib/gitlab/gitaly_client/util.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient module Util diff --git a/lib/gitlab/gitaly_client/wiki_file.rb b/lib/gitlab/gitaly_client/wiki_file.rb index 47c60c92484..ef2b23732d1 100644 --- a/lib/gitlab/gitaly_client/wiki_file.rb +++ b/lib/gitlab/gitaly_client/wiki_file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class WikiFile diff --git a/lib/gitlab/gitaly_client/wiki_page.rb b/lib/gitlab/gitaly_client/wiki_page.rb index a02d15db5dd..757a429fb8a 100644 --- a/lib/gitlab/gitaly_client/wiki_page.rb +++ b/lib/gitlab/gitaly_client/wiki_page.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitalyClient class WikiPage diff --git a/lib/gitlab/gitaly_client/wiki_service.rb b/lib/gitlab/gitaly_client/wiki_service.rb index 7c2c228ad01..2b3d622af4d 100644 --- a/lib/gitlab/gitaly_client/wiki_service.rb +++ b/lib/gitlab/gitaly_client/wiki_service.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'stringio' module Gitlab @@ -139,7 +141,7 @@ module Gitlab next unless message.name.present? || wiki_file if wiki_file - wiki_file.raw_data << message.raw_data + wiki_file.raw_data = "#{wiki_file.raw_data}#{message.raw_data}" else wiki_file = GitalyClient::WikiFile.new(message.to_h) # All gRPC strings in a response are frozen, so we get @@ -160,7 +162,7 @@ module Gitlab ) response = GitalyClient.call(@repository.storage, :wiki_service, :wiki_get_formatted_data, request) - response.reduce("") { |memo, msg| memo << msg.data } + response.reduce([]) { |memo, msg| memo << msg.data }.join end private diff --git a/lib/gitlab/gitlab_import/client.rb b/lib/gitlab/gitlab_import/client.rb index 38ef12491df..86474159f8b 100644 --- a/lib/gitlab/gitlab_import/client.rb +++ b/lib/gitlab/gitlab_import/client.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitlabImport class Client diff --git a/lib/gitlab/gitlab_import/importer.rb b/lib/gitlab/gitlab_import/importer.rb index 047487f1d24..e84863deba8 100644 --- a/lib/gitlab/gitlab_import/importer.rb +++ b/lib/gitlab/gitlab_import/importer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitlabImport class Importer @@ -22,22 +24,22 @@ module Gitlab issues = client.issues(project_identifier) issues.each do |issue| - body = @formatter.author_line(issue["author"]["name"]) - body += issue["description"] + body = [@formatter.author_line(issue["author"]["name"])] + body << issue["description"] comments = client.issue_comments(project_identifier, issue["iid"]) if comments.any? - body += @formatter.comments_header + body << @formatter.comments_header end comments.each do |comment| - body += @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"]) + body << @formatter.comment(comment["author"]["name"], comment["created_at"], comment["body"]) end project.issues.create!( iid: issue["iid"], - description: body, + description: body.join, title: issue["title"], state: issue["state"], updated_at: issue["updated_at"], diff --git a/lib/gitlab/gitlab_import/project_creator.rb b/lib/gitlab/gitlab_import/project_creator.rb index 430b8c10058..35feea17351 100644 --- a/lib/gitlab/gitlab_import/project_creator.rb +++ b/lib/gitlab/gitlab_import/project_creator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GitlabImport class ProjectCreator diff --git a/lib/gitlab/google_code_import/client.rb b/lib/gitlab/google_code_import/client.rb index b1dbf554e41..52d714880b5 100644 --- a/lib/gitlab/google_code_import/client.rb +++ b/lib/gitlab/google_code_import/client.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GoogleCodeImport class Client diff --git a/lib/gitlab/google_code_import/importer.rb b/lib/gitlab/google_code_import/importer.rb index 0c08c0fedaa..1e7203cb82a 100644 --- a/lib/gitlab/google_code_import/importer.rb +++ b/lib/gitlab/google_code_import/importer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GoogleCodeImport class Importer diff --git a/lib/gitlab/google_code_import/project_creator.rb b/lib/gitlab/google_code_import/project_creator.rb index 326cfcaa8af..eaef85acb98 100644 --- a/lib/gitlab/google_code_import/project_creator.rb +++ b/lib/gitlab/google_code_import/project_creator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GoogleCodeImport class ProjectCreator diff --git a/lib/gitlab/google_code_import/repository.rb b/lib/gitlab/google_code_import/repository.rb index ad33fc2cad2..19627c8cd35 100644 --- a/lib/gitlab/google_code_import/repository.rb +++ b/lib/gitlab/google_code_import/repository.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GoogleCodeImport class Repository diff --git a/lib/gitlab/gpg/commit.rb b/lib/gitlab/gpg/commit.rb index 2bc081a6181..31bab20b044 100644 --- a/lib/gitlab/gpg/commit.rb +++ b/lib/gitlab/gpg/commit.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Gpg class Commit diff --git a/lib/gitlab/gpg/invalid_gpg_signature_updater.rb b/lib/gitlab/gpg/invalid_gpg_signature_updater.rb index 6972bd685f7..d892d27a917 100644 --- a/lib/gitlab/gpg/invalid_gpg_signature_updater.rb +++ b/lib/gitlab/gpg/invalid_gpg_signature_updater.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Gpg class InvalidGpgSignatureUpdater diff --git a/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb b/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb index 41004408dec..9bb1e8fc7a2 100644 --- a/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb +++ b/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module GrapeLogging module Formatters diff --git a/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb b/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb index 0adac79f25a..705e23adff2 100644 --- a/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb +++ b/lib/gitlab/grape_logging/loggers/queue_duration_logger.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This grape_logging module (https://github.com/aserafin/grape_logging) makes it # possible to log how much time an API request was queued by Workhorse. module Gitlab diff --git a/lib/gitlab/grape_logging/loggers/user_logger.rb b/lib/gitlab/grape_logging/loggers/user_logger.rb index fa172861967..6caa6c715e7 100644 --- a/lib/gitlab/grape_logging/loggers/user_logger.rb +++ b/lib/gitlab/grape_logging/loggers/user_logger.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This grape_logging module (https://github.com/aserafin/grape_logging) makes it # possible to log the user who performed the Grape API action by retrieving # the user context from the request environment. diff --git a/lib/gitlab/graphql/authorize.rb b/lib/gitlab/graphql/authorize.rb index 93a903915b0..5e48bf9043d 100644 --- a/lib/gitlab/graphql/authorize.rb +++ b/lib/gitlab/graphql/authorize.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql # Allow fields to declare permissions their objects must have. The field diff --git a/lib/gitlab/graphql/authorize/authorize_resource.rb b/lib/gitlab/graphql/authorize/authorize_resource.rb index 40895686a8a..a56c4f6368d 100644 --- a/lib/gitlab/graphql/authorize/authorize_resource.rb +++ b/lib/gitlab/graphql/authorize/authorize_resource.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Authorize diff --git a/lib/gitlab/graphql/authorize/instrumentation.rb b/lib/gitlab/graphql/authorize/instrumentation.rb index 6cb8e617f62..d638d2b43ee 100644 --- a/lib/gitlab/graphql/authorize/instrumentation.rb +++ b/lib/gitlab/graphql/authorize/instrumentation.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Authorize diff --git a/lib/gitlab/graphql/connections.rb b/lib/gitlab/graphql/connections.rb index 2582ffeb2a8..fbccdfa7b08 100644 --- a/lib/gitlab/graphql/connections.rb +++ b/lib/gitlab/graphql/connections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Connections diff --git a/lib/gitlab/graphql/connections/keyset_connection.rb b/lib/gitlab/graphql/connections/keyset_connection.rb index 3c0d7e9784a..851054c0393 100644 --- a/lib/gitlab/graphql/connections/keyset_connection.rb +++ b/lib/gitlab/graphql/connections/keyset_connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Connections diff --git a/lib/gitlab/graphql/errors.rb b/lib/gitlab/graphql/errors.rb index f8c7ec24be1..fe74549e322 100644 --- a/lib/gitlab/graphql/errors.rb +++ b/lib/gitlab/graphql/errors.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Errors diff --git a/lib/gitlab/graphql/expose_permissions.rb b/lib/gitlab/graphql/expose_permissions.rb index e3779995406..365b7cca24f 100644 --- a/lib/gitlab/graphql/expose_permissions.rb +++ b/lib/gitlab/graphql/expose_permissions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module ExposePermissions diff --git a/lib/gitlab/graphql/present.rb b/lib/gitlab/graphql/present.rb index 2c7b64f1be9..7f69bf601d6 100644 --- a/lib/gitlab/graphql/present.rb +++ b/lib/gitlab/graphql/present.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Present diff --git a/lib/gitlab/graphql/present/instrumentation.rb b/lib/gitlab/graphql/present/instrumentation.rb index f87fd147b15..ab03c40c22d 100644 --- a/lib/gitlab/graphql/present/instrumentation.rb +++ b/lib/gitlab/graphql/present/instrumentation.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql module Present diff --git a/lib/gitlab/graphql/variables.rb b/lib/gitlab/graphql/variables.rb index ffbaf65b512..b13ea37c21f 100644 --- a/lib/gitlab/graphql/variables.rb +++ b/lib/gitlab/graphql/variables.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphql class Variables diff --git a/lib/gitlab/graphs/commits.rb b/lib/gitlab/graphs/commits.rb index c4ffc19df09..66e1b2e78b4 100644 --- a/lib/gitlab/graphs/commits.rb +++ b/lib/gitlab/graphs/commits.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module Graphs class Commits diff --git a/lib/gitlab/hashed_storage/migrator.rb b/lib/gitlab/hashed_storage/migrator.rb index 4edc251facb..1f29cf10cad 100644 --- a/lib/gitlab/hashed_storage/migrator.rb +++ b/lib/gitlab/hashed_storage/migrator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HashedStorage # Hashed Storage Migrator diff --git a/lib/gitlab/hashed_storage/rake_helper.rb b/lib/gitlab/hashed_storage/rake_helper.rb index 22edd5f999d..38f552fab03 100644 --- a/lib/gitlab/hashed_storage/rake_helper.rb +++ b/lib/gitlab/hashed_storage/rake_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HashedStorage module RakeHelper diff --git a/lib/gitlab/health_checks/base_abstract_check.rb b/lib/gitlab/health_checks/base_abstract_check.rb index 8b365dab185..1d31f59999c 100644 --- a/lib/gitlab/health_checks/base_abstract_check.rb +++ b/lib/gitlab/health_checks/base_abstract_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks module BaseAbstractCheck diff --git a/lib/gitlab/health_checks/db_check.rb b/lib/gitlab/health_checks/db_check.rb index 08495c0a59e..2bcd25cd3cc 100644 --- a/lib/gitlab/health_checks/db_check.rb +++ b/lib/gitlab/health_checks/db_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks class DbCheck diff --git a/lib/gitlab/health_checks/gitaly_check.rb b/lib/gitlab/health_checks/gitaly_check.rb index 1f623e0b6ec..898733fea5d 100644 --- a/lib/gitlab/health_checks/gitaly_check.rb +++ b/lib/gitlab/health_checks/gitaly_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks class GitalyCheck diff --git a/lib/gitlab/health_checks/metric.rb b/lib/gitlab/health_checks/metric.rb index d62d9136886..62a5216d159 100644 --- a/lib/gitlab/health_checks/metric.rb +++ b/lib/gitlab/health_checks/metric.rb @@ -1,3 +1,6 @@ -module Gitlab::HealthChecks # rubocop:disable Naming/FileName +# rubocop:disable Naming/FileName +# frozen_string_literal: true + +module Gitlab::HealthChecks Metric = Struct.new(:name, :value, :labels) end diff --git a/lib/gitlab/health_checks/prometheus_text_format.rb b/lib/gitlab/health_checks/prometheus_text_format.rb index b3c759b4730..2a8f9d31cd5 100644 --- a/lib/gitlab/health_checks/prometheus_text_format.rb +++ b/lib/gitlab/health_checks/prometheus_text_format.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks class PrometheusTextFormat diff --git a/lib/gitlab/health_checks/redis/cache_check.rb b/lib/gitlab/health_checks/redis/cache_check.rb index 2f6c4db12bb..0c8fe83893b 100644 --- a/lib/gitlab/health_checks/redis/cache_check.rb +++ b/lib/gitlab/health_checks/redis/cache_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks module Redis diff --git a/lib/gitlab/health_checks/redis/queues_check.rb b/lib/gitlab/health_checks/redis/queues_check.rb index 63d2882c5b2..b1e33b9f459 100644 --- a/lib/gitlab/health_checks/redis/queues_check.rb +++ b/lib/gitlab/health_checks/redis/queues_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks module Redis diff --git a/lib/gitlab/health_checks/redis/redis_check.rb b/lib/gitlab/health_checks/redis/redis_check.rb index 8ceb0a0aa46..f7e46fce134 100644 --- a/lib/gitlab/health_checks/redis/redis_check.rb +++ b/lib/gitlab/health_checks/redis/redis_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks module Redis diff --git a/lib/gitlab/health_checks/redis/shared_state_check.rb b/lib/gitlab/health_checks/redis/shared_state_check.rb index f1ea1ffe1be..285ac271929 100644 --- a/lib/gitlab/health_checks/redis/shared_state_check.rb +++ b/lib/gitlab/health_checks/redis/shared_state_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks module Redis diff --git a/lib/gitlab/health_checks/result.rb b/lib/gitlab/health_checks/result.rb index e323e2c9723..d32a6980eb8 100644 --- a/lib/gitlab/health_checks/result.rb +++ b/lib/gitlab/health_checks/result.rb @@ -1,3 +1,6 @@ -module Gitlab::HealthChecks # rubocop:disable Naming/FileName +# rubocop:disable Naming/FileName +# frozen_string_literal: true + +module Gitlab::HealthChecks Result = Struct.new(:success, :message, :labels) end diff --git a/lib/gitlab/health_checks/simple_abstract_check.rb b/lib/gitlab/health_checks/simple_abstract_check.rb index 96945ce5b20..3588260d6eb 100644 --- a/lib/gitlab/health_checks/simple_abstract_check.rb +++ b/lib/gitlab/health_checks/simple_abstract_check.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Gitlab module HealthChecks module SimpleAbstractCheck -- cgit v1.2.1 From cb1a3077ceec61d2042c5959ce864ff6c1fc51da Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Wed, 14 Nov 2018 09:08:37 +0100 Subject: Fix path to project permissions --- .../img/container_registry_checkbox.png | Bin 4730 -> 0 bytes doc/ci/examples/laravel_with_gitlab_and_envoy/index.md | 4 +--- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 doc/ci/examples/laravel_with_gitlab_and_envoy/img/container_registry_checkbox.png diff --git a/doc/ci/examples/laravel_with_gitlab_and_envoy/img/container_registry_checkbox.png b/doc/ci/examples/laravel_with_gitlab_and_envoy/img/container_registry_checkbox.png deleted file mode 100644 index a56c07a0da7..00000000000 Binary files a/doc/ci/examples/laravel_with_gitlab_and_envoy/img/container_registry_checkbox.png and /dev/null differ diff --git a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md index b6989d229d1..b090ea014dc 100644 --- a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md +++ b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md @@ -444,9 +444,7 @@ On your GitLab project repository navigate to the **Registry** tab. ![container registry page empty image](img/container_registry_page_empty_image.png) -You may need to [enable Container Registry](../../../user/project/container_registry.md#enable-the-container-registry-for-your-project) to your project to see this tab. You'll find it under your project's **Settings > General > Sharing and permissions**. - -![container registry checkbox](img/container_registry_checkbox.png) +You may need to [enable Container Registry](../../../user/project/container_registry.md#enable-the-container-registry-for-your-project) to your project to see this tab. You'll find it under your project's **Settings > General > Permissions**. To start using Container Registry on our machine, we first need to login to the GitLab registry using our GitLab username and password: -- cgit v1.2.1 From 3797cfbd392df9a73f709126c837725622116f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Javier=20L=C3=B3pez?= Date: Wed, 14 Nov 2018 09:55:57 +0100 Subject: Fix bug in CommitCheck --- lib/gitlab/checks/commit_check.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/checks/commit_check.rb b/lib/gitlab/checks/commit_check.rb index 6dd74e8fb74..58267b6752f 100644 --- a/lib/gitlab/checks/commit_check.rb +++ b/lib/gitlab/checks/commit_check.rb @@ -10,8 +10,8 @@ module Gitlab def initialize(project, user, newrev, oldrev) @project = project @user = user - @newrev = user - @oldrev = user + @newrev = newrev + @oldrev = oldrev @file_paths = [] end -- cgit v1.2.1 From 408902eef60e7546f9bc2f358bad941c650860f2 Mon Sep 17 00:00:00 2001 From: Daniel Fernau Date: Wed, 14 Nov 2018 12:38:50 +0000 Subject: Update doc/university/training/topics/tags.md --- doc/university/training/topics/tags.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/university/training/topics/tags.md b/doc/university/training/topics/tags.md index 9526bcbfb82..14c39457838 100644 --- a/doc/university/training/topics/tags.md +++ b/doc/university/training/topics/tags.md @@ -22,7 +22,7 @@ comments: false **Additional resources** - + ---------- -- cgit v1.2.1 From b45501395ce13eabd079acd1640f99a94c4eee85 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Wed, 14 Nov 2018 14:46:31 +0100 Subject: Fix default sorting for subgroups and projects list --- app/finders/group_descendants_finder.rb | 2 +- .../53290-incorrect-project-list-order-select-default-label.yml | 5 +++++ spec/finders/group_descendants_finder_spec.rb | 7 +++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/53290-incorrect-project-list-order-select-default-label.yml diff --git a/app/finders/group_descendants_finder.rb b/app/finders/group_descendants_finder.rb index c96979619fd..a9ce5be13f3 100644 --- a/app/finders/group_descendants_finder.rb +++ b/app/finders/group_descendants_finder.rb @@ -178,7 +178,7 @@ class GroupDescendantsFinder end def sort - params.fetch(:sort, 'id_asc') + params.fetch(:sort, 'created_desc') end # rubocop: disable CodeReuse/ActiveRecord diff --git a/changelogs/unreleased/53290-incorrect-project-list-order-select-default-label.yml b/changelogs/unreleased/53290-incorrect-project-list-order-select-default-label.yml new file mode 100644 index 00000000000..d076352a27b --- /dev/null +++ b/changelogs/unreleased/53290-incorrect-project-list-order-select-default-label.yml @@ -0,0 +1,5 @@ +--- +title: Fix default sorting for subgroups and projects list +merge_request: 23058 +author: Jacopo Beschi @jacopo-beschi +type: fixed diff --git a/spec/finders/group_descendants_finder_spec.rb b/spec/finders/group_descendants_finder_spec.rb index c64abdc3619..c28fd7cad11 100644 --- a/spec/finders/group_descendants_finder_spec.rb +++ b/spec/finders/group_descendants_finder_spec.rb @@ -74,6 +74,13 @@ describe GroupDescendantsFinder do end end + it 'sorts elements by latest created as default' do + project1 = create(:project, namespace: group, created_at: 1.hour.ago) + project2 = create(:project, namespace: group) + + expect(subject.execute).to eq([project2, project1]) + end + context 'sorting by name' do let!(:project1) { create(:project, namespace: group, name: 'a', path: 'project-a') } let!(:project2) { create(:project, namespace: group, name: 'z', path: 'project-z') } -- cgit v1.2.1 From f1f038956a3afa7ae77c7155f5302f1dc63884a4 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Wed, 14 Nov 2018 15:00:23 +0100 Subject: Revert API is going into 11.5, not 11.6. --- doc/api/commits.md | 2 +- lib/api/commits.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/commits.md b/doc/api/commits.md index 994eefa423f..7d9b52ec24f 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -290,7 +290,7 @@ Example response: ## Revert a commit -> [Introduced][ce-22919] in GitLab 11.6. +> [Introduced][ce-22919] in GitLab 11.5. Reverts a commit in a given branch. diff --git a/lib/api/commits.rb b/lib/api/commits.rb index 3b8f3fedccf..337b92a6183 100644 --- a/lib/api/commits.rb +++ b/lib/api/commits.rb @@ -207,7 +207,7 @@ module API end desc 'Revert a commit in a branch' do - detail 'This feature was introduced in GitLab 11.6' + detail 'This feature was introduced in GitLab 11.5' success Entities::Commit end params do -- cgit v1.2.1 From 6b0ea951cac3905437abb2bbacaf422371f097e0 Mon Sep 17 00:00:00 2001 From: Jacopo Date: Fri, 19 Oct 2018 09:16:58 +0200 Subject: Creates /create_merge_request quickaction With this quick action the user can create a new MR starting from the current issue using as `source_branch` the given `branch name` and as `target_branch` the project default branch. If the `branch name` is omitted a name is automatically created starting from the issue title. --- app/services/issues/update_service.rb | 13 +++++ .../merge_requests/create_from_issue_service.rb | 6 ++- app/services/quick_actions/interpret_service.rb | 16 ++++++ app/services/system_note_service.rb | 8 ++- ...085-add-a-create_merge_request-quick-action.yml | 5 ++ doc/user/project/quick_actions.md | 1 + .../user_creates_branch_and_merge_request_spec.rb | 4 +- .../issues/user_uses_quick_actions_spec.rb | 58 ++++++++++++++++++++++ .../create_from_issue_service_spec.rb | 10 +++- .../quick_actions/interpret_service_spec.rb | 53 ++++++++++++++++++++ spec/services/system_note_service_spec.rb | 14 ++++++ 11 files changed, 182 insertions(+), 6 deletions(-) create mode 100644 changelogs/unreleased/40085-add-a-create_merge_request-quick-action.yml diff --git a/app/services/issues/update_service.rb b/app/services/issues/update_service.rb index fba252b0bae..a1d0cc0e568 100644 --- a/app/services/issues/update_service.rb +++ b/app/services/issues/update_service.rb @@ -11,6 +11,12 @@ module Issues move_issue_to_new_project(issue) || update(issue) end + def update(issue) + create_merge_request_from_quick_action + + super + end + def before_update(issue) spam_check(issue, current_user) end @@ -93,6 +99,13 @@ module Issues private + def create_merge_request_from_quick_action + create_merge_request_params = params.delete(:create_merge_request) + return unless create_merge_request_params + + MergeRequests::CreateFromIssueService.new(project, current_user, create_merge_request_params).execute + end + def handle_milestone_change(issue) return if skip_milestone_email diff --git a/app/services/merge_requests/create_from_issue_service.rb b/app/services/merge_requests/create_from_issue_service.rb index 020af0bb950..e69791872cc 100644 --- a/app/services/merge_requests/create_from_issue_service.rb +++ b/app/services/merge_requests/create_from_issue_service.rb @@ -19,13 +19,15 @@ module MergeRequests result = CreateBranchService.new(project, current_user).execute(branch_name, ref) return result if result[:status] == :error - SystemNoteService.new_issue_branch(issue, project, current_user, branch_name) - new_merge_request = create(merge_request) if new_merge_request.valid? + SystemNoteService.new_merge_request(issue, project, current_user, new_merge_request) + success(new_merge_request) else + SystemNoteService.new_issue_branch(issue, project, current_user, branch_name) + error(new_merge_request.errors) end end diff --git a/app/services/quick_actions/interpret_service.rb b/app/services/quick_actions/interpret_service.rb index 9c81de7e90e..d248b10f41e 100644 --- a/app/services/quick_actions/interpret_service.rb +++ b/app/services/quick_actions/interpret_service.rb @@ -635,6 +635,22 @@ module QuickActions @updates[:tag_message] = message end + desc 'Create a merge request.' + explanation do |branch_name = nil| + branch_text = branch_name ? "branch '#{branch_name}'" : 'a branch' + "Creates #{branch_text} and a merge request to resolve this issue" + end + params "" + condition do + issuable.is_a?(Issue) && current_user.can?(:create_merge_request_in, project) && current_user.can?(:push_code, project) + end + command :create_merge_request do |branch_name = nil| + @updates[:create_merge_request] = { + branch_name: branch_name, + issue_iid: issuable.iid + } + end + # rubocop: disable CodeReuse/ActiveRecord def extract_users(params) return [] if params.nil? diff --git a/app/services/system_note_service.rb b/app/services/system_note_service.rb index 729bc991294..ec6c306227b 100644 --- a/app/services/system_note_service.rb +++ b/app/services/system_note_service.rb @@ -407,11 +407,17 @@ module SystemNoteService def new_issue_branch(issue, project, author, branch) link = url_helpers.project_compare_url(project, from: project.default_branch, to: branch) - body = "created branch [`#{branch}`](#{link})" + body = "created branch [`#{branch}`](#{link}) to address this issue" create_note(NoteSummary.new(issue, project, author, body, action: 'branch')) end + def new_merge_request(issue, project, author, merge_request) + body = "created merge request #{merge_request.to_reference} to address this issue" + + create_note(NoteSummary.new(issue, project, author, body, action: 'merge')) + end + # Called when a Mentionable references a Noteable # # noteable - Noteable object being referenced diff --git a/changelogs/unreleased/40085-add-a-create_merge_request-quick-action.yml b/changelogs/unreleased/40085-add-a-create_merge_request-quick-action.yml new file mode 100644 index 00000000000..e1614ac7669 --- /dev/null +++ b/changelogs/unreleased/40085-add-a-create_merge_request-quick-action.yml @@ -0,0 +1,5 @@ +--- +title: Creates /create_merge_request quickaction +merge_request: 22485 +author: Jacopo Beschi @jacopo-beschi +type: added diff --git a/doc/user/project/quick_actions.md b/doc/user/project/quick_actions.md index 0a4542b71ed..85a03d125dd 100644 --- a/doc/user/project/quick_actions.md +++ b/doc/user/project/quick_actions.md @@ -53,6 +53,7 @@ discussions, and descriptions: | `/target_branch ` | Set target branch | | ✓ | | `/wip` | Toggle the Work In Progress status | | ✓ | | `/merge` | Merge (when pipeline succeeds) | | ✓ | +| `/create_merge_request ` | Create a new merge request starting from the current issue | ✓ | | ## Quick actions for commit messages diff --git a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb index 3dfcbc2fcb8..a912c327728 100644 --- a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb +++ b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb @@ -76,7 +76,7 @@ describe 'User creates branch and merge request on issue page', :js do visit project_issue_path(project, issue) - expect(page).to have_content('created branch 1-cherry-coloured-funk') + expect(page).to have_content("created merge request !1 to address this issue") expect(page).to have_content('mentioned in merge request !1') end @@ -106,7 +106,7 @@ describe 'User creates branch and merge request on issue page', :js do visit project_issue_path(project, issue) - expect(page).to have_content('created branch custom-branch-name') + expect(page).to have_content("created merge request !1 to address this issue") expect(page).to have_content('mentioned in merge request !1') end diff --git a/spec/features/issues/user_uses_quick_actions_spec.rb b/spec/features/issues/user_uses_quick_actions_spec.rb index 5926e442f24..27cffdc5f8b 100644 --- a/spec/features/issues/user_uses_quick_actions_spec.rb +++ b/spec/features/issues/user_uses_quick_actions_spec.rb @@ -303,5 +303,63 @@ describe 'Issues > User uses quick actions', :js do end end end + + describe 'create a merge request starting from an issue' do + let(:project) { create(:project, :public, :repository) } + let(:issue) { create(:issue, project: project) } + + def expect_mr_quickaction(success) + expect(page).to have_content 'Commands applied' + + if success + expect(page).to have_content 'created merge request' + else + expect(page).not_to have_content 'created merge request' + end + end + + it "doesn't create a merge request when the branch name is invalid" do + add_note("/create_merge_request invalid branch name") + + wait_for_requests + + expect_mr_quickaction(false) + end + + it "doesn't create a merge request when a branch with that name already exists" do + add_note("/create_merge_request feature") + + wait_for_requests + + expect_mr_quickaction(false) + end + + it 'creates a new merge request using issue iid and title as branch name when the branch name is empty' do + add_note("/create_merge_request") + + wait_for_requests + + expect_mr_quickaction(true) + + created_mr = project.merge_requests.last + expect(created_mr.source_branch).to eq(issue.to_branch_name) + + visit project_merge_request_path(project, created_mr) + expect(page).to have_content %{WIP: Resolve "#{issue.title}"} + end + + it 'creates a merge request using the given branch name' do + branch_name = '1-feature' + add_note("/create_merge_request #{branch_name}") + + expect_mr_quickaction(true) + + created_mr = project.merge_requests.last + expect(created_mr.source_branch).to eq(branch_name) + + visit project_merge_request_path(project, created_mr) + expect(page).to have_content %{WIP: Resolve "#{issue.title}"} + end + end end end diff --git a/spec/services/merge_requests/create_from_issue_service_spec.rb b/spec/services/merge_requests/create_from_issue_service_spec.rb index b1882df732d..393299cce00 100644 --- a/spec/services/merge_requests/create_from_issue_service_spec.rb +++ b/spec/services/merge_requests/create_from_issue_service_spec.rb @@ -61,7 +61,15 @@ describe MergeRequests::CreateFromIssueService do expect(project.repository.branch_exists?(custom_source_branch)).to be_truthy end - it 'creates a system note' do + it 'creates the new_merge_request system note' do + expect(SystemNoteService).to receive(:new_merge_request).with(issue, project, user, instance_of(MergeRequest)) + + service.execute + end + + it 'creates the new_issue_branch system note when the branch could be created but the merge_request cannot be created' do + project.project_feature.update!(merge_requests_access_level: ProjectFeature::DISABLED) + expect(SystemNoteService).to receive(:new_issue_branch).with(issue, project, user, issue.to_branch_name) service.execute diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb index 5a7cafcb60f..938764f40b0 100644 --- a/spec/services/quick_actions/interpret_service_spec.rb +++ b/spec/services/quick_actions/interpret_service_spec.rb @@ -1222,6 +1222,37 @@ describe QuickActions::InterpretService do expect(commands).to be_empty expect(text).to eq("#{described_class::SHRUG}\n/close") end + + context '/create_merge_request command' do + let(:branch_name) { '1-feature' } + let(:content) { "/create_merge_request #{branch_name}" } + let(:issuable) { issue } + + context 'if issuable is not an Issue' do + let(:issuable) { merge_request } + + it_behaves_like 'empty command' + end + + context "when logged user cannot create_merge_requests in the project" do + let(:project) { create(:project, :archived) } + + it_behaves_like 'empty command' + end + + context 'when logged user cannot push code to the project' do + let(:project) { create(:project, :private) } + let(:service) { described_class.new(project, create(:user)) } + + it_behaves_like 'empty command' + end + + it 'populates create_merge_request with branch_name and issue iid' do + _, updates = service.execute(content, issuable) + + expect(updates).to eq(create_merge_request: { branch_name: branch_name, issue_iid: issuable.iid }) + end + end end describe '#explain' do @@ -1473,5 +1504,27 @@ describe QuickActions::InterpretService do end end end + + describe 'create a merge request' do + context 'with no branch name' do + let(:content) { '/create_merge_request' } + + it 'uses the default branch name' do + _, explanations = service.explain(content, issue) + + expect(explanations).to eq(['Creates a branch and a merge request to resolve this issue']) + end + end + + context 'with a branch name' do + let(:content) { '/create_merge_request foo' } + + it 'uses the given branch name' do + _, explanations = service.explain(content, issue) + + expect(explanations).to eq(["Creates branch 'foo' and a merge request to resolve this issue"]) + end + end + end end end diff --git a/spec/services/system_note_service_spec.rb b/spec/services/system_note_service_spec.rb index a18126ee339..0fbfcb34e50 100644 --- a/spec/services/system_note_service_spec.rb +++ b/spec/services/system_note_service_spec.rb @@ -432,6 +432,20 @@ describe SystemNoteService do end end + describe '.new_merge_request' do + subject { described_class.new_merge_request(noteable, project, author, merge_request) } + + let(:merge_request) { create(:merge_request, source_project: project, target_project: project) } + + it_behaves_like 'a system note' do + let(:action) { 'merge' } + end + + it 'sets the new merge request note text' do + expect(subject.note).to eq("created merge request #{merge_request.to_reference} to address this issue") + end + end + describe '.cross_reference' do subject { described_class.cross_reference(noteable, mentioner, author) } -- cgit v1.2.1 From 3cd538c2e9e18f31cee008d9b9e13df4dfd40b1d Mon Sep 17 00:00:00 2001 From: James Lopez Date: Wed, 14 Nov 2018 15:37:30 +0100 Subject: Fix text rendering of readme/index --- lib/gitlab/file_detector.rb | 2 +- spec/lib/gitlab/file_detector_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb index d6338b09e3d..4e749068f93 100644 --- a/lib/gitlab/file_detector.rb +++ b/lib/gitlab/file_detector.rb @@ -8,7 +8,7 @@ module Gitlab module FileDetector PATTERNS = { # Project files - readme: %r{\A(readme|index)[^/]*\z}i, + readme: %r{\A(readme|index)(|\.#{Gitlab::MarkupHelper::EXTENSIONS.join('|\.')})$[^\/]*\z}i, changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i, license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i, contributing: %r{\Acontributing[^/]*\z}i, diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index edab53247e9..ba65827d1fb 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -23,6 +23,10 @@ describe Gitlab::FileDetector do end end + it 'returns nil for a README.rb file' do + expect(described_class.type_of('README.rb')).to be_nil + end + it 'returns nil for a README file in a directory' do expect(described_class.type_of('foo/README.md')).to be_nil end -- cgit v1.2.1 From ec5d3abdbcfcdb09f12d9bde446a386f637d4932 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 14 Nov 2018 07:18:32 -0800 Subject: Bump Gitaly version to 0.132.0 See https://gitlab.com/gitlab-org/gitaly/blob/master/CHANGELOG.md --- GITALY_SERVER_VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index 4db8830b115..e491d6243c6 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -0.129.0 +0.132.0 -- cgit v1.2.1 From 4166ce773ba4445acb9dcf38eacd69ac10a8d30c Mon Sep 17 00:00:00 2001 From: Takuya Noguchi Date: Wed, 14 Nov 2018 17:35:56 +0900 Subject: Update asciidoctor to 1.5.8 Signed-off-by: Takuya Noguchi --- Gemfile | 2 +- Gemfile.lock | 4 ++-- Gemfile.rails4.lock | 4 ++-- changelogs/unreleased/54010-update-asciidoctor-to-1-5-8.yml | 5 +++++ 4 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelogs/unreleased/54010-update-asciidoctor-to-1-5-8.yml diff --git a/Gemfile b/Gemfile index 7030bd9c5e8..2d7a1066a5b 100644 --- a/Gemfile +++ b/Gemfile @@ -133,7 +133,7 @@ gem 'rdoc', '~> 6.0' gem 'org-ruby', '~> 0.9.12' gem 'creole', '~> 0.5.0' gem 'wikicloth', '0.8.1' -gem 'asciidoctor', '~> 1.5.6' +gem 'asciidoctor', '~> 1.5.8' gem 'asciidoctor-plantuml', '0.0.8' gem 'rouge', '~> 3.1' gem 'truncato', '~> 0.7.9' diff --git a/Gemfile.lock b/Gemfile.lock index f08855ed049..b0afed9e067 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -58,7 +58,7 @@ GEM faraday_middleware (~> 0.9) faraday_middleware-multi_json (~> 0.0) oauth2 (~> 1.0) - asciidoctor (1.5.6.2) + asciidoctor (1.5.8) asciidoctor-plantuml (0.0.8) asciidoctor (~> 1.5) ast (2.4.0) @@ -942,7 +942,7 @@ DEPENDENCIES addressable (~> 2.5.2) akismet (~> 2.0) asana (~> 0.6.0) - asciidoctor (~> 1.5.6) + asciidoctor (~> 1.5.8) asciidoctor-plantuml (= 0.0.8) attr_encrypted (~> 3.1.0) awesome_print diff --git a/Gemfile.rails4.lock b/Gemfile.rails4.lock index 5bec40de909..a9506010cc5 100644 --- a/Gemfile.rails4.lock +++ b/Gemfile.rails4.lock @@ -55,7 +55,7 @@ GEM faraday_middleware (~> 0.9) faraday_middleware-multi_json (~> 0.0) oauth2 (~> 1.0) - asciidoctor (1.5.6.2) + asciidoctor (1.5.8) asciidoctor-plantuml (0.0.8) asciidoctor (~> 1.5) ast (2.4.0) @@ -933,7 +933,7 @@ DEPENDENCIES addressable (~> 2.5.2) akismet (~> 2.0) asana (~> 0.6.0) - asciidoctor (~> 1.5.6) + asciidoctor (~> 1.5.8) asciidoctor-plantuml (= 0.0.8) attr_encrypted (~> 3.1.0) awesome_print diff --git a/changelogs/unreleased/54010-update-asciidoctor-to-1-5-8.yml b/changelogs/unreleased/54010-update-asciidoctor-to-1-5-8.yml new file mode 100644 index 00000000000..f0b0aa0ee1c --- /dev/null +++ b/changelogs/unreleased/54010-update-asciidoctor-to-1-5-8.yml @@ -0,0 +1,5 @@ +--- +title: Update asciidoctor to 1.5.8 +merge_request: 23047 +author: Takuya Noguchi +type: other -- cgit v1.2.1 From 459cfeb97a163d4420d21526fea61f0eacf2b39a Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Wed, 14 Nov 2018 18:16:04 +0200 Subject: Change breadcrumb title for contribution charts --- app/views/projects/graphs/charts.html.haml | 2 +- app/views/projects/pipelines/charts.html.haml | 3 +-- .../gt-change-breadcrumb-title-for-contribution-charts.yml | 5 +++++ locale/gitlab.pot | 6 ++++++ 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 changelogs/unreleased/gt-change-breadcrumb-title-for-contribution-charts.yml diff --git a/app/views/projects/graphs/charts.html.haml b/app/views/projects/graphs/charts.html.haml index 3f1974d05f4..b0e22a35fe1 100644 --- a/app/views/projects/graphs/charts.html.haml +++ b/app/views/projects/graphs/charts.html.haml @@ -1,5 +1,5 @@ - @no_container = true -- page_title "Charts" +- page_title _("Contribution Charts") .repo-charts{ class: container_class } %h4.sub-header diff --git a/app/views/projects/pipelines/charts.html.haml b/app/views/projects/pipelines/charts.html.haml index a86cb14960a..ec17eddba79 100644 --- a/app/views/projects/pipelines/charts.html.haml +++ b/app/views/projects/pipelines/charts.html.haml @@ -1,6 +1,5 @@ - @no_container = true -- breadcrumb_title "CI / CD Charts" -- page_title _("Charts"), _("Pipelines") +- page_title _("CI / CD Charts") %div{ class: container_class } .sub-header-block diff --git a/changelogs/unreleased/gt-change-breadcrumb-title-for-contribution-charts.yml b/changelogs/unreleased/gt-change-breadcrumb-title-for-contribution-charts.yml new file mode 100644 index 00000000000..233cc43117d --- /dev/null +++ b/changelogs/unreleased/gt-change-breadcrumb-title-for-contribution-charts.yml @@ -0,0 +1,5 @@ +--- +title: Change breadcrumb title for contribution charts +merge_request: 23071 +author: George Tsiolis +type: changed diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d3e1a51370e..01cd84cb747 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -1073,6 +1073,9 @@ msgstr "" msgid "CI / CD" msgstr "" +msgid "CI / CD Charts" +msgstr "" + msgid "CI / CD Settings" msgstr "" @@ -1953,6 +1956,9 @@ msgstr "" msgid "Contribution" msgstr "" +msgid "Contribution Charts" +msgstr "" + msgid "Contribution guide" msgstr "" -- cgit v1.2.1 From f2479e1987304fc7064de4b1f5e72320f958edd7 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Wed, 14 Nov 2018 11:17:10 -0500 Subject: Prevents empty button in jobs empty state Returns `null` instead of an empty object to make sure Vue doesn't render the button --- app/assets/javascripts/jobs/store/getters.js | 2 +- changelogs/unreleased/54021-empty-button.yml | 5 +++++ spec/javascripts/jobs/components/empty_state_spec.js | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/54021-empty-button.yml diff --git a/app/assets/javascripts/jobs/store/getters.js b/app/assets/javascripts/jobs/store/getters.js index d440b2c9ef1..35e92b0b5d9 100644 --- a/app/assets/javascripts/jobs/store/getters.js +++ b/app/assets/javascripts/jobs/store/getters.js @@ -42,7 +42,7 @@ export const emptyStateIllustration = state => (state.job && state.job.status && state.job.status.illustration) || {}; export const emptyStateAction = state => - (state.job && state.job.status && state.job.status.action) || {}; + (state.job && state.job.status && state.job.status.action) || null; export const isScrollingDown = state => isScrolledToBottom() && !state.isTraceComplete; diff --git a/changelogs/unreleased/54021-empty-button.yml b/changelogs/unreleased/54021-empty-button.yml new file mode 100644 index 00000000000..3b03665cf95 --- /dev/null +++ b/changelogs/unreleased/54021-empty-button.yml @@ -0,0 +1,5 @@ +--- +title: Prevent empty button being rendered in empty state +merge_request: +author: +type: fixed diff --git a/spec/javascripts/jobs/components/empty_state_spec.js b/spec/javascripts/jobs/components/empty_state_spec.js index 0a39709221c..a2df79bdda0 100644 --- a/spec/javascripts/jobs/components/empty_state_spec.js +++ b/spec/javascripts/jobs/components/empty_state_spec.js @@ -84,6 +84,7 @@ describe('Empty State', () => { vm = mountComponent(Component, { ...props, content, + action: null, }); expect(vm.$el.querySelector('.js-job-empty-state-action')).toBeNull(); -- cgit v1.2.1 From 6e3aaf7b8909f147acd59b2c97f89af6253125bc Mon Sep 17 00:00:00 2001 From: Lukas Eipert Date: Wed, 14 Nov 2018 17:06:37 +0100 Subject: Check compilation of FE assets against multiple node versions --- .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94922aec598..1303503117e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -842,6 +842,39 @@ qa:selectors: - bundle install - bundle exec bin/qa Test::Sanity::Selectors +.qa-frontend-node: &qa-frontend-node + stage: test + variables: + NODE_OPTIONS: --max_old_space_size=3584 + cache: + key: "$CI_JOB_NAME" + paths: + - .yarn-cache/ + dependencies: [] + before_script: [] + script: + - date + - yarn install --frozen-lockfile --cache-folder .yarn-cache + - date + - yarn run webpack-prod + +qa-frontend-node:6: + <<: *qa-frontend-node + image: node:6-alpine + +qa-frontend-node:8: + <<: *qa-frontend-node + image: node:8-alpine + +qa-frontend-node:10: + <<: *qa-frontend-node + image: node:10-alpine + +qa-frontend-node:latest: + <<: *qa-frontend-node + image: node:alpine + allow_failure: true + coverage: # Don't include dedicated-no-docs-no-db-pull-cache-job here since we need to # download artifacts from all the rspec jobs instead of from setup-test-env only -- cgit v1.2.1 From 2a5319832454fe40cfea151dd7b9e2aa520b3450 Mon Sep 17 00:00:00 2001 From: Heinrich Lee Yu Date: Fri, 9 Nov 2018 22:29:45 +0800 Subject: Refactor whitelisting of filter params --- app/controllers/concerns/issuable_collections.rb | 36 +++++++++++----------- app/controllers/concerns/merge_requests_action.rb | 2 +- app/controllers/dashboard_controller.rb | 16 +++------- app/finders/issuable_finder.rb | 14 ++------- app/helpers/application_helper.rb | 14 +-------- .../concerns/issuable_collections_spec.rb | 15 +++------ 6 files changed, 32 insertions(+), 65 deletions(-) diff --git a/app/controllers/concerns/issuable_collections.rb b/app/controllers/concerns/issuable_collections.rb index 5217b4be928..34a8c50fcbd 100644 --- a/app/controllers/concerns/issuable_collections.rb +++ b/app/controllers/concerns/issuable_collections.rb @@ -81,36 +81,36 @@ module IssuableCollections end def issuable_finder_for(finder_class) - finder_class.new(current_user, filter_params) + finder_class.new(current_user, finder_options) end # rubocop:disable Gitlab/ModuleWithInstanceVariables - # rubocop: disable CodeReuse/ActiveRecord - def filter_params - set_sort_order_from_cookie - set_default_state + def finder_options + params[:state] = default_state if params[:state].blank? - # Skip irrelevant Rails routing params - @filter_params = params.dup.except(:controller, :action, :namespace_id) - @filter_params[:sort] ||= default_sort_order + options = { + scope: params[:scope], + state: params[:state], + sort: set_sort_order_from_cookie || default_sort_order + } - @sort = @filter_params[:sort] + # Used by view to highlight active option + @sort = options[:sort] if @project - @filter_params[:project_id] = @project.id + options[:project_id] = @project.id elsif @group - @filter_params[:group_id] = @group.id - @filter_params[:include_subgroups] = true - @filter_params[:use_cte_for_search] = true + options[:group_id] = @group.id + options[:include_subgroups] = true + options[:use_cte_for_search] = true end - @filter_params.permit(finder_type.valid_params) + params.permit(finder_type.valid_params).merge(options) end - # rubocop: enable CodeReuse/ActiveRecord # rubocop:enable Gitlab/ModuleWithInstanceVariables - def set_default_state - params[:state] = 'opened' if params[:state].blank? + def default_state + 'opened' end def set_sort_order_from_cookie @@ -121,7 +121,7 @@ module IssuableCollections sort_value = update_cookie_value(sort_param) set_secure_cookie(remember_sorting_key, sort_value) - params[:sort] = sort_value + sort_value end def remember_sorting_key diff --git a/app/controllers/concerns/merge_requests_action.rb b/app/controllers/concerns/merge_requests_action.rb index 285f2c3a8a0..ed10f32512e 100644 --- a/app/controllers/concerns/merge_requests_action.rb +++ b/app/controllers/concerns/merge_requests_action.rb @@ -19,7 +19,7 @@ module MergeRequestsAction (MergeRequestsFinder if action_name == 'merge_requests') end - def filter_params + def finder_options super.merge(non_archived: true) end end diff --git a/app/controllers/dashboard_controller.rb b/app/controllers/dashboard_controller.rb index 5076c3da324..4ce9be44403 100644 --- a/app/controllers/dashboard_controller.rb +++ b/app/controllers/dashboard_controller.rb @@ -4,17 +4,6 @@ class DashboardController < Dashboard::ApplicationController include IssuesAction include MergeRequestsAction - FILTER_PARAMS = [ - # author_id and assignee_id are kept so old RSS links still work - :author_id, - :assignee_id, - :author_username, - :assignee_username, - :milestone_title, - :label_name, - :my_reaction_emoji - ].freeze - before_action :event_filter, only: :activity before_action :projects, only: [:issues, :merge_requests] before_action :set_show_full_reference, only: [:issues, :merge_requests] @@ -55,10 +44,13 @@ class DashboardController < Dashboard::ApplicationController end def check_filters_presence! - @no_filters_set = FILTER_PARAMS.none? { |k| params.key?(k) } + @no_filters_set = finder_type.scalar_params.none? { |k| params.key?(k) } return unless @no_filters_set + # Call to set selected `state` and `sort` options in view + finder_options + respond_to do |format| format.html { render } format.atom { head :bad_request } diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index 93bef592c65..fdc630cbf72 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -14,7 +14,9 @@ # project_id: integer # milestone_title: string # author_id: integer +# author_username: string # assignee_id: integer or 'None' or 'Any' +# assignee_username: string # search: string # label_name: string # sort: string @@ -49,25 +51,15 @@ class IssuableFinder assignee_username author_id author_username - authorized_only - group_id - iids label_name milestone_title my_reaction_emoji - non_archived - project_id - scope search - sort - state - include_subgroups - use_cte_for_search ] end def self.array_params - @array_params ||= { label_name: [], iids: [], assignee_username: [] } + @array_params ||= { label_name: [], assignee_username: [] } end def self.valid_params diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 61d4386fb9f..74042f0bae8 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -173,19 +173,7 @@ module ApplicationHelper without = options.delete(:without) add_label = options.delete(:label) - exist_opts = { - state: params[:state], - scope: params[:scope], - milestone_title: params[:milestone_title], - assignee_username: params[:assignee_username], - author_username: params[:author_username], - search: params[:search], - label_name: params[:label_name], - my_reaction_emoji: params[:my_reaction_emoji], - wip: params[:wip] - } - - options = exist_opts.merge(options) + options = request.query_parameters.merge(options) if without.present? without.each do |key| diff --git a/spec/controllers/concerns/issuable_collections_spec.rb b/spec/controllers/concerns/issuable_collections_spec.rb index d16a3464495..e93c923fd39 100644 --- a/spec/controllers/concerns/issuable_collections_spec.rb +++ b/spec/controllers/concerns/issuable_collections_spec.rb @@ -60,7 +60,7 @@ describe IssuableCollections do end end - describe '#filter_params' do + describe '#finder_options' do let(:params) do { assignee_id: '1', @@ -84,25 +84,20 @@ describe IssuableCollections do } end - it 'filters params' do + it 'only allows whitelisted params' do allow(controller).to receive(:cookies).and_return({}) - filtered_params = controller.send(:filter_params) + finder_options = controller.send(:finder_options) - expect(filtered_params).to eq({ + expect(finder_options).to eq({ 'assignee_id' => '1', 'assignee_username' => 'user1', 'author_id' => '2', 'author_username' => 'user2', - 'authorized_only' => 'true', - 'due_date' => '2017-01-01', - 'group_id' => '3', - 'iids' => '4', 'label_name' => 'foo', 'milestone_title' => 'bar', 'my_reaction_emoji' => 'thumbsup', - 'non_archived' => 'true', - 'project_id' => '5', + 'due_date' => '2017-01-01', 'scope' => 'all', 'search' => 'baz', 'sort' => 'priority', -- cgit v1.2.1 From 039df0267e6c3e2070aa9bf92b56bee0f0ac8ca9 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Mon, 12 Nov 2018 17:26:51 -0200 Subject: Avoid Gitaly RPC errors when fetching diff stats --- changelogs/unreleased/osw-fallback-on-blank-refs.yml | 5 +++++ lib/gitlab/git/repository.rb | 10 +++++++++- spec/lib/gitlab/git/repository_spec.rb | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/osw-fallback-on-blank-refs.yml diff --git a/changelogs/unreleased/osw-fallback-on-blank-refs.yml b/changelogs/unreleased/osw-fallback-on-blank-refs.yml new file mode 100644 index 00000000000..039179f5829 --- /dev/null +++ b/changelogs/unreleased/osw-fallback-on-blank-refs.yml @@ -0,0 +1,5 @@ +--- +title: Avoid Gitaly RPC errors when fetching diff stats +merge_request: 22995 +author: +type: fixed diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 1642c4c5687..aaaf794668d 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -419,13 +419,17 @@ module Gitlab end def diff_stats(left_id, right_id) + if [left_id, right_id].any? { |ref| ref.blank? || Gitlab::Git.blank_ref?(ref) } + return empty_diff_stats + end + stats = wrapped_gitaly_errors do gitaly_commit_client.diff_stats(left_id, right_id) end Gitlab::Git::DiffStatsCollection.new(stats) rescue CommandError, TypeError - Gitlab::Git::DiffStatsCollection.new([]) + empty_diff_stats end # Returns a RefName for a given SHA @@ -962,6 +966,10 @@ module Gitlab private + def empty_diff_stats + Gitlab::Git::DiffStatsCollection.new([]) + end + def uncached_has_local_branches? wrapped_gitaly_errors do gitaly_repository_client.has_local_branches? diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb index 54291e847d8..1fe73c12fc0 100644 --- a/spec/lib/gitlab/git/repository_spec.rb +++ b/spec/lib/gitlab/git/repository_spec.rb @@ -1095,12 +1095,26 @@ describe Gitlab::Git::Repository, :seed_helper do end it 'returns no Gitaly::DiffStats when there is a nil SHA' do + expect_any_instance_of(Gitlab::GitalyClient::CommitService) + .not_to receive(:diff_stats) + collection = repository.diff_stats(nil, 'master') expect(collection).to be_a(Gitlab::Git::DiffStatsCollection) expect(collection).to be_a(Enumerable) expect(collection.to_a).to be_empty end + + it 'returns no Gitaly::DiffStats when there is a BLANK_SHA' do + expect_any_instance_of(Gitlab::GitalyClient::CommitService) + .not_to receive(:diff_stats) + + collection = repository.diff_stats(Gitlab::Git::BLANK_SHA, 'master') + + expect(collection).to be_a(Gitlab::Git::DiffStatsCollection) + expect(collection).to be_a(Enumerable) + expect(collection.to_a).to be_empty + end end describe "#ls_files" do -- cgit v1.2.1 From 341db7d36ee91e300f53479922f1f88b9d91b13f Mon Sep 17 00:00:00 2001 From: Luke Bennett Date: Wed, 14 Nov 2018 20:19:27 +0000 Subject: Change supported web browsers sentence to bullet list in requirements.md --- doc/install/requirements.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/doc/install/requirements.md b/doc/install/requirements.md index dcc6d75724e..97190544c3d 100644 --- a/doc/install/requirements.md +++ b/doc/install/requirements.md @@ -197,7 +197,13 @@ use the CI features. ## Supported web browsers -We support the current and the previous major release of Firefox, Chrome/Chromium, Safari and Microsoft browsers (Microsoft Edge and Internet Explorer 11). +We support the current and the previous major release of: + +- Firefox +- Chrome/Chromium +- Safari +- Microsoft Edge +- Internet Explorer 11 Each time a new browser version is released, we begin supporting that version and stop supporting the third most recent version. -- cgit v1.2.1 From 19a79483dce0fbbbdeebb4f7bdb7d334df480996 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Wed, 7 Nov 2018 12:19:12 -0200 Subject: Add docs for commenting in any line of MR diff files --- .../merge_requests/img/comment-on-any-diff-line.png | Bin 0 -> 177323 bytes doc/user/project/merge_requests/index.md | 9 +++++++++ 2 files changed, 9 insertions(+) create mode 100644 doc/user/project/merge_requests/img/comment-on-any-diff-line.png diff --git a/doc/user/project/merge_requests/img/comment-on-any-diff-line.png b/doc/user/project/merge_requests/img/comment-on-any-diff-line.png new file mode 100644 index 00000000000..856ede41527 Binary files /dev/null and b/doc/user/project/merge_requests/img/comment-on-any-diff-line.png differ diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index 6de2ab07fc4..f2f2497f0be 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -141,6 +141,15 @@ you hide discussions that are no longer relevant. [Read more about resolving discussion comments in merge requests reviews.](../../discussions/index.md) +## Commenting on any file line in merge requests + +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/13950) in GitLab 11.5. + +GitLab provides a way of leaving comments in any part of the file being changed +in a Merge Request. To do so, click the **...** button in the gutter of the Merge Request diff UI to expand the diff lines and leave a comment, just as you would for a changed line. + +![Comment on any diff file line](img/comment-on-any-diff-line.png) + ## Resolve conflicts When a merge request has conflicts, GitLab may provide the option to resolve -- cgit v1.2.1 From 6c796702a4dd89ae76215b4d99ec02a6e224b704 Mon Sep 17 00:00:00 2001 From: Oswaldo Ferreira Date: Wed, 14 Nov 2018 19:22:49 -0200 Subject: Remove 'comment_on_any_diff_line' feature flag --- app/controllers/projects/blob_controller.rb | 7 +------ spec/controllers/projects/blob_controller_spec.rb | 22 ---------------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/app/controllers/projects/blob_controller.rb b/app/controllers/projects/blob_controller.rb index 0718658cd48..2a6fe3b9c97 100644 --- a/app/controllers/projects/blob_controller.rb +++ b/app/controllers/projects/blob_controller.rb @@ -122,7 +122,7 @@ class Projects::BlobController < Projects::ApplicationController @lines.map! do |line| # These are marked as context lines but are loaded from blobs. # We also have context lines loaded from diffs in other places. - diff_line = Gitlab::Diff::Line.new(line, expanded_diff_line_type, nil, nil, nil) + diff_line = Gitlab::Diff::Line.new(line, nil, nil, nil, nil) diff_line.rich_text = line diff_line end @@ -132,11 +132,6 @@ class Projects::BlobController < Projects::ApplicationController render json: DiffLineSerializer.new.represent(@lines) end - def expanded_diff_line_type - # Context lines can't receive comments. - Feature.enabled?(:comment_in_any_diff_line, @project) ? nil : 'context' - end - def add_match_line return unless @form.unfold? diff --git a/spec/controllers/projects/blob_controller_spec.rb b/spec/controllers/projects/blob_controller_spec.rb index 74771abde71..5fdf7f1229d 100644 --- a/spec/controllers/projects/blob_controller_spec.rb +++ b/spec/controllers/projects/blob_controller_spec.rb @@ -141,28 +141,6 @@ describe Projects::BlobController do expect(lines.first).to have_key('rich_text') end - context 'comment in any diff line feature flag' do - it 'renders context lines when feature disabled' do - stub_feature_flags(comment_in_any_diff_line: false) - - do_get(since: 1, to: 5, offset: 10, from_merge_request: true) - lines = JSON.parse(response.body) - all_context = lines.all? { |line| line['type'] == 'context' } - - expect(all_context).to be(true) - end - - it 'renders unchanged lines when feature enabled' do - stub_feature_flags(comment_in_any_diff_line: true) - - do_get(since: 1, to: 5, offset: 10, from_merge_request: true) - lines = JSON.parse(response.body) - all_unchanged = lines.all? { |line| line['type'].nil? } - - expect(all_unchanged).to be(true) - end - end - context 'when rendering match lines' do it 'adds top match line when "since" is less than 1' do do_get(since: 5, to: 10, offset: 10, from_merge_request: true) -- cgit v1.2.1 From 29c219d60c56bd7865fee67d5d11018fa0d1d7cc Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Wed, 14 Nov 2018 20:55:41 +0200 Subject: Add markdown support information for project settings [ci skip] --- doc/user/project/settings/index.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/user/project/settings/index.md b/doc/user/project/settings/index.md index 084d1161633..d6754372816 100644 --- a/doc/user/project/settings/index.md +++ b/doc/user/project/settings/index.md @@ -18,6 +18,8 @@ Adjust your project's name, description, avatar, [default branch](../repository/ ![general project settings](img/general_settings.png) +The project description also partially supports [standard markdown](../../markdown.md#standard-markdown). You can use [emphasis](../../markdown.md#emphasis), [links](../../markdown.md#links), and [line-breaks](../../markdown.md#line-breaks) to add more context to the project description. + ### Sharing and permissions Set up your project's access, [visibility](../../../public_access/public_access.md), and enable [Container Registry](../container_registry.md) for your projects: -- cgit v1.2.1 From 429d3e49520d018258460782a5f456125e5610af Mon Sep 17 00:00:00 2001 From: Thong Kuah Date: Mon, 12 Nov 2018 12:23:32 +1300 Subject: Update config map if already present on install When an application install fails, and the user retries install, the configmap for the application will already exists. If so, we simply update instead of create. --- .../53626-update-config-map-on-install-retry.yml | 5 ++++ lib/gitlab/kubernetes/helm/api.rb | 12 +++++++++- spec/lib/gitlab/kubernetes/helm/api_spec.rb | 27 ++++++++++++++++------ 3 files changed, 36 insertions(+), 8 deletions(-) create mode 100644 changelogs/unreleased/53626-update-config-map-on-install-retry.yml diff --git a/changelogs/unreleased/53626-update-config-map-on-install-retry.yml b/changelogs/unreleased/53626-update-config-map-on-install-retry.yml new file mode 100644 index 00000000000..38e79c06c89 --- /dev/null +++ b/changelogs/unreleased/53626-update-config-map-on-install-retry.yml @@ -0,0 +1,5 @@ +--- +title: Update config map for gitlab managed application if already present on install +merge_request: 22969 +author: +type: other diff --git a/lib/gitlab/kubernetes/helm/api.rb b/lib/gitlab/kubernetes/helm/api.rb index 06841ec7b76..7c026ac9e68 100644 --- a/lib/gitlab/kubernetes/helm/api.rb +++ b/lib/gitlab/kubernetes/helm/api.rb @@ -54,7 +54,11 @@ module Gitlab def create_config_map(command) command.config_map_resource.tap do |config_map_resource| - kubeclient.create_config_map(config_map_resource) + if config_map_exists?(config_map_resource) + kubeclient.update_config_map(config_map_resource) + else + kubeclient.create_config_map(config_map_resource) + end end end @@ -88,6 +92,12 @@ module Gitlab end end + def config_map_exists?(resource) + kubeclient.get_config_map(resource.metadata.name, resource.metadata.namespace) + rescue ::Kubeclient::ResourceNotFoundError + false + end + def service_account_exists?(resource) kubeclient.get_service_account(resource.metadata.name, resource.metadata.namespace) rescue ::Kubeclient::ResourceNotFoundError diff --git a/spec/lib/gitlab/kubernetes/helm/api_spec.rb b/spec/lib/gitlab/kubernetes/helm/api_spec.rb index a8124ced28c..8bce7a4cdf5 100644 --- a/spec/lib/gitlab/kubernetes/helm/api_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/api_spec.rb @@ -36,6 +36,7 @@ describe Gitlab::Kubernetes::Helm::Api do describe '#install' do before do allow(client).to receive(:create_pod).and_return(nil) + allow(client).to receive(:get_config_map).and_return(nil) allow(client).to receive(:create_config_map).and_return(nil) allow(client).to receive(:create_service_account).and_return(nil) allow(client).to receive(:create_cluster_role_binding).and_return(nil) @@ -57,6 +58,18 @@ describe Gitlab::Kubernetes::Helm::Api do subject.install(command) end + + context 'config map already exists' do + before do + expect(client).to receive(:get_config_map).with("values-content-configuration-#{application_name}", gitlab_namespace).and_return(resource) + end + + it 'updates the config map' do + expect(client).to receive(:update_config_map).with(resource).once + + subject.install(command) + end + end end context 'without a service account' do @@ -88,8 +101,8 @@ describe Gitlab::Kubernetes::Helm::Api do context 'service account and cluster role binding does not exist' do before do - expect(client).to receive('get_service_account').with('tiller', 'gitlab-managed-apps').and_raise(Kubeclient::ResourceNotFoundError.new(404, 'Not found', nil)) - expect(client).to receive('get_cluster_role_binding').with('tiller-admin').and_raise(Kubeclient::ResourceNotFoundError.new(404, 'Not found', nil)) + expect(client).to receive(:get_service_account).with('tiller', 'gitlab-managed-apps').and_raise(Kubeclient::ResourceNotFoundError.new(404, 'Not found', nil)) + expect(client).to receive(:get_cluster_role_binding).with('tiller-admin').and_raise(Kubeclient::ResourceNotFoundError.new(404, 'Not found', nil)) end it 'creates a service account, followed the cluster role binding on kubeclient' do @@ -102,8 +115,8 @@ describe Gitlab::Kubernetes::Helm::Api do context 'service account already exists' do before do - expect(client).to receive('get_service_account').with('tiller', 'gitlab-managed-apps').and_return(service_account_resource) - expect(client).to receive('get_cluster_role_binding').with('tiller-admin').and_raise(Kubeclient::ResourceNotFoundError.new(404, 'Not found', nil)) + expect(client).to receive(:get_service_account).with('tiller', 'gitlab-managed-apps').and_return(service_account_resource) + expect(client).to receive(:get_cluster_role_binding).with('tiller-admin').and_raise(Kubeclient::ResourceNotFoundError.new(404, 'Not found', nil)) end it 'updates the service account, followed by creating the cluster role binding' do @@ -116,8 +129,8 @@ describe Gitlab::Kubernetes::Helm::Api do context 'service account and cluster role binding already exists' do before do - expect(client).to receive('get_service_account').with('tiller', 'gitlab-managed-apps').and_return(service_account_resource) - expect(client).to receive('get_cluster_role_binding').with('tiller-admin').and_return(cluster_role_binding_resource) + expect(client).to receive(:get_service_account).with('tiller', 'gitlab-managed-apps').and_return(service_account_resource) + expect(client).to receive(:get_cluster_role_binding).with('tiller-admin').and_return(cluster_role_binding_resource) end it 'updates the service account, followed by creating the cluster role binding' do @@ -130,7 +143,7 @@ describe Gitlab::Kubernetes::Helm::Api do context 'a non-404 error is thrown' do before do - expect(client).to receive('get_service_account').with('tiller', 'gitlab-managed-apps').and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil)) + expect(client).to receive(:get_service_account).with('tiller', 'gitlab-managed-apps').and_raise(Kubeclient::HttpError.new(401, 'Unauthorized', nil)) end it 'raises an error' do -- cgit v1.2.1 From b8bd7ef8097e47a44055d712ab818d4bd6cabc77 Mon Sep 17 00:00:00 2001 From: yukihir0 Date: Thu, 15 Nov 2018 19:15:03 +0900 Subject: Fix types comment --- app/assets/javascripts/files_comment_button.js | 2 +- app/workers/build_finished_worker.rb | 2 +- app/workers/process_commit_worker.rb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/files_comment_button.js b/app/assets/javascripts/files_comment_button.js index 3233f5c4f71..aad5647c045 100644 --- a/app/assets/javascripts/files_comment_button.js +++ b/app/assets/javascripts/files_comment_button.js @@ -1,5 +1,5 @@ /* Developer beware! Do not add logic to showButton or hideButton - * that will force a reflow. Doing so will create a signficant performance + * that will force a reflow. Doing so will create a significant performance * bottleneck for pages with large diffs. For a comprehensive list of what * causes reflows, visit https://gist.github.com/paulirish/5d52fb081b3570c81e3a */ diff --git a/app/workers/build_finished_worker.rb b/app/workers/build_finished_worker.rb index 51cbbe8882e..61d866b1f02 100644 --- a/app/workers/build_finished_worker.rb +++ b/app/workers/build_finished_worker.rb @@ -13,7 +13,7 @@ class BuildFinishedWorker BuildTraceSectionsWorker.new.perform(build.id) BuildCoverageWorker.new.perform(build.id) - # We execute that async as this are two indepentent operations that can be executed after TraceSections and Coverage + # We execute that async as this are two independent operations that can be executed after TraceSections and Coverage BuildHooksWorker.perform_async(build.id) ArchiveTraceWorker.perform_async(build.id) end diff --git a/app/workers/process_commit_worker.rb b/app/workers/process_commit_worker.rb index 7b167c95c29..29a7f8e691a 100644 --- a/app/workers/process_commit_worker.rb +++ b/app/workers/process_commit_worker.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# Worker for processing individiual commit messages pushed to a repository. +# Worker for processing individual commit messages pushed to a repository. # # Jobs for this worker are scheduled for every commit that is being pushed. As a # result of this the workload of this worker should be kept to a bare minimum. -- cgit v1.2.1 From 566ba126f5d8090edc760fe0c20215da73452e47 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Thu, 15 Nov 2018 12:13:50 +0200 Subject: Fix typos in lib --- changelogs/unreleased/gt-fix-typos-in-lib.yml | 5 +++++ lib/gitlab/gitaly_client.rb | 2 +- lib/gitlab/http_io.rb | 12 +++++------ lib/gitlab/view/presenter/base.rb | 4 ++-- spec/controllers/registrations_controller_spec.rb | 2 +- spec/controllers/sessions_controller_spec.rb | 2 +- spec/features/issues/form_spec.rb | 2 +- .../user_creates_branch_and_merge_request_spec.rb | 4 ++-- spec/features/projects/jobs_spec.rb | 4 ++-- spec/fixtures/trace/sample_trace | 24 +++++++++++----------- spec/lib/gitlab/ci/build/policy/refs_spec.rb | 6 +++--- spec/lib/gitlab/ci/config/entry/artifacts_spec.rb | 2 +- spec/lib/gitlab/ci/config/entry/policy_spec.rb | 2 +- spec/lib/gitlab/ci/config/entry/reports_spec.rb | 2 +- spec/lib/gitlab/git/commit_spec.rb | 2 +- spec/lib/gitlab/git/tag_spec.rb | 2 +- spec/services/system_hooks_service_spec.rb | 2 +- spec/workers/emails_on_push_worker_spec.rb | 2 +- 18 files changed, 43 insertions(+), 38 deletions(-) create mode 100644 changelogs/unreleased/gt-fix-typos-in-lib.yml diff --git a/changelogs/unreleased/gt-fix-typos-in-lib.yml b/changelogs/unreleased/gt-fix-typos-in-lib.yml new file mode 100644 index 00000000000..32ccd03b063 --- /dev/null +++ b/changelogs/unreleased/gt-fix-typos-in-lib.yml @@ -0,0 +1,5 @@ +--- +title: Fix typos in lib +merge_request: 23106 +author: George Tsiolis +type: other diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index d99a9f15371..8b455dc7696 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -139,7 +139,7 @@ module Gitlab ensure duration = Gitlab::Metrics::System.monotonic_time - start - # Keep track, seperately, for the performance bar + # Keep track, separately, for the performance bar self.query_time += duration gitaly_controller_action_duration_seconds.observe( current_transaction_labels.merge(gitaly_service: service.to_s, rpc: rpc.to_s), diff --git a/lib/gitlab/http_io.rb b/lib/gitlab/http_io.rb index 9d7763fc5ac..e768b8adb12 100644 --- a/lib/gitlab/http_io.rb +++ b/lib/gitlab/http_io.rb @@ -161,14 +161,14 @@ module Gitlab ## # Note: If provider does not return content_range, then we set it as we requested # Provider: minio - # - When the file size is larger than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206 - # - When the file size is smaller than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206 + # - When the file size is larger than requested Content-range, the Content-range is included in responses with Net::HTTPPartialContent 206 + # - When the file size is smaller than requested Content-range, the Content-range is included in responses with Net::HTTPPartialContent 206 # Provider: AWS - # - When the file size is larger than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206 - # - When the file size is smaller than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206 + # - When the file size is larger than requested Content-range, the Content-range is included in responses with Net::HTTPPartialContent 206 + # - When the file size is smaller than requested Content-range, the Content-range is included in responses with Net::HTTPPartialContent 206 # Provider: GCS - # - When the file size is larger than requested Content-range, the Content-range is included in responces with Net::HTTPPartialContent 206 - # - When the file size is smaller than requested Content-range, the Content-range is included in responces with Net::HTTPOK 200 + # - When the file size is larger than requested Content-range, the Content-range is included in responses with Net::HTTPPartialContent 206 + # - When the file size is smaller than requested Content-range, the Content-range is included in responses with Net::HTTPOK 200 @chunk_range ||= (chunk_start...(chunk_start + @chunk.bytesize)) end diff --git a/lib/gitlab/view/presenter/base.rb b/lib/gitlab/view/presenter/base.rb index 36162faa1eb..c3fd6d317aa 100644 --- a/lib/gitlab/view/presenter/base.rb +++ b/lib/gitlab/view/presenter/base.rb @@ -11,8 +11,8 @@ module Gitlab attr_reader :subject - def can?(user, action, overriden_subject = nil) - super(user, action, overriden_subject || subject) + def can?(user, action, overridden_subject = nil) + super(user, action, overridden_subject || subject) end # delegate all #can? queries to the subject diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 898f3863008..d334a2ff566 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -49,7 +49,7 @@ describe RegistrationsController do end it 'displays an error when the reCAPTCHA is not solved' do - # Without this, `verify_recaptcha` arbitraily returns true in test env + # Without this, `verify_recaptcha` arbitrarily returns true in test env Recaptcha.configuration.skip_verify_env.delete('test') post(:create, user_params) diff --git a/spec/controllers/sessions_controller_spec.rb b/spec/controllers/sessions_controller_spec.rb index 8e25b61e2f1..c691b3f478b 100644 --- a/spec/controllers/sessions_controller_spec.rb +++ b/spec/controllers/sessions_controller_spec.rb @@ -89,7 +89,7 @@ describe SessionsController do end it 'displays an error when the reCAPTCHA is not solved' do - # Without this, `verify_recaptcha` arbitraily returns true in test env + # Without this, `verify_recaptcha` arbitrarily returns true in test env Recaptcha.configuration.skip_verify_env.delete('test') counter = double(:counter) diff --git a/spec/features/issues/form_spec.rb b/spec/features/issues/form_spec.rb index 1456a2f0375..f2e4c5779df 100644 --- a/spec/features/issues/form_spec.rb +++ b/spec/features/issues/form_spec.rb @@ -27,7 +27,7 @@ describe 'New/edit issue', :js do before do # Using `allow_any_instance_of`/`and_wrap_original`, `original` would # somehow refer to the very block we defined to _wrap_ that method, instead of - # the original method, resulting in infinite recurison when called. + # the original method, resulting in infinite recursion when called. # This is likely a bug with helper modules included into dynamically generated view classes. # To work around this, we have to hold on to and call to the original implementation manually. original_issue_dropdown_options = FormHelper.instance_method(:issue_assignees_dropdown_options) diff --git a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb index 3dfcbc2fcb8..297cd808460 100644 --- a/spec/features/issues/user_creates_branch_and_merge_request_spec.rb +++ b/spec/features/issues/user_creates_branch_and_merge_request_spec.rb @@ -55,11 +55,11 @@ describe 'User creates branch and merge request on issue page', :js do test_branch_name_checking(input_branch_name) test_source_checking(input_source) - # The button inside dropdown should be disabled if any errors occured. + # The button inside dropdown should be disabled if any errors occurred. expect(page).to have_button('Create branch', disabled: true) end - # The top level button should be disabled if any errors occured. + # The top level button should be disabled if any errors occurred. expect(page).to have_button('Create branch', disabled: true) end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index a1323699969..99a7fbb63bd 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -719,7 +719,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do context 'on mobile', :js do let(:job) { create(:ci_build, pipeline: pipeline) } - it 'renders collpased sidebar' do + it 'renders collapsed sidebar' do page.current_window.resize_to(600, 800) visit project_job_path(project, job) @@ -738,7 +738,7 @@ describe 'Jobs', :clean_gitlab_redis_shared_state do wait_for_requests expect(page).to have_css('.js-job-sidebar.right-sidebar-expanded') - expect(page).not_to have_css('.js-job-sidebar.right-sidebar-collpased') + expect(page).not_to have_css('.js-job-sidebar.right-sidebar-collapsed') end end diff --git a/spec/fixtures/trace/sample_trace b/spec/fixtures/trace/sample_trace index 7bfe3f83b7b..3d8beb0dec2 100644 --- a/spec/fixtures/trace/sample_trace +++ b/spec/fixtures/trace/sample_trace @@ -2334,12 +2334,12 @@ Boards::Lists::MoveService keeps position of lists when list type is closed when list type is set to label keeps position of lists when new position is nil - keeps position of lists when new positon is equal to old position - keeps position of lists when new positon is negative - keeps position of lists when new positon is equal to number of labels lists - keeps position of lists when new positon is greater than number of labels lists - increments position of intermediate lists when new positon is equal to first position - decrements position of intermediate lists when new positon is equal to last position + keeps position of lists when new position is equal to old position + keeps position of lists when new position is negative + keeps position of lists when new position is equal to number of labels lists + keeps position of lists when new position is greater than number of labels lists + increments position of intermediate lists when new position is equal to first position + decrements position of intermediate lists when new position is equal to last position decrements position of intermediate lists when new position is greater than old position increments position of intermediate lists when new position is lower than old position when board parent is a group @@ -2347,12 +2347,12 @@ Boards::Lists::MoveService keeps position of lists when list type is closed when list type is set to label keeps position of lists when new position is nil - keeps position of lists when new positon is equal to old position - keeps position of lists when new positon is negative - keeps position of lists when new positon is equal to number of labels lists - keeps position of lists when new positon is greater than number of labels lists - increments position of intermediate lists when new positon is equal to first position - decrements position of intermediate lists when new positon is equal to last position + keeps position of lists when new position is equal to old position + keeps position of lists when new position is negative + keeps position of lists when new position is equal to number of labels lists + keeps position of lists when new position is greater than number of labels lists + increments position of intermediate lists when new position is equal to first position + decrements position of intermediate lists when new position is equal to last position decrements position of intermediate lists when new position is greater than old position increments position of intermediate lists when new position is lower than old position diff --git a/spec/lib/gitlab/ci/build/policy/refs_spec.rb b/spec/lib/gitlab/ci/build/policy/refs_spec.rb index 7211187e511..553fc0fb9bf 100644 --- a/spec/lib/gitlab/ci/build/policy/refs_spec.rb +++ b/spec/lib/gitlab/ci/build/policy/refs_spec.rb @@ -16,7 +16,7 @@ describe Gitlab::Ci::Build::Policy::Refs do end end - context 'when maching tags' do + context 'when matching tags' do context 'when pipeline runs for a tag' do let(:pipeline) do build_stubbed(:ci_pipeline, ref: 'feature', tag: true) @@ -56,10 +56,10 @@ describe Gitlab::Ci::Build::Policy::Refs do end end - context 'when maching a source' do + context 'when matching a source' do let(:pipeline) { build_stubbed(:ci_pipeline, source: :push) } - it 'is satisifed when provided source keyword matches' do + it 'is satisfied when provided source keyword matches' do expect(described_class.new(%w[pushes])) .to be_satisfied_by(pipeline) end diff --git a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb index d48aac15f28..bd1f2c92844 100644 --- a/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/artifacts_spec.rb @@ -8,7 +8,7 @@ describe Gitlab::Ci::Config::Entry::Artifacts do let(:config) { { paths: %w[public/] } } describe '#value' do - it 'returns artifacs configuration' do + it 'returns artifacts configuration' do expect(entry.value).to eq config end end diff --git a/spec/lib/gitlab/ci/config/entry/policy_spec.rb b/spec/lib/gitlab/ci/config/entry/policy_spec.rb index bef93fe7af7..83001b7fdd8 100644 --- a/spec/lib/gitlab/ci/config/entry/policy_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/policy_spec.rb @@ -58,7 +58,7 @@ describe Gitlab::Ci::Config::Entry::Policy do end context 'when using complex policy' do - context 'when specifiying refs policy' do + context 'when specifying refs policy' do let(:config) { { refs: ['master'] } } it 'is a correct configuraton' do diff --git a/spec/lib/gitlab/ci/config/entry/reports_spec.rb b/spec/lib/gitlab/ci/config/entry/reports_spec.rb index 1140bfdf6c3..38943138cbf 100644 --- a/spec/lib/gitlab/ci/config/entry/reports_spec.rb +++ b/spec/lib/gitlab/ci/config/entry/reports_spec.rb @@ -19,7 +19,7 @@ describe Gitlab::Ci::Config::Entry::Reports do shared_examples 'a valid entry' do |keyword, file| describe '#value' do - it 'returns artifacs configuration' do + it 'returns artifacts configuration' do expect(entry.value).to eq({ "#{keyword}": [file] } ) end end diff --git a/spec/lib/gitlab/git/commit_spec.rb b/spec/lib/gitlab/git/commit_spec.rb index 9ef27081f98..6be35eee0fd 100644 --- a/spec/lib/gitlab/git/commit_spec.rb +++ b/spec/lib/gitlab/git/commit_spec.rb @@ -94,7 +94,7 @@ describe Gitlab::Git::Commit, :seed_helper do context 'body_size less than threshold' do let(:body_size) { 123 } - it 'fetches commit message seperately' do + it 'fetches commit message separately' do expect(described_class).to receive(:get_message).with(repository, id) commit.safe_message diff --git a/spec/lib/gitlab/git/tag_spec.rb b/spec/lib/gitlab/git/tag_spec.rb index 2d9db576a6c..c5bad062c2a 100644 --- a/spec/lib/gitlab/git/tag_spec.rb +++ b/spec/lib/gitlab/git/tag_spec.rb @@ -68,7 +68,7 @@ describe Gitlab::Git::Tag, :seed_helper do context 'message_size less than threshold' do let(:message_size) { 123 } - it 'fetches tag message seperately' do + it 'fetches tag message separately' do expect(described_class).to receive(:get_message).with(repository, gitaly_tag.id) tag.message diff --git a/spec/services/system_hooks_service_spec.rb b/spec/services/system_hooks_service_spec.rb index e0335880e8e..81b2c17fdb5 100644 --- a/spec/services/system_hooks_service_spec.rb +++ b/spec/services/system_hooks_service_spec.rb @@ -32,7 +32,7 @@ describe SystemHooksService do end it do - project.old_path_with_namespace = 'transfered_from_path' + project.old_path_with_namespace = 'transferred_from_path' expect(event_data(project, :transfer)).to include( :event_name, :name, :created_at, :updated_at, :path, :project_id, :owner_name, :owner_email, :project_visibility, diff --git a/spec/workers/emails_on_push_worker_spec.rb b/spec/workers/emails_on_push_worker_spec.rb index f17c5ac6aac..05b4fb49ea3 100644 --- a/spec/workers/emails_on_push_worker_spec.rb +++ b/spec/workers/emails_on_push_worker_spec.rb @@ -101,7 +101,7 @@ describe EmailsOnPushWorker, :mailer do context "when there are multiple recipients" do before do - # This is a hack because we modify the mail object before sending, for efficency, + # This is a hack because we modify the mail object before sending, for efficiency, # but the TestMailer adapter just appends the objects to an array. To clone a mail # object, create a new one! # https://github.com/mikel/mail/issues/314#issuecomment-12750108 -- cgit v1.2.1 From 884dc4a1dfbcdaf1df4e0d1f7f83100f8437b19b Mon Sep 17 00:00:00 2001 From: yoda Date: Thu, 15 Nov 2018 10:21:49 +0000 Subject: fix typo addres to address --- doc/api/avatar.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/avatar.md b/doc/api/avatar.md index 7faed893066..aa6f7c185ae 100644 --- a/doc/api/avatar.md +++ b/doc/api/avatar.md @@ -4,7 +4,7 @@ ## Get a single avatar URL -Get a single avatar URL for a given email addres. If user with matching public +Get a single avatar URL for a given email address. If user with matching public email address is not found, results from external avatar services are returned. This endpoint can be accessed without authentication. In case public visibility is restricted, response will be `403 Forbidden` when unauthenticated. -- cgit v1.2.1 From 62dfb280992f59ecc5029eb923ce03c0f169b372 Mon Sep 17 00:00:00 2001 From: Jan Provaznik Date: Thu, 15 Nov 2018 12:08:36 +0100 Subject: Remove Gemfile.rails5 This file is not needed anymore (since we switched to rails 5 already). --- Gemfile.rails5 | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 Gemfile.rails5 diff --git a/Gemfile.rails5 b/Gemfile.rails5 deleted file mode 100644 index 2b526b19ba0..00000000000 --- a/Gemfile.rails5 +++ /dev/null @@ -1,7 +0,0 @@ -# BUNDLE_GEMFILE=Gemfile.rails5 bundle install - -ENV["RAILS5"] = "true" - -gemfile = File.expand_path("../Gemfile", __FILE__) - -eval(File.read(gemfile), nil, gemfile) -- cgit v1.2.1 From 09490fd0ef5717b28af3f23b85d7887c282883d7 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Thu, 15 Nov 2018 11:19:04 +0000 Subject: Ignore environment validation failure --- app/models/concerns/deployable.rb | 4 ++ .../ignore-environment-validation-failure.yml | 5 +++ spec/models/concerns/deployable_spec.rb | 21 ++++++++++ spec/services/ci/create_pipeline_service_spec.rb | 48 ++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 changelogs/unreleased/ignore-environment-validation-failure.yml diff --git a/app/models/concerns/deployable.rb b/app/models/concerns/deployable.rb index 85db01af18d..bc12b06b5af 100644 --- a/app/models/concerns/deployable.rb +++ b/app/models/concerns/deployable.rb @@ -13,6 +13,10 @@ module Deployable name: expanded_environment_name ) + # If we failed to persist envirionment record by validation error, such as name with invalid character, + # the job will fall back to a non-environment job. + return unless environment.persisted? + create_deployment!( project_id: environment.project_id, environment: environment, diff --git a/changelogs/unreleased/ignore-environment-validation-failure.yml b/changelogs/unreleased/ignore-environment-validation-failure.yml new file mode 100644 index 00000000000..1b61cf86dc4 --- /dev/null +++ b/changelogs/unreleased/ignore-environment-validation-failure.yml @@ -0,0 +1,5 @@ +--- +title: Ignore environment validation failure +merge_request: 23100 +author: +type: fixed diff --git a/spec/models/concerns/deployable_spec.rb b/spec/models/concerns/deployable_spec.rb index ac79c75a55e..6951be903fe 100644 --- a/spec/models/concerns/deployable_spec.rb +++ b/spec/models/concerns/deployable_spec.rb @@ -49,5 +49,26 @@ describe Deployable do expect(environment).to be_nil end end + + context 'when environment scope contains invalid character' do + let(:job) do + create( + :ci_build, + name: 'job:deploy-to-test-site', + environment: '$CI_JOB_NAME', + options: { + environment: { + name: '$CI_JOB_NAME', + url: 'http://staging.example.com/$CI_JOB_NAME', + on_stop: 'stop_review_app' + } + }) + end + + it 'does not create a deployment and environment record' do + expect(deployment).to be_nil + expect(environment).to be_nil + end + end end end diff --git a/spec/services/ci/create_pipeline_service_spec.rb b/spec/services/ci/create_pipeline_service_spec.rb index 193148d403a..4d9c5aabbda 100644 --- a/spec/services/ci/create_pipeline_service_spec.rb +++ b/spec/services/ci/create_pipeline_service_spec.rb @@ -608,5 +608,53 @@ describe Ci::CreatePipelineService do .to eq variables_attributes.map(&:with_indifferent_access) end end + + context 'when pipeline has a job with environment' do + let(:pipeline) { execute_service } + + before do + stub_ci_pipeline_yaml_file(YAML.dump(config)) + end + + context 'when environment name is valid' do + let(:config) do + { + review_app: { + script: 'deploy', + environment: { + name: 'review/${CI_COMMIT_REF_NAME}', + url: 'http://${CI_COMMIT_REF_SLUG}-staging.example.com' + } + } + } + end + + it 'has a job with environment' do + expect(pipeline.builds.count).to eq(1) + expect(pipeline.builds.first.persisted_environment.name).to eq('review/master') + expect(pipeline.builds.first.deployment).to be_created + end + end + + context 'when environment name is invalid' do + let(:config) do + { + 'job:deploy-to-test-site': { + script: 'deploy', + environment: { + name: '${CI_JOB_NAME}', + url: 'https://$APP_URL' + } + } + } + end + + it 'has a job without environment' do + expect(pipeline.builds.count).to eq(1) + expect(pipeline.builds.first.persisted_environment).to be_nil + expect(pipeline.builds.first.deployment).to be_nil + end + end + end end end -- cgit v1.2.1 From 327892b23e72eb9a4af773f58f9abaf8e9c34fde Mon Sep 17 00:00:00 2001 From: Chris Baumbauer Date: Thu, 15 Nov 2018 11:39:43 +0000 Subject: Add knative client to kubeclient library --- app/models/clusters/applications/knative.rb | 4 ++++ changelogs/unreleased/triggermesh-phase2-serverless.yml | 5 +++++ lib/gitlab/kubernetes/kube_client.rb | 3 ++- spec/lib/gitlab/kubernetes/kube_client_spec.rb | 14 ++++++++++++++ spec/support/helpers/kubernetes_helpers.rb | 13 +++++++++++++ 5 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/triggermesh-phase2-serverless.yml diff --git a/app/models/clusters/applications/knative.rb b/app/models/clusters/applications/knative.rb index a79a97576d1..c66d5ce54db 100644 --- a/app/models/clusters/applications/knative.rb +++ b/app/models/clusters/applications/knative.rb @@ -41,6 +41,10 @@ module Clusters ) end + def client + cluster.platform_kubernetes.kubeclient.knative_client + end + private def install_script diff --git a/changelogs/unreleased/triggermesh-phase2-serverless.yml b/changelogs/unreleased/triggermesh-phase2-serverless.yml new file mode 100644 index 00000000000..bee2b5e1e2c --- /dev/null +++ b/changelogs/unreleased/triggermesh-phase2-serverless.yml @@ -0,0 +1,5 @@ +--- +title: Add knative client to kubeclient library +merge_request: 22968 +author: cab105 +type: added diff --git a/lib/gitlab/kubernetes/kube_client.rb b/lib/gitlab/kubernetes/kube_client.rb index f266177bec1..b947f6b551e 100644 --- a/lib/gitlab/kubernetes/kube_client.rb +++ b/lib/gitlab/kubernetes/kube_client.rb @@ -16,7 +16,8 @@ module Gitlab SUPPORTED_API_GROUPS = { core: { group: 'api', version: 'v1' }, rbac: { group: 'apis/rbac.authorization.k8s.io', version: 'v1' }, - extensions: { group: 'apis/extensions', version: 'v1beta1' } + extensions: { group: 'apis/extensions', version: 'v1beta1' }, + knative: { group: 'apis/serving.knative.dev', version: 'v1alpha1' } }.freeze SUPPORTED_API_GROUPS.each do |name, params| diff --git a/spec/lib/gitlab/kubernetes/kube_client_spec.rb b/spec/lib/gitlab/kubernetes/kube_client_spec.rb index eed4135d8a2..3979a43216c 100644 --- a/spec/lib/gitlab/kubernetes/kube_client_spec.rb +++ b/spec/lib/gitlab/kubernetes/kube_client_spec.rb @@ -66,6 +66,20 @@ describe Gitlab::Kubernetes::KubeClient do end end + describe '#knative_client' do + subject { client.knative_client } + + it_behaves_like 'a Kubeclient' + + it 'has the extensions API group endpoint' do + expect(subject.api_endpoint.to_s).to match(%r{\/apis\/serving.knative.dev\Z}) + end + + it 'has the api_version' do + expect(subject.instance_variable_get(:@api_version)).to eq('v1alpha1') + end + end + describe 'core API' do let(:core_client) { client.core_client } diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index 35ae04b16c6..ccaf86aa3a6 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -17,6 +17,7 @@ module KubernetesHelpers WebMock.stub_request(:get, api_url + '/api/v1').to_return(kube_response(kube_v1_discovery_body)) WebMock.stub_request(:get, api_url + '/apis/extensions/v1beta1').to_return(kube_response(kube_v1beta1_discovery_body)) WebMock.stub_request(:get, api_url + '/apis/rbac.authorization.k8s.io/v1').to_return(kube_response(kube_v1_rbac_authorization_discovery_body)) + WebMock.stub_request(:get, api_url + '/apis/serving.knative.dev/v1alpha1').to_return(kube_response(kube_v1alpha1_serving_knative_discovery_body)) end def stub_kubeclient_pods(response = nil) @@ -134,6 +135,18 @@ module KubernetesHelpers } end + def kube_v1alpha1_serving_knative_discovery_body + { + "kind" => "APIResourceList", + "resources" => [ + { "name" => "revisions", "namespaced" => true, "kind" => "Revision" }, + { "name" => "services", "namespaced" => true, "kind" => "Service" }, + { "name" => "configurations", "namespaced" => true, "kind" => "Configuration" }, + { "name" => "routes", "namespaced" => true, "kind" => "Route" } + ] + } + end + def kube_pods_body { "kind" => "PodList", -- cgit v1.2.1 From 428b220a1fd750bf1c3e4f39a2dd670871ad85b6 Mon Sep 17 00:00:00 2001 From: Hiroyuki Sato Date: Thu, 15 Nov 2018 20:27:35 +0900 Subject: Fix not render emoji in filter dropdown --- app/assets/javascripts/filtered_search/dropdown_emoji.js | 11 +++++++---- changelogs/unreleased/fix-not-render-emoji.yml | 5 +++++ 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 changelogs/unreleased/fix-not-render-emoji.yml diff --git a/app/assets/javascripts/filtered_search/dropdown_emoji.js b/app/assets/javascripts/filtered_search/dropdown_emoji.js index af7936a92fb..d9a4d06b549 100644 --- a/app/assets/javascripts/filtered_search/dropdown_emoji.js +++ b/app/assets/javascripts/filtered_search/dropdown_emoji.js @@ -69,10 +69,13 @@ export default class DropdownEmoji extends FilteredSearchDropdown { // Replace empty gl-emoji tag to real content const dropdownItems = [...this.dropdown.querySelectorAll('.filter-dropdown-item')]; dropdownItems.forEach(dropdownItem => { - const name = dropdownItem.querySelector('.js-data-value').innerText; - const emojiTag = this.glEmojiTag(name); - const emojiElement = dropdownItem.querySelector('gl-emoji'); - emojiElement.outerHTML = emojiTag; + const valueElement = dropdownItem.querySelector('.js-data-value'); + if (valueElement !== null) { + const name = valueElement.innerText; + const emojiTag = this.glEmojiTag(name); + const emojiElement = dropdownItem.querySelector('gl-emoji'); + emojiElement.outerHTML = emojiTag; + } }); } diff --git a/changelogs/unreleased/fix-not-render-emoji.yml b/changelogs/unreleased/fix-not-render-emoji.yml new file mode 100644 index 00000000000..857b97004f0 --- /dev/null +++ b/changelogs/unreleased/fix-not-render-emoji.yml @@ -0,0 +1,5 @@ +--- +title: Fix not render emoji in filter dropdown +merge_request: 23112 +author: Hiroyuki Sato +type: fixed -- cgit v1.2.1 From 90801a43ca69462d7cd39e64c2eee6e871c03111 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Tue, 30 Oct 2018 16:03:57 +0100 Subject: Validate foreign keys being indexed --- .../validate-foreign-keys-being-indexed.yml | 5 ++ .../validate-that-foreign-keys-are-created.yml | 5 ++ ...0154446_add_missing_indexes_for_foreign_keys.rb | 38 +++++++++ db/schema.rb | 21 +++++ doc/development/migration_style_guide.md | 7 +- spec/db/schema_spec.rb | 90 ++++++++++++++++++++++ 6 files changed, 160 insertions(+), 6 deletions(-) create mode 100644 changelogs/unreleased/validate-foreign-keys-being-indexed.yml create mode 100644 changelogs/unreleased/validate-that-foreign-keys-are-created.yml create mode 100644 db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb create mode 100644 spec/db/schema_spec.rb diff --git a/changelogs/unreleased/validate-foreign-keys-being-indexed.yml b/changelogs/unreleased/validate-foreign-keys-being-indexed.yml new file mode 100644 index 00000000000..aec1717b8d5 --- /dev/null +++ b/changelogs/unreleased/validate-foreign-keys-being-indexed.yml @@ -0,0 +1,5 @@ +--- +title: Validate foreign keys being indexed +merge_request: +author: +type: performance diff --git a/changelogs/unreleased/validate-that-foreign-keys-are-created.yml b/changelogs/unreleased/validate-that-foreign-keys-are-created.yml new file mode 100644 index 00000000000..2cda5c86ea5 --- /dev/null +++ b/changelogs/unreleased/validate-that-foreign-keys-are-created.yml @@ -0,0 +1,5 @@ +--- +title: Validate that FK is created for column with _id +merge_request: +author: +type: performance diff --git a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb new file mode 100644 index 00000000000..ffd37f54965 --- /dev/null +++ b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +class AddMissingIndexesForForeignKeys < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index(:application_settings, :usage_stats_set_by_user_id) + add_concurrent_index(:ci_pipeline_schedules, :owner_id) + add_concurrent_index(:ci_trigger_requests, :trigger_id) + add_concurrent_index(:ci_triggers, :owner_id) + add_concurrent_index(:clusters_applications_helm, :cluster_id, unique: true) + add_concurrent_index(:clusters_applications_ingress, :cluster_id, unique: true) + add_concurrent_index(:clusters_applications_jupyter, :cluster_id, unique: true) + add_concurrent_index(:clusters_applications_jupyter, :oauth_application_id) + add_concurrent_index(:clusters_applications_prometheus, :cluster_id, unique: true) + add_concurrent_index(:fork_network_members, :forked_from_project_id) + add_concurrent_index(:internal_ids, :namespace_id) + add_concurrent_index(:internal_ids, :project_id) + add_concurrent_index(:issues, :closed_by_id) + add_concurrent_index(:label_priorities, :label_id) + add_concurrent_index(:merge_request_metrics, :merged_by_id) + add_concurrent_index(:merge_request_metrics, :latest_closed_by_id) + add_concurrent_index(:oauth_openid_requests, :access_grant_id) + add_concurrent_index(:project_deploy_tokens, :deploy_token_id) + add_concurrent_index(:protected_tag_create_access_levels, :group_id) + add_concurrent_index(:subscriptions, :project_id) + add_concurrent_index(:user_statuses, :user_id) + add_concurrent_index(:users, :accepted_term_id) + end + + def down + # no-op + end +end diff --git a/db/schema.rb b/db/schema.rb index deaa2d30b26..d798a26d498 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -166,6 +166,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "diff_max_patch_bytes", default: 102400, null: false t.integer "archive_builds_in_seconds" t.string "commit_email_hostname" + t.index ["usage_stats_set_by_user_id"], name: "index_application_settings_on_usage_stats_set_by_user_id", using: :btree end create_table "audit_events", force: :cascade do |t| @@ -435,6 +436,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime "created_at" t.datetime "updated_at" t.index ["next_run_at", "active"], name: "index_ci_pipeline_schedules_on_next_run_at_and_active", using: :btree + t.index ["owner_id"], name: "index_ci_pipeline_schedules_on_owner_id", using: :btree t.index ["project_id"], name: "index_ci_pipeline_schedules_on_project_id", using: :btree end @@ -547,6 +549,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime "updated_at" t.integer "commit_id" t.index ["commit_id"], name: "index_ci_trigger_requests_on_commit_id", using: :btree + t.index ["trigger_id"], name: "index_ci_trigger_requests_on_trigger_id", using: :btree end create_table "ci_triggers", force: :cascade do |t| @@ -557,6 +560,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "owner_id" t.string "description" t.string "ref" + t.index ["owner_id"], name: "index_ci_triggers_on_owner_id", using: :btree t.index ["project_id"], name: "index_ci_triggers_on_project_id", using: :btree end @@ -646,6 +650,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.text "encrypted_ca_key" t.text "encrypted_ca_key_iv" t.text "ca_cert" + t.index ["cluster_id"], name: "index_clusters_applications_helm_on_cluster_id", unique: true, using: :btree end create_table "clusters_applications_ingress", force: :cascade do |t| @@ -658,6 +663,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.string "cluster_ip" t.text "status_reason" t.string "external_ip" + t.index ["cluster_id"], name: "index_clusters_applications_ingress_on_cluster_id", unique: true, using: :btree end create_table "clusters_applications_jupyter", force: :cascade do |t| @@ -669,6 +675,8 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "updated_at", null: false t.text "status_reason" + t.index ["cluster_id"], name: "index_clusters_applications_jupyter_on_cluster_id", unique: true, using: :btree + t.index ["oauth_application_id"], name: "index_clusters_applications_jupyter_on_oauth_application_id", using: :btree end create_table "clusters_applications_knative", force: :cascade do |t| @@ -688,6 +696,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.text "status_reason" t.datetime_with_timezone "created_at", null: false t.datetime_with_timezone "updated_at", null: false + t.index ["cluster_id"], name: "index_clusters_applications_prometheus_on_cluster_id", unique: true, using: :btree end create_table "clusters_applications_runners", force: :cascade do |t| @@ -871,6 +880,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "project_id", null: false t.integer "forked_from_project_id" t.index ["fork_network_id"], name: "index_fork_network_members_on_fork_network_id", using: :btree + t.index ["forked_from_project_id"], name: "index_fork_network_members_on_forked_from_project_id", using: :btree t.index ["project_id"], name: "index_fork_network_members_on_project_id", unique: true, using: :btree end @@ -960,6 +970,8 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "usage", null: false t.integer "last_value", null: false t.integer "namespace_id" + t.index ["namespace_id"], name: "index_internal_ids_on_namespace_id", using: :btree + t.index ["project_id"], name: "index_internal_ids_on_project_id", using: :btree t.index ["usage", "namespace_id"], name: "index_internal_ids_on_usage_and_namespace_id", unique: true, where: "(namespace_id IS NOT NULL)", using: :btree t.index ["usage", "project_id"], name: "index_internal_ids_on_usage_and_project_id", unique: true, where: "(project_id IS NOT NULL)", using: :btree end @@ -1007,6 +1019,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime_with_timezone "closed_at" t.integer "closed_by_id" t.index ["author_id"], name: "index_issues_on_author_id", using: :btree + t.index ["closed_by_id"], name: "index_issues_on_closed_by_id", using: :btree t.index ["confidential"], name: "index_issues_on_confidential", using: :btree t.index ["description"], name: "index_issues_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} t.index ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree @@ -1052,6 +1065,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "priority", null: false t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["label_id"], name: "index_label_priorities_on_label_id", using: :btree t.index ["priority"], name: "index_label_priorities_on_priority", using: :btree t.index ["project_id", "label_id"], name: "index_label_priorities_on_project_id_and_label_id", unique: true, using: :btree end @@ -1194,7 +1208,9 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "latest_closed_by_id" t.datetime_with_timezone "latest_closed_at" t.index ["first_deployed_to_production_at"], name: "index_merge_request_metrics_on_first_deployed_to_production_at", using: :btree + t.index ["latest_closed_by_id"], name: "index_merge_request_metrics_on_latest_closed_by_id", using: :btree t.index ["merge_request_id"], name: "index_merge_request_metrics", using: :btree + t.index ["merged_by_id"], name: "index_merge_request_metrics_on_merged_by_id", using: :btree t.index ["pipeline_id"], name: "index_merge_request_metrics_on_pipeline_id", using: :btree end @@ -1436,6 +1452,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do create_table "oauth_openid_requests", force: :cascade do |t| t.integer "access_grant_id", null: false t.string "nonce", null: false + t.index ["access_grant_id"], name: "index_oauth_openid_requests_on_access_grant_id", using: :btree end create_table "pages_domains", force: :cascade do |t| @@ -1700,6 +1717,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.integer "group_id" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.index ["group_id"], name: "index_protected_tag_create_access_levels_on_group_id", using: :btree t.index ["protected_tag_id"], name: "index_protected_tag_create_access", using: :btree t.index ["user_id"], name: "index_protected_tag_create_access_levels_on_user_id", using: :btree end @@ -1903,6 +1921,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.datetime "created_at" t.datetime "updated_at" t.integer "project_id" + t.index ["project_id"], name: "index_subscriptions_on_project_id", using: :btree t.index ["subscribable_id", "subscribable_type", "user_id", "project_id"], name: "index_subscriptions_on_subscribable_and_user_id_and_project_id", unique: true, using: :btree end @@ -2067,6 +2086,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.string "emoji", default: "speech_balloon", null: false t.string "message", limit: 100 t.string "message_html" + t.index ["user_id"], name: "index_user_statuses_on_user_id", using: :btree end create_table "user_synced_attributes_metadata", force: :cascade do |t| @@ -2147,6 +2167,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.boolean "private_profile" t.boolean "include_private_contributions" t.string "commit_email" + t.index ["accepted_term_id"], name: "index_users_on_accepted_term_id", using: :btree t.index ["admin"], name: "index_users_on_admin", using: :btree t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree t.index ["created_at"], name: "index_users_on_created_at", using: :btree diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md index 6f31e5b82e5..e4e532bb4ed 100644 --- a/doc/development/migration_style_guide.md +++ b/doc/development/migration_style_guide.md @@ -187,12 +187,7 @@ end When adding a foreign-key constraint to either an existing or new column remember to also add a index on the column. -This is _required_ if the foreign-key constraint specifies -`ON DELETE CASCADE` or `ON DELETE SET NULL` behavior. On a cascading -delete, the [corresponding record needs to be retrieved using an -index](https://www.cybertec-postgresql.com/en/postgresql-indexes-and-foreign-keys/) -(otherwise, we'd need to scan the whole table) for subsequent update or -deletion. +This is _required_ for all foreign-keys. Here's an example where we add a new column with a foreign key constraint. Note it includes `index: true` to create an index for it. diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb new file mode 100644 index 00000000000..43e23ee389e --- /dev/null +++ b/spec/db/schema_spec.rb @@ -0,0 +1,90 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'Database schema' do + let(:connection) { ActiveRecord::Base.connection } + let(:tables) { connection.tables } + + # Use if you are certain that this column should not have a foreign key + IGNORED_FK_COLUMNS = { + abuse_reports: %w[reporter_id user_id], + application_settings: %w[performance_bar_allowed_group_id], + audit_events: %w[author_id entity_id], + award_emoji: %w[awardable_id user_id], + chat_names: %w[chat_id service_id team_id user_id], + chat_teams: %w[team_id], + ci_builds: %w[erased_by_id runner_id trigger_request_id user_id], + ci_pipelines: %w[user_id], + ci_runner_projects: %w[runner_id], + ci_trigger_requests: %w[commit_id], + cluster_providers_gcp: %w[gcp_project_id operation_id], + deploy_keys_projects: %w[deploy_key_id], + deployments: %w[deployable_id environment_id user_id], + emails: %w[user_id], + events: %w[target_id], + forked_project_links: %w[forked_from_project_id], + identities: %w[user_id], + issues: %w[last_edited_by_id], + keys: %w[user_id], + label_links: %w[target_id], + lfs_objects_projects: %w[lfs_object_id project_id], + members: %w[source_id created_by_id], + merge_requests: %w[last_edited_by_id], + namespaces: %w[owner_id parent_id], + notes: %w[author_id commit_id noteable_id updated_by_id resolved_by_id discussion_id], + notification_settings: %w[source_id], + oauth_access_grants: %w[resource_owner_id application_id], + oauth_access_tokens: %w[resource_owner_id application_id], + oauth_applications: %w[owner_id], + project_group_links: %w[group_id], + project_statistics: %w[namespace_id], + projects: %w[creator_id namespace_id ci_id], + redirect_routes: %w[source_id], + repository_languages: %w[programming_language_id], + routes: %w[source_id], + sent_notifications: %w[project_id noteable_id recipient_id commit_id in_reply_to_discussion_id], + snippets: %w[author_id], + spam_logs: %w[user_id], + subscriptions: %w[user_id subscribable_id], + taggings: %w[tag_id taggable_id tagger_id], + timelogs: %w[user_id], + todos: %w[target_id commit_id], + uploads: %w[model_id], + user_agent_details: %w[subject_id], + users: %w[color_scheme_id created_by_id theme_id], + users_star_projects: %w[user_id], + web_hooks: %w[service_id] + }.with_indifferent_access.freeze + + context 'for table' do + ActiveRecord::Base.connection.tables.sort.each do |table| + describe table do + let(:indexes) { connection.indexes(table) } + let(:columns) { connection.columns(table) } + let(:foreign_keys) { connection.foreign_keys(table) } + + context 'all foreign keys' do + # for index to be effective, the FK constraint has to be at first place + it 'are indexed' do + first_indexed_column = indexes.map(&:columns).map(&:first) + foreign_keys_columns = foreign_keys.map(&:column) + + expect(first_indexed_column.uniq).to include(*foreign_keys_columns) + end + end + + context 'columns ending with _id' do + let(:column_names) { columns.map(&:name) } + let(:column_names_with_id) { column_names.select { |column_name| column_name.ends_with?('_id') } } + let(:foreign_keys_columns) { foreign_keys.map(&:column) } + let(:ignored_columns) { IGNORED_FK_COLUMNS[table] || [] } + + it 'do have the foreign keys' do + expect(column_names_with_id - ignored_columns).to contain_exactly(*foreign_keys_columns) + end + end + end + end + end +end -- cgit v1.2.1 From bef905a90965f491e9f2390af45c749902cd6098 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Thu, 15 Nov 2018 12:57:13 +0100 Subject: Backport EE changes --- spec/db/schema_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb index 43e23ee389e..e8584846b56 100644 --- a/spec/db/schema_spec.rb +++ b/spec/db/schema_spec.rb @@ -78,7 +78,7 @@ describe 'Database schema' do let(:column_names) { columns.map(&:name) } let(:column_names_with_id) { column_names.select { |column_name| column_name.ends_with?('_id') } } let(:foreign_keys_columns) { foreign_keys.map(&:column) } - let(:ignored_columns) { IGNORED_FK_COLUMNS[table] || [] } + let(:ignored_columns) { ignored_fk_columns(table) } it 'do have the foreign keys' do expect(column_names_with_id - ignored_columns).to contain_exactly(*foreign_keys_columns) @@ -87,4 +87,10 @@ describe 'Database schema' do end end end + + private + + def ignored_fk_columns(column) + IGNORED_FK_COLUMNS.fetch(column, []) + end end -- cgit v1.2.1 From e31e70d461a25a9772dca71568effc32732d4bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Thu, 15 Nov 2018 13:01:10 +0100 Subject: Remove indexes for FK --- ...0154446_add_missing_indexes_for_foreign_keys.rb | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb index ffd37f54965..8a639e3275b 100644 --- a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb +++ b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb @@ -33,6 +33,31 @@ class AddMissingIndexesForForeignKeys < ActiveRecord::Migration end def down - # no-op + # MySQL requires index for FK, + # thus removal of indexes does fail + return if Gitlab::Database.mysql? + + remove_concurrent_index(:application_settings, :usage_stats_set_by_user_id) + remove_concurrent_index(:ci_pipeline_schedules, :owner_id) + remove_concurrent_index(:ci_trigger_requests, :trigger_id) + remove_concurrent_index(:ci_triggers, :owner_id) + remove_concurrent_index(:clusters_applications_helm, :cluster_id, unique: true) + remove_concurrent_index(:clusters_applications_ingress, :cluster_id, unique: true) + remove_concurrent_index(:clusters_applications_jupyter, :cluster_id, unique: true) + remove_concurrent_index(:clusters_applications_jupyter, :oauth_application_id) + remove_concurrent_index(:clusters_applications_prometheus, :cluster_id, unique: true) + remove_concurrent_index(:fork_network_members, :forked_from_project_id) + remove_concurrent_index(:internal_ids, :namespace_id) + remove_concurrent_index(:internal_ids, :project_id) + remove_concurrent_index(:issues, :closed_by_id) + remove_concurrent_index(:label_priorities, :label_id) + remove_concurrent_index(:merge_request_metrics, :merged_by_id) + remove_concurrent_index(:merge_request_metrics, :latest_closed_by_id) + remove_concurrent_index(:oauth_openid_requests, :access_grant_id) + remove_concurrent_index(:project_deploy_tokens, :deploy_token_id) + remove_concurrent_index(:protected_tag_create_access_levels, :group_id) + remove_concurrent_index(:subscriptions, :project_id) + remove_concurrent_index(:user_statuses, :user_id) + remove_concurrent_index(:users, :accepted_term_id) end end -- cgit v1.2.1 From 5cda92b1cf624f8aa9f33d38b6699b9ae9fc7f8e Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 15 Nov 2018 12:07:20 +0000 Subject: Refactor spec to test all extensions --- spec/lib/gitlab/file_detector_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index ba65827d1fb..b2f8d5c4558 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -15,9 +15,11 @@ describe Gitlab::FileDetector do describe '.type_of' do it 'returns the type of a README file' do + extensions = Gitlab::MarkupHelper::EXTENSIONS + Gitlab::MarkupHelper::EXTENSIONS.map(&:upcase) + %w[README readme INDEX index].each do |filename| expect(described_class.type_of(filename)).to eq(:readme) - %w[.md .adoc .rst].each do |extname| + extensions.each do |extname| expect(described_class.type_of(filename + extname)).to eq(:readme) end end -- cgit v1.2.1 From eaf7fd1bef14feadb58aa36ac1a11f6f4a4890b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Thu, 15 Nov 2018 13:14:09 +0100 Subject: Update CHANGELOG --- changelogs/unreleased/validate-foreign-keys-being-indexed.yml | 4 ++-- changelogs/unreleased/validate-that-foreign-keys-are-created.yml | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) delete mode 100644 changelogs/unreleased/validate-that-foreign-keys-are-created.yml diff --git a/changelogs/unreleased/validate-foreign-keys-being-indexed.yml b/changelogs/unreleased/validate-foreign-keys-being-indexed.yml index aec1717b8d5..6608a93c08f 100644 --- a/changelogs/unreleased/validate-foreign-keys-being-indexed.yml +++ b/changelogs/unreleased/validate-foreign-keys-being-indexed.yml @@ -1,5 +1,5 @@ --- -title: Validate foreign keys being indexed -merge_request: +title: Validate foreign keys being created and indexed for column with _id +merge_request: 22808 author: type: performance diff --git a/changelogs/unreleased/validate-that-foreign-keys-are-created.yml b/changelogs/unreleased/validate-that-foreign-keys-are-created.yml deleted file mode 100644 index 2cda5c86ea5..00000000000 --- a/changelogs/unreleased/validate-that-foreign-keys-are-created.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Validate that FK is created for column with _id -merge_request: -author: -type: performance -- cgit v1.2.1 From 0f8251e7617a9b6a81edc180acef61fd3173b15c Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Thu, 15 Nov 2018 10:34:41 +0200 Subject: Fix typo in notebook props --- app/assets/javascripts/notebook/cells/output/index.vue | 2 +- changelogs/unreleased/gt-fix-typo-in-notebook-props.yml | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/gt-fix-typo-in-notebook-props.yml diff --git a/app/assets/javascripts/notebook/cells/output/index.vue b/app/assets/javascripts/notebook/cells/output/index.vue index d9f8604ed10..bd0bcc0d819 100644 --- a/app/assets/javascripts/notebook/cells/output/index.vue +++ b/app/assets/javascripts/notebook/cells/output/index.vue @@ -22,7 +22,7 @@ export default { }, output: { type: Object, - requred: true, + required: true, default: () => ({}), }, }, diff --git a/changelogs/unreleased/gt-fix-typo-in-notebook-props.yml b/changelogs/unreleased/gt-fix-typo-in-notebook-props.yml new file mode 100644 index 00000000000..60603905a2d --- /dev/null +++ b/changelogs/unreleased/gt-fix-typo-in-notebook-props.yml @@ -0,0 +1,5 @@ +--- +title: Fix typo in notebook props +merge_request: 23103 +author: George Tsiolis +type: other -- cgit v1.2.1 From ccd1d6826bd192bc1fc078e19e3a3d6ce768c8ee Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Thu, 15 Nov 2018 12:04:25 +0200 Subject: Fix typos in comments for js --- .../javascripts/diff_notes/components/jump_to_discussion.js | 2 +- app/assets/javascripts/diffs/store/getters.js | 2 +- app/assets/javascripts/files_comment_button.js | 2 +- spec/javascripts/vue_shared/components/expand_button_spec.js | 2 +- spec/lib/gitlab/import_export/project.json | 10 +++++----- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js index c0c21416275..8542a6e718a 100644 --- a/app/assets/javascripts/diff_notes/components/jump_to_discussion.js +++ b/app/assets/javascripts/diff_notes/components/jump_to_discussion.js @@ -112,7 +112,7 @@ const JumpToDiscussion = Vue.extend({ if (!hasDiscussionsToJumpTo) { // If there are no discussions to jump to on the current page, - // switch to the notes tab and jump to the first disucssion there. + // switch to the notes tab and jump to the first discussion there. window.mrTabs.activateTab('show'); activeTab = 'show'; jumpToFirstDiscussion = true; diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index 7f02c67a64e..c3c4b9bb0f2 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -23,7 +23,7 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => { }; /** - * Checks if the diff has all discussions collpased + * Checks if the diff has all discussions collapsed * @param {Object} diff * @returns {Boolean} */ diff --git a/app/assets/javascripts/files_comment_button.js b/app/assets/javascripts/files_comment_button.js index 3233f5c4f71..aad5647c045 100644 --- a/app/assets/javascripts/files_comment_button.js +++ b/app/assets/javascripts/files_comment_button.js @@ -1,5 +1,5 @@ /* Developer beware! Do not add logic to showButton or hideButton - * that will force a reflow. Doing so will create a signficant performance + * that will force a reflow. Doing so will create a significant performance * bottleneck for pages with large diffs. For a comprehensive list of what * causes reflows, visit https://gist.github.com/paulirish/5d52fb081b3570c81e3a */ diff --git a/spec/javascripts/vue_shared/components/expand_button_spec.js b/spec/javascripts/vue_shared/components/expand_button_spec.js index 98fee9a74a5..2af4abc299a 100644 --- a/spec/javascripts/vue_shared/components/expand_button_spec.js +++ b/spec/javascripts/vue_shared/components/expand_button_spec.js @@ -18,7 +18,7 @@ describe('expand button', () => { vm.$destroy(); }); - it('renders a collpased button', () => { + it('renders a collapsed button', () => { expect(vm.$children[0].iconTestClass).toEqual('ic-ellipsis_h'); }); diff --git a/spec/lib/gitlab/import_export/project.json b/spec/lib/gitlab/import_export/project.json index 3f2281f213f..58949f76bd6 100644 --- a/spec/lib/gitlab/import_export/project.json +++ b/spec/lib/gitlab/import_export/project.json @@ -2556,7 +2556,7 @@ "merge_request_diff_id": 27, "relative_order": 0, "sha": "bb5206fee213d983da88c47f9cf4cc6caf9c66dc", - "message": "Feature conflcit added\n\nSigned-off-by: Dmitriy Zaporozhets \n", + "message": "Feature conflict added\n\nSigned-off-by: Dmitriy Zaporozhets \n", "authored_date": "2014-08-06T08:35:52.000+02:00", "author_name": "Dmitriy Zaporozhets", "author_email": "dmitriy.zaporozhets@gmail.com", @@ -3605,7 +3605,7 @@ "merge_request_diff_id": 14, "relative_order": 8, "sha": "08f22f255f082689c0d7d39d19205085311542bc", - "message": "remove emtpy file.(beacase git ignore empty file)\nadd whitespace test file.\n", + "message": "remove empty file.(beacase git ignore empty file)\nadd whitespace test file.\n", "authored_date": "2015-11-13T06:00:16.000+01:00", "author_name": "윤민식", "author_email": "minsik.yoon@samsung.com", @@ -4290,7 +4290,7 @@ "merge_request_diff_id": 13, "relative_order": 8, "sha": "08f22f255f082689c0d7d39d19205085311542bc", - "message": "remove emtpy file.(beacase git ignore empty file)\nadd whitespace test file.\n", + "message": "remove empty file.(beacase git ignore empty file)\nadd whitespace test file.\n", "authored_date": "2015-11-13T06:00:16.000+01:00", "author_name": "윤민식", "author_email": "minsik.yoon@samsung.com", @@ -4799,7 +4799,7 @@ "merge_request_diff_id": 12, "relative_order": 8, "sha": "08f22f255f082689c0d7d39d19205085311542bc", - "message": "remove emtpy file.(beacase git ignore empty file)\nadd whitespace test file.\n", + "message": "remove empty file.(beacase git ignore empty file)\nadd whitespace test file.\n", "authored_date": "2015-11-13T06:00:16.000+01:00", "author_name": "윤민식", "author_email": "minsik.yoon@samsung.com", @@ -5507,7 +5507,7 @@ "merge_request_diff_id": 10, "relative_order": 8, "sha": "08f22f255f082689c0d7d39d19205085311542bc", - "message": "remove emtpy file.(beacase git ignore empty file)\nadd whitespace test file.\n", + "message": "remove empty file.(beacase git ignore empty file)\nadd whitespace test file.\n", "authored_date": "2015-11-13T06:00:16.000+01:00", "author_name": "윤민식", "author_email": "minsik.yoon@samsung.com", -- cgit v1.2.1 From 5e6663a21a7f9c141ee6d52353e2f6bb36707bce Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 15 Nov 2018 13:00:12 +0000 Subject: Update spec to use PLAIN_FILENAMES constant --- spec/lib/gitlab/file_detector_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index b2f8d5c4558..462cc113a95 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -15,9 +15,10 @@ describe Gitlab::FileDetector do describe '.type_of' do it 'returns the type of a README file' do + filenames = Gitlab::MarkupHelper::PLAIN_FILENAMES + Gitlab::MarkupHelper::PLAIN_FILENAMES.map(&:upcase) extensions = Gitlab::MarkupHelper::EXTENSIONS + Gitlab::MarkupHelper::EXTENSIONS.map(&:upcase) - %w[README readme INDEX index].each do |filename| + filenames.each do |filename| expect(described_class.type_of(filename)).to eq(:readme) extensions.each do |extname| expect(described_class.type_of(filename + extname)).to eq(:readme) -- cgit v1.2.1 From 39451c9554b3cba2cade6971572626d0578a2fb0 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 15 Nov 2018 13:06:00 +0000 Subject: Fix trailing whitespace --- spec/lib/gitlab/file_detector_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index 462cc113a95..d731f88ae03 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -17,7 +17,7 @@ describe Gitlab::FileDetector do it 'returns the type of a README file' do filenames = Gitlab::MarkupHelper::PLAIN_FILENAMES + Gitlab::MarkupHelper::PLAIN_FILENAMES.map(&:upcase) extensions = Gitlab::MarkupHelper::EXTENSIONS + Gitlab::MarkupHelper::EXTENSIONS.map(&:upcase) - + filenames.each do |filename| expect(described_class.type_of(filename)).to eq(:readme) extensions.each do |extname| -- cgit v1.2.1 From b27db6cf0acb632de5201abf70f5acaabeba18e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Wed, 14 Nov 2018 16:24:14 +0100 Subject: Use the new parallel keyword in .gitlab-ci.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- .gitlab-ci.yml | 147 +++++++--------------------------------------------- Gemfile | 2 +- Gemfile.lock | 4 +- Gemfile.rails4.lock | 4 +- 4 files changed, 24 insertions(+), 133 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2595d0bbe1b..82d2cb8d09f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -150,13 +150,12 @@ stages: stage: test script: - JOB_NAME=( $CI_JOB_NAME ) - - export CI_NODE_INDEX=${JOB_NAME[-2]} - - export CI_NODE_TOTAL=${JOB_NAME[-1]} - - export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${JOB_NAME[0]}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json + - TEST_TOOL=${JOB_NAME[0]} + - export KNAPSACK_REPORT_PATH=knapsack/${CI_PROJECT_NAME}/${TEST_TOOL}_node_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - export KNAPSACK_GENERATE_REPORT=true - export SUITE_FLAKY_RSPEC_REPORT_PATH=${FLAKY_RSPEC_SUITE_REPORT_PATH} - - export FLAKY_RSPEC_REPORT_PATH=rspec_flaky/all_${JOB_NAME[0]}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - - export NEW_FLAKY_RSPEC_REPORT_PATH=rspec_flaky/new_${JOB_NAME[0]}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json + - export FLAKY_RSPEC_REPORT_PATH=rspec_flaky/all_${TEST_TOOL}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json + - export NEW_FLAKY_RSPEC_REPORT_PATH=rspec_flaky/new_${TEST_TOOL}_${CI_NODE_INDEX}_${CI_NODE_TOTAL}_report.json - export FLAKY_RSPEC_GENERATE_REPORT=true - export CACHE_CLASSES=true - cp ${KNAPSACK_RSPEC_SUITE_REPORT_PATH} ${KNAPSACK_REPORT_PATH} @@ -461,129 +460,21 @@ danger-review: - yarn install --frozen-lockfile --cache-folder .yarn-cache - danger --fail-on-errors=true -rspec-pg 0 30: *rspec-metadata-pg -rspec-pg 1 30: *rspec-metadata-pg -rspec-pg 2 30: *rspec-metadata-pg -rspec-pg 3 30: *rspec-metadata-pg -rspec-pg 4 30: *rspec-metadata-pg -rspec-pg 5 30: *rspec-metadata-pg -rspec-pg 6 30: *rspec-metadata-pg -rspec-pg 7 30: *rspec-metadata-pg -rspec-pg 8 30: *rspec-metadata-pg -rspec-pg 9 30: *rspec-metadata-pg -rspec-pg 10 30: *rspec-metadata-pg -rspec-pg 11 30: *rspec-metadata-pg -rspec-pg 12 30: *rspec-metadata-pg -rspec-pg 13 30: *rspec-metadata-pg -rspec-pg 14 30: *rspec-metadata-pg -rspec-pg 15 30: *rspec-metadata-pg -rspec-pg 16 30: *rspec-metadata-pg -rspec-pg 17 30: *rspec-metadata-pg -rspec-pg 18 30: *rspec-metadata-pg -rspec-pg 19 30: *rspec-metadata-pg -rspec-pg 20 30: *rspec-metadata-pg -rspec-pg 21 30: *rspec-metadata-pg -rspec-pg 22 30: *rspec-metadata-pg -rspec-pg 23 30: *rspec-metadata-pg -rspec-pg 24 30: *rspec-metadata-pg -rspec-pg 25 30: *rspec-metadata-pg -rspec-pg 26 30: *rspec-metadata-pg -rspec-pg 27 30: *rspec-metadata-pg -rspec-pg 28 30: *rspec-metadata-pg -rspec-pg 29 30: *rspec-metadata-pg - -rspec-mysql 0 30: *rspec-metadata-mysql -rspec-mysql 1 30: *rspec-metadata-mysql -rspec-mysql 2 30: *rspec-metadata-mysql -rspec-mysql 3 30: *rspec-metadata-mysql -rspec-mysql 4 30: *rspec-metadata-mysql -rspec-mysql 5 30: *rspec-metadata-mysql -rspec-mysql 6 30: *rspec-metadata-mysql -rspec-mysql 7 30: *rspec-metadata-mysql -rspec-mysql 8 30: *rspec-metadata-mysql -rspec-mysql 9 30: *rspec-metadata-mysql -rspec-mysql 10 30: *rspec-metadata-mysql -rspec-mysql 11 30: *rspec-metadata-mysql -rspec-mysql 12 30: *rspec-metadata-mysql -rspec-mysql 13 30: *rspec-metadata-mysql -rspec-mysql 14 30: *rspec-metadata-mysql -rspec-mysql 15 30: *rspec-metadata-mysql -rspec-mysql 16 30: *rspec-metadata-mysql -rspec-mysql 17 30: *rspec-metadata-mysql -rspec-mysql 18 30: *rspec-metadata-mysql -rspec-mysql 19 30: *rspec-metadata-mysql -rspec-mysql 20 30: *rspec-metadata-mysql -rspec-mysql 21 30: *rspec-metadata-mysql -rspec-mysql 22 30: *rspec-metadata-mysql -rspec-mysql 23 30: *rspec-metadata-mysql -rspec-mysql 24 30: *rspec-metadata-mysql -rspec-mysql 25 30: *rspec-metadata-mysql -rspec-mysql 26 30: *rspec-metadata-mysql -rspec-mysql 27 30: *rspec-metadata-mysql -rspec-mysql 28 30: *rspec-metadata-mysql -rspec-mysql 29 30: *rspec-metadata-mysql - -rspec-pg-rails4 0 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 1 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 2 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 3 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 4 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 5 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 6 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 7 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 8 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 9 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 10 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 11 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 12 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 13 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 14 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 15 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 16 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 17 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 18 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 19 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 20 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 21 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 22 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 23 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 24 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 25 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 26 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 27 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 28 30: *rspec-metadata-pg-rails4 -rspec-pg-rails4 29 30: *rspec-metadata-pg-rails4 - -rspec-mysql-rails4 0 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 1 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 2 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 3 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 4 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 5 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 6 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 7 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 8 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 9 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 10 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 11 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 12 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 13 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 14 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 15 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 16 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 17 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 18 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 19 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 20 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 21 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 22 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 23 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 24 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 25 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 26 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 27 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 28 30: *rspec-metadata-mysql-rails4 -rspec-mysql-rails4 29 30: *rspec-metadata-mysql-rails4 +rspec-pg: + <<: *rspec-metadata-pg + parallel: 30 + +rspec-mysql: + <<: *rspec-metadata-mysql + parallel: 30 + +rspec-pg-rails4: + <<: *rspec-metadata-pg-rails4 + parallel: 30 + +rspec-mysql-rails4: + <<: *rspec-metadata-mysql-rails4 + parallel: 30 static-analysis: <<: *dedicated-no-docs-no-db-pull-cache-job diff --git a/Gemfile b/Gemfile index 7030bd9c5e8..2a228b326ad 100644 --- a/Gemfile +++ b/Gemfile @@ -364,7 +364,7 @@ group :development, :test do gem 'benchmark-ips', '~> 2.3.0', require: false gem 'license_finder', '~> 5.4', require: false - gem 'knapsack', '~> 1.16' + gem 'knapsack', '~> 1.17' gem 'activerecord_sane_schema_dumper', gem_versions['activerecord_sane_schema_dumper'] diff --git a/Gemfile.lock b/Gemfile.lock index f08855ed049..e21a1b85457 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -415,7 +415,7 @@ GEM kaminari-core (= 1.0.1) kaminari-core (1.0.1) kgio (2.10.0) - knapsack (1.16.0) + knapsack (1.17.0) rake kubeclient (3.1.0) http (~> 2.2.2) @@ -1039,7 +1039,7 @@ DEPENDENCIES json-schema (~> 2.8.0) jwt (~> 1.5.6) kaminari (~> 1.0) - knapsack (~> 1.16) + knapsack (~> 1.17) kubeclient (~> 3.1.0) letter_opener_web (~> 1.3.0) license_finder (~> 5.4) diff --git a/Gemfile.rails4.lock b/Gemfile.rails4.lock index 5bec40de909..fea3102b8d6 100644 --- a/Gemfile.rails4.lock +++ b/Gemfile.rails4.lock @@ -412,7 +412,7 @@ GEM kaminari-core (= 1.0.1) kaminari-core (1.0.1) kgio (2.10.0) - knapsack (1.16.0) + knapsack (1.17.0) rake kubeclient (3.1.0) http (~> 2.2.2) @@ -1030,7 +1030,7 @@ DEPENDENCIES json-schema (~> 2.8.0) jwt (~> 1.5.6) kaminari (~> 1.0) - knapsack (~> 1.16) + knapsack (~> 1.17) kubeclient (~> 3.1.0) letter_opener_web (~> 1.3.0) license_finder (~> 5.4) -- cgit v1.2.1 From c8dc8c388719f8960a1288fa43212c62f1acffc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Thu, 15 Nov 2018 14:34:55 +0100 Subject: Add missing cluster_id on knative --- db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb | 2 ++ db/schema.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb index 8a639e3275b..176d55565d8 100644 --- a/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb +++ b/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb @@ -16,6 +16,7 @@ class AddMissingIndexesForForeignKeys < ActiveRecord::Migration add_concurrent_index(:clusters_applications_ingress, :cluster_id, unique: true) add_concurrent_index(:clusters_applications_jupyter, :cluster_id, unique: true) add_concurrent_index(:clusters_applications_jupyter, :oauth_application_id) + add_concurrent_index(:clusters_applications_knative, :cluster_id, unique: true) add_concurrent_index(:clusters_applications_prometheus, :cluster_id, unique: true) add_concurrent_index(:fork_network_members, :forked_from_project_id) add_concurrent_index(:internal_ids, :namespace_id) @@ -45,6 +46,7 @@ class AddMissingIndexesForForeignKeys < ActiveRecord::Migration remove_concurrent_index(:clusters_applications_ingress, :cluster_id, unique: true) remove_concurrent_index(:clusters_applications_jupyter, :cluster_id, unique: true) remove_concurrent_index(:clusters_applications_jupyter, :oauth_application_id) + remove_concurrent_index(:clusters_applications_knative, :cluster_id, unique: true) remove_concurrent_index(:clusters_applications_prometheus, :cluster_id, unique: true) remove_concurrent_index(:fork_network_members, :forked_from_project_id) remove_concurrent_index(:internal_ids, :namespace_id) diff --git a/db/schema.rb b/db/schema.rb index d798a26d498..8e02f43f702 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -687,6 +687,7 @@ ActiveRecord::Schema.define(version: 20181107054254) do t.string "version", null: false t.string "hostname" t.text "status_reason" + t.index ["cluster_id"], name: "index_clusters_applications_knative_on_cluster_id", unique: true, using: :btree end create_table "clusters_applications_prometheus", force: :cascade do |t| -- cgit v1.2.1 From 71f4ec45c029a2b6101f6eaf849da79289915583 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Thu, 15 Nov 2018 15:20:58 +0100 Subject: Fix spec failure --- spec/lib/gitlab/file_detector_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/lib/gitlab/file_detector_spec.rb b/spec/lib/gitlab/file_detector_spec.rb index d731f88ae03..4ba9094b24e 100644 --- a/spec/lib/gitlab/file_detector_spec.rb +++ b/spec/lib/gitlab/file_detector_spec.rb @@ -20,8 +20,9 @@ describe Gitlab::FileDetector do filenames.each do |filename| expect(described_class.type_of(filename)).to eq(:readme) + extensions.each do |extname| - expect(described_class.type_of(filename + extname)).to eq(:readme) + expect(described_class.type_of("#{filename}.#{extname}")).to eq(:readme) end end end -- cgit v1.2.1 From f208f4c236b4ea464842407a23d428d84e07038a Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Thu, 15 Nov 2018 06:53:47 +0100 Subject: Allow partially migrated repositories to continue migration Previously we verified if the projecthave at least migrated their repository to hashed storage and prevented the migration command to start a new migration. The new version checks for the latest storage version available (fully migrated), otherwise it allows migration to be triggered again. --- app/models/project.rb | 2 +- changelogs/unreleased/53700-hashed-storagemigration.yml | 5 +++++ spec/models/project_spec.rb | 8 ++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/53700-hashed-storagemigration.yml diff --git a/app/models/project.rb b/app/models/project.rb index d87fc1e4b86..7bd44f6a37c 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1968,7 +1968,7 @@ class Project < ActiveRecord::Base end def migrate_to_hashed_storage! - return if hashed_storage?(:repository) + return unless storage_upgradable? update!(repository_read_only: true) diff --git a/changelogs/unreleased/53700-hashed-storagemigration.yml b/changelogs/unreleased/53700-hashed-storagemigration.yml new file mode 100644 index 00000000000..899012ffd22 --- /dev/null +++ b/changelogs/unreleased/53700-hashed-storagemigration.yml @@ -0,0 +1,5 @@ +--- +title: 'Hashed Storage: allow migration to be retried in partially migrated projects' +merge_request: 23087 +author: +type: fixed diff --git a/spec/models/project_spec.rb b/spec/models/project_spec.rb index bdff68cee8b..51278836604 100644 --- a/spec/models/project_spec.rb +++ b/spec/models/project_spec.rb @@ -3087,6 +3087,14 @@ describe Project do it 'does not flag as read-only' do expect { project.migrate_to_hashed_storage! }.not_to change { project.repository_read_only } end + + context 'when partially migrated' do + it 'returns true' do + project = create(:project, storage_version: 1, skip_disk_validation: true) + + expect(project.migrate_to_hashed_storage!).to be_truthy + end + end end end -- cgit v1.2.1 From 23bcbf04c875ac31e6a04453931d5173c56d5efa Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 15 Nov 2018 06:33:23 -0800 Subject: Remove display of local Sidekiq process in /admin/sidekiq In a cloud-native or high-availability configuration, Sidekiq may not be running on the same node as the Web worker. The output of the `ps` output does not work in this case and can mislead admins that Sidekiq isn't running. Remove it in favor of the Sidekiq dashboard, which shows local processes using the Redis information. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/46133 --- .../admin/background_jobs_controller.rb | 5 --- app/views/admin/background_jobs/show.html.haml | 38 ---------------------- .../sh-remove-local-sidekiq-admin-check.yml | 5 +++ 3 files changed, 5 insertions(+), 43 deletions(-) create mode 100644 changelogs/unreleased/sh-remove-local-sidekiq-admin-check.yml diff --git a/app/controllers/admin/background_jobs_controller.rb b/app/controllers/admin/background_jobs_controller.rb index 7701f2e645b..fc877142418 100644 --- a/app/controllers/admin/background_jobs_controller.rb +++ b/app/controllers/admin/background_jobs_controller.rb @@ -1,9 +1,4 @@ # frozen_string_literal: true class Admin::BackgroundJobsController < Admin::ApplicationController - def show - ps_output, _ = Gitlab::Popen.popen(%W(ps ww -U #{Gitlab.config.gitlab.user} -o pid,pcpu,pmem,stat,start,command)) - @sidekiq_processes = ps_output.split("\n").grep(/sidekiq \d+\.\d+\.\d+/) - @concurrency = Sidekiq.options[:concurrency] - end end diff --git a/app/views/admin/background_jobs/show.html.haml b/app/views/admin/background_jobs/show.html.haml index 9aa705d9fa6..a0a00ac5d96 100644 --- a/app/views/admin/background_jobs/show.html.haml +++ b/app/views/admin/background_jobs/show.html.haml @@ -6,43 +6,5 @@ %p.light GitLab uses #{link_to "sidekiq", "http://sidekiq.org/"} library for async job processing %hr - - .card - .card-header Sidekiq running processes - .card-body - - if @sidekiq_processes.empty? - %h4.cred - %i.fa.fa-exclamation-triangle - There are no running sidekiq processes. Please restart GitLab - - else - .table-holder - %table.table - %thead - %th USER - %th PID - %th CPU - %th MEM - %th STATE - %th START - %th COMMAND - %tbody - - @sidekiq_processes.each do |process| - %tr - %td= gitlab_config.user - - parse_sidekiq_ps(process).each do |value| - %td= value - .clearfix - %p - %i.fa.fa-exclamation-circle - If '[#{@concurrency} of #{@concurrency} busy]' is shown, restart GitLab. - = link_to sprite_icon('question', size: 16), help_page_path('administration/restart_gitlab') - - %p - %i.fa.fa-exclamation-circle - If more than one sidekiq process is listed, stop GitLab, kill the remaining sidekiq processes (sudo pkill -u #{gitlab_config.user} -f sidekiq) and restart GitLab. - = link_to sprite_icon('question', size: 16), help_page_path('administration/restart_gitlab') - - - .card %iframe{ src: sidekiq_path, width: '100%', height: 970, style: "border: 0" } diff --git a/changelogs/unreleased/sh-remove-local-sidekiq-admin-check.yml b/changelogs/unreleased/sh-remove-local-sidekiq-admin-check.yml new file mode 100644 index 00000000000..3ec15908fc7 --- /dev/null +++ b/changelogs/unreleased/sh-remove-local-sidekiq-admin-check.yml @@ -0,0 +1,5 @@ +--- +title: Remove display of local Sidekiq process in /admin/sidekiq +merge_request: 23118 +author: +type: fixed -- cgit v1.2.1 From 0aa386f75c96356a7f40c0b8029f9df608babe99 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 15 Nov 2018 16:09:27 +0100 Subject: Refactor Member#add_user for GitLab EE GitLab EE extends Member#add_user by adding some LDAP specific flags. Prior to these changes, the only way this could be done was by modifying Member#add_user in place. This could lead to merge conflicts whenever a developer wants to change this method. To resolve this issue, the logic that EE extends has been moved into a separate method with the appropriate arguments. This allows EE to extend the logic by prepending the method using an EE specific module. --- app/models/member.rb | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/app/models/member.rb b/app/models/member.rb index 0696ea46c8b..bc8ac14d148 100644 --- a/app/models/member.rb +++ b/app/models/member.rb @@ -152,11 +152,13 @@ class Member < ActiveRecord::Base return member unless can_update_member?(current_user, member) - member.attributes = { - created_by: member.created_by || current_user, - access_level: access_level, - expires_at: expires_at - } + set_member_attributes( + member, + access_level, + current_user: current_user, + expires_at: expires_at, + ldap: ldap + ) if member.request? ::Members::ApproveAccessRequestService.new( @@ -175,6 +177,18 @@ class Member < ActiveRecord::Base # rubocop: enable CodeReuse/ServiceClass end + # Populates the attributes of a member. + # + # This logic resides in a separate method so that EE can extend this logic, + # without having to patch the `add_user` method directly. + def set_member_attributes(member, access_level, current_user: nil, expires_at: nil, ldap: false) + member.attributes = { + created_by: member.created_by || current_user, + access_level: access_level, + expires_at: expires_at + } + end + def add_users(source, users, access_level, current_user: nil, expires_at: nil) return [] unless users.present? -- cgit v1.2.1 From 47dd7d0bbed879625f6ff19960ff390956e7c331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Coutable?= Date: Thu, 15 Nov 2018 13:32:17 +0100 Subject: Use gitlab-default_value_with Rails 5 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This forks live at https://github.com/gitlabhq/default_value_for/tree/69-fix-action_controller-parameters-handling and fixes an issue where default_value_for wouldn't handle `ActionController::Parameters` correctly with Rails 5. This fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/54093. Signed-off-by: Rémy Coutable --- Gemfile | 13 ++++++++----- Gemfile.lock | 6 +++--- app/services/users/build_service.rb | 2 +- ...doesn-t-handle-actioncontroller-parameters-correctly.yml | 7 +++++++ spec/services/users/build_service_spec.rb | 2 +- 5 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 changelogs/unreleased/54093-the-default_value_for-gem-doesn-t-handle-actioncontroller-parameters-correctly.yml diff --git a/Gemfile b/Gemfile index 2a228b326ad..fa7c0d12eba 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,9 @@ def rails5? end gem_versions = {} -gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0' : '0.2' -gem_versions['default_value_for'] = rails5? ? '~> 3.0.5' : '~> 3.0.0' -gem_versions['rails'] = rails5? ? '5.0.7' : '4.2.10' -gem_versions['rails-i18n'] = rails5? ? '~> 5.1' : '~> 4.0.9' +gem_versions['activerecord_sane_schema_dumper'] = rails5? ? '1.0' : '0.2' +gem_versions['rails'] = rails5? ? '5.0.7' : '4.2.10' +gem_versions['rails-i18n'] = rails5? ? '~> 5.1' : '~> 4.0.9' # --- The end of special code for migrating to Rails 5.0 --- source 'https://rubygems.org' @@ -21,7 +20,11 @@ gem 'responders', '~> 2.0' gem 'sprockets', '~> 3.7.0' # Default values for AR models -gem 'default_value_for', gem_versions['default_value_for'] +if rails5? + gem 'gitlab-default_value_for', '~> 3.1.1', require: 'default_value_for' +else + gem 'default_value_for', '~> 3.0.0' +end # Supported DBs gem 'mysql2', '~> 0.4.10', group: :mysql diff --git a/Gemfile.lock b/Gemfile.lock index e21a1b85457..defcfe8e3a8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -146,8 +146,6 @@ GEM html-pipeline declarative (0.0.10) declarative-option (0.1.0) - default_value_for (3.0.5) - activerecord (>= 3.2.0, < 5.2) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) device_detector (1.0.0) @@ -277,6 +275,8 @@ GEM gitaly-proto (0.123.0) grpc (~> 1.0) github-markup (1.7.0) + gitlab-default_value_for (3.1.1) + activerecord (>= 3.2.0, < 6.0) gitlab-markup (1.6.5) gitlab-sidekiq-fetcher (0.3.0) sidekiq (~> 5) @@ -971,7 +971,6 @@ DEPENDENCIES creole (~> 0.5.0) database_cleaner (~> 1.5.0) deckar01-task_list (= 2.0.0) - default_value_for (~> 3.0.5) device_detector devise (~> 4.4) devise-two-factor (~> 3.0.0) @@ -1007,6 +1006,7 @@ DEPENDENCIES gettext_i18n_rails_js (~> 1.3) gitaly-proto (~> 0.123.0) github-markup (~> 1.7.0) + gitlab-default_value_for (~> 3.1.1) gitlab-markup (~> 1.6.5) gitlab-sidekiq-fetcher gitlab-styles (~> 2.4) diff --git a/app/services/users/build_service.rb b/app/services/users/build_service.rb index 24ac20fdd29..3f503f3da28 100644 --- a/app/services/users/build_service.rb +++ b/app/services/users/build_service.rb @@ -28,7 +28,7 @@ module Users identity_attrs = params.slice(:extern_uid, :provider) - if identity_attrs.any? + unless identity_attrs.empty? user.identities.build(identity_attrs) end diff --git a/changelogs/unreleased/54093-the-default_value_for-gem-doesn-t-handle-actioncontroller-parameters-correctly.yml b/changelogs/unreleased/54093-the-default_value_for-gem-doesn-t-handle-actioncontroller-parameters-correctly.yml new file mode 100644 index 00000000000..3d6fd2d065a --- /dev/null +++ b/changelogs/unreleased/54093-the-default_value_for-gem-doesn-t-handle-actioncontroller-parameters-correctly.yml @@ -0,0 +1,7 @@ +--- +title: Fixes an issue where default values from models would override values set in + the interface (e.g. users would be set to external even though their emails matches + the internal email address pattern) +merge_request: 23114 +author: +type: fixed diff --git a/spec/services/users/build_service_spec.rb b/spec/services/users/build_service_spec.rb index 17bc880dec5..b7b9817efdb 100644 --- a/spec/services/users/build_service_spec.rb +++ b/spec/services/users/build_service_spec.rb @@ -8,7 +8,7 @@ describe Users::BuildService do context 'with an admin user' do let(:admin_user) { create(:admin) } - let(:service) { described_class.new(admin_user, params) } + let(:service) { described_class.new(admin_user, ActionController::Parameters.new(params).permit!) } it 'returns a valid user' do expect(service.execute).to be_valid -- cgit v1.2.1 From 553eaf01f7f299842d0985325e11ff8f58ef9c03 Mon Sep 17 00:00:00 2001 From: Ian Baum Date: Wed, 14 Nov 2018 11:36:02 -0600 Subject: Add BUILD_ASSETS_IMAGE CI variable * Defaults to FALSE * Can be used to disable building/pushing the assets image in the gitlab:compile:assets job --- .gitlab-ci.yml | 1 + scripts/build_assets_image | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 94922aec598..bac46a689f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,6 +32,7 @@ variables: GET_SOURCES_ATTEMPTS: "3" KNAPSACK_RSPEC_SUITE_REPORT_PATH: knapsack/${CI_PROJECT_NAME}/rspec_report-master.json FLAKY_RSPEC_SUITE_REPORT_PATH: rspec_flaky/report-suite.json + BUILD_ASSETS_IMAGE: "false" before_script: - bundle --version diff --git a/scripts/build_assets_image b/scripts/build_assets_image index 1d77524d503..4e5ef977161 100755 --- a/scripts/build_assets_image +++ b/scripts/build_assets_image @@ -1,5 +1,11 @@ #!/bin/bash +# Exit early if we don't want to build the image +if [[ "${BUILD_ASSETS_IMAGE}" != "true" ]] +then + exit 0 +fi + # Generate the image name based on the project this is being run in ASSETS_IMAGE_NAME=$(echo ${CI_PROJECT_NAME} | awk '{ -- cgit v1.2.1 From 94d518f5d68b9bcead7564b6f8d42047cdf5d23b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Ru=CC=88ttimann?= Date: Thu, 15 Nov 2018 10:56:21 +0100 Subject: Add a test for the creation of an internal user by an admin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Rémy Coutable --- spec/features/admin/admin_users_spec.rb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/admin_users_spec.rb b/spec/features/admin/admin_users_spec.rb index d32f33ca1e2..f7c7a257075 100644 --- a/spec/features/admin/admin_users_spec.rb +++ b/spec/features/admin/admin_users_spec.rb @@ -130,7 +130,7 @@ describe "Admin::Users" do context 'with regex to match internal user email address set', :js do before do stub_application_setting(user_default_external: true) - stub_application_setting(user_default_internal_regex: '.internal@') + stub_application_setting(user_default_internal_regex: '\.internal@') visit new_admin_user_path end @@ -169,6 +169,22 @@ describe "Admin::Users" do expects_warning_to_be_hidden end + + it 'creates an internal user' do + user_name = 'tester1' + fill_in 'user_email', with: 'test.internal@domain.ch' + fill_in 'user_name', with: 'tester1 name' + fill_in 'user_username', with: user_name + + expects_external_to_be_unchecked + expects_warning_to_be_shown + + click_button 'Create user' + + new_user = User.find_by(username: user_name) + + expect(new_user.external).to be_falsy + end end end end -- cgit v1.2.1 From 4ee8bd11fa317a99dc0f99ea8d33271e4c9d1a47 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Thu, 15 Nov 2018 16:55:51 +0100 Subject: Backport ServiceHook#execute from EE In EE this method takes an additional argument that specifies the name of the hook to trigger. There is no particular reason to not backport this to CE, since by default the behaviour remains the same. By backporting this code we remove the need for prepending ServiceHook with a module in EE. --- app/models/hooks/service_hook.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/hooks/service_hook.rb b/app/models/hooks/service_hook.rb index 7d9f6d89d44..8f305dd7c22 100644 --- a/app/models/hooks/service_hook.rb +++ b/app/models/hooks/service_hook.rb @@ -5,8 +5,8 @@ class ServiceHook < WebHook validates :service, presence: true # rubocop: disable CodeReuse/ServiceClass - def execute(data) - WebHookService.new(self, data, 'service_hook').execute + def execute(data, hook_name = 'service_hook') + WebHookService.new(self, data, hook_name).execute end # rubocop: enable CodeReuse/ServiceClass end -- cgit v1.2.1 From 4a2b19706c58074a31d2b3a7e80f15c89c8cf85b Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Thu, 15 Nov 2018 18:14:16 +0200 Subject: Rename diffs store variable --- app/assets/javascripts/diffs/store/actions.js | 2 +- app/assets/javascripts/diffs/store/getters.js | 2 +- changelogs/unreleased/gt-rename-diffs-store-variable.yml | 5 +++++ spec/javascripts/diffs/store/actions_spec.js | 6 +++--- spec/javascripts/diffs/store/getters_spec.js | 8 ++++---- 5 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 changelogs/unreleased/gt-rename-diffs-store-variable.yml diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index fb648527450..6354d3ce1e6 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -167,7 +167,7 @@ export const expandAllFiles = ({ commit }) => { export const toggleFileDiscussions = ({ getters, dispatch }, diff) => { const discussions = getters.getDiffFileDiscussions(diff); const shouldCloseAll = getters.diffHasAllExpandedDiscussions(diff); - const shouldExpandAll = getters.diffHasAllCollpasedDiscussions(diff); + const shouldExpandAll = getters.diffHasAllCollapsedDiscussions(diff); discussions.forEach(discussion => { const data = { discussionId: discussion.id }; diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index 7f02c67a64e..05e32e3c1f1 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -27,7 +27,7 @@ export const diffHasAllExpandedDiscussions = (state, getters) => diff => { * @param {Object} diff * @returns {Boolean} */ -export const diffHasAllCollpasedDiscussions = (state, getters) => diff => { +export const diffHasAllCollapsedDiscussions = (state, getters) => diff => { const discussions = getters.getDiffFileDiscussions(diff); return ( diff --git a/changelogs/unreleased/gt-rename-diffs-store-variable.yml b/changelogs/unreleased/gt-rename-diffs-store-variable.yml new file mode 100644 index 00000000000..0aed49f3d60 --- /dev/null +++ b/changelogs/unreleased/gt-rename-diffs-store-variable.yml @@ -0,0 +1,5 @@ +--- +title: Rename diffs store variable +merge_request: 23123 +author: George Tsiolis +type: other diff --git a/spec/javascripts/diffs/store/actions_spec.js b/spec/javascripts/diffs/store/actions_spec.js index d94a9cd1710..acd95a3dd8b 100644 --- a/spec/javascripts/diffs/store/actions_spec.js +++ b/spec/javascripts/diffs/store/actions_spec.js @@ -416,7 +416,7 @@ describe('DiffsStoreActions', () => { const getters = { getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]), diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(true), - diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(false), + diffHasAllCollapsedDiscussions: jasmine.createSpy().and.returnValue(false), }; const dispatch = jasmine.createSpy('dispatch'); @@ -434,7 +434,7 @@ describe('DiffsStoreActions', () => { const getters = { getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ id: 1 }]), diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false), - diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(true), + diffHasAllCollapsedDiscussions: jasmine.createSpy().and.returnValue(true), }; const dispatch = jasmine.createSpy(); @@ -452,7 +452,7 @@ describe('DiffsStoreActions', () => { const getters = { getDiffFileDiscussions: jasmine.createSpy().and.returnValue([{ expanded: false, id: 1 }]), diffHasAllExpandedDiscussions: jasmine.createSpy().and.returnValue(false), - diffHasAllCollpasedDiscussions: jasmine.createSpy().and.returnValue(false), + diffHasAllCollapsedDiscussions: jasmine.createSpy().and.returnValue(false), }; const dispatch = jasmine.createSpy(); diff --git a/spec/javascripts/diffs/store/getters_spec.js b/spec/javascripts/diffs/store/getters_spec.js index 2449bb65d07..eef95c823fb 100644 --- a/spec/javascripts/diffs/store/getters_spec.js +++ b/spec/javascripts/diffs/store/getters_spec.js @@ -106,13 +106,13 @@ describe('Diffs Module Getters', () => { }); }); - describe('diffHasAllCollpasedDiscussions', () => { + describe('diffHasAllCollapsedDiscussions', () => { it('returns true when all discussions are collapsed', () => { discussionMock.diff_file.file_hash = diffFileMock.fileHash; discussionMock.expanded = false; expect( - getters.diffHasAllCollpasedDiscussions(localState, { + getters.diffHasAllCollapsedDiscussions(localState, { getDiffFileDiscussions: () => [discussionMock], })(diffFileMock), ).toEqual(true); @@ -120,7 +120,7 @@ describe('Diffs Module Getters', () => { it('returns false when there are no discussions', () => { expect( - getters.diffHasAllCollpasedDiscussions(localState, { + getters.diffHasAllCollapsedDiscussions(localState, { getDiffFileDiscussions: () => [], })(diffFileMock), ).toEqual(false); @@ -130,7 +130,7 @@ describe('Diffs Module Getters', () => { discussionMock1.expanded = false; expect( - getters.diffHasAllCollpasedDiscussions(localState, { + getters.diffHasAllCollapsedDiscussions(localState, { getDiffFileDiscussions: () => [discussionMock, discussionMock1], })(diffFileMock), ).toEqual(false); -- cgit v1.2.1 From 513f53a6c0929683899b684b566dcf1fdf0fd7fc Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Thu, 15 Nov 2018 18:23:23 +0200 Subject: Remove unused project method --- app/models/project.rb | 4 ---- changelogs/unreleased/gt-remove-unused-project-method.yml | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changelogs/unreleased/gt-remove-unused-project-method.yml diff --git a/app/models/project.rb b/app/models/project.rb index d87fc1e4b86..ab19190385e 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -1903,10 +1903,6 @@ class Project < ActiveRecord::Base false end - def issue_board_milestone_available?(user = nil) - feature_available?(:issue_board_milestone, user) - end - def full_path_was File.join(namespace.full_path, previous_changes['path'].first) end diff --git a/changelogs/unreleased/gt-remove-unused-project-method.yml b/changelogs/unreleased/gt-remove-unused-project-method.yml new file mode 100644 index 00000000000..2d60c2fe423 --- /dev/null +++ b/changelogs/unreleased/gt-remove-unused-project-method.yml @@ -0,0 +1,5 @@ +--- +title: Remove unused project method +merge_request: 54103 +author: George Tsiolis +type: other -- cgit v1.2.1 From 590ff80f839179c1e178e941cd57946e9bb91b79 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Tue, 13 Nov 2018 17:29:14 +0100 Subject: Refactor how a few ActiveRecord enums are defined In a few models we define ActiveRecord enums that are redefined in EE using the following pattern: enum :some_enum, { ... }.merge(EE_ENUM_VALUES) This particular approach is problematic to deal with, because it requires that we `prepend` and EE module _before_ defining the enum. This typically translates to the `prepend` being the first line in the model in EE, but this can easily lead to merge conflicts when developers add more `include` and/or `prepend` lines. As part of https://gitlab.com/gitlab-org/gitlab-ee/issues/8244 and https://gitlab.com/gitlab-org/gitlab-ee/issues/8241 we are moving `prepend` to the last line in a file, reducing the chances of running into merge conflicts. This poses a bit of a problem with the pattern above, because this pattern does not allow us to move the `prepend` further down a file. To resolve this problem, we simply move the Hash value of the enum to a separate class method. This method is defined in a separate module where necessary, allowing us to use it like so: enum :failure_reasons, ::SomeModelEnums.failure_reasons The method in turn is defined in a very straightforward manner: module SomeModelEnums def self.failure_reasons { ... } end end This makes it easy for EE to add values without requiring the `prepend` to be placed before the `enum` is defined. For more information, see the following issues and merge requests: * https://gitlab.com/gitlab-org/gitlab-ee/issues/8244 * https://gitlab.com/gitlab-org/gitlab-ee/issues/8241 * https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/8424 --- app/models/ci/pipeline.rb | 19 ++++++------------- app/models/ci/pipeline_enums.rb | 28 ++++++++++++++++++++++++++++ app/models/commit_status.rb | 15 +++------------ app/models/commit_status_enums.rb | 20 ++++++++++++++++++++ app/models/user_callout.rb | 8 +++----- app/models/user_callout_enums.rb | 16 ++++++++++++++++ app/presenters/ci/pipeline_presenter.rb | 10 ++++++---- 7 files changed, 82 insertions(+), 34 deletions(-) create mode 100644 app/models/ci/pipeline_enums.rb create mode 100644 app/models/commit_status_enums.rb create mode 100644 app/models/user_callout_enums.rb diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 56010e899a4..9512ba42f67 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -58,15 +58,9 @@ module Ci after_create :keep_around_commits, unless: :importing? - enum_with_nil source: { - unknown: nil, - push: 1, - web: 2, - trigger: 3, - schedule: 4, - api: 5, - external: 6 - } + # We use `Ci::PipelineEnums.sources` here so that EE can more easily extend + # this `Hash` with new values. + enum_with_nil source: ::Ci::PipelineEnums.sources enum_with_nil config_source: { unknown_source: nil, @@ -74,10 +68,9 @@ module Ci auto_devops_source: 2 } - enum failure_reason: { - unknown_failure: 0, - config_error: 1 - } + # We use `Ci::PipelineEnums.failure_reasons` here so that EE can more easily + # extend this `Hash` with new values. + enum failure_reason: ::Ci::PipelineEnums.failure_reasons state_machine :status, initial: :created do event :enqueue do diff --git a/app/models/ci/pipeline_enums.rb b/app/models/ci/pipeline_enums.rb new file mode 100644 index 00000000000..8d8d16e2ec1 --- /dev/null +++ b/app/models/ci/pipeline_enums.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +module Ci + module PipelineEnums + # Returns the `Hash` to use for creating the `failure_reason` enum for + # `Ci::Pipeline`. + def self.failure_reasons + { + unknown_failure: 0, + config_error: 1 + } + end + + # Returns the `Hash` to use for creating the `sources` enum for + # `Ci::Pipeline`. + def self.sources + { + unknown: nil, + push: 1, + web: 2, + trigger: 3, + schedule: 4, + api: 5, + external: 6 + } + end + end +end diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 755f8bd4d06..0f50bd39131 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -42,18 +42,9 @@ class CommitStatus < ActiveRecord::Base scope :retried_ordered, -> { retried.ordered.includes(project: :namespace) } scope :after_stage, -> (index) { where('stage_idx > ?', index) } - enum_with_nil failure_reason: { - unknown_failure: nil, - script_failure: 1, - api_failure: 2, - stuck_or_timeout_failure: 3, - runner_system_failure: 4, - missing_dependency_failure: 5, - runner_unsupported: 6, - stale_schedule: 7, - job_execution_timeout: 8, - archived_failure: 9 - } + # We use `CommitStatusEnums.failure_reasons` here so that EE can more easily + # extend this `Hash` with new values. + enum_with_nil failure_reason: ::CommitStatusEnums.failure_reasons ## # We still create some CommitStatuses outside of CreatePipelineService. diff --git a/app/models/commit_status_enums.rb b/app/models/commit_status_enums.rb new file mode 100644 index 00000000000..152105d9429 --- /dev/null +++ b/app/models/commit_status_enums.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +module CommitStatusEnums + # Returns the Hash to use for creating the `failure_reason` enum for + # `CommitStatus`. + def self.failure_reasons + { + unknown_failure: nil, + script_failure: 1, + api_failure: 2, + stuck_or_timeout_failure: 3, + runner_system_failure: 4, + missing_dependency_failure: 5, + runner_unsupported: 6, + stale_schedule: 7, + job_execution_timeout: 8, + archived_failure: 9 + } + end +end diff --git a/app/models/user_callout.rb b/app/models/user_callout.rb index 1cd05cf3aac..76e7bc06b4e 100644 --- a/app/models/user_callout.rb +++ b/app/models/user_callout.rb @@ -3,11 +3,9 @@ class UserCallout < ActiveRecord::Base belongs_to :user - enum feature_name: { - gke_cluster_integration: 1, - gcp_signup_offer: 2, - cluster_security_warning: 3 - } + # We use `UserCalloutEnums.feature_names` here so that EE can more easily + # extend this `Hash` with new values. + enum feature_name: ::UserCalloutEnums.feature_names validates :user, presence: true validates :feature_name, diff --git a/app/models/user_callout_enums.rb b/app/models/user_callout_enums.rb new file mode 100644 index 00000000000..b9373ae6166 --- /dev/null +++ b/app/models/user_callout_enums.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +module UserCalloutEnums + # Returns the `Hash` to use for the `feature_name` enum in the `UserCallout` + # model. + # + # This method is separate from the `UserCallout` model so that it can be + # extended by EE. + def self.feature_names + { + gke_cluster_integration: 1, + gcp_signup_offer: 2, + cluster_security_warning: 3 + } + end +end diff --git a/app/presenters/ci/pipeline_presenter.rb b/app/presenters/ci/pipeline_presenter.rb index 93a38f92073..57daf04efc6 100644 --- a/app/presenters/ci/pipeline_presenter.rb +++ b/app/presenters/ci/pipeline_presenter.rb @@ -4,9 +4,11 @@ module Ci class PipelinePresenter < Gitlab::View::Presenter::Delegated include Gitlab::Utils::StrongMemoize - FAILURE_REASONS = { - config_error: 'CI/CD YAML configuration error!' - }.freeze + # We use a class method here instead of a constant, allowing EE to redefine + # the returned `Hash` more easily. + def self.failure_reasons + { config_error: 'CI/CD YAML configuration error!' } + end presents :pipeline @@ -21,7 +23,7 @@ module Ci def failure_reason return unless pipeline.failure_reason? - FAILURE_REASONS[pipeline.failure_reason.to_sym] || + self.class.failure_reasons[pipeline.failure_reason.to_sym] || pipeline.failure_reason end -- cgit v1.2.1 From 9ca6cd895b8add2cc2b171182114e27e2afb5f30 Mon Sep 17 00:00:00 2001 From: James Ramsay Date: Fri, 9 Nov 2018 14:31:43 +0000 Subject: Fix object storage tier information --- doc/administration/uploads.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/administration/uploads.md b/doc/administration/uploads.md index aec9a359ada..f85a1f791f9 100644 --- a/doc/administration/uploads.md +++ b/doc/administration/uploads.md @@ -48,11 +48,12 @@ _The uploads are stored by default in 1. Save the file and [restart GitLab][] for the changes to take effect. -### Using object storage +### Using object storage **[CORE ONLY]** > **Notes:** > -> - [Introduced][ee-3867] in [GitLab Enterprise Edition Premium][eep] 10.5. +> - [Introduced][ee-3867] in [GitLab Premium][eep] 10.5. +> - [Introduced][ce17358] in [GitLab Core][ce] 10.7. > - Since version 11.1, we support direct_upload to S3. If you don't want to use the local disk where GitLab is installed to store the @@ -197,4 +198,6 @@ _The uploads are stored by default in [reconfigure gitlab]: restart_gitlab.md#omnibus-gitlab-reconfigure "How to reconfigure Omnibus GitLab" [restart gitlab]: restart_gitlab.md#installations-from-source "How to restart GitLab" [eep]: https://about.gitlab.com/gitlab-ee/ "GitLab Enterprise Edition Premium" +[ce]: https://about.gitlab.com/gitlab-ce/ "GitLab Community Edition" [ee-3867]: https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/3867 +[ce-17358]: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/17358 -- cgit v1.2.1 From 9bea3c0fbb6c16adcdccf7044583415bda8234c1 Mon Sep 17 00:00:00 2001 From: Kirill Zaitsev Date: Thu, 15 Nov 2018 21:42:10 +0200 Subject: Add glob for CI changes detection --- .../unreleased/added-glob-for-ci-changes-detection.yml | 5 +++++ doc/ci/yaml/README.md | 2 ++ lib/gitlab/ci/build/policy/changes.rb | 2 +- spec/lib/gitlab/ci/build/policy/changes_spec.rb | 12 ++++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/added-glob-for-ci-changes-detection.yml diff --git a/changelogs/unreleased/added-glob-for-ci-changes-detection.yml b/changelogs/unreleased/added-glob-for-ci-changes-detection.yml new file mode 100644 index 00000000000..887c6ef0346 --- /dev/null +++ b/changelogs/unreleased/added-glob-for-ci-changes-detection.yml @@ -0,0 +1,5 @@ +--- +title: Added glob for CI changes detection +merge_request: 23128 +author: Kirill Zaitsev +type: added diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index aab5f268ef9..2a667c985da 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -476,6 +476,7 @@ docker build: - Dockerfile - docker/scripts/* - dockerfiles/**/* + - more_scripts/*.{rb,py,sh} ``` In the scenario above, if you are pushing multiple commits to GitLab to an @@ -485,6 +486,7 @@ one of the commits contains changes to either: - The `Dockerfile` file. - Any of the files inside `docker/scripts/` directory. - Any of the files and subfolders inside `dockerfiles` directory. +- Any of the files with `rb`, `py`, `sh` extensions inside `more_scripts` directory. CAUTION: **Warning:** There are some caveats when using this feature with new branches and tags. See diff --git a/lib/gitlab/ci/build/policy/changes.rb b/lib/gitlab/ci/build/policy/changes.rb index 7bf51519752..1663c875426 100644 --- a/lib/gitlab/ci/build/policy/changes.rb +++ b/lib/gitlab/ci/build/policy/changes.rb @@ -14,7 +14,7 @@ module Gitlab pipeline.modified_paths.any? do |path| @globs.any? do |glob| - File.fnmatch?(glob, path, File::FNM_PATHNAME | File::FNM_DOTMATCH) + File.fnmatch?(glob, path, File::FNM_PATHNAME | File::FNM_DOTMATCH | File::FNM_EXTGLOB) end end end diff --git a/spec/lib/gitlab/ci/build/policy/changes_spec.rb b/spec/lib/gitlab/ci/build/policy/changes_spec.rb index ab401108c84..523d00c1272 100644 --- a/spec/lib/gitlab/ci/build/policy/changes_spec.rb +++ b/spec/lib/gitlab/ci/build/policy/changes_spec.rb @@ -49,6 +49,12 @@ describe Gitlab::Ci::Build::Policy::Changes do expect(policy).to be_satisfied_by(pipeline, seed) end + it 'is satisfied by matching a pattern with a glob' do + policy = described_class.new(%w[some/**/*.{rb,txt}]) + + expect(policy).to be_satisfied_by(pipeline, seed) + end + it 'is not satisfied when pattern does not match path' do policy = described_class.new(%w[some/*.rb]) @@ -61,6 +67,12 @@ describe Gitlab::Ci::Build::Policy::Changes do expect(policy).not_to be_satisfied_by(pipeline, seed) end + it 'is not satified when pattern with glob does not match' do + policy = described_class.new(%w[invalid/*.{md,rake}]) + + expect(policy).not_to be_satisfied_by(pipeline, seed) + end + context 'when pipelines does not run for a branch update' do before do pipeline.before_sha = Gitlab::Git::BLANK_SHA -- cgit v1.2.1 From 75815769b0b606f3d0c096009d14b864a5b876b0 Mon Sep 17 00:00:00 2001 From: jumpyoshim Date: Fri, 16 Nov 2018 06:29:53 +0900 Subject: Fix typo pipline to pipeline --- app/assets/javascripts/ide/stores/modules/pipelines/actions.js | 2 +- locale/ar_SA/gitlab.po | 2 +- locale/bg/gitlab.po | 2 +- locale/ca_ES/gitlab.po | 2 +- locale/cs_CZ/gitlab.po | 2 +- locale/da_DK/gitlab.po | 2 +- locale/de/gitlab.po | 2 +- locale/eo/gitlab.po | 2 +- locale/es/gitlab.po | 2 +- locale/et_EE/gitlab.po | 2 +- locale/fil_PH/gitlab.po | 2 +- locale/fr/gitlab.po | 2 +- locale/gitlab.pot | 2 +- locale/gl_ES/gitlab.po | 2 +- locale/he_IL/gitlab.po | 2 +- locale/id_ID/gitlab.po | 2 +- locale/it/gitlab.po | 2 +- locale/ja/gitlab.po | 2 +- locale/ko/gitlab.po | 2 +- locale/mn_MN/gitlab.po | 2 +- locale/nb_NO/gitlab.po | 2 +- locale/nl_NL/gitlab.po | 2 +- locale/pl_PL/gitlab.po | 2 +- locale/pt_BR/gitlab.po | 2 +- locale/ro_RO/gitlab.po | 2 +- locale/ru/gitlab.po | 2 +- locale/sq_AL/gitlab.po | 2 +- locale/tr_TR/gitlab.po | 2 +- locale/uk/gitlab.po | 2 +- locale/zh_CN/gitlab.po | 2 +- locale/zh_HK/gitlab.po | 2 +- locale/zh_TW/gitlab.po | 2 +- spec/finders/pipelines_finder_spec.rb | 2 +- spec/javascripts/ide/stores/modules/pipelines/actions_spec.js | 2 +- 34 files changed, 34 insertions(+), 34 deletions(-) diff --git a/app/assets/javascripts/ide/stores/modules/pipelines/actions.js b/app/assets/javascripts/ide/stores/modules/pipelines/actions.js index 8fa86995ef0..ea2525a2f0e 100644 --- a/app/assets/javascripts/ide/stores/modules/pipelines/actions.js +++ b/app/assets/javascripts/ide/stores/modules/pipelines/actions.js @@ -28,7 +28,7 @@ export const receiveLatestPipelineError = ({ commit, dispatch }, err) => { dispatch( 'setErrorMessage', { - text: __('An error occured whilst fetching the latest pipline.'), + text: __('An error occured whilst fetching the latest pipeline.'), action: () => dispatch('forcePipelineRequest').then(() => dispatch('setErrorMessage', null, { root: true }), diff --git a/locale/ar_SA/gitlab.po b/locale/ar_SA/gitlab.po index 903d72d9ea8..a0c555ccc7a 100644 --- a/locale/ar_SA/gitlab.po +++ b/locale/ar_SA/gitlab.po @@ -681,7 +681,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/bg/gitlab.po b/locale/bg/gitlab.po index e3a5e191023..b8a73e18820 100644 --- a/locale/bg/gitlab.po +++ b/locale/bg/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/ca_ES/gitlab.po b/locale/ca_ES/gitlab.po index 91d5fb17000..05efe907e71 100644 --- a/locale/ca_ES/gitlab.po +++ b/locale/ca_ES/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/cs_CZ/gitlab.po b/locale/cs_CZ/gitlab.po index 867b9b27ad2..4f576429d6e 100644 --- a/locale/cs_CZ/gitlab.po +++ b/locale/cs_CZ/gitlab.po @@ -621,7 +621,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/da_DK/gitlab.po b/locale/da_DK/gitlab.po index f8412f28cbe..aa230b080d2 100644 --- a/locale/da_DK/gitlab.po +++ b/locale/da_DK/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/de/gitlab.po b/locale/de/gitlab.po index 5f9fbc1cc39..77feb26c5b5 100644 --- a/locale/de/gitlab.po +++ b/locale/de/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/eo/gitlab.po b/locale/eo/gitlab.po index 15d537ff3b4..5fec5d622a6 100644 --- a/locale/eo/gitlab.po +++ b/locale/eo/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/es/gitlab.po b/locale/es/gitlab.po index 0d8ee05b364..d8e8f9192aa 100644 --- a/locale/es/gitlab.po +++ b/locale/es/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/et_EE/gitlab.po b/locale/et_EE/gitlab.po index 1f699a8e06d..e081fd5d231 100644 --- a/locale/et_EE/gitlab.po +++ b/locale/et_EE/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/fil_PH/gitlab.po b/locale/fil_PH/gitlab.po index c9b371f8df3..928b70180ab 100644 --- a/locale/fil_PH/gitlab.po +++ b/locale/fil_PH/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/fr/gitlab.po b/locale/fr/gitlab.po index 1925235d48a..6b3cee0d189 100644 --- a/locale/fr/gitlab.po +++ b/locale/fr/gitlab.po @@ -561,7 +561,7 @@ msgstr "Une erreur est survenue lors de la création de la nouvelle branche." msgid "An error occured whilst fetching the job trace." msgstr "Une erreur est survenue pendant le rapatriement de la trace de la tâche." -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "Une erreur est survenue lors du rapatriement de dernier pipeline." msgid "An error occured whilst loading all the files." diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d3e1a51370e..f18821adb5f 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -501,7 +501,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/gl_ES/gitlab.po b/locale/gl_ES/gitlab.po index 44c47901b56..ea8072915ad 100644 --- a/locale/gl_ES/gitlab.po +++ b/locale/gl_ES/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/he_IL/gitlab.po b/locale/he_IL/gitlab.po index 7cff1c5d712..7bba6bc8b67 100644 --- a/locale/he_IL/gitlab.po +++ b/locale/he_IL/gitlab.po @@ -621,7 +621,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/id_ID/gitlab.po b/locale/id_ID/gitlab.po index 2f3c35e4253..3cafee803c0 100644 --- a/locale/id_ID/gitlab.po +++ b/locale/id_ID/gitlab.po @@ -531,7 +531,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/it/gitlab.po b/locale/it/gitlab.po index 984a200c958..49999ed9e4f 100644 --- a/locale/it/gitlab.po +++ b/locale/it/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/ja/gitlab.po b/locale/ja/gitlab.po index ac940230ac2..eefb08975f1 100644 --- a/locale/ja/gitlab.po +++ b/locale/ja/gitlab.po @@ -531,7 +531,7 @@ msgstr "新しいブランチの作成中にエラーが発生しました。" msgid "An error occured whilst fetching the job trace." msgstr "ジョブトレースの取得中にエラーが発生しました。" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "最新のパイプラインの取得中にエラーが発生しました。" msgid "An error occured whilst loading all the files." diff --git a/locale/ko/gitlab.po b/locale/ko/gitlab.po index a50f5bfacef..543596b0a73 100644 --- a/locale/ko/gitlab.po +++ b/locale/ko/gitlab.po @@ -531,7 +531,7 @@ msgstr "새 브랜치를 만드는 동안 오류가 발생했습니다." msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/mn_MN/gitlab.po b/locale/mn_MN/gitlab.po index c256a2d2b1f..248d725684e 100644 --- a/locale/mn_MN/gitlab.po +++ b/locale/mn_MN/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/nb_NO/gitlab.po b/locale/nb_NO/gitlab.po index 9be8a4e8d0b..4f433c04553 100644 --- a/locale/nb_NO/gitlab.po +++ b/locale/nb_NO/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/nl_NL/gitlab.po b/locale/nl_NL/gitlab.po index 2ad2eaafc33..93468fa6a34 100644 --- a/locale/nl_NL/gitlab.po +++ b/locale/nl_NL/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/pl_PL/gitlab.po b/locale/pl_PL/gitlab.po index a4bd1fe747b..bde5d9f1dbb 100644 --- a/locale/pl_PL/gitlab.po +++ b/locale/pl_PL/gitlab.po @@ -621,7 +621,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/pt_BR/gitlab.po b/locale/pt_BR/gitlab.po index 79e365319c9..a0c6bfbb926 100644 --- a/locale/pt_BR/gitlab.po +++ b/locale/pt_BR/gitlab.po @@ -561,7 +561,7 @@ msgstr "Um erro ocorreu ao criar o novo branch." msgid "An error occured whilst fetching the job trace." msgstr "Ocorreu um erro ao carregar o rastro da tarefa." -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "Ocorreu um erro ao carregar o último pipeline." msgid "An error occured whilst loading all the files." diff --git a/locale/ro_RO/gitlab.po b/locale/ro_RO/gitlab.po index 49613a3f462..933dd2827c2 100644 --- a/locale/ro_RO/gitlab.po +++ b/locale/ro_RO/gitlab.po @@ -591,7 +591,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/ru/gitlab.po b/locale/ru/gitlab.po index b8a4805498b..d6ed79c9d7e 100644 --- a/locale/ru/gitlab.po +++ b/locale/ru/gitlab.po @@ -621,7 +621,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/sq_AL/gitlab.po b/locale/sq_AL/gitlab.po index 633b2a6bda7..b61876e993d 100644 --- a/locale/sq_AL/gitlab.po +++ b/locale/sq_AL/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/tr_TR/gitlab.po b/locale/tr_TR/gitlab.po index 723f4876053..27d628ba55d 100644 --- a/locale/tr_TR/gitlab.po +++ b/locale/tr_TR/gitlab.po @@ -561,7 +561,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/uk/gitlab.po b/locale/uk/gitlab.po index 99ba26152ee..8f5577c0abf 100644 --- a/locale/uk/gitlab.po +++ b/locale/uk/gitlab.po @@ -621,7 +621,7 @@ msgstr "Помилка при створенні нової гілки." msgid "An error occured whilst fetching the job trace." msgstr "Трапилася помилка при отриманні логу завдання." -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "Трапилася помилка при отриманні даних останнього конвеєра." msgid "An error occured whilst loading all the files." diff --git a/locale/zh_CN/gitlab.po b/locale/zh_CN/gitlab.po index 2d3aeca7cc7..abf66ca2866 100644 --- a/locale/zh_CN/gitlab.po +++ b/locale/zh_CN/gitlab.po @@ -531,7 +531,7 @@ msgstr "创建分支时发生错误。" msgid "An error occured whilst fetching the job trace." msgstr "获取作业日志时发生错误。" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "获取流水线时发生错误。" msgid "An error occured whilst loading all the files." diff --git a/locale/zh_HK/gitlab.po b/locale/zh_HK/gitlab.po index d8fe2d5b13e..bb634e325d8 100644 --- a/locale/zh_HK/gitlab.po +++ b/locale/zh_HK/gitlab.po @@ -531,7 +531,7 @@ msgstr "" msgid "An error occured whilst fetching the job trace." msgstr "" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "" msgid "An error occured whilst loading all the files." diff --git a/locale/zh_TW/gitlab.po b/locale/zh_TW/gitlab.po index 1bccf6de738..4e7117bf993 100644 --- a/locale/zh_TW/gitlab.po +++ b/locale/zh_TW/gitlab.po @@ -531,7 +531,7 @@ msgstr "創建新分支時發生錯誤。" msgid "An error occured whilst fetching the job trace." msgstr "取得工作追蹤資訊時發生錯誤" -msgid "An error occured whilst fetching the latest pipline." +msgid "An error occured whilst fetching the latest pipeline." msgstr "取得最新流水線時發生錯誤" msgid "An error occured whilst loading all the files." diff --git a/spec/finders/pipelines_finder_spec.rb b/spec/finders/pipelines_finder_spec.rb index c6e832ad69b..c2c304589c9 100644 --- a/spec/finders/pipelines_finder_spec.rb +++ b/spec/finders/pipelines_finder_spec.rb @@ -225,7 +225,7 @@ describe PipelinesFinder do end end - context 'when the project has limited access to piplines' do + context 'when the project has limited access to pipelines' do let(:project) { create(:project, :private, :repository) } let(:current_user) { create(:user) } let!(:pipelines) { create_list(:ci_pipeline, 2, project: project) } diff --git a/spec/javascripts/ide/stores/modules/pipelines/actions_spec.js b/spec/javascripts/ide/stores/modules/pipelines/actions_spec.js index d85354c3681..c9c09ee9afe 100644 --- a/spec/javascripts/ide/stores/modules/pipelines/actions_spec.js +++ b/spec/javascripts/ide/stores/modules/pipelines/actions_spec.js @@ -77,7 +77,7 @@ describe('IDE pipelines actions', () => { { type: 'setErrorMessage', payload: { - text: 'An error occured whilst fetching the latest pipline.', + text: 'An error occured whilst fetching the latest pipeline.', action: jasmine.any(Function), actionText: 'Please try again', actionPayload: null, -- cgit v1.2.1 From a784107f7e00130ea0ba7f1973db4f948a708ace Mon Sep 17 00:00:00 2001 From: Florent Monbillard Date: Fri, 16 Nov 2018 03:12:26 +0000 Subject: Fix typo (install_depedencies => install_dependencies) --- doc/ci/yaml/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md index aab5f268ef9..a19833ac0f2 100644 --- a/doc/ci/yaml/README.md +++ b/doc/ci/yaml/README.md @@ -1767,7 +1767,7 @@ stages: production: script: - - install_depedencies + - install_dependencies - deploy - notify_owner ``` -- cgit v1.2.1 From 94b9ec52a18d6448ecb21f2e21c2e71e75a0e363 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 16 Nov 2018 03:38:59 +0000 Subject: Replace deploy-stage.png with smaller and cropped --- .../clusters/serverless/img/deploy-stage.png | Bin 34472 -> 12029 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/user/project/clusters/serverless/img/deploy-stage.png b/doc/user/project/clusters/serverless/img/deploy-stage.png index eed5f948ba0..dc2f8af9c63 100644 Binary files a/doc/user/project/clusters/serverless/img/deploy-stage.png and b/doc/user/project/clusters/serverless/img/deploy-stage.png differ -- cgit v1.2.1 From 25a1209b888b628a4844ae8ff7a85139bdba37d1 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 16 Nov 2018 03:45:06 +0000 Subject: minor edits --- doc/user/project/clusters/index.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index ebbabf4e997..5605f57737e 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -49,8 +49,8 @@ new Kubernetes cluster to your project: NOTE: **Note:** You need Maintainer [permissions] and above to access the Kubernetes page. -1. Click on **Add Kubernetes cluster**. -1. Click on **Create with Google Kubernetes Engine**. +1. Click **Add Kubernetes cluster**. +1. Click **Create with Google Kubernetes Engine**. 1. Connect your Google account if you haven't done already by clicking the **Sign in with Google** button. 1. From there on, choose your cluster's settings: @@ -78,8 +78,8 @@ To add an existing Kubernetes cluster to your project: NOTE: **Note:** You need Maintainer [permissions] and above to access the Kubernetes page. -1. Click on **Add Kubernetes cluster**. -1. Click on **Add an existing Kubernetes cluster** and fill in the details: +1. Click **Add Kubernetes cluster**. +1. Click **Add an existing Kubernetes cluster** and fill in the details: - **Kubernetes cluster name** (required) - The name you wish to give the cluster. - **Environment scope** (required)- The [associated environment](#setting-the-environment-scope) to this cluster. @@ -254,10 +254,10 @@ your ingress application in which case you should manually determine it. ### Manually determining the IP address -If the cluster is on GKE, click on the **Google Kubernetes Engine** link in the +If the cluster is on GKE, click the **Google Kubernetes Engine** link in the **Advanced settings**, or go directly to the [Google Kubernetes Engine dashboard](https://console.cloud.google.com/kubernetes/) -and select the proper project and cluster. Then click on **Connect** and execute +and select the proper project and cluster. Then click **Connect** and execute the `gcloud` command in a local terminal or using the **Cloud Shell**. If the cluster is not on GKE, follow the specific instructions for your @@ -301,7 +301,7 @@ your apps will not be able to be reached, and you'd have to change the DNS record again. In order to avoid that, you should change it into a static reserved IP. -[Read how to promote an ephemeral external IP address in GKE.](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address#promote_ephemeral_ip) +Read how to [promote an ephemeral external IP address in GKE](https://cloud.google.com/compute/docs/ip-addresses/reserve-static-external-ip-address#promote_ephemeral_ip). ### Pointing your DNS at the cluster IP @@ -407,7 +407,7 @@ service account of the cluster integration. After you have successfully added your cluster information, you can enable the Kubernetes cluster integration: -1. Click the "Enabled/Disabled" switch +1. Click the **Enabled/Disabled** switch 1. Hit **Save** for the changes to take effect You can now start using your Kubernetes cluster for your deployments. @@ -424,7 +424,7 @@ When you remove a cluster, you only remove its relation to GitLab, not the cluster itself. To remove the cluster, you can do so by visiting the GKE dashboard or using `kubectl`. -To remove the Kubernetes cluster integration from your project, simply click on the +To remove the Kubernetes cluster integration from your project, simply click the **Remove integration** button. You will then be able to follow the procedure and add a Kubernetes cluster again. @@ -489,7 +489,7 @@ the deployment variables above, ensuring any pods you create are labelled with ### Integrating Amazon EKS cluster with GitLab -- Learn how to [connect and deploy to an Amazon EKS cluster.](eks_and_gitlab/index.md) +- Learn how to [connect and deploy to an Amazon EKS cluster](eks_and_gitlab/index.md). ### Serverless -- cgit v1.2.1 From d3fede240fb1877735a6346b67fa5acd8795e397 Mon Sep 17 00:00:00 2001 From: Mike Lewis Date: Fri, 16 Nov 2018 03:55:12 +0000 Subject: minor edits --- doc/user/project/clusters/serverless/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index 046564d6015..bdbc4f7f09d 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -100,12 +100,12 @@ You may download the sample [Knative Ruby App](https://gitlab.com/knative-exampl ## Deploy the application with Knative With all the pieces in place, you can simply create a new CI pipeline to deploy the Knative application. Navigate to -**CI/CD >> Pipelines** and click on the "**Run Pipeline"** button on the upper right hand side of the screen. On the -Pipelines page now click "**Create pipeline**". +**CI/CD >> Pipelines** and click the **Run Pipeline** button at the upper-right part of the screen. Then, on the +Pipelines page, click **Create pipeline**. ## Obtain the URL for the Knative deployment -Once all the stages of the pipeline finish, click on the "deploy" stage +Once all the stages of the pipeline finish, click the **deploy** stage. ![deploy stage](img/deploy-stage.png) @@ -131,7 +131,7 @@ Service domain: knative.knative-4342902.knative.info Job succeeded ``` -The second to last line, labeled "**Service domain**" contains the URL for the deployment. Copy and paste the domain into your +The second to last line, labeled **Service domain** contains the URL for the deployment. Copy and paste the domain into your browser to see the app live. ![knative app](img/knative-app.png) \ No newline at end of file -- cgit v1.2.1 From 198f2a0b6149a2e7c069ad3aaad6ced9f5bb3ea1 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Thu, 15 Nov 2018 22:49:48 -0800 Subject: Use Nokogiri as the ActiveSupport XML backend This significantly improves performance and reduces memory consumption when parsing XML files. On a test with 124 JUnit files from a CE build, there was about a 4x reduction in processing time. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54068 --- changelogs/unreleased/sh-use-nokogiri-xml-backend.yml | 5 +++++ config/application.rb | 3 +++ lib/gitlab/ci/parsers/test/junit.rb | 2 +- spec/fast_spec_helper.rb | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelogs/unreleased/sh-use-nokogiri-xml-backend.yml diff --git a/changelogs/unreleased/sh-use-nokogiri-xml-backend.yml b/changelogs/unreleased/sh-use-nokogiri-xml-backend.yml new file mode 100644 index 00000000000..6a82e32c416 --- /dev/null +++ b/changelogs/unreleased/sh-use-nokogiri-xml-backend.yml @@ -0,0 +1,5 @@ +--- +title: Use Nokogiri as the ActiveSupport XML backend +merge_request: 23136 +author: +type: performance diff --git a/config/application.rb b/config/application.rb index 1b084e91cfb..921baa5d617 100644 --- a/config/application.rb +++ b/config/application.rb @@ -158,6 +158,9 @@ module Gitlab config.action_view.sanitized_allowed_protocols = %w(smb) + # Nokogiri is significantly faster and uses less memory than REXML + ActiveSupport::XmlMini.backend = 'Nokogiri' + # This middleware needs to precede ActiveRecord::QueryCache and other middlewares that # connect to the database. config.middleware.insert_after Rails::Rack::Logger, ::Gitlab::Middleware::BasicHealthCheck diff --git a/lib/gitlab/ci/parsers/test/junit.rb b/lib/gitlab/ci/parsers/test/junit.rb index ed5a79d9b9b..2791730fd26 100644 --- a/lib/gitlab/ci/parsers/test/junit.rb +++ b/lib/gitlab/ci/parsers/test/junit.rb @@ -14,7 +14,7 @@ module Gitlab test_case = create_test_case(test_case) test_suite.add_test_case(test_case) end - rescue REXML::ParseException + rescue Nokogiri::XML::SyntaxError raise JunitParserError, "XML parsing failed" rescue raise JunitParserError, "JUnit parsing failed" diff --git a/spec/fast_spec_helper.rb b/spec/fast_spec_helper.rb index fe475e1f7a0..0b5ab16ad71 100644 --- a/spec/fast_spec_helper.rb +++ b/spec/fast_spec_helper.rb @@ -9,3 +9,4 @@ require 'active_support/all' ActiveSupport::Dependencies.autoload_paths << 'lib' ActiveSupport::Dependencies.autoload_paths << 'ee/lib' +ActiveSupport::XmlMini.backend = 'Nokogiri' -- cgit v1.2.1 From 032a4c230669b7e15d464d99f99ea4ced3de488b Mon Sep 17 00:00:00 2001 From: Daniel Gruesso Date: Fri, 16 Nov 2018 09:08:52 +0000 Subject: Docs eks update --- .../clusters/eks_and_gitlab/img/new_project.png | Bin 7813 -> 0 bytes .../project/clusters/eks_and_gitlab/img/rbac.png | Bin 49712 -> 15960 bytes doc/user/project/clusters/eks_and_gitlab/index.md | 271 +++++++++++++-------- 3 files changed, 170 insertions(+), 101 deletions(-) delete mode 100644 doc/user/project/clusters/eks_and_gitlab/img/new_project.png diff --git a/doc/user/project/clusters/eks_and_gitlab/img/new_project.png b/doc/user/project/clusters/eks_and_gitlab/img/new_project.png deleted file mode 100644 index 02afc099f10..00000000000 Binary files a/doc/user/project/clusters/eks_and_gitlab/img/new_project.png and /dev/null differ diff --git a/doc/user/project/clusters/eks_and_gitlab/img/rbac.png b/doc/user/project/clusters/eks_and_gitlab/img/rbac.png index c8adaad13c2..517e4f7ca44 100644 Binary files a/doc/user/project/clusters/eks_and_gitlab/img/rbac.png and b/doc/user/project/clusters/eks_and_gitlab/img/rbac.png differ diff --git a/doc/user/project/clusters/eks_and_gitlab/index.md b/doc/user/project/clusters/eks_and_gitlab/index.md index 45d77e075f1..fa2ed21f980 100644 --- a/doc/user/project/clusters/eks_and_gitlab/index.md +++ b/doc/user/project/clusters/eks_and_gitlab/index.md @@ -1,123 +1,139 @@ # Connecting and deploying to an Amazon EKS cluster -## Introduction +In this tutorial, we will show how to integrate an +[Amazon EKS](https://aws.amazon.com/eks/) cluster with GitLab and begin +deploying applications. -In this tutorial, we will show how to integrate an [Amazon EKS](https://aws.amazon.com/eks/) cluster with GitLab, and begin deploying applications. +## Introduction For an end-to-end walkthrough we will: -1. Start with a new project based on the sample Ruby on Rails template -1. Integrate an EKS cluster -1. Utilize [Auto DevOps](../../../../topics/autodevops/) to build, test, and deploy our application +1. Start with a new project based on the sample Ruby on Rails template. +1. Integrate an EKS cluster. +1. Utilize [Auto DevOps](../../../../topics/autodevops/) to build, test, and deploy our application. You will need: -1. An account on GitLab, like [GitLab.com](https://gitlab.com) -1. An Amazon EKS cluster (with worker nodes properly configured) -1. `kubectl` [installed and configured for access to the EKS cluster](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#get-started-kubectl) +1. An account on GitLab, like [GitLab.com](https://gitlab.com). +1. An Amazon EKS cluster (with worker nodes properly configured). +1. `kubectl` [installed and configured for access to the EKS cluster](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html#get-started-kubectl). -If you don't have an Amazon EKS cluster, one can be created by following [the EKS getting started guide](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html). +If you don't have an Amazon EKS cluster, one can be created by following the +[EKS getting started guide](https://docs.aws.amazon.com/eks/latest/userguide/getting-started.html). ## Creating a new project -On GitLab, create a new project by clicking on the `+` icon in the top navigation bar, and selecting `New project`. - -![New Project](img/new_project.png) +On GitLab, create a new project by clicking on the `+` icon in the top navigation +bar and selecting **New project**. -On the new project screen, click on the `Create from template` tab, and select `Use template` for the Ruby on Rails sample project. +On the new project screen, click on the **Create from template** tab, and select +"Use template" for the Ruby on Rails sample project. -Give the project a name, and then select `Create project`. +Give the project a name, and then select **Create project**. ![Create Project](img/create_project.png) ## Configuring and connecting the EKS cluster -From the left side bar, hover over `Operations` and select `Kubernetes`, then click on `Add Kubernetes cluster`, and finally `Add an existing Kubernetes cluster`. +From the left side bar, hover over **Operations > Kubernetes > Add Kubernetes cluster**, +then click **Add an existing Kubernetes cluster**. -A few details from the EKS cluster will be required to connect it to GitLab. +A few details from the EKS cluster will be required to connect it to GitLab: -1. **Retrieve the certificate**: A valid Kubernetes certificate is needed to authenticate to the EKS cluster. We will use the certificate created by default. Open a shell and use `kubectl` to retrieve it: - - List the secrets with `kubectl get secrets`, and one should named similar to `default-token-xxxxx`. Copy that token name for use below. - - Get the certificate with `kubectl get secret -o jsonpath="{['data']['ca\.crt']}" | base64 -D` +1. **Retrieve the certificate**: A valid Kubernetes certificate is needed to + authenticate to the EKS cluster. We will use the certificate created by default. + Open a shell and use `kubectl` to retrieve it: -1. **Create admin token**: A `cluster-admin` token is required to install and manage Helm Tiller. GitLab establishes mutual SSL auth with Helm Tiller and creates limited service accounts for each application. To create the token we will create an admin service account as follows: + - List the secrets with `kubectl get secrets`, and one should named similar to + `default-token-xxxxx`. Copy that token name for use below. + - Get the certificate with: - 1. Create a file called `eks-admin-service-account.yaml` with the text below: + ```sh + kubectl get secret -o jsonpath="{['data']['ca\.crt']}" | base64 -D + ``` - ```yaml - apiVersion: v1 - kind: ServiceAccount - metadata: - name: eks-admin - namespace: kube-system - ``` +1. **Create admin token**: A `cluster-admin` token is required to install and + manage Helm Tiller. GitLab establishes mutual SSL auth with Helm Tiller + and creates limited service accounts for each application. To create the + token we will create an admin service account as follows: - 2. Apply the service account to your cluster: + 2.1. Create a file called `eks-admin-service-account.yaml` with contents: - ```bash - kubectl apply -f eks-admin-service-account.yaml - ``` + ```yaml + apiVersion: v1 + kind: ServiceAccount + metadata: + name: eks-admin + namespace: kube-system + ``` - Output: + 2.2. Apply the service account to your cluster: - ```bash - serviceaccount "eks-admin" created - ``` + ```bash + kubectl apply -f eks-admin-service-account.yaml + ``` - 3. Create a file called `eks-admin-cluster-role-binding.yaml` with the text below: + Output: - ```yaml - apiVersion: rbac.authorization.k8s.io/v1beta1 - kind: ClusterRoleBinding - metadata: - name: eks-admin - roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin - subjects: - - kind: ServiceAccount - name: eks-admin - namespace: kube-system - ``` + ```bash + serviceaccount "eks-admin" created + ``` - 4. Apply the cluster role binding to your cluster: + 2.3. Create a file called `eks-admin-cluster-role-binding.yaml` with contents: - ```bash - kubectl apply -f eks-admin-cluster-role-binding.yaml - ``` + ```yaml + apiVersion: rbac.authorization.k8s.io/v1beta1 + kind: ClusterRoleBinding + metadata: + name: eks-admin + roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: cluster-admin + subjects: + - kind: ServiceAccount + name: eks-admin + namespace: kube-system + ``` - Output: + 2.4. Apply the cluster role binding to your cluster: - ```bash - clusterrolebinding "eks-admin" created - ``` + ```bash + kubectl apply -f eks-admin-cluster-role-binding.yaml + ``` - 5. Retrieve the token for the `eks-admin` service account. Copy the `` value from the output. + Output: - ```bash - kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}') - ``` + ```bash + clusterrolebinding "eks-admin" created + ``` - Output: - - ```yaml - Name: eks-admin-token-b5zv4 - Namespace: kube-system - Labels: - Annotations: kubernetes.io/service-account.name=eks-admin - kubernetes.io/service-account.uid=bcfe66ac-39be-11e8-97e8-026dce96b6e8 + 2.5. Retrieve the token for the `eks-admin` service account: - Type: kubernetes.io/service-account-token + ```bash + kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}') + ``` - Data - ==== - ca.crt: 1025 bytes - namespace: 11 bytes - token: - ``` + Copy the `` value from the output: + + ```yaml + Name: eks-admin-token-b5zv4 + Namespace: kube-system + Labels: + Annotations: kubernetes.io/service-account.name=eks-admin + kubernetes.io/service-account.uid=bcfe66ac-39be-11e8-97e8-026dce96b6e8 -1. The API server endpoint is also required, so GitLab can connect to the cluster. This is displayed on the AWS EKS console, when viewing the EKS cluster details. + Type: kubernetes.io/service-account-token + + Data + ==== + ca.crt: 1025 bytes + namespace: 11 bytes + token: + ``` + +1. The API server endpoint is also required, so GitLab can connect to the cluster. + This is displayed on the AWS EKS console, when viewing the EKS cluster details. You now have all the information needed to connect the EKS cluster: @@ -130,17 +146,26 @@ You now have all the information needed to connect the EKS cluster: ![Add Cluster](img/add_cluster.png) -Click on `Add Kubernetes cluster`, the cluster is now connected to GitLab. At this point, [Kubernetes deployment variables](../#deployment-variables) will automatically be available during CI jobs, making it easy to interact with the cluster. +Click on **Add Kubernetes cluster**, the cluster is now connected to GitLab. +At this point, [Kubernetes deployment variables](../#deployment-variables) will +automatically be available during CI/CD jobs, making it easy to interact with the cluster. If you would like to utilize your own CI/CD scripts to deploy to the cluster, you can stop here. -## Disable Role-Based Access Control (RBAC) - Optional +## Disable Role-Based Access Control (RBAC) (optional) -When connecting a cluster via GitLab integration, you may specify whether the cluster is RBAC-enabled or not. This will affect how GitLab interacts with the cluster for certain operations. If you **did not** check the "RBAC-enabled cluster" checkbox at creation time, GitLab will assume RBAC is disabled for your cluster when interacting with it. If so, you must disable RBAC on your cluster for the integration to work properly. +When connecting a cluster via GitLab integration, you may specify whether the +cluster is RBAC-enabled or not. This will affect how GitLab interacts with the +cluster for certain operations. If you **did not** check the "RBAC-enabled cluster" +checkbox at creation time, GitLab will assume RBAC is disabled for your cluster +when interacting with it. If so, you must disable RBAC on your cluster for the +integration to work properly. ![rbac](img/rbac.png) -> **Note**: Disabling RBAC means that any application running in the cluster, or user who can authenticate to the cluster, has full API access. This is a [security concern](https://docs.gitlab.com/ee/user/project/clusters/#security-implications), and may not be desirable. +NOTE: **Note**: Disabling RBAC means that any application running in the cluster, +or user who can authenticate to the cluster, has full API access. This is a +[security concern](../index.md#security-implications), and may not be desirable. To effectively disable RBAC, global permissions can be applied granting full access: @@ -154,56 +179,100 @@ kubectl create clusterrolebinding permissive-binding \ ## Deploy services to the cluster -GitLab supports one-click deployment of helpful services to the cluster, many of which support Auto DevOps. Back on the Kubernetes cluster screen in GitLab, a list of applications is now available to deploy. +GitLab supports one-click deployment of helpful services to the cluster, many of +which support Auto DevOps. Back on the Kubernetes cluster screen in GitLab, a +list of applications is now available to deploy. -First install Helm Tiller, a package manager for Kubernetes. This enables deployment of the other applications. +First, install Helm Tiller, a package manager for Kubernetes. This enables +deployment of the other applications. ![Deploy Apps](img/deploy_apps.png) ### Deploying NGINX Ingress (optional) -Next, if you would like the deployed app to be reachable on the internet, deploy the Ingress. Note that this will also cause an [Elastic Load Balancer](https://aws.amazon.com/documentation/elastic-load-balancing/) to be created, which will incur additional AWS costs. +Next, if you would like the deployed app to be reachable on the internet, deploy +the Ingress. Note that this will also cause an +[Elastic Load Balancer](https://aws.amazon.com/documentation/elastic-load-balancing/) +to be created, which will incur additional AWS costs. + +Once installed, you may see a `?` for "Ingress IP Address". This is because the +created ELB is available at a DNS name, not an IP address. To get the DNS name, +run: -Once installed, you may see a `?` for `Ingress IP Address`. This is because the created ELB is available at a DNS name, not an IP address. To get the DNS name, run: `kubectl get service ingress-nginx-ingress-controller -n gitlab-managed-apps -o jsonpath="{.status.loadBalancer.ingress[0].hostname}"`. Note, you may see a trailing `%` on some Kubernetes versions, do not include it. +```sh +kubectl get service ingress-nginx-ingress-controller -n gitlab-managed-apps -o jsonpath="{.status.loadBalancer.ingress[0].hostname}" +``` + +Note that you may see a trailing `%` on some Kubernetes versions, **do not include it**. -The Ingress is now available at this address, and will route incoming requests to the proper service based on the DNS name in the request. To support this, a wildcard DNS CNAME record should be created for the desired domain name. For example `*.myekscluster.com` would point to the Ingress hostname obtained earlier. +The Ingress is now available at this address and will route incoming requests to +the proper service based on the DNS name in the request. To support this, a +wildcard DNS CNAME record should be created for the desired domain name. For example, +`*.myekscluster.com` would point to the Ingress hostname obtained earlier. ![Create DNS](img/create_dns.png) ### Deploying the GitLab Runner (optional) -If the project is on GitLab.com, free shared runners are available and you do not have to deploy one. If a project specific runner is desired, or there are no shared runners, it is easy to deploy one. +If the project is on GitLab.com, free shared Runners are available and you do +not have to deploy one. If a project specific Runner is desired, or there are no +shared Runners, it is easy to deploy one. -Simply click on the `Install` button for the GitLab Runner. It is important to note that the runner deployed is set as **privileged**, which means it essentially has root access to the underlying machine. This is required to build docker images, and so is on by default. +Simply click on the **Install** button for the GitLab Runner. It is important to +note that the Runner deployed is set as **privileged**, which means it essentially +has root access to the underlying machine. This is required to build docker images, +and so is on by default. ### Deploying Prometheus (optional) -GitLab is able to monitor applications automatically, utilizing [Prometheus](../../integrations/prometheus.html). Kubernetes container CPU and memory metrics are automatically collected, and response metrics are retrieved from NGINX Ingress as well. +GitLab is able to monitor applications automatically, utilizing +[Prometheus](../../integrations/prometheus.html). Kubernetes container CPU and +memory metrics are automatically collected, and response metrics are retrieved +from NGINX Ingress as well. -To enable monitoring, simply install Prometheus into the cluster with the `Install` button. +To enable monitoring, simply install Prometheus into the cluster with the +**Install** button. ## Create a default Storage Class -Amazon EKS does not have a default Storage Class out of the box, which means requests for persistent volumes will not be automatically fulfilled. As part of Auto DevOps, the deployed Postgres instance requests persistent storage, and without a default storage class it will fail to start. +Amazon EKS doesn't have a default Storage Class out of the box, which means +requests for persistent volumes will not be automatically fulfilled. As part +of Auto DevOps, the deployed Postgres instance requests persistent storage, +and without a default storage class it will fail to start. -If a default Storage Class does not already exist and is desired, follow Amazon's [short guide](https://docs.aws.amazon.com/eks/latest/userguide/storage-classes.html) to create one. +If a default Storage Class doesn't already exist and is desired, follow Amazon's +[guide on storage classes](https://docs.aws.amazon.com/eks/latest/userguide/storage-classes.html) +to create one. -Alternatively, disable Postgres by setting the project variable [`POSTGRES_ENABLED`](../../../../topics/autodevops/#environment-variables) to `false`. +Alternatively, disable Postgres by setting the project variable +[`POSTGRES_ENABLED`](../../../../topics/autodevops/#environment-variables) to `false`. ## Deploy the app to EKS -With RBAC disabled and services deployed, [Auto DevOps](https://docs.gitlab.com/ee/topics/autodevops/) can now be leveraged to build, test, and deploy the app. To enable, click on `Settings` in the left sidebar, then `CI/CD`. You will see a section for `Auto DevOps`, expand it. Click on the radio button to `Enable Auto DevOps`. +With RBAC disabled and services deployed, +[Auto DevOps](../../../../topics/autodevops/index.md) can now be leveraged +to build, test, and deploy the app. -If a wildcard DNS entry was created resolving to the Load Balancer, enter it in the `domain` field. Otherwise, the deployed app will not be externally available outside of the cluster. To save, click `Save changes`. +[Enable Auto DevOps](../../../../topics/autodevops/index.md##enablingdisabling-auto-devops-at-the-project-level) +if not already enabled. If a wildcard DNS entry was created resolving to the +Load Balancer, enter it in the `domain` field under the Auto DevOps settings. +Otherwise, the deployed app will not be externally available outside of the cluster. ![Deploy Pipeline](img/pipeline.png) -A new pipeline will automatically be created, which will begin to build, test, and deploy the app. +A new pipeline will automatically be created, which will begin to build, test, +and deploy the app. -After the pipeline has finished, your app will be running in EKS and available to users. Click on `CI/CD` tab in the left navigation bar, and choose `Environments`. +After the pipeline has finished, your app will be running in EKS and available +to users. Click on **CI/CD > Environments**. ![Deployed Environment](img/environment.png) -You will see a list of the environments and their deploy status, as well as options to browse to the app, view monitoring metrics, and even access a shell on the running pod. +You will see a list of the environments and their deploy status, as well as +options to browse to the app, view monitoring metrics, and even access a shell +on the running pod. + +## Learn more -To learn more about Auto DevOps, review our [documentation](../../../../topics/autodevops/). +To learn more on automatically deploying your applications, +read about [Auto DevOps](../../../../topics/autodevops/index.md). -- cgit v1.2.1 From 718c66f6ee80fe49a64f6181a2fff17f208e094a Mon Sep 17 00:00:00 2001 From: Phil Hughes Date: Fri, 16 Nov 2018 09:42:04 +0000 Subject: Fixed image discussion styling Fixes the styling of image discussions after the discussion styling changes. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/54110 --- app/assets/stylesheets/framework/files.scss | 1 - app/assets/stylesheets/pages/diff.scss | 14 +++++++++----- app/assets/stylesheets/pages/notes.scss | 8 +------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/app/assets/stylesheets/framework/files.scss b/app/assets/stylesheets/framework/files.scss index 6bdcb20210b..037a5adfb7e 100644 --- a/app/assets/stylesheets/framework/files.scss +++ b/app/assets/stylesheets/framework/files.scss @@ -415,7 +415,6 @@ span.idiff { } .preview-container { - height: 100%; overflow: auto; .file-container { diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index 6d998fa1e07..3c7bf0b0e46 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -842,11 +842,15 @@ background-repeat: repeat; } - .diff-file-discussions + .discussion-form::before { - width: auto; - margin-left: -16px; - margin-right: -16px; - margin-bottom: 16px; + .diff-file-discussions + .discussion-form { + padding: $gl-padding; + + &::before { + width: auto; + margin-left: -$gl-padding; + margin-right: -$gl-padding; + margin-bottom: $gl-padding; + } } .notes { diff --git a/app/assets/stylesheets/pages/notes.scss b/app/assets/stylesheets/pages/notes.scss index 1f34537d856..085ff27e6ef 100644 --- a/app/assets/stylesheets/pages/notes.scss +++ b/app/assets/stylesheets/pages/notes.scss @@ -433,14 +433,8 @@ $note-form-margin-left: 72px; } .discussion-notes { - &:not(:first-child) { - border-top: 1px solid $white-normal; - margin-top: 20px; - } - &:not(:last-child) { - border-bottom: 1px solid $white-normal; - margin-bottom: 20px; + margin-bottom: 0; } .system-note { -- cgit v1.2.1 From f837281ff6f2e27a838eaa40a908ca6b9b47d2a0 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 16 Nov 2018 11:03:45 +0100 Subject: Update regex to use union --- lib/gitlab/file_detector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb index 4e749068f93..2e78fc0e9c5 100644 --- a/lib/gitlab/file_detector.rb +++ b/lib/gitlab/file_detector.rb @@ -8,7 +8,7 @@ module Gitlab module FileDetector PATTERNS = { # Project files - readme: %r{\A(readme|index)(|\.#{Gitlab::MarkupHelper::EXTENSIONS.join('|\.')})$[^\/]*\z}i, + readme: %r{\A(#{Regexp.union(*Gitlab::MarkupHelper::PLAIN_FILENAMES).source})(\.(#{Regexp.union(*Gitlab::MarkupHelper::EXTENSIONS).source}))?$[^\/]*\z}i, changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i, license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i, contributing: %r{\Acontributing[^/]*\z}i, -- cgit v1.2.1 From d2d8b935e2aee96e534543141d2f0beb449b7d79 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Wed, 14 Nov 2018 21:42:18 +0200 Subject: Fix typos in docs --- .gitlab/issue_templates/Test plan.md | 4 ++-- doc/administration/high_availability/redis.md | 2 +- doc/ci/variables/where_variables_can_be_used.md | 2 +- doc/development/feature_flags.md | 2 +- doc/development/testing_guide/review_apps.md | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab/issue_templates/Test plan.md b/.gitlab/issue_templates/Test plan.md index db8e30c419c..a3c3f4a6509 100644 --- a/.gitlab/issue_templates/Test plan.md +++ b/.gitlab/issue_templates/Test plan.md @@ -64,7 +64,7 @@ Some features might be simple enough that they only involve one Component, while more complex features could involve multiple or even all. Example (from https://gitlab.com/gitlab-org/gitlab-ce/issues/50353): -* Respository is +* Repository is * Intuitive * It's easy to select the desired file template * It doesn't require unnecessary actions to save the change @@ -93,4 +93,4 @@ When adding new automated tests, please keep [testing levels](https://docs.gitla in mind. --> -/label ~Quality ~"test plan" \ No newline at end of file +/label ~Quality ~"test plan" diff --git a/doc/administration/high_availability/redis.md b/doc/administration/high_availability/redis.md index 7c1ef43499d..a9ba40c870c 100644 --- a/doc/administration/high_availability/redis.md +++ b/doc/administration/high_availability/redis.md @@ -684,7 +684,7 @@ cache, queues, and shared_state. To make this work with Sentinel: ``` 1. Note that for each persistence class, GitLab will default to using the configuration specified in `gitlab_rails['redis_sentinels']` unless - overriden by the settings above. + overridden by the settings above. 1. Be sure to include BOTH configuration options for each persistent classes. For example, if you choose to configure a cache instance, you must specify both `gitlab_rails['redis_cache_instance']` and `gitlab_rails['redis_cache_sentinels']` for GitLab to generate the proper configuration files. diff --git a/doc/ci/variables/where_variables_can_be_used.md b/doc/ci/variables/where_variables_can_be_used.md index 4e8ce10c9cb..1d98e8426fe 100644 --- a/doc/ci/variables/where_variables_can_be_used.md +++ b/doc/ci/variables/where_variables_can_be_used.md @@ -17,7 +17,7 @@ There are two places defined variables can be used. On the: | Definition | Can be expanded? | Expansion place | Description | |--------------------------------------|-------------------|-----------------|--------------| -| `environment:url` | yes | GitLab | The variable expansion is made by GitLab's [internal variable expansion mechanism](#gitlab-internal-variable-expansion-mechanism).
    • Supported: all variables defined for a job (project/group variables, variables from `.gitlab-ci.yml`, variables from triggers, variables from pipeline schedules)
    • Not suported: variables defined in Runner's `config.toml` and variables created in job's `script`
    | +| `environment:url` | yes | GitLab | The variable expansion is made by GitLab's [internal variable expansion mechanism](#gitlab-internal-variable-expansion-mechanism).
    • Supported: all variables defined for a job (project/group variables, variables from `.gitlab-ci.yml`, variables from triggers, variables from pipeline schedules)
    • Not supported: variables defined in Runner's `config.toml` and variables created in job's `script`
    | | `environment:name` | yes | GitLab | Similar to `environment:url`, but the variables expansion doesn't support:
    • variables that are based on the environment's name (`CI_ENVIRONMENT_NAME`, `CI_ENVIRONMENT_SLUG`)
    • any other variables related to environment (currently only `CI_ENVIRONMENT_URL`)
    • [persisted variables](#persisted-variables)
    | | `variables` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | | `image` | yes | Runner | The variable expansion is made by GitLab Runner's [internal variable expansion mechanism](#gitlab-runner-internal-variable-expansion-mechanism) | diff --git a/doc/development/feature_flags.md b/doc/development/feature_flags.md index 350593cc813..1019a1fd0e2 100644 --- a/doc/development/feature_flags.md +++ b/doc/development/feature_flags.md @@ -33,7 +33,7 @@ You can follow the progress on that [in the issue on our issue tracker](https:// In general, it's better to have a group- or user-based gate, and you should prefer it over the use of percentage gates. This would make debugging easier, as you -filter for example logs and errors based on actors too. Futhermore, this allows +filter for example logs and errors based on actors too. Furthermore, this allows for enabling for the `gitlab-org` group first, while the rest of the users aren't impacted. diff --git a/doc/development/testing_guide/review_apps.md b/doc/development/testing_guide/review_apps.md index 36d150c8a5b..1830641431e 100644 --- a/doc/development/testing_guide/review_apps.md +++ b/doc/development/testing_guide/review_apps.md @@ -24,7 +24,7 @@ Review Apps are automatically deployed by each pipeline, both in [`scripts/review_apps/review-apps.sh`][review-apps.sh] - These scripts are basically [our official Auto DevOps scripts][Auto-DevOps.gitlab-ci.yml] where the - default CNG images are overriden with the images built and stored in the + default CNG images are overridden with the images built and stored in the [`CNG-mirror` project's registry][cng-mirror-registry]. - Since we're using [the official GitLab Helm chart][helm-chart], this means you get a dedicated environment for your branch that's very close to what it @@ -33,7 +33,7 @@ Review Apps are automatically deployed by each pipeline, both in thanks to the direct link to it from the MR widget. The default username is `root` and its password can be found in the 1Password secure note named **gitlab-{ce,ee} Review App's root password** (note that there's currently - [a bug where the default password seems to be overriden][password-bug]). + [a bug where the default password seems to be overridden][password-bug]). **Additional notes:** -- cgit v1.2.1 From fe1469e12f7a1895cbf534f9ab17fd32af0e954c Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Wed, 14 Nov 2018 12:38:08 +0000 Subject: Upgrade helm to 2.11.0 and upgrade on every install --- app/models/clusters/concerns/application_status.rb | 4 +++ .../unreleased/49726-upgrade-helm-to-2-11.yml | 5 ++++ doc/user/project/clusters/index.md | 4 +++ lib/gitlab/kubernetes/helm.rb | 2 +- lib/gitlab/kubernetes/helm/install_command.rb | 10 ++++++- lib/gitlab/kubernetes/helm/upgrade_command.rb | 10 ++++++- .../gitlab/kubernetes/helm/install_command_spec.rb | 21 +++++++++----- spec/lib/gitlab/kubernetes/helm/pod_spec.rb | 2 +- .../gitlab/kubernetes/helm/upgrade_command_spec.rb | 12 +++++--- .../clusters/applications/prometheus_spec.rb | 2 +- .../cluster_application_status_shared_examples.rb | 32 +++++++++++++++++++++- 11 files changed, 87 insertions(+), 17 deletions(-) create mode 100644 changelogs/unreleased/49726-upgrade-helm-to-2-11.yml diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb index 93bdf9c223d..712dc901795 100644 --- a/app/models/clusters/concerns/application_status.rb +++ b/app/models/clusters/concerns/application_status.rb @@ -64,6 +64,10 @@ module Clusters status_reason = transition.args.first app_status.status_reason = status_reason if status_reason end + + before_transition any => [:installed, :updated] do |app_status, _| + app_status.cluster.application_helm.update!(version: Gitlab::Kubernetes::Helm::HELM_VERSION) + end end end diff --git a/changelogs/unreleased/49726-upgrade-helm-to-2-11.yml b/changelogs/unreleased/49726-upgrade-helm-to-2-11.yml new file mode 100644 index 00000000000..dd26af875f5 --- /dev/null +++ b/changelogs/unreleased/49726-upgrade-helm-to-2-11.yml @@ -0,0 +1,5 @@ +--- +title: Upgrade helm to 2.11.0 and upgrade on every install +merge_request: 22693 +author: +type: added diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index 3fbd4c21eab..1d1de01c120 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -230,6 +230,10 @@ twice, which can lead to confusion during deployments. | [JupyterHub](http://jupyter.org/) | 11.0+ | [JupyterHub](https://jupyterhub.readthedocs.io/en/stable/) is a multi-user service for managing notebooks across a team. [Jupyter Notebooks](https://jupyter-notebook.readthedocs.io/en/latest/) provide a web-based interactive programming environment used for data analysis, visualization, and machine learning. We use [this](https://gitlab.com/gitlab-org/jupyterhub-user-image/blob/master/Dockerfile) custom Jupyter image that installs additional useful packages on top of the base Jupyter. You will also see ready-to-use DevOps Runbooks built with Nurtch's [Rubix library](https://github.com/amit1rrr/rubix). More information on creating executable runbooks can be found at [Nurtch Documentation](http://docs.nurtch.com/en/latest). **Note**: Authentication will be enabled for any user of the GitLab server via OAuth2. HTTPS will be supported in a future release. | [jupyter/jupyterhub](https://jupyterhub.github.io/helm-chart/) | | [Knative](https://cloud.google.com/knative) | 0.1.2 | Knative provides a platform to create, deploy, and manage serverless workloads from a Kubernetes cluster. It is used in conjunction with, and includes [Istio](https://istio.io) to provide an external IP address for all programs hosted by Knative. You will be prompted to enter a wildcard domain where your applications will be exposed. Configure your DNS server to use the external IP address for that domain. For any application created and installed, they will be accessible as ... **Note**: This will require your kubernetes cluster to have RBAC enabled. | [knative/knative](https://storage.googleapis.com/triggermesh-charts) +NOTE: **Note:** +As of GitLab 11.6 Helm Tiller will be upgraded to the latest version supported +by GitLab before installing any of the above applications. + ## Getting the external IP address NOTE: **Note:** diff --git a/lib/gitlab/kubernetes/helm.rb b/lib/gitlab/kubernetes/helm.rb index 1cd4f9e17b7..5a22b5e3364 100644 --- a/lib/gitlab/kubernetes/helm.rb +++ b/lib/gitlab/kubernetes/helm.rb @@ -1,7 +1,7 @@ module Gitlab module Kubernetes module Helm - HELM_VERSION = '2.7.2'.freeze + HELM_VERSION = '2.11.0'.freeze KUBECTL_VERSION = '1.11.0'.freeze NAMESPACE = 'gitlab-managed-apps'.freeze SERVICE_ACCOUNT = 'tiller'.freeze diff --git a/lib/gitlab/kubernetes/helm/install_command.rb b/lib/gitlab/kubernetes/helm/install_command.rb index ff1c1657b98..5c7b6d6cb75 100644 --- a/lib/gitlab/kubernetes/helm/install_command.rb +++ b/lib/gitlab/kubernetes/helm/install_command.rb @@ -20,6 +20,10 @@ module Gitlab def generate_script super + [ init_command, + # Sleep is necessary to give Tiller time to restart after upgrade. + # Ideally we'd be able to use --wait but cannot because of + # https://github.com/helm/helm/issues/4855 + sleep_command, repository_command, repository_update_command, preinstall_command, @@ -35,7 +39,11 @@ module Gitlab private def init_command - 'helm init --client-only' + 'helm init --upgrade --tiller-namespace gitlab-managed-apps' + end + + def sleep_command + 'sleep 30' end def repository_command diff --git a/lib/gitlab/kubernetes/helm/upgrade_command.rb b/lib/gitlab/kubernetes/helm/upgrade_command.rb index b36315f7a82..5b47944e5e6 100644 --- a/lib/gitlab/kubernetes/helm/upgrade_command.rb +++ b/lib/gitlab/kubernetes/helm/upgrade_command.rb @@ -20,6 +20,10 @@ module Gitlab def generate_script super + [ init_command, + # Sleep is necessary to give Tiller time to restart after upgrade. + # Ideally we'd be able to use --wait but cannot because of + # https://github.com/helm/helm/issues/4855 + sleep_command, repository_command, script_command ].compact.join("\n") @@ -36,7 +40,11 @@ module Gitlab private def init_command - 'helm init --client-only' + 'helm init --upgrade --tiller-namespace gitlab-managed-apps' + end + + def sleep_command + 'sleep 30' end def repository_command diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb index 2b7e3ea6def..9fa47f9a264 100644 --- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb @@ -26,7 +26,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add app-name https://repository.example.com helm repo update #{helm_install_comand} @@ -54,7 +55,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -84,7 +86,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 #{helm_install_command} EOS end @@ -111,7 +114,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -134,7 +138,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -157,7 +162,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -182,7 +188,8 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} diff --git a/spec/lib/gitlab/kubernetes/helm/pod_spec.rb b/spec/lib/gitlab/kubernetes/helm/pod_spec.rb index c92bc92c42d..2dd3a570a1d 100644 --- a/spec/lib/gitlab/kubernetes/helm/pod_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/pod_spec.rb @@ -30,7 +30,7 @@ describe Gitlab::Kubernetes::Helm::Pod do it 'should generate the appropriate specifications for the container' do container = subject.generate.spec.containers.first expect(container.name).to eq('helm') - expect(container.image).to eq('registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/2.7.2-kube-1.11.0') + expect(container.image).to eq('registry.gitlab.com/gitlab-org/cluster-integration/helm-install-image/releases/2.11.0-kube-1.11.0') expect(container.env.count).to eq(3) expect(container.env.map(&:name)).to match_array([:HELM_VERSION, :TILLER_NAMESPACE, :COMMAND_SCRIPT]) expect(container.command).to match_array(["/bin/sh"]) diff --git a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb index 9c9fc91ef3c..afc926abc27 100644 --- a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb @@ -21,7 +21,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end @@ -33,7 +34,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end @@ -56,7 +58,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm repo add #{application.name} #{application.repository} helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS @@ -70,7 +73,8 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --client-only + helm init --upgrade --tiller-namespace gitlab-managed-apps + sleep 30 helm upgrade #{application.name} #{application.chart} --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end diff --git a/spec/models/clusters/applications/prometheus_spec.rb b/spec/models/clusters/applications/prometheus_spec.rb index 86de9dc60f2..b5aa1dcece5 100644 --- a/spec/models/clusters/applications/prometheus_spec.rb +++ b/spec/models/clusters/applications/prometheus_spec.rb @@ -35,7 +35,7 @@ describe Clusters::Applications::Prometheus do describe 'transition to installed' do let(:project) { create(:project) } - let(:cluster) { create(:cluster, projects: [project]) } + let(:cluster) { create(:cluster, :with_installed_helm, projects: [project]) } let(:prometheus_service) { double('prometheus_service') } subject { create(:clusters_applications_prometheus, :installing, cluster: cluster) } diff --git a/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb b/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb index 82f0dd5d00f..c391cc48f4e 100644 --- a/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb +++ b/spec/support/shared_examples/models/cluster_application_status_shared_examples.rb @@ -44,10 +44,40 @@ shared_examples 'cluster application status specs' do |application_name| subject { create(application_name, :installing) } it 'is installed' do - subject.make_installed + subject.make_installed! expect(subject).to be_installed end + + it 'updates helm version' do + subject.cluster.application_helm.update!(version: '1.2.3') + + subject.make_installed! + + subject.cluster.application_helm.reload + + expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION) + end + end + + describe '#make_updated' do + subject { create(application_name, :updating) } + + it 'is updated' do + subject.make_updated! + + expect(subject).to be_updated + end + + it 'updates helm version' do + subject.cluster.application_helm.update!(version: '1.2.3') + + subject.make_updated! + + subject.cluster.application_helm.reload + + expect(subject.cluster.application_helm.version).to eq(Gitlab::Kubernetes::Helm::HELM_VERSION) + end end describe '#make_errored' do -- cgit v1.2.1 From 53b2c3011e01b7f0174a0863e2597d3b4a251321 Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 16 Nov 2018 11:27:47 +0100 Subject: Remove redundant end anchors --- lib/gitlab/file_detector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb index 2e78fc0e9c5..48025f6ad5a 100644 --- a/lib/gitlab/file_detector.rb +++ b/lib/gitlab/file_detector.rb @@ -8,7 +8,7 @@ module Gitlab module FileDetector PATTERNS = { # Project files - readme: %r{\A(#{Regexp.union(*Gitlab::MarkupHelper::PLAIN_FILENAMES).source})(\.(#{Regexp.union(*Gitlab::MarkupHelper::EXTENSIONS).source}))?$[^\/]*\z}i, + readme: %r{\A(#{Regexp.union(*Gitlab::MarkupHelper::PLAIN_FILENAMES).source})(\.(#{Regexp.union(*Gitlab::MarkupHelper::EXTENSIONS).source}))?\z}i, changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i, license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i, contributing: %r{\Acontributing[^/]*\z}i, -- cgit v1.2.1 From 4363a73303b2b6631b88e7355faeaf162985972a Mon Sep 17 00:00:00 2001 From: Mateusz Date: Fri, 16 Nov 2018 10:44:55 +0000 Subject: Update 11.2-to-11.3.md --- doc/update/11.2-to-11.3.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/update/11.2-to-11.3.md b/doc/update/11.2-to-11.3.md index d77f879ee57..f2b8efc3e6e 100644 --- a/doc/update/11.2-to-11.3.md +++ b/doc/update/11.2-to-11.3.md @@ -235,7 +235,7 @@ There might be configuration options available for [`gitlab.yml`][yaml]. View th ```sh cd /home/git/gitlab -git diff origin/11-1-stable:config/gitlab.yml.example origin/11-3-stable:config/gitlab.yml.example +git diff origin/11-2-stable:config/gitlab.yml.example origin/11-3-stable:config/gitlab.yml.example ``` #### Nginx configuration @@ -246,10 +246,10 @@ Ensure you're still up-to-date with the latest NGINX configuration changes: cd /home/git/gitlab # For HTTPS configurations -git diff origin/11-1-stable:lib/support/nginx/gitlab-ssl origin/11-3-stable:lib/support/nginx/gitlab-ssl +git diff origin/11-2-stable:lib/support/nginx/gitlab-ssl origin/11-3-stable:lib/support/nginx/gitlab-ssl # For HTTP configurations -git diff origin/11-1-stable:lib/support/nginx/gitlab origin/11-3-stable:lib/support/nginx/gitlab +git diff origin/11-2-stable:lib/support/nginx/gitlab origin/11-3-stable:lib/support/nginx/gitlab ``` If you are using Strict-Transport-Security in your installation to continue using it you must enable it in your Nginx @@ -283,7 +283,7 @@ There might be new configuration options available for [`gitlab.default.example` ```sh cd /home/git/gitlab -git diff origin/11-1-stable:lib/support/init.d/gitlab.default.example origin/11-3-stable:lib/support/init.d/gitlab.default.example +git diff origin/11-2-stable:lib/support/init.d/gitlab.default.example origin/11-3-stable:lib/support/init.d/gitlab.default.example ``` Ensure you're still up-to-date with the latest init script changes: -- cgit v1.2.1 From a71b3f6a7c13fdc0978a1e9d0151fe15399b8b59 Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Thu, 15 Nov 2018 14:13:32 +0000 Subject: Extract Helm::ClientCommand for shared commands --- app/models/clusters/concerns/application_status.rb | 3 +++ lib/gitlab/kubernetes/helm/client_command.rb | 26 ++++++++++++++++++++++ lib/gitlab/kubernetes/helm/install_command.rb | 18 ++------------- lib/gitlab/kubernetes/helm/upgrade_command.rb | 18 ++------------- 4 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 lib/gitlab/kubernetes/helm/client_command.rb diff --git a/app/models/clusters/concerns/application_status.rb b/app/models/clusters/concerns/application_status.rb index 712dc901795..0e74cce29b7 100644 --- a/app/models/clusters/concerns/application_status.rb +++ b/app/models/clusters/concerns/application_status.rb @@ -66,6 +66,9 @@ module Clusters end before_transition any => [:installed, :updated] do |app_status, _| + # When installing any application we are also performing an update + # of tiller (see Gitlab::Kubernetes::Helm::ClientCommand) so + # therefore we need to reflect that in the database. app_status.cluster.application_helm.update!(version: Gitlab::Kubernetes::Helm::HELM_VERSION) end end diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb new file mode 100644 index 00000000000..0ff0169b61d --- /dev/null +++ b/lib/gitlab/kubernetes/helm/client_command.rb @@ -0,0 +1,26 @@ +module Gitlab + module Kubernetes + module Helm + module ClientCommand + def init_command + # Here we are always upgrading to the latest version of Tiller when + # installing an app. We ensure the helm version stored in the + # database is correct by also updating this after transition to + # :installed,:updated in Clusters::Concerns::ApplicationStatus + 'helm init --upgrade --tiller-namespace gitlab-managed-apps' + end + + def wait_for_tiller_command + # This is necessary to give Tiller time to restart after upgrade. + # Ideally we'd be able to use --wait but cannot because of + # https://github.com/helm/helm/issues/4855 + 'sleep 30' + end + + def repository_command + ['helm', 'repo', 'add', name, repository].shelljoin if repository + end + end + end + end +end diff --git a/lib/gitlab/kubernetes/helm/install_command.rb b/lib/gitlab/kubernetes/helm/install_command.rb index 5c7b6d6cb75..52700b5dc09 100644 --- a/lib/gitlab/kubernetes/helm/install_command.rb +++ b/lib/gitlab/kubernetes/helm/install_command.rb @@ -3,6 +3,7 @@ module Gitlab module Helm class InstallCommand include BaseCommand + include ClientCommand attr_reader :name, :files, :chart, :version, :repository, :preinstall, :postinstall @@ -20,10 +21,7 @@ module Gitlab def generate_script super + [ init_command, - # Sleep is necessary to give Tiller time to restart after upgrade. - # Ideally we'd be able to use --wait but cannot because of - # https://github.com/helm/helm/issues/4855 - sleep_command, + wait_for_tiller_command, repository_command, repository_update_command, preinstall_command, @@ -38,18 +36,6 @@ module Gitlab private - def init_command - 'helm init --upgrade --tiller-namespace gitlab-managed-apps' - end - - def sleep_command - 'sleep 30' - end - - def repository_command - ['helm', 'repo', 'add', name, repository].shelljoin if repository - end - def repository_update_command 'helm repo update' if repository end diff --git a/lib/gitlab/kubernetes/helm/upgrade_command.rb b/lib/gitlab/kubernetes/helm/upgrade_command.rb index 5b47944e5e6..9daffc138b5 100644 --- a/lib/gitlab/kubernetes/helm/upgrade_command.rb +++ b/lib/gitlab/kubernetes/helm/upgrade_command.rb @@ -5,6 +5,7 @@ module Gitlab module Helm class UpgradeCommand include BaseCommand + include ClientCommand attr_reader :name, :chart, :version, :repository, :files @@ -20,10 +21,7 @@ module Gitlab def generate_script super + [ init_command, - # Sleep is necessary to give Tiller time to restart after upgrade. - # Ideally we'd be able to use --wait but cannot because of - # https://github.com/helm/helm/issues/4855 - sleep_command, + wait_for_tiller_command, repository_command, script_command ].compact.join("\n") @@ -39,18 +37,6 @@ module Gitlab private - def init_command - 'helm init --upgrade --tiller-namespace gitlab-managed-apps' - end - - def sleep_command - 'sleep 30' - end - - def repository_command - "helm repo add #{name} #{repository}" if repository - end - def script_command upgrade_flags = "#{optional_version_flag}#{optional_tls_flags}" \ " --reset-values" \ -- cgit v1.2.1 From 9b1a99b03d114e88e2512c75f9711cb38b34bc0c Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Thu, 15 Nov 2018 14:21:32 +0000 Subject: Use helm version loop instead of sleep in ClientCommand --- lib/gitlab/kubernetes/helm/client_command.rb | 2 +- spec/lib/gitlab/kubernetes/helm/install_command_spec.rb | 14 +++++++------- spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb index 0ff0169b61d..bc554684fc7 100644 --- a/lib/gitlab/kubernetes/helm/client_command.rb +++ b/lib/gitlab/kubernetes/helm/client_command.rb @@ -14,7 +14,7 @@ module Gitlab # This is necessary to give Tiller time to restart after upgrade. # Ideally we'd be able to use --wait but cannot because of # https://github.com/helm/helm/issues/4855 - 'sleep 30' + 'for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done' end def repository_command diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb index 9fa47f9a264..432dab5654d 100644 --- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb @@ -27,7 +27,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_comand} @@ -56,7 +56,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -87,7 +87,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done #{helm_install_command} EOS end @@ -115,7 +115,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -139,7 +139,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -163,7 +163,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} @@ -189,7 +189,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update #{helm_install_command} diff --git a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb index afc926abc27..879f7a444a8 100644 --- a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb @@ -22,7 +22,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end @@ -35,7 +35,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end @@ -59,7 +59,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add #{application.name} #{application.repository} helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS @@ -74,7 +74,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do let(:commands) do <<~EOS helm init --upgrade --tiller-namespace gitlab-managed-apps - sleep 30 + for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS end -- cgit v1.2.1 From 1244533b770ea0baf97fc0693a208394b162ead6 Mon Sep 17 00:00:00 2001 From: Dylan Griffith Date: Thu, 15 Nov 2018 14:23:36 +0000 Subject: Remove unnecessary --tiller-namespace --- lib/gitlab/kubernetes/helm/client_command.rb | 2 +- spec/lib/gitlab/kubernetes/helm/install_command_spec.rb | 14 +++++++------- spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/gitlab/kubernetes/helm/client_command.rb b/lib/gitlab/kubernetes/helm/client_command.rb index bc554684fc7..72bafc07bf0 100644 --- a/lib/gitlab/kubernetes/helm/client_command.rb +++ b/lib/gitlab/kubernetes/helm/client_command.rb @@ -7,7 +7,7 @@ module Gitlab # installing an app. We ensure the helm version stored in the # database is correct by also updating this after transition to # :installed,:updated in Clusters::Concerns::ApplicationStatus - 'helm init --upgrade --tiller-namespace gitlab-managed-apps' + 'helm init --upgrade' end def wait_for_tiller_command diff --git a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb index 432dab5654d..39852b7fe29 100644 --- a/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/install_command_spec.rb @@ -26,7 +26,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update @@ -55,7 +55,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update @@ -86,7 +86,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done #{helm_install_command} EOS @@ -114,7 +114,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update @@ -138,7 +138,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update @@ -162,7 +162,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update @@ -188,7 +188,7 @@ describe Gitlab::Kubernetes::Helm::InstallCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add app-name https://repository.example.com helm repo update diff --git a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb index 879f7a444a8..9b201dae417 100644 --- a/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb +++ b/spec/lib/gitlab/kubernetes/helm/upgrade_command_spec.rb @@ -21,7 +21,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS @@ -34,7 +34,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS @@ -58,7 +58,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm repo add #{application.name} #{application.repository} helm upgrade #{application.name} #{application.chart} --tls --tls-ca-cert /data/helm/#{application.name}/config/ca.pem --tls-cert /data/helm/#{application.name}/config/cert.pem --tls-key /data/helm/#{application.name}/config/key.pem --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml @@ -73,7 +73,7 @@ describe Gitlab::Kubernetes::Helm::UpgradeCommand do it_behaves_like 'helm commands' do let(:commands) do <<~EOS - helm init --upgrade --tiller-namespace gitlab-managed-apps + helm init --upgrade for i in $(seq 1 30); do helm version && break; sleep 1s; echo "Retrying ($i)..."; done helm upgrade #{application.name} #{application.chart} --reset-values --install --namespace #{namespace} -f /data/helm/#{application.name}/config/values.yaml EOS -- cgit v1.2.1 From a4ae5411f5e75ca90f6172d8d03c6524f8efb8cb Mon Sep 17 00:00:00 2001 From: James Lopez Date: Fri, 16 Nov 2018 12:09:18 +0100 Subject: Fix rubocop warning --- lib/gitlab/file_detector.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/file_detector.rb b/lib/gitlab/file_detector.rb index 48025f6ad5a..2770469ca9f 100644 --- a/lib/gitlab/file_detector.rb +++ b/lib/gitlab/file_detector.rb @@ -8,7 +8,7 @@ module Gitlab module FileDetector PATTERNS = { # Project files - readme: %r{\A(#{Regexp.union(*Gitlab::MarkupHelper::PLAIN_FILENAMES).source})(\.(#{Regexp.union(*Gitlab::MarkupHelper::EXTENSIONS).source}))?\z}i, + readme: /\A(#{Regexp.union(*Gitlab::MarkupHelper::PLAIN_FILENAMES).source})(\.(#{Regexp.union(*Gitlab::MarkupHelper::EXTENSIONS).source}))?\z/i, changelog: %r{\A(changelog|history|changes|news)[^/]*\z}i, license: %r{\A((un)?licen[sc]e|copying)(\.[^/]+)?\z}i, contributing: %r{\Acontributing[^/]*\z}i, -- cgit v1.2.1 From 35239a6aec84c47895ad6664a9b1075be12bd105 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Fri, 16 Nov 2018 10:53:44 +0100 Subject: Show what RPC is called in the performance bar Now only the data was shown of the service, which is not valueable at times given some of those expose a lot of RPCs. --- changelogs/unreleased/zj-improve-gitaly-pb.yml | 5 + lib/gitlab/git/blob.rb | 2 - lib/gitlab/git/repository.rb | 6 -- lib/gitlab/gitaly_client.rb | 125 ++----------------------- 4 files changed, 15 insertions(+), 123 deletions(-) create mode 100644 changelogs/unreleased/zj-improve-gitaly-pb.yml diff --git a/changelogs/unreleased/zj-improve-gitaly-pb.yml b/changelogs/unreleased/zj-improve-gitaly-pb.yml new file mode 100644 index 00000000000..506a0303d8a --- /dev/null +++ b/changelogs/unreleased/zj-improve-gitaly-pb.yml @@ -0,0 +1,5 @@ +--- +title: Show what RPC is called in the performance bar +merge_request: 23140 +author: +type: other diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index 9dd1c484d59..2d25389594e 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -1,7 +1,5 @@ # frozen_string_literal: true -# Gitaly note: JV: seems to be completely migrated (behind feature flags). - module Gitlab module Git class Blob diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 993955d1a6b..289796ae93b 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -885,12 +885,6 @@ module Gitlab Gitlab::GitalyClient::ConflictsService.new(self, our_commit_oid, their_commit_oid) end - def gitaly_migrate(method, status: Gitlab::GitalyClient::MigrationStatus::OPT_IN, &block) - wrapped_gitaly_errors do - Gitlab::GitalyClient.migrate(method, status: status, &block) - end - end - def clean_stale_repository_files wrapped_gitaly_errors do gitaly_repository_client.cleanup if exists? diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index d99a9f15371..613f0d31075 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -9,11 +9,6 @@ require 'grpc/health/v1/health_services_pb' module Gitlab module GitalyClient include Gitlab::Metrics::Methods - module MigrationStatus - DISABLED = 1 - OPT_IN = 2 - OPT_OUT = 3 - end class TooManyInvocationsError < StandardError attr_reader :call_site, :invocation_count, :max_call_stack @@ -31,7 +26,7 @@ module Gitlab end end - SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION'.freeze + SERVER_VERSION_FILE = 'GITALY_SERVER_VERSION' MAXIMUM_GITALY_CALLS = 35 CLIENT_NAME = (Sidekiq.server? ? 'gitlab-sidekiq' : 'gitlab-web').freeze @@ -43,11 +38,6 @@ module Gitlab self.query_time = 0 - define_histogram :gitaly_migrate_call_duration_seconds do - docstring "Gitaly migration call execution timings" - base_labels gitaly_enabled: nil, feature: nil - end - define_histogram :gitaly_controller_action_duration_seconds do docstring "Gitaly endpoint histogram by controller and action combination" base_labels Gitlab::Metrics::Transaction::BASE_LABELS.merge(gitaly_service: nil, rpc: nil) @@ -126,7 +116,6 @@ module Gitlab def self.call(storage, service, rpc, request, remote_storage: nil, timeout: nil) start = Gitlab::Metrics::System.monotonic_time request_hash = request.is_a?(Google::Protobuf::MessageExts) ? request.to_h : {} - @current_call_id ||= SecureRandom.uuid enforce_gitaly_request_limits(:call) @@ -145,9 +134,7 @@ module Gitlab current_transaction_labels.merge(gitaly_service: service.to_s, rpc: rpc.to_s), duration) - add_call_details(id: @current_call_id, feature: service, duration: duration, request: request_hash) - - @current_call_id = nil + add_call_details(feature: "#{service}##{rpc}", duration: duration, request: request_hash, rpc: rpc) end def self.handle_grpc_unavailable!(ex) @@ -222,7 +209,7 @@ module Gitlab result end - SERVER_FEATURE_FLAGS = %w[gogit_findcommit].freeze + SERVER_FEATURE_FLAGS = %w[].freeze def self.server_feature_flags SERVER_FEATURE_FLAGS.map do |f| @@ -237,82 +224,8 @@ module Gitlab params['gitaly_token'].presence || Gitlab.config.gitaly['token'] end - # Evaluates whether a feature toggle is on or off - def self.feature_enabled?(feature_name, status: MigrationStatus::OPT_IN) - # Disabled features are always off! - return false if status == MigrationStatus::DISABLED - - feature = Feature.get("gitaly_#{feature_name}") - - # If the feature has been set, always evaluate - if Feature.persisted?(feature) - if feature.percentage_of_time_value > 0 - # Probabilistically enable this feature - return Random.rand() * 100 < feature.percentage_of_time_value - end - - return feature.enabled? - end - - # If the feature has not been set, the default depends - # on it's status - case status - when MigrationStatus::OPT_OUT - true - when MigrationStatus::OPT_IN - opt_into_all_features? && !explicit_opt_in_required.include?(feature_name) - else - false - end - rescue => ex - # During application startup feature lookups in SQL can fail - Rails.logger.warn "exception while checking Gitaly feature status for #{feature_name}: #{ex}" - false - end - - # We have a mechanism to let GitLab automatically opt in to all Gitaly - # features. We want to be able to exclude some features from automatic - # opt-in. This function has an override in EE. - def self.explicit_opt_in_required - [] - end - - # opt_into_all_features? returns true when the current environment - # is one in which we opt into features automatically - def self.opt_into_all_features? - Rails.env.development? || ENV["GITALY_FEATURE_DEFAULT_ON"] == "1" - end - private_class_method :opt_into_all_features? - - def self.migrate(feature, status: MigrationStatus::OPT_IN) - # Enforce limits at both the `migrate` and `call` sites to ensure that - # problems are not hidden by a feature being disabled - enforce_gitaly_request_limits(:migrate) - - is_enabled = feature_enabled?(feature, status: status) - metric_name = feature.to_s - metric_name += "_gitaly" if is_enabled - - Gitlab::Metrics.measure(metric_name) do - # Some migrate calls wrap other migrate calls - allow_n_plus_1_calls do - feature_stack = Thread.current[:gitaly_feature_stack] ||= [] - feature_stack.unshift(feature) - begin - start = Gitlab::Metrics::System.monotonic_time - @current_call_id = SecureRandom.uuid - call_details = { id: @current_call_id } - yield is_enabled - ensure - total_time = Gitlab::Metrics::System.monotonic_time - start - gitaly_migrate_call_duration_seconds.observe({ gitaly_enabled: is_enabled, feature: feature }, total_time) - feature_stack.shift - Thread.current[:gitaly_feature_stack] = nil if feature_stack.empty? - - add_call_details(call_details.merge(feature: feature, duration: total_time)) - end - end - end + def self.feature_enabled?(feature_name) + Feature.enabled?("gitaly_#{feature_name}") end # Ensures that Gitaly is not being abuse through n+1 misuse etc @@ -368,38 +281,20 @@ module Gitlab end private_class_method :decrement_call_count - # Returns an estimate of the number of Gitaly calls made for this - # request + # Returns the of the number of Gitaly calls made for this request def self.get_request_count - return 0 unless Gitlab::SafeRequestStore.active? - - gitaly_migrate_count = get_call_count("gitaly_migrate_actual") - gitaly_call_count = get_call_count("gitaly_call_actual") - - # Using the maximum of migrate and call_count will provide an - # indicator of how many Gitaly calls will be made, even - # before a feature is enabled. This provides us with a single - # metric, but not an exact number, but this tradeoff is acceptable - if gitaly_migrate_count > gitaly_call_count - gitaly_migrate_count - else - gitaly_call_count - end + get_call_count("gitaly_call_actual") end def self.reset_counts return unless Gitlab::SafeRequestStore.active? - %w[migrate call].each do |call_site| - Gitlab::SafeRequestStore["gitaly_#{call_site}_actual"] = 0 - Gitlab::SafeRequestStore["gitaly_#{call_site}_permitted"] = 0 - end + Gitlab::SafeRequestStore["gitaly_call_actual"] = 0 + Gitlab::SafeRequestStore["gitaly_call_permitted"] = 0 end def self.add_call_details(details) - id = details.delete(:id) - - return unless id && Gitlab::SafeRequestStore[:peek_enabled] + return unless Gitlab::SafeRequestStore[:peek_enabled] Gitlab::SafeRequestStore['gitaly_call_details'] ||= {} Gitlab::SafeRequestStore['gitaly_call_details'][id] ||= {} -- cgit v1.2.1 From f826f9072267b7e50d5c2c32da42f22def1b9ccf Mon Sep 17 00:00:00 2001 From: Mateusz Date: Fri, 16 Nov 2018 11:23:09 +0000 Subject: Update 11.3-to-11.4.md --- doc/update/11.3-to-11.4.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/update/11.3-to-11.4.md b/doc/update/11.3-to-11.4.md index 00dfb19b4b4..fddec45e57a 100644 --- a/doc/update/11.3-to-11.4.md +++ b/doc/update/11.3-to-11.4.md @@ -235,7 +235,7 @@ There might be configuration options available for [`gitlab.yml`][yaml]. View th ```sh cd /home/git/gitlab -git diff origin/11-1-stable:config/gitlab.yml.example origin/11-4-stable:config/gitlab.yml.example +git diff origin/11-3-stable:config/gitlab.yml.example origin/11-4-stable:config/gitlab.yml.example ``` #### Nginx configuration @@ -246,10 +246,10 @@ Ensure you're still up-to-date with the latest NGINX configuration changes: cd /home/git/gitlab # For HTTPS configurations -git diff origin/11-1-stable:lib/support/nginx/gitlab-ssl origin/11-4-stable:lib/support/nginx/gitlab-ssl +git diff origin/11-3-stable:lib/support/nginx/gitlab-ssl origin/11-4-stable:lib/support/nginx/gitlab-ssl # For HTTP configurations -git diff origin/11-1-stable:lib/support/nginx/gitlab origin/11-4-stable:lib/support/nginx/gitlab +git diff origin/11-3-stable:lib/support/nginx/gitlab origin/11-4-stable:lib/support/nginx/gitlab ``` If you are using Strict-Transport-Security in your installation to continue using it you must enable it in your Nginx @@ -283,7 +283,7 @@ There might be new configuration options available for [`gitlab.default.example` ```sh cd /home/git/gitlab -git diff origin/11-1-stable:lib/support/init.d/gitlab.default.example origin/11-4-stable:lib/support/init.d/gitlab.default.example +git diff origin/11-3-stable:lib/support/init.d/gitlab.default.example origin/11-4-stable:lib/support/init.d/gitlab.default.example ``` Ensure you're still up-to-date with the latest init script changes: -- cgit v1.2.1 From 3835787003a4917a4ac3d7da0958497a5aab4ab3 Mon Sep 17 00:00:00 2001 From: George Tsiolis Date: Fri, 16 Nov 2018 15:13:06 +0200 Subject: Replace weight icon --- app/assets/stylesheets/pages/issuable.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/assets/stylesheets/pages/issuable.scss b/app/assets/stylesheets/pages/issuable.scss index 3aa79bf2466..38851de6401 100644 --- a/app/assets/stylesheets/pages/issuable.scss +++ b/app/assets/stylesheets/pages/issuable.scss @@ -727,6 +727,10 @@ .issuable-main-info { flex: 1 auto; margin-right: 10px; + + .issue-weight-icon { + vertical-align: sub; + } } .issuable-meta { -- cgit v1.2.1 From 56f2071031ddbf97c5f13c0614d00e9d4fd7a4cb Mon Sep 17 00:00:00 2001 From: Lee Matos Date: Fri, 16 Nov 2018 15:06:22 +0000 Subject: Update architecture.md to have a component by component overview --- doc/development/architecture.md | 189 +++++++++++++++++++++++++++++++++++----- 1 file changed, 166 insertions(+), 23 deletions(-) diff --git a/doc/development/architecture.md b/doc/development/architecture.md index 66d8a4f2f6e..01d99c46f89 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -10,39 +10,182 @@ For information, see the [GitLab Release Process](https://gitlab.com/gitlab-org/ Both EE and CE require some add-on components called gitlab-shell and Gitaly. These components are available from the [gitlab-shell](https://gitlab.com/gitlab-org/gitlab-shell/tree/master) and [gitaly](https://gitlab.com/gitlab-org/gitaly/tree/master) repositories respectively. New versions are usually tags but staying on the master branch will give you the latest stable version. New releases are generally around the same time as GitLab CE releases with exception for informal security updates deemed critical. -## Physical office analogy +## GitLab Omnibus Component by Component -You can imagine GitLab as a physical office. +This document is designed to be consumed by systems adminstrators and GitLab Support Engineers who want to understand more about the internals of GitLab and how they work together. -**The repositories** are the goods GitLab handles. -They can be stored in a warehouse. -This can be either a hard disk, or something more complex, such as a NFS filesystem; +When deployed, GitLab should be considered the amalgamation of the below processes. When troubleshooting or debugging, be as specific as possible as to which component you are referencing. That should increase clarity and reduce confusion. -**Nginx** acts like the front-desk. -Users come to Nginx and request actions to be done by workers in the office; +### GitLab Process Descriptions -**The database** is a series of metal file cabinets with information on: - - The goods in the warehouse (metadata, issues, merge requests etc); - - The users coming to the front desk (permissions) +As of this writing, a fresh GitLab 11.3.0 install will show the following processes with `gitlab-ctl status`: -**Redis** is a communication board with “cubby holes” that can contain tasks for office workers; +``` +run: alertmanager: (pid 30829) 14207s; run: log: (pid 13906) 2432044s +run: gitaly: (pid 30771) 14210s; run: log: (pid 13843) 2432046s +run: gitlab-monitor: (pid 30788) 14209s; run: log: (pid 13868) 2432045s +run: gitlab-workhorse: (pid 30758) 14210s; run: log: (pid 13855) 2432046s +run: logrotate: (pid 30246) 3407s; run: log: (pid 13825) 2432047s +run: nginx: (pid 30849) 14207s; run: log: (pid 13856) 2432046s +run: node-exporter: (pid 30929) 14206s; run: log: (pid 13877) 2432045s +run: postgres-exporter: (pid 30935) 14206s; run: log: (pid 13931) 2432044s +run: postgresql: (pid 13133) 2432214s; run: log: (pid 13848) 2432046s +run: prometheus: (pid 30807) 14209s; run: log: (pid 13884) 2432045s +run: redis: (pid 30560) 14274s; run: log: (pid 13807) 2432047s +run: redis-exporter: (pid 30946) 14205s; run: log: (pid 13869) 2432045s +run: sidekiq: (pid 30953) 14205s; run: log: (pid 13810) 2432047s +run: unicorn: (pid 30960) 14204s; run: log: (pid 13809) 2432047s +``` + +### Layers + +GitLab can be considered to have two layers from a process perspective: + +- **Monitoring**: Anything from this layer is not required to deliver GitLab the application, but will allow administrators more insight into their infrastructure and what the service as a whole is doing. +- **Core**: Any process that is vital for the delivery of GitLab as as platform. If any of these processes halt there will be a GitLab outage. For the Core layer, you can further divide into: + - **Processors**: These processes are responsible for actually performing operations and presenting the service. + - **Data**: These services store/expose structured data for the GitLab service. + +### alertmanager + +- Omnibus configuration options +- Layer: Monitoring + +[Alert manager](https://prometheus.io/docs/alerting/alertmanager/) is a tool provided by prometheus that _"handles alerts sent by client applications such as the Prometheus server. It takes care of deduplicating, grouping, and routing them to the correct receiver integration such as email, PagerDuty, or OpsGenie. It also takes care of silencing and inhibition of alerts."_ You can read more in [issue gitlab-ce#45740](https://gitlab.com/gitlab-org/gitlab-ce/issues/45740) about what we will be alerting on. + +### gitaly + +- [Omnibus confiugration options](https://gitlab.com/gitlab-org/gitaly/tree/master/doc/configuration) +- Layer: Core Service (Data) + +Gitaly is a service designed by GitLab to remove our need for NFS for Git storage in distributed deployments of GitLab. (Think GitLab.com or High Availablity Deployments) As of 11.3.0, This service handles all Git level access in GitLab. You can read more about the project [in the project's readme](https://gitlab.com/gitlab-org/gitaly). + +### gitlab-monitor + +- Omnibus configuration options +- Layer: Monitoring + +GitLab Monitor is a process disigned in house that allows us to export metrics about GitLab application internals to prometheus. You can read more [in the project's readme](https://gitlab.com/gitlab-org/gitlab-monitor) + +### gitlab-workhorse + +- Omnibus configuration options +- Layer: Core Service (Processor) + +[GitLab Workhorse](https://gitlab.com/gitlab-org/gitlab-workhorse) is a program designed at GitLab to help alieviate pressure from unicorn. You can read more about the [historical reasons for developing](https://about.gitlab.com/2016/04/12/a-brief-history-of-gitlab-workhorse/). It's designed to act as a smart reverse proxy to help speed up GitLab as a whole. + +### logrotate + +- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/logs.html#logrotate) +- Layer: Core Service + +GitLab is comprised of a large number of services that all log. We started bundling our own logrotate as of 7.4 to make sure we were logging responsibly. This is just a packaged version of the common opensource offering. + +### nginx + +- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/nginx.html) +- Layer: Core Service (Processor) + +Nginx as as an ingress port for all HTTP requests and routes them to the approriate sub-systems within GitLab. We are bundling an unmodified version of the popular open source webserver. + +### node-exporter + +- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/node_exporter.html) +- Layer: Monitoring + +[Node Exporter](https://github.com/prometheus/node_exporter) is a Prometheus tool that gives us metrics on the underlying machine. (Think CPU/Disk/Load) It's just a packaged version of the common open source offering from the Prometheus project. + +### postgres-exporter + +- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/postgres_exporter.html) +- Layer: Monitoring + +[Postgres-exporter](https://github.com/wrouesnel/postgres_exporter) is the community provided Prometheus exporter that will deliver data about Postgres to prometheus for use in Grafana Dashboards. + +### postgresql + +- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/database.html) +- Layer: Core Service (Data) + +GitLab packages the popular Database to provide storage for Application meta data and user information. + +### prometheus + +- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/) +- Layer: Monitoring + +Prometheus is a time-series tool that helps GitLab administrators expose metrics about the individual processes used to provide GitLab the service. + +### redis + +- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/redis.html) +- Layer: Core Service (Data) + +Redis is packaged to provide a place to store: + +- session data +- temporary cache information +- background job queues. + +### redis-exporter + +- [Omnibus configuration options](https://docs.gitlab.com/ee/administration/monitoring/prometheus/redis_exporter.html) +- Layer: Monitoring + +[Redis Exporter](https://github.com/oliver006/redis_exporter) is designed to give specific metrics about the Redis process to Prometheus so that we can graph these metrics in Graphana. + +### sidekiq + +- Omnibus configuration options +- Layer: Core Service (Processor) + +Sidekiq is a Ruby background job processor that pulls jobs from the redis queue and processes them. Background jobs allow GitLab to provide a faster request/response cycle by moving work into the background. + +### unicorn + +- [Omnibus configuration options](https://docs.gitlab.com/omnibus/settings/unicorn.html) +- Layer: Core Service (Processor) + +[Unicorn](https://bogomips.org/unicorn/) is a Ruby application server that is used to run the core Rails Application that provides the user facing features in GitLab. Often process output you will see this as `bundle` or `config.ru` depending on the GitLab version. + +### Additional Processes + +### GitLab Pages + +TODO + +### Mattermost + +TODO + +## GitLab by Request Type + +GitLab provides two "interfaces" for end users to access the service: + +- Web HTTP Requests (Viewing the UI/API) +- Git HTTP/SSH Requests (Pushing/Pulling Git Data) + +It's important to understand the distinction as some processes are used in both and others are exclusive to a specific request type. + +### GitLab Web HTTP Request Cycle + +When making a request to an HTTP Endpoint (Think `/users/sign_in`) the request will take the following path through the GitLab Service: + +- nginx - Acts as our first line reverse proxy +- gitlab-workhorse - This determines if it needs to go to the Rails application or somewhere else to reduce load on unicorn. +- unicorn - Since this is a web request, and it needs to access the application it will go to Unicorn. +- Postgres/Gitaly/Redis - Depending on the type of request, it may hit these services to store or retreive data. -**Sidekiq** is a worker that primarily handles sending out emails. -It takes tasks from the Redis communication board; -**A Unicorn worker** is a worker that handles quick/mundane tasks. -They work with the communication board (Redis). -Their job description: - - check permissions by checking the user session stored in a Redis “cubby hole”; - - make tasks for Sidekiq; - - fetch stuff from the warehouse or move things around in there; +### GitLab Git Request Cycle -**GitLab-shell** is a third kind of worker that takes orders from a fax machine (SSH) instead of the front desk (HTTP). -GitLab-shell communicates with Sidekiq via the “communication board” (Redis), and asks quick questions of the Unicorn workers either directly or via the front desk. +Below we describe the different pathing that HTTP vs. SSH Git requests will take. There is some overlap with the Web Request Cycle but also some differences. -**Gitaly** is a back desk that is specialized on reaching the disks to perform git operations efficiently and keep a copy of the result of costly operations. All git operations go through Gitaly. +### Web Request (80/443) +TODO -**GitLab Enterprise Edition (the application)** is the collection of processes and business practices that the office is run by. +### SSH Request (22) +TODO ## System Layout -- cgit v1.2.1 From 28c2d4020939b3462d31136ba330575db9f6cb50 Mon Sep 17 00:00:00 2001 From: "Balasankar \"Balu\" C" Date: Fri, 16 Nov 2018 15:08:43 +0000 Subject: Add information on support for git v2 in docs --- doc/administration/git_protocol.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/administration/git_protocol.md b/doc/administration/git_protocol.md index b1be078d672..341a00009e5 100644 --- a/doc/administration/git_protocol.md +++ b/doc/administration/git_protocol.md @@ -19,7 +19,15 @@ and the [protocol documentation](https://github.com/git/git/blob/master/Document From the client side, `git` `v2.18.0` or newer must be installed. From the server side, if we want to configure SSH we need to set the `sshd` -server to accept the `GIT_PROTOCOL` environment, +server to accept the `GIT_PROTOCOL` environment. + +In installations using [GitLab Helm Charts](../install/kubernetes/gitlab_chart.md) +and [All-in-one docker image](https://docs.gitlab.com/omnibus/docker/), the SSH +service is already configured to accept the `GIT_PROTOCOL` environment and users +need not do anything more. + +For Omnibus GitLab and installations from source, you have to manually update +the SSH configuration of your server: ``` # /etc/ssh/sshd_config -- cgit v1.2.1 From 19440e67225d41ff821a9e31f47d60fe7a1718c2 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 16 Nov 2018 04:56:27 +0100 Subject: Change project cache key to depend on ID instead of full path Previously, project cache used as part of the namespace the `full_path`, which included namespace and project slug. That meant that anytime a project was renamed or transfered to a different namespace, we would lose the existing cache. This is not necessary, nor desired. I've prefixed cache key with `project:` to make it easy to find in redis if necessary as well as make it possible to purge all project related cache. I've also switched the cache key type to go after the initial namespace and not before. --- lib/gitlab/repository_cache.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gitlab/repository_cache.rb b/lib/gitlab/repository_cache.rb index 56007574b1b..6b0808f5304 100644 --- a/lib/gitlab/repository_cache.rb +++ b/lib/gitlab/repository_cache.rb @@ -7,13 +7,13 @@ module Gitlab def initialize(repository, extra_namespace: nil, backend: Rails.cache) @repository = repository - @namespace = "#{repository.full_path}:#{repository.project.id}" + @namespace = "project:#{repository.project.id}" @namespace = "#{@namespace}:#{extra_namespace}" if extra_namespace @backend = backend end def cache_key(type) - "#{type}:#{namespace}" + "#{namespace}:#{type}" end def expire(key) -- cgit v1.2.1 From cb541aef892ca47ee01e2e71fb5edaa227cd7927 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 16 Nov 2018 05:52:13 +0100 Subject: Change project pipeline status cache key to follow project convention Old cache key was: `projects/#{id}/pipeline_status/#{sha}` New one is: `project:#{id}:pipeline_status:#{sha}` This allows to delete any project related key just by scanning for: `project:#{id}`. --- lib/gitlab/cache/ci/project_pipeline_status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gitlab/cache/ci/project_pipeline_status.rb b/lib/gitlab/cache/ci/project_pipeline_status.rb index dfbb83f7bb9..78b0eaac8cd 100644 --- a/lib/gitlab/cache/ci/project_pipeline_status.rb +++ b/lib/gitlab/cache/ci/project_pipeline_status.rb @@ -42,7 +42,7 @@ module Gitlab end def self.cache_key_for_project(project) - "#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:projects/#{project.id}/pipeline_status/#{project.commit&.sha}" + "#{Gitlab::Redis::Cache::CACHE_NAMESPACE}:project:#{project.id}:pipeline_status:#{project.commit&.sha}" end def self.update_for_pipeline(pipeline) -- cgit v1.2.1 From 2123b7896cb556d45b00f508a074e13e82f5ba17 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 16 Nov 2018 14:38:47 +0100 Subject: Change specs to accept new cache keys for projects --- spec/lib/gitlab/repository_cache_spec.rb | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/spec/lib/gitlab/repository_cache_spec.rb b/spec/lib/gitlab/repository_cache_spec.rb index 741ee12633f..1b9a8b4ab0d 100644 --- a/spec/lib/gitlab/repository_cache_spec.rb +++ b/spec/lib/gitlab/repository_cache_spec.rb @@ -4,14 +4,14 @@ describe Gitlab::RepositoryCache do let(:backend) { double('backend').as_null_object } let(:project) { create(:project) } let(:repository) { project.repository } - let(:namespace) { "#{repository.full_path}:#{project.id}" } + let(:namespace) { "project:#{project.id}" } let(:cache) { described_class.new(repository, backend: backend) } describe '#cache_key' do subject { cache.cache_key(:foo) } it 'includes the namespace' do - expect(subject).to eq "foo:#{namespace}" + expect(subject).to eq "#{namespace}:foo" end context 'with a given namespace' do @@ -22,7 +22,7 @@ describe Gitlab::RepositoryCache do end it 'includes the full namespace' do - expect(subject).to eq "foo:#{namespace}:#{extra_namespace}" + expect(subject).to eq "#{namespace}:#{extra_namespace}:foo" end end end @@ -30,21 +30,21 @@ describe Gitlab::RepositoryCache do describe '#expire' do it 'expires the given key from the cache' do cache.expire(:foo) - expect(backend).to have_received(:delete).with("foo:#{namespace}") + expect(backend).to have_received(:delete).with("#{namespace}:foo") end end describe '#fetch' do it 'fetches the given key from the cache' do cache.fetch(:bar) - expect(backend).to have_received(:fetch).with("bar:#{namespace}") + expect(backend).to have_received(:fetch).with("#{namespace}:bar") end it 'accepts a block' do p = -> {} cache.fetch(:baz, &p) - expect(backend).to have_received(:fetch).with("baz:#{namespace}", &p) + expect(backend).to have_received(:fetch).with("#{namespace}:baz", &p) end end @@ -67,7 +67,7 @@ describe Gitlab::RepositoryCache do end it 'caches the value' do - expect(backend).to receive(:write).with("#{key}:#{namespace}", true) + expect(backend).to receive(:write).with("#{namespace}:#{key}", true) cache.fetch_without_caching_false(key) { true } end @@ -83,7 +83,7 @@ describe Gitlab::RepositoryCache do end it 'does not cache the value' do - expect(backend).not_to receive(:write).with("#{key}:#{namespace}", true) + expect(backend).not_to receive(:write).with("#{namespace}:#{key}", true) cache.fetch_without_caching_false(key, &p) end @@ -92,7 +92,7 @@ describe Gitlab::RepositoryCache do context 'when the cached value is truthy' do before do - backend.write("#{key}:#{namespace}", true) + backend.write("#{namespace}:#{key}", true) end it 'returns the cached value' do @@ -116,7 +116,7 @@ describe Gitlab::RepositoryCache do context 'when the cached value is falsey' do before do - backend.write("#{key}:#{namespace}", false) + backend.write("#{namespace}:#{key}", false) end it 'returns the result of the block' do @@ -126,7 +126,7 @@ describe Gitlab::RepositoryCache do end it 'writes the truthy value to the cache' do - expect(backend).to receive(:write).with("#{key}:#{namespace}", 'block result') + expect(backend).to receive(:write).with("#{namespace}:#{key}", 'block result') cache.fetch_without_caching_false(key) { 'block result' } end -- cgit v1.2.1 From 7d629787fb4a676798e8545b13e48c540d473986 Mon Sep 17 00:00:00 2001 From: Gabriel Mazetto Date: Fri, 16 Nov 2018 16:16:21 +0100 Subject: Add `wiki` extra namespace when repository is_wiki: true --- app/models/repository.rb | 12 ++++++++++-- spec/models/repository_spec.rb | 18 ++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 6e179f61a7b..fff6d4be275 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -1049,11 +1049,19 @@ class Repository end def cache - @cache ||= Gitlab::RepositoryCache.new(self) + @cache ||= if is_wiki + Gitlab::RepositoryCache.new(self, extra_namespace: 'wiki') + else + Gitlab::RepositoryCache.new(self) + end end def request_store_cache - @request_store_cache ||= Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore) + @request_store_cache ||= if is_wiki + Gitlab::RepositoryCache.new(self, extra_namespace: 'wiki', backend: Gitlab::SafeRequestStore) + else + Gitlab::RepositoryCache.new(self, backend: Gitlab::SafeRequestStore) + end end def tags_sorted_by_committed_date diff --git a/spec/models/repository_spec.rb b/spec/models/repository_spec.rb index 799a60ac62f..56edb0fd6da 100644 --- a/spec/models/repository_spec.rb +++ b/spec/models/repository_spec.rb @@ -2403,4 +2403,22 @@ describe Repository do repository.merge_base('master', 'fix') end end + + describe '#cache' do + subject(:cache) { repository.send(:cache) } + + it 'returns a RepositoryCache' do + expect(subject).to be_kind_of Gitlab::RepositoryCache + end + + it 'when is_wiki it includes wiki as part of key' do + allow(repository).to receive(:is_wiki) { true } + + expect(subject.namespace).to include('wiki') + end + + it 'when is_wiki is false extra_namespace is nil' do + expect(subject.namespace).not_to include('wiki') + end + end end -- cgit v1.2.1 From bec84f9112cc85815d081c4f1240d2635be9c658 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 16 Nov 2018 17:05:54 +0100 Subject: Increase rspec parallelization to 50 --- .gitlab-ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b7f18673a58..9da46f4f24b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -463,19 +463,19 @@ danger-review: rspec-pg: <<: *rspec-metadata-pg - parallel: 30 + parallel: 50 rspec-mysql: <<: *rspec-metadata-mysql - parallel: 30 + parallel: 50 rspec-pg-rails4: <<: *rspec-metadata-pg-rails4 - parallel: 30 + parallel: 50 rspec-mysql-rails4: <<: *rspec-metadata-mysql-rails4 - parallel: 30 + parallel: 50 static-analysis: <<: *dedicated-no-docs-no-db-pull-cache-job -- cgit v1.2.1 From 7b2fe02b182476ff648a7dc14ce10ea75e4b5bde Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Thu, 15 Nov 2018 13:05:39 +0100 Subject: Update the cluster docs for Knative --- doc/user/project/clusters/index.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/doc/user/project/clusters/index.md b/doc/user/project/clusters/index.md index 6b633424c82..85af0312270 100644 --- a/doc/user/project/clusters/index.md +++ b/doc/user/project/clusters/index.md @@ -228,7 +228,7 @@ twice, which can lead to confusion during deployments. | [Prometheus](https://prometheus.io/docs/introduction/overview/) | 10.4+ | Prometheus is an open-source monitoring and alerting system useful to supervise your deployed applications. | [stable/prometheus](https://github.com/helm/charts/tree/master/stable/prometheus) | | [GitLab Runner](https://docs.gitlab.com/runner/) | 10.6+ | GitLab Runner is the open source project that is used to run your jobs and send the results back to GitLab. It is used in conjunction with [GitLab CI/CD](https://about.gitlab.com/features/gitlab-ci-cd/), the open-source continuous integration service included with GitLab that coordinates the jobs. When installing the GitLab Runner via the applications, it will run in **privileged mode** by default. Make sure you read the [security implications](#security-implications) before doing so. | [runner/gitlab-runner](https://gitlab.com/charts/gitlab-runner) | | [JupyterHub](http://jupyter.org/) | 11.0+ | [JupyterHub](https://jupyterhub.readthedocs.io/en/stable/) is a multi-user service for managing notebooks across a team. [Jupyter Notebooks](https://jupyter-notebook.readthedocs.io/en/latest/) provide a web-based interactive programming environment used for data analysis, visualization, and machine learning. We use [this](https://gitlab.com/gitlab-org/jupyterhub-user-image/blob/master/Dockerfile) custom Jupyter image that installs additional useful packages on top of the base Jupyter. You will also see ready-to-use DevOps Runbooks built with Nurtch's [Rubix library](https://github.com/amit1rrr/rubix). More information on creating executable runbooks can be found at [Nurtch Documentation](http://docs.nurtch.com/en/latest). **Note**: Authentication will be enabled for any user of the GitLab server via OAuth2. HTTPS will be supported in a future release. | [jupyter/jupyterhub](https://jupyterhub.github.io/helm-chart/) | -| [Knative](https://cloud.google.com/knative) | 0.1.2 | Knative provides a platform to create, deploy, and manage serverless workloads from a Kubernetes cluster. It is used in conjunction with, and includes [Istio](https://istio.io) to provide an external IP address for all programs hosted by Knative. You will be prompted to enter a wildcard domain where your applications will be exposed. Configure your DNS server to use the external IP address for that domain. For any application created and installed, they will be accessible as `..`. **Note**: This will require your kubernetes cluster to have RBAC enabled. | [knative/knative](https://storage.googleapis.com/triggermesh-charts) +| [Knative](https://cloud.google.com/knative) | 11.5+ | Knative provides a platform to create, deploy, and manage serverless workloads from a Kubernetes cluster. It is used in conjunction with, and includes [Istio](https://istio.io) to provide an external IP address for all programs hosted by Knative. You will be prompted to enter a wildcard domain where your applications will be exposed. Configure your DNS server to use the external IP address for that domain. For any application created and installed, they will be accessible as `..`. This will require your kubernetes cluster to have [RBAC enabled](#role-based-access-control-rbac). | [knative/knative](https://storage.googleapis.com/triggermesh-charts) ## Getting the external IP address @@ -263,6 +263,9 @@ the `gcloud` command in a local terminal or using the **Cloud Shell**. If the cluster is not on GKE, follow the specific instructions for your Kubernetes provider to configure `kubectl` with the right credentials. +The output of the following examples will show the external IP address of your +cluster. This information can then be used to set up DNS entries and forwarding +rules that allow external access to your deployed applications. If you installed the Ingress [via the **Applications**](#installing-applications), run the following command: @@ -271,28 +274,23 @@ run the following command: kubectl get svc --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` -NOTE: **Note:** -For Istio/Knative, use the following command: +For Istio/Knative, the command will be different: ```bash kubectl get svc --namespace=istio-system knative-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` -Otherwise, you can list the IP addresses of all load balancers: +Some Kubernetes clusters return a hostname instead, like [Amazon EKS](https://aws.amazon.com/eks/). For these platforms, run: ```bash -kubectl get svc --all-namespaces -o jsonpath='{range.items[?(@.status.loadBalancer.ingress)]}{.status.loadBalancer.ingress[*].ip} ' +kubectl get service ingress-nginx-ingress-controller -n gitlab-managed-apps -o jsonpath="{.status.loadBalancer.ingress[0].hostname}". ``` -> **Note**: Some Kubernetes clusters return a hostname instead, like [Amazon EKS](https://aws.amazon.com/eks/). For these platforms, run: - -> ```bash -> kubectl get service ingress-nginx-ingress-controller -n gitlab-managed-apps -o jsonpath="{.status.loadBalancer.ingress[0].hostname}". -> ``` +Otherwise, you can list the IP addresses of all load balancers: -The output is the external IP address of your cluster. This information can then -be used to set up DNS entries and forwarding rules that allow external access to -your deployed applications. +```bash +kubectl get svc --all-namespaces -o jsonpath='{range.items[?(@.status.loadBalancer.ingress)]}{.status.loadBalancer.ingress[*].ip} ' +``` ### Using a static IP -- cgit v1.2.1 From 2f2c45bd3dc2eb30ef8b22b19e6343dd4046c815 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Mon, 12 Nov 2018 17:07:35 +0100 Subject: Add docs for linking in changed pages from MR widget --- doc/ci/environments.md | 34 ++++++++++++++++++++++++++-------- doc/ci/img/view_on_env_blob.png | Bin 32924 -> 11889 bytes doc/ci/img/view_on_mr_widget.png | Bin 0 -> 21969 bytes 3 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 doc/ci/img/view_on_mr_widget.png diff --git a/doc/ci/environments.md b/doc/ci/environments.md index 4d740c32fd6..6874583256a 100644 --- a/doc/ci/environments.md +++ b/doc/ci/environments.md @@ -416,19 +416,18 @@ and/or `production`) you can see this information in the merge request itself. ### Go directly from source files to public pages on the environment -> Introduced in GitLab 8.17. +> Introduced in GitLab 8.17. In GitLab 11.5 the file links +are surfaced to the merge request widget. -To go one step further, we can specify a Route Map to get GitLab to show us "View on [environment URL]" buttons to go directly from a file to that file's representation on the deployed website. It will be exposed in a few places: - -| In the diff for a merge request, comparison or commit | In the file view | -| ------ | ------ | -| !["View on env" button in merge request diff](img/view_on_env_mr.png) | !["View on env" button in file view](img/view_on_env_blob.png) | +You can specify a Route Map to get GitLab to show "View on " +buttons to go directly from a file to that file's representation on the +[deployed website via Review Apps](review_apps/index.md). To get this to work, you need to tell GitLab how the paths of files in your repository map to paths of pages on your website, using a Route Map. A Route Map is a file inside the repository at `.gitlab/route-map.yml`, which contains a YAML array that maps `source` paths (in the repository) to `public` paths (on the website). - -This is an example of a route map for [Middleman](https://middlemanapp.com) static websites like [http://about.gitlab.com](https://gitlab.com/gitlab-com/www-gitlab-com): +Below is an example of a route map for [Middleman](https://middlemanapp.com) static websites +like : ```yaml # Team data @@ -467,6 +466,25 @@ In the example above, the fact that mappings are evaluated in order of their def --- +Once you have the route mapping set up, it will be exposed in a few places: + +- In the merge request widget. The **View app** button will take you to the + environment URL you have set up in `.gitlab-ci.yml`. The dropdown will render + the first 5 matched items from the route map, but you can filter them if more + than 5 are available. + + ![View app file list in merge request widget](img/view_on_mr_widget.png) + +- In the diff for a merge request, comparison, or commit. + + !["View on env" button in merge request diff](img/view_on_env_mr.png) + +- In the blob file view. + + !["View on env" button in file view](img/view_on_env_blob.png) | + +--- + We now have a full development cycle, where our app is tested, built, deployed as a Review app, deployed to a staging server once the merge request is merged, and finally manually deployed to the production server. What we just described diff --git a/doc/ci/img/view_on_env_blob.png b/doc/ci/img/view_on_env_blob.png index dd9ca40280a..acc457fbb38 100644 Binary files a/doc/ci/img/view_on_env_blob.png and b/doc/ci/img/view_on_env_blob.png differ diff --git a/doc/ci/img/view_on_mr_widget.png b/doc/ci/img/view_on_mr_widget.png new file mode 100644 index 00000000000..04f4b58df62 Binary files /dev/null and b/doc/ci/img/view_on_mr_widget.png differ -- cgit v1.2.1 From c900d58849ecf5910aa9dabb23aa0d403b6d6d72 Mon Sep 17 00:00:00 2001 From: Cynthia Ng Date: Fri, 16 Nov 2018 18:18:32 +0000 Subject: minor: format fix for GH import page --- doc/user/project/import/github.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user/project/import/github.md b/doc/user/project/import/github.md index 3e4be043199..42da2210fab 100644 --- a/doc/user/project/import/github.md +++ b/doc/user/project/import/github.md @@ -17,6 +17,7 @@ the [GitHub rake task](../../../administration/raketasks/github_import.md) to im GitHub without the constraints of a Sidekiq worker. The following aspects of a project are imported: + * Repository description (GitLab.com & 7.7+) * Git repository data (GitLab.com & 7.7+) * Issues (GitLab.com & 7.7+) -- cgit v1.2.1 From 3ed37f181e53298e51987558bd0d4b345cb168e9 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 16 Nov 2018 19:32:14 +0100 Subject: Make the table of tech writers and stages more compact --- danger/documentation/Dangerfile | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/danger/documentation/Dangerfile b/danger/documentation/Dangerfile index 1ee025f0972..87c61d6e90d 100644 --- a/danger/documentation/Dangerfile +++ b/danger/documentation/Dangerfile @@ -15,10 +15,10 @@ docs_paths_to_review = docs_paths_requiring_review(helper.all_changed_files) unless docs_paths_to_review.empty? message 'This merge request adds or changes files that require a ' \ - 'review from the docs team.' + 'review from the Docs team.' markdown(<<~MARKDOWN) -## Docs Review +## Docs review The following files require a review from the Documentation team: @@ -32,24 +32,15 @@ the documentation. GitLabbers are also welcome to use the [#docs](https://gitlab Who to ping [based on DevOps stages](https://about.gitlab.com/handbook/product/categories/#devops-stages): -| Stage | Tech writer | -| ------------- | ----------- | -| ~Create | `@marcia` | -| ~Configure | `@eread` | -| ~Distribution | `@axil` | -| ~Geo | `@eread` | -| ~Gitaly | `@axil` | -| ~Gitter | `@axil` | -| ~Manage | `@eread` | -| ~Monitoring | `@axil` | -| ~Packaging | `@axil` | -| ~Plan | `@mikelewis`| -| ~Release | `marcia` | -| ~Secure | `@axil` | -| ~Verify | `@eread` | +| Tech writer | Stage(s) | +| ------------ | ------------------------------------------------------------ | +| `@marcia` | ~Create ~Release | +| `@axil` | ~Distribution ~Gitaly ~Gitter ~Monitoring ~Packaging ~Secure | +| `@eread` | ~Manage ~Configure ~Geo ~Verify | +| `@mikelewis` | ~Plan | If you are not sure which category the change falls within, or the change is not -part of one of these categories, you can mention the whole team with `@gl-docsteam`. +part of one of these categories, you can mention one of the usernames above. MARKDOWN unless gitlab.mr_labels.include?('Documentation') -- cgit v1.2.1 From fbe3667ae2209d844ea89ec69f2da1e3d7cfc36c Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Fri, 16 Nov 2018 20:13:36 +0100 Subject: Fix some "Introduced in" inconsistencies --- doc/user/project/merge_requests/index.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/user/project/merge_requests/index.md b/doc/user/project/merge_requests/index.md index f2f2497f0be..8a68185798b 100644 --- a/doc/user/project/merge_requests/index.md +++ b/doc/user/project/merge_requests/index.md @@ -177,11 +177,11 @@ administrator to do so. ### Adding patches when creating a merge request via e-mail -> **Note**: This feature was [implemented in GitLab 11.5](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22723) +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/22723) in GitLab 11.5. You can add commits to the merge request being created by adding -patches as attachments to the email, all attachments with a filename -ending in `.patch` will be considered patches. The patches will be processed +patches as attachments to the email. All attachments with a filename +ending in `.patch` will be considered patches and they will be processed ordered by name. The combined size of the patches can be 2MB. @@ -194,7 +194,7 @@ branch already exists, the patches will be applied on top of it. ## Find the merge request that introduced a change -> **Note**: this feature was [implemented in GitLab 10.5](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383). +> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/2383) in GitLab 10.5. When viewing the commit details page, GitLab will link to the merge request (or merge requests, if it's in more than one) containing that commit. -- cgit v1.2.1 From 8b1f2823a28ce791e6e0a56f36aeebc7e61740cc Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Fri, 16 Nov 2018 19:29:11 +0000 Subject: Use @gitlab npm namespace --- app/assets/javascripts/badges/components/badge.vue | 2 +- .../javascripts/badges/components/badge_form.vue | 2 +- .../javascripts/badges/components/badge_list.vue | 2 +- .../badges/components/badge_list_row.vue | 2 +- .../javascripts/boards/components/board_list.vue | 2 +- .../boards/components/board_new_issue.vue | 2 +- .../boards/components/issue_card_inner.vue | 4 +- .../boards/components/issue_due_date.vue | 2 +- .../boards/components/issue_time_estimate.vue | 2 +- .../javascripts/boards/components/modal/index.vue | 2 +- .../boards/components/modal/lists_dropdown.vue | 2 +- .../boards/components/project_select.vue | 2 +- .../deploy_keys/components/action_btn.vue | 2 +- .../javascripts/deploy_keys/components/app.vue | 2 +- app/assets/javascripts/diffs/components/app.vue | 2 +- .../diffs/components/compare_versions.vue | 2 +- .../javascripts/diffs/components/diff_file.vue | 2 +- .../diffs/components/diff_gutter_avatars.vue | 2 +- .../javascripts/diffs/components/tree_list.vue | 2 +- .../environments/components/container.vue | 2 +- .../components/environment_actions.vue | 2 +- .../components/environment_external_url.vue | 2 +- .../environments/components/environment_item.vue | 2 +- .../components/environment_monitoring.vue | 2 +- .../components/environment_rollback.vue | 4 +- .../environments/components/environment_stop.vue | 2 +- .../components/environment_terminal_button.vue | 2 +- .../environments/components/environments_table.vue | 2 +- .../components/stop_environment_modal.vue | 2 +- .../javascripts/frequent_items/components/app.vue | 2 +- app/assets/javascripts/groups/components/app.vue | 2 +- .../ide/components/branches/search_list.vue | 2 +- .../javascripts/ide/components/error_message.vue | 2 +- .../ide/components/file_templates/dropdown.vue | 2 +- .../javascripts/ide/components/ide_side_bar.vue | 2 +- .../javascripts/ide/components/ide_tree_list.vue | 2 +- .../javascripts/ide/components/jobs/list.vue | 2 +- .../javascripts/ide/components/jobs/stage.vue | 2 +- .../ide/components/merge_requests/list.vue | 2 +- .../javascripts/ide/components/pipelines/list.vue | 2 +- .../ide/components/preview/clientside.vue | 2 +- .../ide/components/preview/navigator.vue | 2 +- .../jobs/components/artifacts_block.vue | 2 +- .../javascripts/jobs/components/commit_block.vue | 2 +- .../javascripts/jobs/components/empty_state.vue | 2 +- .../javascripts/jobs/components/erased_block.vue | 2 +- app/assets/javascripts/jobs/components/job_app.vue | 2 +- .../jobs/components/job_container_item.vue | 2 +- .../jobs/components/job_log_controllers.vue | 2 +- app/assets/javascripts/jobs/components/sidebar.vue | 2 +- .../jobs/components/sidebar_detail_row.vue | 2 +- .../javascripts/jobs/components/stuck_block.vue | 2 +- .../javascripts/jobs/components/trigger_block.vue | 2 +- app/assets/javascripts/notes.js | 2 +- .../notes/components/diff_with_note.vue | 2 +- .../javascripts/notes/components/note_actions.vue | 2 +- .../wikis/components/delete_wiki_modal.vue | 2 +- .../pipelines/components/empty_state.vue | 2 +- .../components/graph/action_component.vue | 2 +- .../pipelines/components/graph/graph_component.vue | 2 +- .../components/graph/job_group_dropdown.vue | 2 +- .../pipelines/components/graph/job_item.vue | 2 +- .../pipelines/components/header_component.vue | 2 +- .../pipelines/components/nav_controls.vue | 2 +- .../pipelines/components/pipeline_url.vue | 2 +- .../pipelines/components/pipelines_actions.vue | 2 +- .../pipelines/components/pipelines_artifacts.vue | 2 +- .../javascripts/pipelines/components/stage.vue | 2 +- .../javascripts/pipelines/mixins/pipelines.js | 2 +- .../components/gke_dropdown_mixin.js | 2 +- .../commit_pipeline_status_component.vue | 2 +- app/assets/javascripts/registry/components/app.vue | 2 +- .../registry/components/collapsible_container.vue | 2 +- .../javascripts/reports/components/summary_row.vue | 2 +- .../set_status_modal/set_status_modal_wrapper.vue | 2 +- .../components/participants/participants.vue | 2 +- .../components/time_tracking/comparison_pane.vue | 2 +- .../sidebar/components/todo_toggle/todo.vue | 2 +- .../components/mr_widget_status_icon.vue | 2 +- .../states/mr_widget_auto_merge_failed.vue | 2 +- .../components/states/mr_widget_merged.vue | 2 +- .../components/states/mr_widget_rebase.vue | 2 +- .../vue_shared/components/changed_file_icon.vue | 2 +- .../vue_shared/components/ci_badge_link.vue | 2 +- .../vue_shared/components/clipboard_button.vue | 2 +- .../javascripts/vue_shared/components/commit.vue | 2 +- .../content_viewer/viewers/download_viewer.vue | 2 +- .../content_viewer/viewers/markdown_viewer.vue | 2 +- .../components/dropdown/dropdown_button.vue | 2 +- .../vue_shared/components/file_icon.vue | 2 +- .../vue_shared/components/gl_countdown.vue | 2 +- .../vue_shared/components/header_ci_component.vue | 2 +- .../vue_shared/components/loading_button.vue | 2 +- .../vue_shared/components/markdown/header.vue | 2 +- .../vue_shared/components/markdown/toolbar.vue | 2 +- .../components/markdown/toolbar_button.vue | 2 +- .../vue_shared/components/notes/skeleton_note.vue | 2 +- .../vue_shared/components/pagination_links.vue | 2 +- .../vue_shared/components/sidebar/date_picker.vue | 2 +- .../components/sidebar/labels_select/base.vue | 2 +- .../vue_shared/components/toggle_button.vue | 2 +- .../components/user_avatar/user_avatar_image.vue | 2 +- .../components/user_avatar/user_avatar_link.vue | 2 +- package.json | 2 +- yarn.lock | 120 ++++++++++++++++++--- 105 files changed, 210 insertions(+), 122 deletions(-) diff --git a/app/assets/javascripts/badges/components/badge.vue b/app/assets/javascripts/badges/components/badge.vue index 8512bf9dd7b..ca1662313c2 100644 --- a/app/assets/javascripts/badges/components/badge.vue +++ b/app/assets/javascripts/badges/components/badge.vue @@ -1,7 +1,7 @@ diff --git a/app/assets/javascripts/badges/components/badge_list_row.vue b/app/assets/javascripts/badges/components/badge_list_row.vue index d01465232a7..9051be1e102 100644 --- a/app/assets/javascripts/badges/components/badge_list_row.vue +++ b/app/assets/javascripts/badges/components/badge_list_row.vue @@ -50,20 +50,14 @@ export default { {{ badgeKindText }} diff --git a/app/assets/javascripts/badges/components/badge_settings.vue b/app/assets/javascripts/badges/components/badge_settings.vue index cc47e56dd1e..75a522efe7e 100644 --- a/app/assets/javascripts/badges/components/badge_settings.vue +++ b/app/assets/javascripts/badges/components/badge_settings.vue @@ -46,7 +46,8 @@ export default { :header-title-text="s__('Badges|Delete badge?')" :footer-primary-button-text="s__('Badges|Delete badge')" footer-primary-button-variant="danger" - @submit="onSubmitModal"> + @submit="onSubmitModal" + >

    - + - +
    diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js index befa1dc455f..d0359fc5fe9 100644 --- a/app/assets/javascripts/blob/viewer/index.js +++ b/app/assets/javascripts/blob/viewer/index.js @@ -23,10 +23,12 @@ export default class BlobViewer { if (!viewer || !viewer.dataset.richType) return; const initViewer = promise => - promise.then(module => module.default(viewer)).catch(error => { - Flash('Error loading file viewer.'); - throw error; - }); + promise + .then(module => module.default(viewer)) + .catch(error => { + Flash('Error loading file viewer.'); + throw error; + }); switch (viewer.dataset.richType) { case 'balsamiq': diff --git a/app/assets/javascripts/boards/components/board_blank_state.vue b/app/assets/javascripts/boards/components/board_blank_state.vue index 561a4636ef5..667eea17d44 100644 --- a/app/assets/javascripts/boards/components/board_blank_state.vue +++ b/app/assets/javascripts/boards/components/board_blank_state.vue @@ -61,35 +61,25 @@ export default {