From 93d7441cc98c1db55797a2181a3d9f4b3d26d82c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 18 Feb 2020 21:09:11 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .gitlab/ci/frontend.gitlab-ci.yml | 2 + app/assets/stylesheets/framework/filters.scss | 1 + app/assets/stylesheets/page_bundles/ide.scss | 2 +- changelogs/unreleased/simplify-ide-colors.yml | 5 ++ config/webpack.config.js | 64 +++++++++++++++---- config/webpack.vendor.config.js | 3 + doc/administration/pages/source.md | 16 +++-- .../active_record/migration/migration.rb | 3 +- .../post_deployment_migration/migration.rb | 3 +- lib/gitlab/git/blob.rb | 5 ++ package.json | 4 +- scripts/clean-old-cached-assets | 2 + spec/lib/gitlab/git/blob_spec.rb | 4 ++ yarn.lock | 16 ++--- 14 files changed, 100 insertions(+), 30 deletions(-) create mode 100644 changelogs/unreleased/simplify-ide-colors.yml diff --git a/.gitlab/ci/frontend.gitlab-ci.yml b/.gitlab/ci/frontend.gitlab-ci.yml index 3a72c941b89..f9db35592aa 100644 --- a/.gitlab/ci/frontend.gitlab-ci.yml +++ b/.gitlab/ci/frontend.gitlab-ci.yml @@ -6,6 +6,7 @@ - tmp/cache/assets/sprockets - tmp/cache/babel-loader - tmp/cache/vue-loader + - tmp/cache/webpack-dlls .gitlab:assets:compile-metadata: extends: @@ -78,6 +79,7 @@ gitlab:assets:compile pull-cache: SETUP_DB: "false" # we override the max_old_space_size to prevent OOM errors NODE_OPTIONS: --max_old_space_size=3584 + WEBPACK_VENDOR_DLL: "true" cache: key: "assets-compile:v9" artifacts: diff --git a/app/assets/stylesheets/framework/filters.scss b/app/assets/stylesheets/framework/filters.scss index 4b45a169a31..e151fff7eb3 100644 --- a/app/assets/stylesheets/framework/filters.scss +++ b/app/assets/stylesheets/framework/filters.scss @@ -56,6 +56,7 @@ padding-left: 12px; position: relative; margin-bottom: 0; + width: 1px; } .input-token { diff --git a/app/assets/stylesheets/page_bundles/ide.scss b/app/assets/stylesheets/page_bundles/ide.scss index 9c64714e5dd..4b838b1383e 100644 --- a/app/assets/stylesheets/page_bundles/ide.scss +++ b/app/assets/stylesheets/page_bundles/ide.scss @@ -75,7 +75,7 @@ $ide-commit-header-height: 48px; .multi-file-tabs { display: flex; - background-color: $white-normal; + background-color: $gray-light; box-shadow: inset 0 -1px $white-dark; > ul { diff --git a/changelogs/unreleased/simplify-ide-colors.yml b/changelogs/unreleased/simplify-ide-colors.yml new file mode 100644 index 00000000000..f8d174998b9 --- /dev/null +++ b/changelogs/unreleased/simplify-ide-colors.yml @@ -0,0 +1,5 @@ +--- +title: Simplifying colors in the Web IDE +merge_request: 25304 +author: +type: other diff --git a/config/webpack.config.js b/config/webpack.config.js index 639de770fd8..05a217c04fe 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -117,23 +117,18 @@ if (IS_EE) { }); } -// if there is a compiled DLL with a matching hash string, use it let dll; if (VENDOR_DLL && !IS_PRODUCTION) { const dllHash = vendorDllHash(); const dllCachePath = path.join(ROOT_PATH, `tmp/cache/webpack-dlls/${dllHash}`); - if (fs.existsSync(dllCachePath)) { - console.log(`Using vendor DLL found at: ${dllCachePath}`); - dll = { - manifestPath: path.join(dllCachePath, 'vendor.dll.manifest.json'), - cacheFrom: dllCachePath, - cacheTo: path.join(ROOT_PATH, `public/assets/webpack/dll.${dllHash}/`), - publicPath: `dll.${dllHash}/vendor.dll.bundle.js`, - }; - } else { - console.log(`Warning: No vendor DLL found at: ${dllCachePath}. DllPlugin disabled.`); - } + dll = { + manifestPath: path.join(dllCachePath, 'vendor.dll.manifest.json'), + cacheFrom: dllCachePath, + cacheTo: path.join(ROOT_PATH, `public/assets/webpack/dll.${dllHash}/`), + publicPath: `dll.${dllHash}/vendor.dll.bundle.js`, + exists: null, + }; } module.exports = { @@ -314,6 +309,51 @@ module.exports = { jQuery: 'jquery', }), + // if DLLs are enabled, detect whether the DLL exists and create it automatically if necessary + dll && { + apply(compiler) { + compiler.hooks.beforeCompile.tapAsync('DllAutoCompilePlugin', (params, callback) => { + if (dll.exists) { + callback(); + } else if (fs.existsSync(dll.manifestPath)) { + console.log(`Using vendor DLL found at: ${dll.cacheFrom}`); + dll.exists = true; + callback(); + } else { + console.log( + `Warning: No vendor DLL found at: ${dll.cacheFrom}. Compiling DLL automatically.`, + ); + + const dllConfig = require('./webpack.vendor.config.js'); + const dllCompiler = webpack(dllConfig); + + dllCompiler.run((err, stats) => { + if (err) { + return callback(err); + } + + const info = stats.toJson(); + + if (stats.hasErrors()) { + console.error(info.errors.join('\n\n')); + return callback('DLL not compiled successfully.'); + } + + if (stats.hasWarnings()) { + console.warn(info.warnings.join('\n\n')); + console.warn('DLL compiled with warnings.'); + } else { + console.log('DLL compiled successfully.'); + } + + dll.exists = true; + callback(); + }); + } + }); + }, + }, + // reference our compiled DLL modules dll && new webpack.DllReferencePlugin({ diff --git a/config/webpack.vendor.config.js b/config/webpack.vendor.config.js index 90736349d91..7ecb9b06fdd 100644 --- a/config/webpack.vendor.config.js +++ b/config/webpack.vendor.config.js @@ -15,6 +15,9 @@ module.exports = { extensions: ['.js'], }, + // ensure output is not generated when errors are encountered + bail: true, + context: ROOT_PATH, entry: { diff --git a/doc/administration/pages/source.md b/doc/administration/pages/source.md index 8373d1c7b1b..3e5a82030a2 100644 --- a/doc/administration/pages/source.md +++ b/doc/administration/pages/source.md @@ -388,6 +388,11 @@ Each request to view a resource in a private site is authenticated by Pages using that token. For each request it receives, it makes a request to the GitLab API to check that the user is authorized to read that site. +From [GitLab 12.8](https://gitlab.com/gitlab-org/omnibus-gitlab/-/merge_requests/3689) onwards, +Access Control parameters for Pages are set in a configuration file, which +by convention is named `gitlab-pages-config`. The configuration file is passed to +pages using the `-config flag` or CONFIG environment variable. + Pages access control is disabled by default. To enable it: 1. Modify your `config/gitlab.yml` file: @@ -402,13 +407,14 @@ Pages access control is disabled by default. To enable it: This should be called `GitLab Pages` and have a `Redirect URL` of `https://projects.example.io/auth`. It does not need to be a "trusted" application, but it does need the `api` scope. -1. Start the Pages daemon with the following additional arguments: +1. Start the Pages daemon by passing a configuration file with the following arguments: ```shell - -auth-client-secret \ - -auth-redirect-uri http://projects.example.io/auth \ - -auth-secret <40 random hex characters> \ - -auth-server + auth-client-id= + auth-client-secret= + auth-redirect-uri='http://projects.example.io/auth' + auth-secret=<40 random hex characters> + auth-server= ``` 1. Users can now configure it in their [projects' settings](../../user/project/pages/introduction.md#gitlab-pages-access-control-core). diff --git a/generator_templates/active_record/migration/migration.rb b/generator_templates/active_record/migration/migration.rb index 153280cd4b7..44d34674983 100644 --- a/generator_templates/active_record/migration/migration.rb +++ b/generator_templates/active_record/migration/migration.rb @@ -4,7 +4,8 @@ # for more information on how to write migrations for GitLab. class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] - include Gitlab::Database::MigrationHelpers + # Uncomment the following include if you require helper functions: + # include Gitlab::Database::MigrationHelpers # Set this constant to true if this migration requires downtime. DOWNTIME = false diff --git a/generator_templates/rails/post_deployment_migration/migration.rb b/generator_templates/rails/post_deployment_migration/migration.rb index 4c1685545b5..6a3ccc1ede8 100644 --- a/generator_templates/rails/post_deployment_migration/migration.rb +++ b/generator_templates/rails/post_deployment_migration/migration.rb @@ -4,7 +4,8 @@ # for more information on how to write migrations for GitLab. class <%= migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] - include Gitlab::Database::MigrationHelpers + # Uncomment the following include if you require helper functions: + # include Gitlab::Database::MigrationHelpers DOWNTIME = false diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb index f2a6211f270..cbde713e3b9 100644 --- a/lib/gitlab/git/blob.rb +++ b/lib/gitlab/git/blob.rb @@ -35,6 +35,11 @@ module Gitlab docstring 'blob.truncated? == false' end + define_histogram :gitlab_blob_size do + docstring 'Gitlab::Git::Blob size' + buckets [1_000, 5_000, 10_000, 50_000, 100_000, 500_000, 1_000_000] + end + class << self def find(repository, sha, path, limit: MAX_DATA_DISPLAY_SIZE) tree_entry(repository, sha, path, limit) diff --git a/package.json b/package.json index 5113c25305e..4398ecc0bc4 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "@babel/plugin-syntax-import-meta": "^7.2.0", "@babel/preset-env": "^7.6.2", "@gitlab/at.js": "^1.5.5", - "@gitlab/svgs": "^1.96.0", - "@gitlab/ui": "^9.8.0", + "@gitlab/svgs": "^1.99.0", + "@gitlab/ui": "^9.11.1", "@gitlab/visual-review-tools": "1.5.1", "@sentry/browser": "^5.10.2", "@sourcegraph/code-host-integration": "0.0.30", diff --git a/scripts/clean-old-cached-assets b/scripts/clean-old-cached-assets index 8bdd3a9cdb6..9a373439e5e 100755 --- a/scripts/clean-old-cached-assets +++ b/scripts/clean-old-cached-assets @@ -2,5 +2,7 @@ # Clean up cached files that are older than 4 days find tmp/cache/assets/sprockets/ -type f -mtime +4 -execdir rm -- "{}" \; +find tmp/cache/webpack-dlls/ -maxdepth 1 -type d -mtime +4 -exec rm -rf -- "{}" \; du -d 0 -h tmp/cache/assets/sprockets | cut -f1 | xargs -I % echo "tmp/cache/assets/sprockets/ is currently %" +du -d 0 -h tmp/cache/webpack-dlls | cut -f1 | xargs -I % echo "tmp/cache/webpack-dlls is currently %" diff --git a/spec/lib/gitlab/git/blob_spec.rb b/spec/lib/gitlab/git/blob_spec.rb index 294e67a19d4..521c03058ca 100644 --- a/spec/lib/gitlab/git/blob_spec.rb +++ b/spec/lib/gitlab/git/blob_spec.rb @@ -597,5 +597,9 @@ describe Gitlab::Git::Blob, :seed_helper do it 'defines :gitlab_blob_truncated_false counter' do expect(described_class).to respond_to(:gitlab_blob_truncated_false) end + + it 'defines :gitlab_blob_size histogram' do + expect(described_class).to respond_to(:gitlab_blob_size) + end end end diff --git a/yarn.lock b/yarn.lock index 94aa81c7aa0..bfd3cdea05d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -740,15 +740,15 @@ dependencies: vue-eslint-parser "^7.0.0" -"@gitlab/svgs@^1.96.0": - version "1.96.0" - resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.96.0.tgz#1d32730389e94358dc245e8336912523446d1269" - integrity sha512-mhg6kndxDhwjWChKhs5utO6PowlOyFdaCXUrkkxxe2H3cd8DYa40QOEcJeUrSIhkmgIMVesUawesx5tt4Bnnnw== +"@gitlab/svgs@^1.99.0": + version "1.99.0" + resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.99.0.tgz#bcf971c3a14920218e86da71ca115244b23a4a3f" + integrity sha512-bxYFxnmuoWPBU9isL3/CYFlr+k2YWU47Pq0vfmSmL7uLnb/vYymfZZF5p3erlZ62WGwuT3kp4GnuoZBMfmannA== -"@gitlab/ui@^9.8.0": - version "9.8.0" - resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-9.8.0.tgz#b1a0b5f1f6ac9fdb19b64d74f0f729e3ec182495" - integrity sha512-0VjSTjCCtevdoeByxf5o/OimzV3zt1MMH5DlZSqakML38uoOM0WpgXI/4xAipzfYwiKUW+IWbuyZGJ3ucaJnhQ== +"@gitlab/ui@^9.11.1": + version "9.11.1" + resolved "https://registry.yarnpkg.com/@gitlab/ui/-/ui-9.11.1.tgz#f234687d2d1b555ebeaf05156e16b4fd97aef453" + integrity sha512-3INIA2n9rxz+VCc0hO4EnmET00XCAMS25hHnIJ6ffKeJz40diCvEZ6Asusv4BiIPosmTyz8VufYGQRq+8v8rNQ== dependencies: "@babel/standalone" "^7.0.0" "@gitlab/vue-toasted" "^1.3.0"