diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 14:28:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-06 14:28:26 +0300 |
commit | 7d5e6412bef7fd457e22532faf859e551f8196fc (patch) | |
tree | dc62b4a7a5fad8ba0ba260ae82e95f8e984f2398 | |
parent | 8e94dad32b10edebf79285c083176c2b7005ef64 (diff) |
Add latest changes from gitlab-org/gitlab@master
33 files changed, 272 insertions, 74 deletions
diff --git a/CHANGELOG-EE.md b/CHANGELOG-EE.md index f2068d36ffc..2ae7cb4c249 100644 --- a/CHANGELOG-EE.md +++ b/CHANGELOG-EE.md @@ -1,5 +1,9 @@ Please view this file on the master branch, on stable branches it's out of date. +## 12.8.3 + +- No changes. + ## 12.8.2 ### Security (5 changes) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0493d54fc8..3dfbbc730b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,29 @@ documentation](doc/development/changelog.md) for instructions on adding your own entry. +## 12.8.3 + +### Fixed (8 changes) + +- Fix Group Import API file upload when object storage is disabled. !25715 +- Fix Web IDE fork modal showing no text. !25842 +- Fixed regression when URL was encoded in a loop. !25849 +- Fixed repository browsing for folders with non-ascii characters. !25877 +- Fix search for Sentry error list. !26129 +- Send credentials with GraphQL fetch requests. !26386 +- Show CI status in project dashboards. !26403 +- Rescue invalid URLs during badge retrieval in asset proxy. !26524 + +### Performance (2 changes) + +- Disable Marginalia line backtrace in production. !26199 +- Remove unnecessary Redis deletes for broadcast messages. !26541 + +### Other (1 change, 1 of them is from the community) + +- Fix fixtures for Error Tracking Web UI. !26233 (Takuya Noguchi) + + ## 12.8.2 ### Security (17 changes) diff --git a/GITLAB_PAGES_VERSION b/GITLAB_PAGES_VERSION index 15b989e398f..092afa15df4 100644 --- a/GITLAB_PAGES_VERSION +++ b/GITLAB_PAGES_VERSION @@ -1 +1 @@ -1.16.0 +1.17.0 diff --git a/app/assets/javascripts/editor/editor_lite.js b/app/assets/javascripts/editor/editor_lite.js index 8711f6e65af..c2723b1d506 100644 --- a/app/assets/javascripts/editor/editor_lite.js +++ b/app/assets/javascripts/editor/editor_lite.js @@ -1,5 +1,5 @@ import { editor as monacoEditor, languages as monacoLanguages, Uri } from 'monaco-editor'; -import whiteTheme from '~/ide/lib/themes/white'; +import { DEFAULT_THEME, themes } from '~/ide/lib/themes'; import { defaultEditorOptions } from '~/ide/lib/editor_options'; import { clearDomElement } from './utils'; @@ -19,8 +19,10 @@ export default class Editor { } static setupMonacoTheme() { - monacoEditor.defineTheme('white', whiteTheme); - monacoEditor.setTheme('white'); + const themeName = window.gon?.user_color_scheme || DEFAULT_THEME; + const theme = themes.find(t => t.name === themeName); + if (theme) monacoEditor.defineTheme(themeName, theme.data); + monacoEditor.setTheme(theme ? themeName : DEFAULT_THEME); } createInstance({ el = undefined, blobPath = '', blobContent = '' } = {}) { diff --git a/changelogs/unreleased/202426-editor-lite-theme-preference.yml b/changelogs/unreleased/202426-editor-lite-theme-preference.yml new file mode 100644 index 00000000000..38e4004657f --- /dev/null +++ b/changelogs/unreleased/202426-editor-lite-theme-preference.yml @@ -0,0 +1,5 @@ +--- +title: In single-file editor set syntax highlighting theme according to user's preference +merge_request: 26606 +author: +type: changed diff --git a/changelogs/unreleased/207837-circular-encoding.yml b/changelogs/unreleased/207837-circular-encoding.yml deleted file mode 100644 index 30aa7bf88a5..00000000000 --- a/changelogs/unreleased/207837-circular-encoding.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fixed regression when URL was encoded in a loop -merge_request: 25849 -author: -type: fixed diff --git a/changelogs/unreleased/207857-fix-web-ide-modal-no-text.yml b/changelogs/unreleased/207857-fix-web-ide-modal-no-text.yml deleted file mode 100644 index 74bbb312f19..00000000000 --- a/changelogs/unreleased/207857-fix-web-ide-modal-no-text.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix Web IDE fork modal showing no text -merge_request: 25842 -author: -type: fixed diff --git a/changelogs/unreleased/208548-better-spec-test-for-error-tracking-web-ui.yml b/changelogs/unreleased/208548-better-spec-test-for-error-tracking-web-ui.yml deleted file mode 100644 index 6b6d479e815..00000000000 --- a/changelogs/unreleased/208548-better-spec-test-for-error-tracking-web-ui.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix fixtures for Error Tracking Web UI -merge_request: 26233 -author: Takuya Noguchi -type: other diff --git a/changelogs/unreleased/28085-index-options-tuning.yml b/changelogs/unreleased/28085-index-options-tuning.yml new file mode 100644 index 00000000000..61f46fbadb1 --- /dev/null +++ b/changelogs/unreleased/28085-index-options-tuning.yml @@ -0,0 +1,5 @@ +--- +title: Optimize storage usage for newly created ES indices +merge_request: 25992 +author: +type: other diff --git a/changelogs/unreleased/georgekoltsov-fix-import-export-uploader.yml b/changelogs/unreleased/georgekoltsov-fix-import-export-uploader.yml deleted file mode 100644 index 0c43c93ce89..00000000000 --- a/changelogs/unreleased/georgekoltsov-fix-import-export-uploader.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix Group Import API file upload when object storage is disabled -merge_request: 25715 -author: -type: fixed diff --git a/changelogs/unreleased/lm-fix-error-query.yml b/changelogs/unreleased/lm-fix-error-query.yml deleted file mode 100644 index 2baa316dd5a..00000000000 --- a/changelogs/unreleased/lm-fix-error-query.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fix search for Sentry error list -merge_request: 26129 -author: -type: fixed diff --git a/changelogs/unreleased/mc-feature-trigger-pipelines-project-subscriptions.yml b/changelogs/unreleased/mc-feature-trigger-pipelines-project-subscriptions.yml new file mode 100644 index 00000000000..b028d619816 --- /dev/null +++ b/changelogs/unreleased/mc-feature-trigger-pipelines-project-subscriptions.yml @@ -0,0 +1,5 @@ +--- +title: Add ability to trigger pipelines when project is rebuilt. +merge_request: 20063 +author: +type: added diff --git a/changelogs/unreleased/pages-1-17.yml b/changelogs/unreleased/pages-1-17.yml new file mode 100644 index 00000000000..16290eef158 --- /dev/null +++ b/changelogs/unreleased/pages-1-17.yml @@ -0,0 +1,5 @@ +--- +title: Upgrade Pages to 1.17.0 +merge_request: 26478 +author: +type: added diff --git a/changelogs/unreleased/ph-p207499-fixNonAsciiChars.yml b/changelogs/unreleased/ph-p207499-fixNonAsciiChars.yml deleted file mode 100644 index 806f4372f89..00000000000 --- a/changelogs/unreleased/ph-p207499-fixNonAsciiChars.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Fixed repository browsing for folders with non-ascii characters -merge_request: 25877 -author: -type: fixed diff --git a/changelogs/unreleased/revert-e0613e64.yml b/changelogs/unreleased/revert-e0613e64.yml deleted file mode 100644 index e94f1df2f4b..00000000000 --- a/changelogs/unreleased/revert-e0613e64.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Show CI status in project dashboards -merge_request: 26403 -author: -type: fixed diff --git a/changelogs/unreleased/sh-disable-line-in-marginalia.yml b/changelogs/unreleased/sh-disable-line-in-marginalia.yml deleted file mode 100644 index 51be4db1965..00000000000 --- a/changelogs/unreleased/sh-disable-line-in-marginalia.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Disable Marginalia line backtrace in production -merge_request: 26199 -author: -type: performance diff --git a/changelogs/unreleased/sh-optimize-broadcast-message-redis.yml b/changelogs/unreleased/sh-optimize-broadcast-message-redis.yml deleted file mode 100644 index c69f3ded73d..00000000000 --- a/changelogs/unreleased/sh-optimize-broadcast-message-redis.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Remove unnecessary Redis deletes for broadcast messages -merge_request: 26541 -author: -type: performance diff --git a/changelogs/unreleased/use-addressable-for-asset-proxy-badge-render.yml b/changelogs/unreleased/use-addressable-for-asset-proxy-badge-render.yml deleted file mode 100644 index 6a021df8027..00000000000 --- a/changelogs/unreleased/use-addressable-for-asset-proxy-badge-render.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Rescue invalid URLs during badge retrieval in asset proxy -merge_request: 26524 -author: -type: fixed diff --git a/changelogs/unreleased/vs-add-credentials-option-for-apollo-link.yml b/changelogs/unreleased/vs-add-credentials-option-for-apollo-link.yml deleted file mode 100644 index 1863f0de26f..00000000000 --- a/changelogs/unreleased/vs-add-credentials-option-for-apollo-link.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Send credentials with GraphQL fetch requests -merge_request: 26386 -author: -type: fixed diff --git a/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb b/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb new file mode 100644 index 00000000000..789f23501fb --- /dev/null +++ b/db/migrate/20200224185814_add_project_subscriptions_to_plan_limits.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class AddProjectSubscriptionsToPlanLimits < ActiveRecord::Migration[6.0] + DOWNTIME = false + + def change + add_column(:plan_limits, :ci_project_subscriptions, :integer, default: 0, null: false) + end +end diff --git a/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb b/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb new file mode 100644 index 00000000000..4a05e2cd779 --- /dev/null +++ b/db/migrate/20200225123228_insert_project_subscriptions_plan_limits.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class InsertProjectSubscriptionsPlanLimits < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def up + return if Rails.env.test? + + if Gitlab.com? + create_or_update_plan_limit('ci_project_subscriptions', 'free', 2) + create_or_update_plan_limit('ci_project_subscriptions', 'bronze', 2) + create_or_update_plan_limit('ci_project_subscriptions', 'silver', 2) + create_or_update_plan_limit('ci_project_subscriptions', 'gold', 2) + else + create_or_update_plan_limit('ci_project_subscriptions', 'default', 2) + end + end + + def down + return if Rails.env.test? + + if Gitlab.com? + create_or_update_plan_limit('ci_project_subscriptions', 'free', 0) + create_or_update_plan_limit('ci_project_subscriptions', 'bronze', 0) + create_or_update_plan_limit('ci_project_subscriptions', 'silver', 0) + create_or_update_plan_limit('ci_project_subscriptions', 'gold', 0) + else + create_or_update_plan_limit('ci_project_subscriptions', 'default', 0) + end + end +end diff --git a/db/migrate/20200228160542_create_ci_sources_projects.rb b/db/migrate/20200228160542_create_ci_sources_projects.rb new file mode 100644 index 00000000000..36f5167a784 --- /dev/null +++ b/db/migrate/20200228160542_create_ci_sources_projects.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class CreateCiSourcesProjects < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :ci_sources_projects do |t| + t.bigint :pipeline_id, null: false + t.bigint :source_project_id, null: false + + t.index [:source_project_id, :pipeline_id], unique: true + t.index :pipeline_id + end + end +end diff --git a/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb new file mode 100644 index 00000000000..db78d9594b0 --- /dev/null +++ b/db/migrate/20200304121828_add_ci_sources_project_pipeline_foreign_key.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddCiSourcesProjectPipelineForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + with_lock_retries do + add_foreign_key :ci_sources_projects, :ci_pipelines, column: :pipeline_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end +end diff --git a/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb new file mode 100644 index 00000000000..88bf835b9f1 --- /dev/null +++ b/db/migrate/20200304121844_add_ci_sources_project_source_project_foreign_key.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +class AddCiSourcesProjectSourceProjectForeignKey < ActiveRecord::Migration[6.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + with_lock_retries do + add_foreign_key :ci_sources_projects, :projects, column: :source_project_id, on_delete: :cascade # rubocop:disable Migration/AddConcurrentForeignKey + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e77e8e44b62..a9cc6d89c6d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -966,6 +966,13 @@ ActiveRecord::Schema.define(version: 2020_03_04_160823) do t.index ["source_project_id"], name: "index_ci_sources_pipelines_on_source_project_id" end + create_table "ci_sources_projects", force: :cascade do |t| + t.bigint "pipeline_id", null: false + t.bigint "source_project_id", null: false + t.index ["pipeline_id"], name: "index_ci_sources_projects_on_pipeline_id" + t.index ["source_project_id", "pipeline_id"], name: "index_ci_sources_projects_on_source_project_id_and_pipeline_id", unique: true + end + create_table "ci_stages", id: :serial, force: :cascade do |t| t.integer "project_id" t.integer "pipeline_id" @@ -3131,6 +3138,7 @@ ActiveRecord::Schema.define(version: 2020_03_04_160823) do t.integer "ci_active_jobs", default: 0, null: false t.integer "project_hooks", default: 0, null: false t.integer "group_hooks", default: 0, null: false + t.integer "ci_project_subscriptions", default: 0, null: false t.index ["plan_id"], name: "index_plan_limits_on_plan_id", unique: true end @@ -4735,6 +4743,8 @@ ActiveRecord::Schema.define(version: 2020_03_04_160823) do add_foreign_key "ci_sources_pipelines", "ci_pipelines", column: "source_pipeline_id", name: "fk_d4e29af7d7", on_delete: :cascade add_foreign_key "ci_sources_pipelines", "projects", column: "source_project_id", name: "fk_acd9737679", on_delete: :cascade add_foreign_key "ci_sources_pipelines", "projects", name: "fk_1e53c97c0a", on_delete: :cascade + add_foreign_key "ci_sources_projects", "ci_pipelines", column: "pipeline_id", on_delete: :cascade + add_foreign_key "ci_sources_projects", "projects", column: "source_project_id", on_delete: :cascade add_foreign_key "ci_stages", "ci_pipelines", column: "pipeline_id", name: "fk_fb57e6cc56", on_delete: :cascade add_foreign_key "ci_stages", "projects", name: "fk_2360681d1d", on_delete: :cascade add_foreign_key "ci_subscriptions_projects", "projects", column: "downstream_project_id", on_delete: :cascade diff --git a/doc/administration/instance_limits.md b/doc/administration/instance_limits.md index 7beb1193459..c005af750ba 100644 --- a/doc/administration/instance_limits.md +++ b/doc/administration/instance_limits.md @@ -87,6 +87,28 @@ Plan.default.limits.update!(ci_active_jobs: 500) NOTE: **Note:** Set the limit to `0` to disable it. +### Number of CI/CD subscriptions to a project + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/9045) in GitLab 12.9. + +The total number of subscriptions can be limited per project. This limit is +checked each time a new subscription is created. + +If a new subscription would cause the total number of subscription to exceed the +limit, the subscription will be considered invalid. + +- On GitLab.com different [limits are defined per plan](../user/gitlab_com/index.md#gitlab-cicd) and they affect all projects under that plan. +- On [GitLab Starter](https://about.gitlab.com/pricing/#self-managed) tier or higher self-hosted installations, this limit is defined for the `default` plan that affects all projects. + +To set this limit on a self-hosted installation, run the following in the +[GitLab Rails console](https://docs.gitlab.com/omnibus/maintenance/#starting-a-rails-console-session): + +```ruby +Plan.default.limits.update!(ci_project_subscriptions: 500) +``` + +NOTE: **Note:** Set the limit to `0` to disable it. + ## Environment data on Deploy Boards [Deploy Boards](../user/project/deploy_boards.md) load information from Kubernetes about diff --git a/doc/ci/multi_project_pipelines.md b/doc/ci/multi_project_pipelines.md index bf59d06f582..e41a6f0d9b1 100644 --- a/doc/ci/multi_project_pipelines.md +++ b/doc/ci/multi_project_pipelines.md @@ -227,3 +227,19 @@ Some features are not implemented yet. For example, support for environments. - `only` and `except` - `when` (only with `on_success`, `on_failure`, and `always` values) - `extends` + +## Trigger a pipeline when an upstream project is rebuilt + +> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/9045) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.8. + +You can trigger a pipeline in your project whenever a pipeline finishes for a new +tag in a different project: + +1. Go to the project's **Settings > CI / CD** page, and expand the **Pipeline subscriptions** section. +1. Enter the path to the project you want to subscribe to. +1. Click subscribe. + +Any pipelines that complete successfully for new tags in the subscribed project +will now trigger a pipeline on the current project's default branch. The maximum +number of upstream pipeline subscriptions is 2, for both the upstream and +downstream projects. diff --git a/doc/development/application_limits.md b/doc/development/application_limits.md index f89b238cd79..81ccebbd690 100644 --- a/doc/development/application_limits.md +++ b/doc/development/application_limits.md @@ -39,6 +39,12 @@ limit values. It's recommended to create separate migration script files. create_or_update_plan_limit('project_hooks', 'gold', 100) ``` +NOTE: **Note:** Some plans exist only on GitLab.com. You can check if the +migration is running on GitLab.com with `Gitlab.com?`. + +NOTE: **Note:** The test environment doesn't have any plans. You can check if a +migration is running in a test environment with `Rails.env.test?` + ### Plan limits validation #### Get current limit @@ -93,3 +99,20 @@ it_behaves_like 'includes Limitable concern' do subject { build(:project_hook, project: create(:project)) } end ``` + +### Subscription Plans + +Self-hosted: + +- `default` - Everyone + +Hosted: + +- `free` - Everyone +- `bronze`- Namespaces with a Bronze subscription +- `silver` - Namespaces with a Silver subscription +- `gold` - Namespaces with a Gold subscription + +NOTE: **Note:** Hosted plans exist only on GitLab.com. + +NOTE: **Note:** The test environment doesn't have any plans. diff --git a/doc/development/dangerbot.md b/doc/development/dangerbot.md index eec81098144..b6362f04311 100644 --- a/doc/development/dangerbot.md +++ b/doc/development/dangerbot.md @@ -15,22 +15,19 @@ to the existing rules, then this is the document for you. ## Danger comments in merge requests -As of [2020-03-03](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26275), -Danger is posting a new comment each time it runs in a pipeline and removes the -previous comments it posted. Before that, Danger would only post one comment and -update its content on subsequent `danger-review` runs. +Danger only posts one comment and updates its content on subsequent +`danger-review` runs. Given this, it's usually one of the first few comments +in a merge request if not the first. If you didn't see it, try to look +from the start of the merge request. ### Advantages -- You get email notifications of Danger failures before the pipeline fails. -- If someone introduces a change that creates a new Danger warning, it's very obvious now, both in email and in the UI. -- If there are no new Danger warnings - just the roulette message - then the email acts as confirmation of that. -- It's easier to see if a roulette recommendation changed, which is useful for people that think about roulette logic/behavior quite often. -- You don't have to scroll up to get to the first Danger comment (sometimes MR can have more than discussions). +- You don't get email notifications each time `danger-review` runs. ### Disadvantages -- You get new email notifications for each `danger-review` run, which can clutter threaded discussions in email clients. +- It's not obvious Danger will update the old comment, thus you need to + pay attention to it if it is updated or not. ## Run Danger locally diff --git a/doc/user/project/settings/import_export.md b/doc/user/project/settings/import_export.md index d32b4847230..c69a4740ab3 100644 --- a/doc/user/project/settings/import_export.md +++ b/doc/user/project/settings/import_export.md @@ -77,6 +77,7 @@ The following items will be exported: - Design Management files and data **(PREMIUM)** - LFS objects - Issue boards +- Pipelines history The following items will NOT be exported: diff --git a/locale/gitlab.pot b/locale/gitlab.pot index cb9cff0b988..e93052df7e0 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -861,6 +861,9 @@ msgstr "" msgid "A secure token that identifies an external storage request." msgstr "" +msgid "A subscription will trigger a new pipeline on the default branch of this project when a pipeline successfully completes for a new tag on the %{default_branch_docs} of the subscribed project." +msgstr "" + msgid "A user with write access to the source branch selected this option" msgstr "" @@ -18897,9 +18900,6 @@ msgstr "" msgid "Subscriptions" msgstr "" -msgid "Subscriptions allow successfully completed pipelines on the %{default_branch_docs} of the subscribed project to trigger a new pipeline on the default branch of this project." -msgstr "" - msgid "Subtracted" msgstr "" @@ -19738,7 +19738,7 @@ msgstr "" msgid "There are no unstaged changes" msgstr "" -msgid "There is a limit of 100 subscriptions from or to a project." +msgid "There is a limit of %{ci_project_subscriptions_limit} subscriptions from or to a project." msgstr "" msgid "There is already a repository with that name on disk" @@ -20203,7 +20203,7 @@ msgstr "" msgid "This project is archived and cannot be commented on." msgstr "" -msgid "This project path either does not exist or is private." +msgid "This project path either does not exist or you do not have access." msgstr "" msgid "This project will be removed on %{date}" diff --git a/spec/javascripts/editor/editor_lite_spec.js b/spec/javascripts/editor/editor_lite_spec.js index 154daccf82d..106264aa13f 100644 --- a/spec/javascripts/editor/editor_lite_spec.js +++ b/spec/javascripts/editor/editor_lite_spec.js @@ -1,5 +1,6 @@ import { editor as monacoEditor, Uri } from 'monaco-editor'; import Editor from '~/editor/editor_lite'; +import { DEFAULT_THEME, themes } from '~/ide/lib/themes'; describe('Base editor', () => { let editorEl; @@ -108,4 +109,52 @@ describe('Base editor', () => { expect(editor.model.getLanguageIdentifier().language).toEqual('plaintext'); }); }); + + describe('syntax highlighting theme', () => { + let themeDefineSpy; + let themeSetSpy; + let defaultScheme; + + beforeEach(() => { + themeDefineSpy = spyOn(monacoEditor, 'defineTheme'); + themeSetSpy = spyOn(monacoEditor, 'setTheme'); + defaultScheme = window.gon.user_color_scheme; + }); + + afterEach(() => { + window.gon.user_color_scheme = defaultScheme; + }); + + it('sets default syntax highlighting theme', () => { + const expectedTheme = themes.find(t => t.name === DEFAULT_THEME); + + editor = new Editor(); + + expect(themeDefineSpy).toHaveBeenCalledWith(DEFAULT_THEME, expectedTheme.data); + expect(themeSetSpy).toHaveBeenCalledWith(DEFAULT_THEME); + }); + + it('sets correct theme if it is set in users preferences', () => { + const expectedTheme = themes.find(t => t.name !== DEFAULT_THEME); + + expect(expectedTheme.name).not.toBe(DEFAULT_THEME); + + window.gon.user_color_scheme = expectedTheme.name; + editor = new Editor(); + + expect(themeDefineSpy).toHaveBeenCalledWith(expectedTheme.name, expectedTheme.data); + expect(themeSetSpy).toHaveBeenCalledWith(expectedTheme.name); + }); + + it('falls back to default theme if a selected one is not supported yet', () => { + const name = 'non-existent-theme'; + const nonExistentTheme = { name }; + + window.gon.user_color_scheme = nonExistentTheme.name; + editor = new Editor(); + + expect(themeDefineSpy).not.toHaveBeenCalled(); + expect(themeSetSpy).toHaveBeenCalledWith(DEFAULT_THEME); + }); + }); }); diff --git a/spec/lib/gitlab/import_export/all_models.yml b/spec/lib/gitlab/import_export/all_models.yml index bbb61b4c356..e579c8474b7 100644 --- a/spec/lib/gitlab/import_export/all_models.yml +++ b/spec/lib/gitlab/import_export/all_models.yml @@ -197,6 +197,7 @@ ci_pipelines: - source_bridge - source_job - sourced_pipelines +- source_project - triggered_by_pipeline - triggered_pipelines - child_pipelines |