diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 15:09:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 15:09:09 +0000 |
commit | c7e385e282bcb8505589bce526e692b7bb819ffa (patch) | |
tree | 3e64affe1c2eebdcaa18cc6319b603f44b03b07e | |
parent | cd3e2c7b9355f8990ab294b34b5e4add4f3985fa (diff) | |
download | gitlab-ce-c7e385e282bcb8505589bce526e692b7bb819ffa.tar.gz |
Add latest changes from gitlab-org/gitlab@master
-rw-r--r-- | .rubocop.yml | 2 | ||||
-rw-r--r-- | app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/pages/projects/registry/repositories/index.js | 10 | ||||
-rw-r--r-- | app/models/snippet.rb | 1 | ||||
-rw-r--r-- | app/views/groups/registry/repositories/index.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/registry/repositories/index.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/lodash_blob.yml | 5 | ||||
-rw-r--r-- | config/initializers/lograge.rb | 2 | ||||
-rw-r--r-- | doc/development/integrations/jira_connect.md | 2 | ||||
-rw-r--r-- | lib/gitlab/ci/config/entry/job.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/utils/log_limited_array.rb | 8 | ||||
-rw-r--r-- | lib/tasks/gitlab/graphql.rake | 13 | ||||
-rw-r--r-- | spec/initializers/lograge_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/ci/yaml_processor_spec.rb | 22 | ||||
-rw-r--r-- | spec/lib/gitlab/utils/log_limited_array_spec.rb | 22 | ||||
-rw-r--r-- | spec/requests/groups/milestones_controller_spec.rb | 2 | ||||
-rw-r--r-- | spec/requests/groups/registry/repositories_controller_spec.rb | 2 |
18 files changed, 81 insertions, 24 deletions
diff --git a/.rubocop.yml b/.rubocop.yml index 514e4271272..e43ed140d90 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -345,6 +345,8 @@ RSpec/HaveGitlabHttpStatus: - 'ee/spec/controllers/**/*' - 'spec/requests/*.rb' - 'ee/spec/requests/*.rb' + - 'spec/requests/{groups,projects,repositories}/**/*' + - 'ee/spec/requests/{groups,projects,repositories}/**/*' - 'spec/requests/api/*/**/*.rb' - 'ee/spec/requests/api/*/**/*.rb' diff --git a/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js b/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js index 87c8568802e..5b781947d55 100644 --- a/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js +++ b/app/assets/javascripts/blob/balsamiq/balsamiq_viewer.js @@ -1,5 +1,5 @@ import sqljs from 'sql.js'; -import { template as _template } from 'underscore'; +import { template as _template } from 'lodash'; import axios from '~/lib/utils/axios_utils'; import { successCodes } from '~/lib/utils/http_status'; diff --git a/app/assets/javascripts/pages/projects/registry/repositories/index.js b/app/assets/javascripts/pages/projects/registry/repositories/index.js index 47fea2be189..73469e287ed 100644 --- a/app/assets/javascripts/pages/projects/registry/repositories/index.js +++ b/app/assets/javascripts/pages/projects/registry/repositories/index.js @@ -3,7 +3,11 @@ import registryExplorer from '~/registry/explorer/index'; document.addEventListener('DOMContentLoaded', () => { initRegistryImages(); - const { attachMainComponent, attachBreadcrumb } = registryExplorer(); - attachBreadcrumb(); - attachMainComponent(); + + const explorer = registryExplorer(); + + if (explorer) { + explorer.attachBreadcrumb(); + explorer.attachMainComponent(); + } }); diff --git a/app/models/snippet.rb b/app/models/snippet.rb index 4ba8e6a94e6..814a88dbd09 100644 --- a/app/models/snippet.rb +++ b/app/models/snippet.rb @@ -17,7 +17,6 @@ class Snippet < ApplicationRecord include HasRepository extend ::Gitlab::Utils::Override - ignore_column :storage_version, remove_with: '12.9', remove_after: '2020-03-22' ignore_column :repository_storage, remove_with: '12.10', remove_after: '2020-04-22' cache_markdown_field :title, pipeline: :single_line diff --git a/app/views/groups/registry/repositories/index.html.haml b/app/views/groups/registry/repositories/index.html.haml index d3c3e5c1436..eff8d77ac72 100644 --- a/app/views/groups/registry/repositories/index.html.haml +++ b/app/views/groups/registry/repositories/index.html.haml @@ -4,7 +4,7 @@ %section .row.registry-placeholder.prepend-bottom-10 .col-12 - - if Feature.enabled?(:vue_container_registry_explorer) + - if Feature.enabled?(:vue_container_registry_explorer, @group) #js-container-registry{ data: { endpoint: group_container_registries_path(@group), "help_page_path" => help_page_path('user/packages/container_registry/index'), "two_factor_auth_help_link" => help_page_path('user/profile/account/two_factor_authentication'), diff --git a/app/views/projects/registry/repositories/index.html.haml b/app/views/projects/registry/repositories/index.html.haml index 3f90334d452..c668c9e8494 100644 --- a/app/views/projects/registry/repositories/index.html.haml +++ b/app/views/projects/registry/repositories/index.html.haml @@ -4,7 +4,7 @@ %section .row.registry-placeholder.prepend-bottom-10 .col-12 - - if Feature.enabled?(:vue_container_registry_explorer) + - if Feature.enabled?(:vue_container_registry_explorer, @project) #js-container-registry{ data: { endpoint: project_container_registry_index_path(@project), project_path: @project.full_path, "help_page_path" => help_page_path('user/packages/container_registry/index'), diff --git a/changelogs/unreleased/lodash_blob.yml b/changelogs/unreleased/lodash_blob.yml new file mode 100644 index 00000000000..c4404157746 --- /dev/null +++ b/changelogs/unreleased/lodash_blob.yml @@ -0,0 +1,5 @@ +--- +title: Replace underscore with lodash in /app/assets/javascripts/blob/ +merge_request: 25113 +author: rkpattnaik780 +type: changed diff --git a/config/initializers/lograge.rb b/config/initializers/lograge.rb index fb93c3a6e12..a2c0fd5cd5c 100644 --- a/config/initializers/lograge.rb +++ b/config/initializers/lograge.rb @@ -28,7 +28,7 @@ unless Gitlab::Runtime.sidekiq? payload = { time: Time.now.utc.iso8601(3), - params: Gitlab::Utils::LogLimitedArray.log_limited_array(params), + params: Gitlab::Utils::LogLimitedArray.log_limited_array(params, sentinel: { key: 'truncated', value: '...' }), remote_ip: event.payload[:remote_ip], user_id: event.payload[:user_id], username: event.payload[:username], diff --git a/doc/development/integrations/jira_connect.md b/doc/development/integrations/jira_connect.md index 9ac87a17232..838358cb540 100644 --- a/doc/development/integrations/jira_connect.md +++ b/doc/development/integrations/jira_connect.md @@ -15,8 +15,6 @@ The following are required to install and test the app: or [ngrok](https://ngrok.com). These also take care of SSL for you because Jira requires all connections to the app host to be over SSL. -> This feature is currently behind the `:jira_connect_app` feature flag - ## Installing the app in Jira 1. Enable Jira development mode to install apps that are not from the Atlassian Marketplace diff --git a/lib/gitlab/ci/config/entry/job.rb b/lib/gitlab/ci/config/entry/job.rb index ffc8cb887e8..666c6e23eb4 100644 --- a/lib/gitlab/ci/config/entry/job.rb +++ b/lib/gitlab/ci/config/entry/job.rb @@ -165,7 +165,7 @@ module Gitlab helpers :before_script, :script, :stage, :type, :after_script, :cache, :image, :services, :only, :except, :variables, :artifacts, :environment, :coverage, :retry, :rules, - :parallel, :needs, :interruptible, :release + :parallel, :needs, :interruptible, :release, :tags attributes :script, :tags, :allow_failure, :when, :dependencies, :needs, :retry, :parallel, :extends, :start_in, :rules, @@ -242,6 +242,7 @@ module Gitlab services: services_value, stage: stage_value, cache: cache_value, + tags: tags_value, only: only_value, except: except_value, rules: has_rules? ? rules_value : nil, diff --git a/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb b/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb index 837473d47cd..1eb1e1b783b 100644 --- a/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb +++ b/lib/gitlab/grape_logging/formatters/lograge_with_timestamp.rb @@ -30,7 +30,8 @@ module Gitlab .each_pair .map { |k, v| { key: k, value: utf8_encode_values(v) } } - Gitlab::Utils::LogLimitedArray.log_limited_array(params_array) + Gitlab::Utils::LogLimitedArray.log_limited_array(params_array, + sentinel: { key: 'truncated', value: '...' }) end def utf8_encode_values(data) diff --git a/lib/gitlab/utils/log_limited_array.rb b/lib/gitlab/utils/log_limited_array.rb index fe8aadf9020..9c207758580 100644 --- a/lib/gitlab/utils/log_limited_array.rb +++ b/lib/gitlab/utils/log_limited_array.rb @@ -6,9 +6,9 @@ module Gitlab MAXIMUM_ARRAY_LENGTH = 10.kilobytes # Prepare an array for logging by limiting its JSON representation - # to around 10 kilobytes. Once we hit the limit, add "..." as the - # last item in the returned array. - def self.log_limited_array(array) + # to around 10 kilobytes. Once we hit the limit, add the sentinel + # value as the last item in the returned array. + def self.log_limited_array(array, sentinel: '...') return [] unless array.is_a?(Array) total_length = 0 @@ -18,7 +18,7 @@ module Gitlab total_length <= MAXIMUM_ARRAY_LENGTH end - limited_array.push('...') if total_length > MAXIMUM_ARRAY_LENGTH + limited_array.push(sentinel) if total_length > MAXIMUM_ARRAY_LENGTH limited_array end diff --git a/lib/tasks/gitlab/graphql.rake b/lib/tasks/gitlab/graphql.rake index c73691f3d45..568761edb33 100644 --- a/lib/tasks/gitlab/graphql.rake +++ b/lib/tasks/gitlab/graphql.rake @@ -8,13 +8,24 @@ namespace :gitlab do OUTPUT_DIR = Rails.root.join("doc/api/graphql/reference") TEMPLATES_DIR = 'lib/gitlab/graphql/docs/templates/' + # Consider all feature flags disabled + # to avoid pipeline failures in case developer + # dumps schema with flags enabled locally before pushing + task disable_feature_flags: :environment do + class Feature + def self.enabled?(*args) + false + end + end + end + # Defines tasks for dumping the GraphQL schema: # - gitlab:graphql:schema:dump # - gitlab:graphql:schema:idl # - gitlab:graphql:schema:json GraphQL::RakeTask.new( schema_name: 'GitlabSchema', - dependencies: [:environment], + dependencies: [:environment, :disable_feature_flags], directory: OUTPUT_DIR, idl_outfile: "gitlab_schema.graphql", json_outfile: "gitlab_schema.json" diff --git a/spec/initializers/lograge_spec.rb b/spec/initializers/lograge_spec.rb index 15165c6db98..0068b894474 100644 --- a/spec/initializers/lograge_spec.rb +++ b/spec/initializers/lograge_spec.rb @@ -17,7 +17,7 @@ describe 'lograge', type: :request do end let(:limited_params) do - large_params.slice(:a, :b).map { |k, v| { key: k.to_s, value: v } } + ['...'] + large_params.slice(:a, :b).map { |k, v| { key: k.to_s, value: v } } + [{ key: 'truncated', value: '...' }] end context 'for API requests' do diff --git a/spec/lib/gitlab/ci/yaml_processor_spec.rb b/spec/lib/gitlab/ci/yaml_processor_spec.rb index e5c5aaa2265..e81aeb620c3 100644 --- a/spec/lib/gitlab/ci/yaml_processor_spec.rb +++ b/spec/lib/gitlab/ci/yaml_processor_spec.rb @@ -87,6 +87,28 @@ module Gitlab end end + describe 'tags entry with default values' do + it 'applies default values' do + config = YAML.dump({ default: { tags: %w[A B] }, + rspec: { script: "rspec" } }) + + config_processor = Gitlab::Ci::YamlProcessor.new(config) + + expect(config_processor.stage_builds_attributes("test").size).to eq(1) + expect(config_processor.stage_builds_attributes("test").first).to eq({ + stage: "test", + stage_idx: 2, + name: "rspec", + only: { refs: %w[branches tags] }, + options: { script: ["rspec"] }, + tag_list: %w[A B], + allow_failure: false, + when: "on_success", + yaml_variables: [] + }) + end + end + describe 'interruptible entry' do describe 'interruptible job' do let(:config) do diff --git a/spec/lib/gitlab/utils/log_limited_array_spec.rb b/spec/lib/gitlab/utils/log_limited_array_spec.rb index 2729b2c7b6f..a236ab37614 100644 --- a/spec/lib/gitlab/utils/log_limited_array_spec.rb +++ b/spec/lib/gitlab/utils/log_limited_array_spec.rb @@ -18,12 +18,26 @@ describe Gitlab::Utils::LogLimitedArray do end context 'when the array exceeds the limit' do - it 'replaces arguments after the limit with an ellipsis string' do + let(:long_array) do half_limit = described_class::MAXIMUM_ARRAY_LENGTH / 2 - long_array = ['a' * half_limit, 'b' * half_limit, 'c'] - expect(described_class.log_limited_array(long_array)) - .to eq(long_array.take(1) + ['...']) + ['a' * half_limit, 'b' * half_limit, 'c'] + end + + context 'when no sentinel value is passed' do + it 'replaces arguments after the limit with an ellipsis string' do + expect(described_class.log_limited_array(long_array)) + .to eq(long_array.take(1) + ['...']) + end + end + + context 'when a sentinel value is passed' do + it 'replaces arguments after the limit with the sentinel' do + sentinel = { truncated: true } + + expect(described_class.log_limited_array(long_array, sentinel: sentinel)) + .to eq(long_array.take(1) + [sentinel]) + end end end diff --git a/spec/requests/groups/milestones_controller_spec.rb b/spec/requests/groups/milestones_controller_spec.rb index 977cccad29f..4d15aa43cd2 100644 --- a/spec/requests/groups/milestones_controller_spec.rb +++ b/spec/requests/groups/milestones_controller_spec.rb @@ -24,7 +24,7 @@ describe Groups::MilestonesController do end expect { get "/groups/#{public_group.to_param}/-/milestones.json" }.not_to exceed_all_query_limit(control_count) - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(:ok) milestones = json_response expect(milestones.count).to eq(3) diff --git a/spec/requests/groups/registry/repositories_controller_spec.rb b/spec/requests/groups/registry/repositories_controller_spec.rb index 35fdeaab604..25bd7aa862e 100644 --- a/spec/requests/groups/registry/repositories_controller_spec.rb +++ b/spec/requests/groups/registry/repositories_controller_spec.rb @@ -28,7 +28,7 @@ describe Groups::Registry::RepositoriesController do expect { get(endpoint) }.not_to exceed_all_query_limit(control_count) # sanity check that response is 200 - expect(response).to have_http_status(200) + expect(response).to have_gitlab_http_status(:ok) repositories = json_response expect(repositories.count).to eq(5) end |