Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-03-06 11:28:26 +00:00
parent 8e94dad32b
commit 7d5e6412be
33 changed files with 272 additions and 74 deletions

View file

@ -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)

View file

@ -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)

View file

@ -1 +1 @@
1.16.0
1.17.0

View file

@ -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 = '' } = {}) {

View file

@ -0,0 +1,5 @@
---
title: In single-file editor set syntax highlighting theme according to user's preference
merge_request: 26606
author:
type: changed

View file

@ -1,5 +0,0 @@
---
title: Fixed regression when URL was encoded in a loop
merge_request: 25849
author:
type: fixed

View file

@ -1,5 +0,0 @@
---
title: Fix Web IDE fork modal showing no text
merge_request: 25842
author:
type: fixed

View file

@ -1,5 +0,0 @@
---
title: Fix fixtures for Error Tracking Web UI
merge_request: 26233
author: Takuya Noguchi
type: other

View file

@ -0,0 +1,5 @@
---
title: Optimize storage usage for newly created ES indices
merge_request: 25992
author:
type: other

View file

@ -1,5 +0,0 @@
---
title: Fix Group Import API file upload when object storage is disabled
merge_request: 25715
author:
type: fixed

View file

@ -1,5 +0,0 @@
---
title: Fix search for Sentry error list
merge_request: 26129
author:
type: fixed

View file

@ -0,0 +1,5 @@
---
title: Add ability to trigger pipelines when project is rebuilt.
merge_request: 20063
author:
type: added

View file

@ -0,0 +1,5 @@
---
title: Upgrade Pages to 1.17.0
merge_request: 26478
author:
type: added

View file

@ -1,5 +0,0 @@
---
title: Fixed repository browsing for folders with non-ascii characters
merge_request: 25877
author:
type: fixed

View file

@ -1,5 +0,0 @@
---
title: Show CI status in project dashboards
merge_request: 26403
author:
type: fixed

View file

@ -1,5 +0,0 @@
---
title: Disable Marginalia line backtrace in production
merge_request: 26199
author:
type: performance

View file

@ -1,5 +0,0 @@
---
title: Remove unnecessary Redis deletes for broadcast messages
merge_request: 26541
author:
type: performance

View file

@ -1,5 +0,0 @@
---
title: Rescue invalid URLs during badge retrieval in asset proxy
merge_request: 26524
author:
type: fixed

View file

@ -1,5 +0,0 @@
---
title: Send credentials with GraphQL fetch requests
merge_request: 26386
author:
type: fixed

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -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

View file

@ -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:

View file

@ -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}"

View file

@ -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);
});
});
});

View file

@ -197,6 +197,7 @@ ci_pipelines:
- source_bridge
- source_job
- sourced_pipelines
- source_project
- triggered_by_pipeline
- triggered_pipelines
- child_pipelines