From f64a639bcfa1fc2bc89ca7db268f594306edfd7c Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 16 Mar 2021 18:18:33 +0000 Subject: Add latest changes from gitlab-org/gitlab@13-10-stable-ee --- lib/tasks/eslint.rake | 2 +- lib/tasks/gitlab/graphql.rake | 17 ++++------------- lib/tasks/gitlab/packages/composer.rake | 20 ++++++++++++++++++++ lib/tasks/gitlab/packages/events.rake | 3 +-- lib/tasks/gitlab_danger.rake | 6 +++--- lib/tasks/lint.rake | 1 - lib/tasks/scss-lint.rake | 12 ------------ 7 files changed, 29 insertions(+), 32 deletions(-) create mode 100644 lib/tasks/gitlab/packages/composer.rake delete mode 100644 lib/tasks/scss-lint.rake (limited to 'lib/tasks') diff --git a/lib/tasks/eslint.rake b/lib/tasks/eslint.rake index ad63de66c81..529f17d4d27 100644 --- a/lib/tasks/eslint.rake +++ b/lib/tasks/eslint.rake @@ -3,7 +3,7 @@ unless Rails.env.production? desc "GitLab | Run ESLint" task eslint: ['yarn:check'] do - unless system('yarn run eslint') + unless system('yarn run lint:eslint:all') abort('rake eslint failed') end end diff --git a/lib/tasks/gitlab/graphql.rake b/lib/tasks/gitlab/graphql.rake index e4eb4604138..77377a7e0fd 100644 --- a/lib/tasks/gitlab/graphql.rake +++ b/lib/tasks/gitlab/graphql.rake @@ -6,6 +6,7 @@ require 'graphql/rake_task' namespace :gitlab do OUTPUT_DIR = Rails.root.join("doc/api/graphql/reference") + TEMP_SCHEMA_DIR = Rails.root.join('tmp/tests/graphql') TEMPLATES_DIR = 'lib/gitlab/graphql/docs/templates/' # Make all feature flags enabled so that all feature flag @@ -27,7 +28,7 @@ namespace :gitlab do GraphQL::RakeTask.new( schema_name: 'GitlabSchema', dependencies: [:environment, :enable_feature_flags], - directory: OUTPUT_DIR, + directory: TEMP_SCHEMA_DIR, idl_outfile: "gitlab_schema.graphql", json_outfile: "gitlab_schema.json" ) @@ -130,18 +131,8 @@ namespace :gitlab do end end - desc 'GitLab | GraphQL | Check if GraphQL schemas are up to date' - task check_schema: [:environment, :enable_feature_flags] do - idl_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.graphql')) - json_doc = File.read(Rails.root.join(OUTPUT_DIR, 'gitlab_schema.json')) - - if idl_doc == GitlabSchema.to_definition && json_doc == GitlabSchema.to_json - puts "GraphQL schema is up to date" - else - format_output('GraphQL schema is outdated! Please update it by running `bundle exec rake gitlab:graphql:schema:dump`.') - abort - end - end + desc 'GitLab | GraphQL | Update GraphQL docs and schema' + task update_all: [:compile_docs, 'schema:dump'] end end diff --git a/lib/tasks/gitlab/packages/composer.rake b/lib/tasks/gitlab/packages/composer.rake new file mode 100644 index 00000000000..c9bccfe9384 --- /dev/null +++ b/lib/tasks/gitlab/packages/composer.rake @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'logger' + +desc "GitLab | Packages | Build composer cache" +namespace :gitlab do + namespace :packages do + task build_composer_cache: :environment do + logger = Logger.new(STDOUT) + logger.info('Starting to build composer cache files') + + ::Packages::Package.composer.find_in_batches do |packages| + packages.group_by { |pkg| [pkg.project_id, pkg.name] }.each do |(project_id, name), packages| + logger.info("Building cache for #{project_id} -> #{name}") + Gitlab::Composer::Cache.new(project: packages.first.project, name: name).execute + end + end + end + end +end diff --git a/lib/tasks/gitlab/packages/events.rake b/lib/tasks/gitlab/packages/events.rake index 4bf4ce430f1..4a6a014acc5 100644 --- a/lib/tasks/gitlab/packages/events.rake +++ b/lib/tasks/gitlab/packages/events.rake @@ -51,8 +51,7 @@ namespace :gitlab do "name" => event_name, "category" => "#{originator_type}_packages", "aggregation" => "weekly", - "redis_slot" => "package", - "feature_flag" => "collect_package_events_redis" + "redis_slot" => "package" } end diff --git a/lib/tasks/gitlab_danger.rake b/lib/tasks/gitlab_danger.rake index 5df4a8ce4f1..ff9464a588a 100644 --- a/lib/tasks/gitlab_danger.rake +++ b/lib/tasks/gitlab_danger.rake @@ -2,16 +2,16 @@ desc 'Run local Danger rules' task :danger_local do - require_relative '../../tooling/gitlab_danger' + require_relative '../../tooling/danger/project_helper' require 'gitlab/popen' - puts("#{GitlabDanger.local_warning_message}\n") + puts("#{Tooling::Danger::ProjectHelper.local_warning_message}\n") # _status will _always_ be 0, regardless of failure or success :( output, _status = Gitlab::Popen.popen(%w{danger dry_run}) if output.empty? - puts(GitlabDanger.success_message) + puts(Tooling::Danger::ProjectHelper.success_message) else puts(output) exit(1) diff --git a/lib/tasks/lint.rake b/lib/tasks/lint.rake index 5d60bc41f21..976ec089011 100644 --- a/lib/tasks/lint.rake +++ b/lib/tasks/lint.rake @@ -33,7 +33,6 @@ unless Rails.env.production? tasks = %w[ config_lint lint:haml - scss_lint gettext:lint lint:static_verification gitlab:sidekiq:all_queues_yml:check diff --git a/lib/tasks/scss-lint.rake b/lib/tasks/scss-lint.rake deleted file mode 100644 index 8a4809f80fd..00000000000 --- a/lib/tasks/scss-lint.rake +++ /dev/null @@ -1,12 +0,0 @@ -# frozen_string_literal: true - -unless Rails.env.production? - require 'scss_lint/rake_task' - - SCSSLint::RakeTask.new do |t| - t.config = '.scss-lint.yml' - # See https://github.com/brigade/scss-lint/issues/726 - # Hack, otherwise linter won't respect scss_files option in config file. - t.files = [] - end -end -- cgit v1.2.3