Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-09-27 00:06:23 +00:00
parent 4309992515
commit 41aba3c68d
9 changed files with 1195 additions and 1025 deletions

View file

@ -11,7 +11,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
const ROOT_PATH = path.resolve(__dirname, '..');
const CACHE_PATH = process.env.WEBPACK_CACHE_PATH || path.join(ROOT_PATH, 'tmp/cache');
const IS_PRODUCTION = process.env.NODE_ENV === 'production';
const IS_DEV_SERVER = process.argv.join(' ').indexOf('webpack-dev-server') !== -1;
const IS_DEV_SERVER = process.env.WEBPACK_DEV_SERVER === 'true';
const IS_EE = require('./helpers/is_ee_env');
const DEV_SERVER_HOST = process.env.DEV_SERVER_HOST || 'localhost';
const DEV_SERVER_PORT = parseInt(process.env.DEV_SERVER_PORT, 10) || 3808;
@ -209,7 +209,9 @@ module.exports = {
{
loader: 'css-loader',
options: {
name: '[name].[hash:8].[ext]',
modules: {
localIdentName: '[name]__[local].[hash:8].[ext]',
},
},
},
],
@ -373,6 +375,9 @@ module.exports = {
openAnalyzer: false,
reportFilename: path.join(ROOT_PATH, 'webpack-report/index.html'),
statsFilename: path.join(ROOT_PATH, 'webpack-report/stats.json'),
statsOptions: {
source: false,
},
}),
new webpack.DefinePlugin({

View file

@ -44,6 +44,10 @@ autoloaded with Rails. Example:
require Rails.root.join('db', 'post_migrate', '20170526185842_migrate_pipeline_stages.rb')
```
### Test helpers
#### `table`
Use the `table` helper to create a temporary `ActiveRecord::Base`-derived model
for a table. [FactoryBot](https://docs.gitlab.com/ee/development/testing_guide/best_practices.html#factories)
**should not** be used to create data for migration specs. For example, to
@ -53,6 +57,8 @@ create a record in the `projects` table:
project = table(:projects).create!(id: 1, name: 'gitlab1', path: 'gitlab1')
```
#### `migrate!`
Use the `migrate!` helper to run the migration that is under test. It will not only
run the migration, but will also bump the schema version in the `schema_migrations`
table. It is necessary because in the `after` hook we trigger the rest of
@ -68,6 +74,33 @@ it 'migrates successfully' do
end
```
#### `reversible_migration`
Use the `reversible_migration` helper to test migrations with either a
`change` or both `up` and `down` hooks. This will test that the state of
the application and its data after the migration becomes reversed is the
same as it was before the migration ran in the first place. The helper:
1. Runs the `before` expectations before the **up** migration.
1. Migrates **up**.
1. Runs the `after` expectations.
1. Migrates **down**.
1. Runs the `before` expectations a second time.
Example:
```ruby
reversible_migration do |migration|
migration.before -> {
# ... pre-migration expectations
}
migration.after -> {
# ... post-migration expectations
}
end
```
### Example database migration test
This spec tests the
@ -93,7 +126,7 @@ describe MigratePipelineStages, :migration do
jobs.create!(id: 2, commit_id: 1, project_id: 123, stage_idx: 1, stage: 'test')
end
# Test the up migration.
# Test just the up migration.
it 'correctly migrates pipeline stages' do
expect(stages.count).to be_zero
@ -102,6 +135,22 @@ describe MigratePipelineStages, :migration do
expect(stages.count).to eq 2
expect(stages.all.pluck(:name)).to match_array %w[test build]
end
# Test a reversible migration.
it 'correctly migrates up and down pipeline stages' do
reversible_migration do |migration|
# Expectations will run before the up migration,
# and then again after the down migration
migration.before -> {
expect(stages.count).to be_zero
}
# Expectations will run after the up migration.
migration.after -> {
expect(stages.count).to eq 2
expect(stages.all.pluck(:name)).to match_array %w[test build]
}
end
end
```

View file

@ -192,13 +192,15 @@ account:
#### Change associated namespace
With a linked GitLab.com account, go to the
[**Subscriptions**](https://customers.gitlab.com/subscriptions) page to choose
or change the namespace your subscription applies to.
With a linked GitLab.com account:
NOTE: **Note:**
Please note that you need to be a group owner to associate a group to your
subscription.
1. Log in to the [GitLab Subscription Manager](https://customers.gitlab.com/customers/sign_in).
1. Navigate to the **Manage Purchases** page.
1. Click **Change linked group**.
1. Select the desired group from the **This subscription is for** dropdown.
1. Click **Proceed to checkout**.
Subscription charges are calculated based on the total number of users in a group, including its subgroups and nested projects. If the total number of users exceeds the number of seats in your subscription, you will be charged for the additional users.
### Confirm or upgrade your subscription

View file

@ -28,7 +28,7 @@ Among numerous use cases for exporting issues for CSV, we can name a few:
## Choosing which issues to include
From the issues page you can narrow down which issues to export using the search bar, along with the All/Open/Closed tabs. All issues returned will be exported, including those not shown on the first page.
After selecting a project, from the issues page you can narrow down which issues to export using the search bar, along with the All/Open/Closed tabs. All issues returned will be exported, including those not shown on the first page.
![CSV export button](img/csv_export_button.png)
@ -72,4 +72,5 @@ Data will be encoded with a comma as the column delimiter, with `"` used to quot
## Limitations
As the issues will be sent as an email attachment, there is a limit on how much data can be exported. Currently this limit is 15MB to ensure successful delivery across a range of email providers. If this limit is reached we suggest narrowing the search before export, perhaps by exporting open and closed issues separately.
- Export Issues to CSV is not available at the Group's Issues List.
- As the issues will be sent as an email attachment, there is a limit on how much data can be exported. Currently this limit is 15MB to ensure successful delivery across a range of email providers. If this limit is reached we suggest narrowing the search before export, perhaps by exporting open and closed issues separately.

View file

@ -56,8 +56,9 @@ module Gitlab
end
def error(error)
log_error(message: error.message, caller: caller[0].dup)
log_debug(backtrace: error.backtrace&.join("\n"))
error_payload = { message: error.message }
error_payload[:error_backtrace] = Gitlab::Profiler.clean_backtrace(error.backtrace) if error.backtrace
log_error(error_payload)
Gitlab::Sentry.track_acceptable_exception(error, extra: log_base_data)

View file

@ -30,13 +30,13 @@
"webpack-prod": "NODE_OPTIONS=\"--max-old-space-size=3584\" NODE_ENV=production webpack --config config/webpack.config.js"
},
"dependencies": {
"@babel/core": "^7.5.5",
"@babel/core": "^7.6.2",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-proposal-json-strings": "^7.2.0",
"@babel/plugin-proposal-private-methods": "^7.4.4",
"@babel/plugin-proposal-private-methods": "^7.6.0",
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-syntax-import-meta": "^7.2.0",
"@babel/preset-env": "^7.5.5",
"@babel/preset-env": "^7.6.2",
"@gitlab/svgs": "^1.74.0",
"@gitlab/ui": "5.26.0",
"@gitlab/visual-review-tools": "1.0.3",
@ -49,19 +49,19 @@
"autosize": "^4.0.0",
"aws-sdk": "^2.526.0",
"axios": "^0.19.0",
"babel-loader": "^8.0.5",
"babel-loader": "^8.0.6",
"bootstrap": "4.3.1",
"brace-expansion": "^1.1.8",
"cache-loader": "^2.0.1",
"cache-loader": "^4.1.0",
"chart.js": "2.7.2",
"classlist-polyfill": "^1.2.0",
"clipboard": "^1.7.1",
"codesandbox-api": "^0.0.20",
"compression-webpack-plugin": "^2.0.0",
"compression-webpack-plugin": "^3.0.0",
"copy-webpack-plugin": "^5.0.4",
"core-js": "^3.1.3",
"core-js": "^3.2.1",
"cropper": "^2.3.0",
"css-loader": "^1.0.0",
"css-loader": "^3.2.0",
"d3": "^4.13.0",
"d3-array": "^1.2.1",
"d3-axis": "^1.0.8",
@ -81,7 +81,7 @@
"emoji-regex": "^7.0.3",
"emoji-unicode-version": "^0.2.1",
"exports-loader": "^0.7.0",
"file-loader": "^3.0.1",
"file-loader": "^4.2.0",
"formdata-polyfill": "^3.0.11",
"fuzzaldrin-plus": "^0.5.0",
"glob": "^7.1.2",
@ -110,7 +110,7 @@
"prosemirror-model": "^1.6.4",
"raphael": "^2.2.7",
"raven-js": "^3.22.1",
"raw-loader": "^1.0.0",
"raw-loader": "^3.1.0",
"sanitize-html": "^1.16.1",
"select2": "3.5.2-browserify",
"sha1": "^1.1.1",
@ -118,7 +118,7 @@
"sortablejs": "^1.10.0",
"sql.js": "^0.4.0",
"stickyfilljs": "^2.0.5",
"style-loader": "^0.23.1",
"style-loader": "^1.0.0",
"svg4everybody": "2.1.9",
"three": "^0.84.0",
"three-orbit-controls": "^82.1.0",
@ -128,20 +128,20 @@
"tiptap-commands": "^1.4.0",
"tiptap-extensions": "^1.8.0",
"underscore": "^1.9.0",
"url-loader": "^1.1.2",
"url-loader": "^2.1.0",
"visibilityjs": "^1.2.4",
"vue": "^2.6.10",
"vue-apollo": "^3.0.0-beta.28",
"vue-loader": "^15.7.0",
"vue-loader": "^15.7.1",
"vue-router": "^3.0.2",
"vue-template-compiler": "^2.6.10",
"vue-virtual-scroll-list": "^1.3.1",
"vuedraggable": "^2.23.0",
"vuex": "^3.1.0",
"webpack": "^4.29.0",
"webpack-bundle-analyzer": "^3.3.2",
"webpack-cli": "^3.2.1",
"webpack-stats-plugin": "^0.2.1",
"webpack": "^4.40.2",
"webpack-bundle-analyzer": "^3.5.1",
"webpack-cli": "^3.3.9",
"webpack-stats-plugin": "^0.3.0",
"worker-loader": "^2.0.0",
"xterm": "^3.5.0"
},
@ -200,7 +200,7 @@
"stylelint-scss": "^3.9.2",
"timezone-mock": "^1.0.8",
"vue-jest": "^4.0.0-beta.2",
"webpack-dev-server": "^3.1.14",
"webpack-dev-server": "^3.8.1",
"yarn-deduplicate": "^1.1.1"
},
"resolutions": {

View file

@ -53,16 +53,17 @@ describe Gitlab::ImportExport::Shared do
subject.error(error)
end
it 'calls the error logger with the full message' do
expect(subject).to receive(:log_error).with(hash_including(message: error.message))
it 'calls the error logger without a backtrace' do
expect(subject).to receive(:log_error).with(message: error.message)
subject.error(error)
end
it 'calls the debug logger with a backtrace' do
error.set_backtrace('backtrace')
it 'calls the error logger with the full message' do
backtrace = caller
allow(error).to receive(:backtrace).and_return(caller)
expect(subject).to receive(:log_debug).with(hash_including(backtrace: 'backtrace'))
expect(subject).to receive(:log_error).with(message: error.message, error_backtrace: Gitlab::Profiler.clean_backtrace(backtrace))
subject.error(error)
end

View file

@ -132,6 +132,41 @@ module MigrationsHelpers
migration.name == described_class.name
end
end
class ReversibleMigrationTest
attr_reader :before_up, :after_up
def initialize
@before_up = -> {}
@after_up = -> {}
end
def before(expectations)
@before_up = expectations
self
end
def after(expectations)
@after_up = expectations
self
end
end
def reversible_migration(&block)
tests = yield(ReversibleMigrationTest.new)
tests.before_up.call
migrate!
tests.after_up.call
schema_migrate_down!
tests.before_up.call
end
end
MigrationsHelpers.prepend_if_ee('EE::MigrationsHelpers')

2054
yarn.lock

File diff suppressed because it is too large Load diff