diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-26 03:08:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-26 03:08:57 +0300 |
commit | 76215aab04e91e904cafdd35a0649205b9245e82 (patch) | |
tree | ec6243fc4a5de352727caf4d890f53a276151643 | |
parent | fba5aaeec6f0e95818092f7b27b1529df1c13b63 (diff) |
Add latest changes from gitlab-org/gitlab@master
20 files changed, 202 insertions, 65 deletions
diff --git a/app/assets/javascripts/performance_bar/components/detailed_metric.vue b/app/assets/javascripts/performance_bar/components/detailed_metric.vue index b7032f7e351..6d896a97455 100644 --- a/app/assets/javascripts/performance_bar/components/detailed_metric.vue +++ b/app/assets/javascripts/performance_bar/components/detailed_metric.vue @@ -94,7 +94,7 @@ export default { data-qa-selector="detailed_metric_content" > <gl-button v-gl-modal="modalId" class="gl-mr-2" type="button" variant="link"> - <span class="gl-text-blue-300">{{ metricDetailsLabel }}</span> + <span class="gl-text-blue-300 gl-font-weight-bold">{{ metricDetailsLabel }}</span> </gl-button> <gl-modal :modal-id="modalId" :title="header" size="lg" footer-class="d-none" scrollable> <table class="table"> diff --git a/app/serializers/README.md b/app/serializers/README.md index 89721f572e0..97e9625eb6f 100644 --- a/app/serializers/README.md +++ b/app/serializers/README.md @@ -99,7 +99,7 @@ create a JSON response according to your needs. ```ruby class PipelineSerializer < BaseSerializer - entity PipelineEntity + entity Ci::PipelineEntity def represent_details(resource) represent(resource, only: [:details]) diff --git a/app/serializers/build_details_entity.rb b/app/serializers/build_details_entity.rb index 2432a6a0e4d..ea72b2b89e7 100644 --- a/app/serializers/build_details_entity.rb +++ b/app/serializers/build_details_entity.rb @@ -9,7 +9,7 @@ class BuildDetailsEntity < JobEntity expose :user, using: UserEntity expose :runner, using: RunnerEntity expose :metadata, using: BuildMetadataEntity - expose :pipeline, using: PipelineEntity + expose :pipeline, using: Ci::PipelineEntity expose :deployment_status, if: -> (*) { build.starts_environment? } do expose :deployment_status, as: :status diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/ci/pipeline_entity.rb index 2d278f0e30d..fabde59634e 100644 --- a/app/serializers/pipeline_entity.rb +++ b/app/serializers/ci/pipeline_entity.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PipelineEntity < Grape::Entity +class Ci::PipelineEntity < Grape::Entity include RequestAwareEntity include Gitlab::Utils::StrongMemoize diff --git a/app/serializers/pipeline_details_entity.rb b/app/serializers/pipeline_details_entity.rb index e53fa7873ac..4fec543eca8 100644 --- a/app/serializers/pipeline_details_entity.rb +++ b/app/serializers/pipeline_details_entity.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class PipelineDetailsEntity < PipelineEntity +class PipelineDetailsEntity < Ci::PipelineEntity expose :project, using: ProjectEntity expose :flags do diff --git a/app/views/projects/cleanup/_show.html.haml b/app/views/projects/cleanup/_show.html.haml index 37ec63cc871..be873f5f0ba 100644 --- a/app/views/projects/cleanup/_show.html.haml +++ b/app/views/projects/cleanup/_show.html.haml @@ -6,7 +6,7 @@ %button.btn.js-settings-toggle = expanded ? _('Collapse') : _('Expand') %p - = _("Clean up after running %{filter_repo} on the repository" % { filter_repo: link_to_filter_repo }).html_safe + = _("Clean up after running %{filter_repo} on the repository." % { filter_repo: link_to_filter_repo }).html_safe = link_to sprite_icon('question-o'), help_page_path('user/project/repository/reducing_the_repo_size_using_git.md'), target: '_blank', rel: 'noopener noreferrer' @@ -24,6 +24,6 @@ = _("No file selected") = f.file_field :bfg_object_map, class: "hidden js-object-map-input", required: true .form-text.text-muted - = _("The maximum file size allowed is %{size}.") % { size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes) } + = _("The maximum file size is %{size}.") % { size: number_to_human_size(Gitlab::CurrentSettings.max_attachment_size.megabytes) } = f.submit _('Start cleanup'), class: 'gl-button btn btn-success' diff --git a/changelogs/unreleased/dblessing_fix_ldap_server_config.yml b/changelogs/unreleased/dblessing_fix_ldap_server_config.yml new file mode 100644 index 00000000000..619d83c98f6 --- /dev/null +++ b/changelogs/unreleased/dblessing_fix_ldap_server_config.yml @@ -0,0 +1,5 @@ +--- +title: Fix missing setting LDAP servers +merge_request: 52512 +author: +type: fixed diff --git a/changelogs/unreleased/pb-bold-font.yml b/changelogs/unreleased/pb-bold-font.yml new file mode 100644 index 00000000000..1cef577d916 --- /dev/null +++ b/changelogs/unreleased/pb-bold-font.yml @@ -0,0 +1,5 @@ +--- +title: Bold metricDetailsLabel in the performance bar +merge_request: 52417 +author: Yogi (@yo) +type: other diff --git a/config/initializers/1_settings.rb b/config/initializers/1_settings.rb index b3ea72fc7e5..bbed08f5044 100644 --- a/config/initializers/1_settings.rb +++ b/config/initializers/1_settings.rb @@ -12,6 +12,7 @@ Settings.encrypted_settings['path'] = Settings.absolute(Settings.encrypted_setti Settings['ldap'] ||= Settingslogic.new({}) Settings.ldap['enabled'] = false if Settings.ldap['enabled'].nil? +Settings.ldap['servers'] ||= Settingslogic.new({}) Settings.ldap['prevent_ldap_sign_in'] = false if Settings.ldap['prevent_ldap_sign_in'].blank? Settings.ldap['secret_file'] = Settings.absolute(Settings.ldap['secret_file'] || File.join(Settings.encrypted_settings['path'], "ldap.yaml.enc")) diff --git a/lib/gitlab/ci/build/rules.rb b/lib/gitlab/ci/build/rules.rb index a39afee194c..2d4f9cf635b 100644 --- a/lib/gitlab/ci/build/rules.rb +++ b/lib/gitlab/ci/build/rules.rb @@ -7,30 +7,17 @@ module Gitlab include ::Gitlab::Utils::StrongMemoize Result = Struct.new(:when, :start_in, :allow_failure, :variables) do - def build_attributes(seed_attributes = {}) + def build_attributes { when: self.when, options: { start_in: start_in }.compact, - allow_failure: allow_failure, - yaml_variables: yaml_variables(seed_attributes[:yaml_variables]) + allow_failure: allow_failure }.compact end def pass? self.when != 'never' end - - private - - def yaml_variables(seed_variables) - return unless variables && seed_variables - - indexed_seed_variables = seed_variables.deep_dup.index_by { |var| var[:key] } - - variables.each_with_object(indexed_seed_variables) do |var, hash| - hash[var[0].to_s] = { key: var[0].to_s, value: var[1], public: true } - end.values - end end def initialize(rule_hashes, default_when:) diff --git a/lib/gitlab/ci/pipeline/seed/build.rb b/lib/gitlab/ci/pipeline/seed/build.rb index 94680d052d9..48411af6f38 100644 --- a/lib/gitlab/ci/pipeline/seed/build.rb +++ b/lib/gitlab/ci/pipeline/seed/build.rb @@ -159,7 +159,11 @@ module Gitlab next {} unless @using_rules if ::Gitlab::Ci::Features.rules_variables_enabled?(@pipeline.project) - rules_result.build_attributes(@seed_attributes) + rules_variables_result = ::Gitlab::Ci::Variables::Helpers.merge_variables( + @seed_attributes[:yaml_variables], rules_result.variables + ) + + rules_result.build_attributes.merge(yaml_variables: rules_variables_result) else rules_result.build_attributes end diff --git a/lib/gitlab/ci/variables/helpers.rb b/lib/gitlab/ci/variables/helpers.rb new file mode 100644 index 00000000000..e2a54f90ecb --- /dev/null +++ b/lib/gitlab/ci/variables/helpers.rb @@ -0,0 +1,32 @@ +# frozen_string_literal: true + +module Gitlab + module Ci + module Variables + module Helpers + class << self + def merge_variables(current_vars, new_vars) + current_vars = transform_from_yaml_variables(current_vars) + new_vars = transform_from_yaml_variables(new_vars) + + transform_to_yaml_variables( + current_vars.merge(new_vars) + ) + end + + def transform_to_yaml_variables(vars) + vars.to_h.map do |key, value| + { key: key.to_s, value: value, public: true } + end + end + + def transform_from_yaml_variables(vars) + return vars.stringify_keys if vars.is_a?(Hash) + + vars.to_a.map { |var| [var[:key].to_s, var[:value]] }.to_h + end + end + end + end + end +end diff --git a/lib/gitlab/ci/yaml_processor/result.rb b/lib/gitlab/ci/yaml_processor/result.rb index 86749cda9c7..3459b69bebc 100644 --- a/lib/gitlab/ci/yaml_processor/result.rb +++ b/lib/gitlab/ci/yaml_processor/result.rb @@ -123,9 +123,7 @@ module Gitlab end def transform_to_yaml_variables(variables) - variables.to_h.map do |key, value| - { key: key.to_s, value: value, public: true } - end + ::Gitlab::Ci::Variables::Helpers.transform_to_yaml_variables(variables) end end end diff --git a/lib/gitlab/diff/file_collection_sorter.rb b/lib/gitlab/diff/file_collection_sorter.rb index 94626875580..7b099543c83 100644 --- a/lib/gitlab/diff/file_collection_sorter.rb +++ b/lib/gitlab/diff/file_collection_sorter.rb @@ -3,6 +3,10 @@ module Gitlab module Diff class FileCollectionSorter + B_FOLLOWS_A = 1 + A_FOLLOWS_B = -1 + EQUIVALENT = 0 + attr_reader :diffs def initialize(diffs) @@ -29,14 +33,16 @@ module Gitlab a_part = a_parts.shift b_part = b_parts.shift - return 1 if a_parts.size < b_parts.size && a_parts.empty? - return -1 if a_parts.size > b_parts.size && b_parts.empty? + return B_FOLLOWS_A if a_parts.size < b_parts.size && a_parts.empty? + return A_FOLLOWS_B if a_parts.size > b_parts.size && b_parts.empty? comparison = a_part <=> b_part - return comparison unless comparison == 0 + return comparison unless comparison == EQUIVALENT + return compare_path_parts(a_parts, b_parts) if a_parts.any? && b_parts.any? - compare_path_parts(a_parts, b_parts) + # If A and B have the same name (e.g. symlink change), they are identical so return 0 + EQUIVALENT end end end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index 9bc44487d76..4c05ce63bf7 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -4457,6 +4457,12 @@ msgstr "" msgid "BillingPlans|Congratulations, your free trial is activated." msgstr "" +msgid "BillingPlans|Current Plan" +msgstr "" + +msgid "BillingPlans|Free upgrade!" +msgstr "" + msgid "BillingPlans|If you would like to downgrade your plan please contact %{support_link_start}Customer Support%{support_link_end}." msgstr "" @@ -4490,6 +4496,9 @@ msgstr "" msgid "BillingPlans|billed annually at %{price_per_year}" msgstr "" +msgid "BillingPlans|for the remainder of your subscription" +msgstr "" + msgid "BillingPlans|frequently asked questions" msgstr "" @@ -4505,6 +4514,9 @@ msgstr "" msgid "BillingPlan|Upgrade" msgstr "" +msgid "BillingPlan|Upgrade for free" +msgstr "" + msgid "Billing|An email address is only visible for users with public emails." msgstr "" @@ -8510,9 +8522,6 @@ msgstr "" msgid "Current Branch" msgstr "" -msgid "Current Plan" -msgstr "" - msgid "Current Project" msgstr "" @@ -28304,6 +28313,9 @@ msgstr "" msgid "The maximum file size allowed is %{size}." msgstr "" +msgid "The maximum file size is %{size}." +msgstr "" + msgid "The merge conflicts for this merge request cannot be resolved through GitLab. Please try to resolve them locally." msgstr "" @@ -30635,6 +30647,9 @@ msgstr "" msgid "Updating" msgstr "" +msgid "Upgrade offers available!" +msgstr "" + msgid "Upgrade your plan" msgstr "" diff --git a/spec/lib/gitlab/ci/build/rules_spec.rb b/spec/lib/gitlab/ci/build/rules_spec.rb index a1af5b75f87..0b50def05d4 100644 --- a/spec/lib/gitlab/ci/build/rules_spec.rb +++ b/spec/lib/gitlab/ci/build/rules_spec.rb @@ -201,40 +201,13 @@ RSpec.describe Gitlab::Ci::Build::Rules do end describe '#build_attributes' do - let(:seed_attributes) { {} } - subject(:build_attributes) do - result.build_attributes(seed_attributes) + result.build_attributes end it 'compacts nil values' do is_expected.to eq(options: {}, when: 'on_success') end - - context 'when there are variables in rules' do - let(:variables) { { VAR1: 'new var 1', VAR3: 'var 3' } } - - context 'when there are seed variables' do - let(:seed_attributes) do - { yaml_variables: [{ key: 'VAR1', value: 'var 1', public: true }, - { key: 'VAR2', value: 'var 2', public: true }] } - end - - it 'returns yaml_variables with override' do - is_expected.to include( - yaml_variables: [{ key: 'VAR1', value: 'new var 1', public: true }, - { key: 'VAR2', value: 'var 2', public: true }, - { key: 'VAR3', value: 'var 3', public: true }] - ) - end - end - - context 'when there is not seed variables' do - it 'does not return yaml_variables' do - is_expected.not_to have_key(:yaml_variables) - end - end - end end describe '#pass?' do diff --git a/spec/lib/gitlab/ci/variables/helpers_spec.rb b/spec/lib/gitlab/ci/variables/helpers_spec.rb new file mode 100644 index 00000000000..b45abf8c0e1 --- /dev/null +++ b/spec/lib/gitlab/ci/variables/helpers_spec.rb @@ -0,0 +1,103 @@ +# frozen_string_literal: true + +require 'fast_spec_helper' + +RSpec.describe Gitlab::Ci::Variables::Helpers do + describe '.merge_variables' do + let(:current_variables) do + [{ key: 'key1', value: 'value1' }, + { key: 'key2', value: 'value2' }] + end + + let(:new_variables) do + [{ key: 'key2', value: 'value22' }, + { key: 'key3', value: 'value3' }] + end + + let(:result) do + [{ key: 'key1', value: 'value1', public: true }, + { key: 'key2', value: 'value22', public: true }, + { key: 'key3', value: 'value3', public: true }] + end + + subject { described_class.merge_variables(current_variables, new_variables) } + + it { is_expected.to eq(result) } + + context 'when new variables is a hash' do + let(:new_variables) do + { 'key2' => 'value22', 'key3' => 'value3' } + end + + it { is_expected.to eq(result) } + end + + context 'when new variables is a hash with symbol keys' do + let(:new_variables) do + { key2: 'value22', key3: 'value3' } + end + + it { is_expected.to eq(result) } + end + + context 'when new variables is nil' do + let(:new_variables) {} + let(:result) do + [{ key: 'key1', value: 'value1', public: true }, + { key: 'key2', value: 'value2', public: true }] + end + + it { is_expected.to eq(result) } + end + end + + describe '.transform_to_yaml_variables' do + let(:variables) do + { 'key1' => 'value1', 'key2' => 'value2' } + end + + let(:result) do + [{ key: 'key1', value: 'value1', public: true }, + { key: 'key2', value: 'value2', public: true }] + end + + subject { described_class.transform_to_yaml_variables(variables) } + + it { is_expected.to eq(result) } + + context 'when variables is nil' do + let(:variables) {} + + it { is_expected.to eq([]) } + end + end + + describe '.transform_from_yaml_variables' do + let(:variables) do + [{ key: 'key1', value: 'value1', public: true }, + { key: 'key2', value: 'value2', public: true }] + end + + let(:result) do + { 'key1' => 'value1', 'key2' => 'value2' } + end + + subject { described_class.transform_from_yaml_variables(variables) } + + it { is_expected.to eq(result) } + + context 'when variables is nil' do + let(:variables) {} + + it { is_expected.to eq({}) } + end + + context 'when variables is a hash' do + let(:variables) do + { key1: 'value1', 'key2' => 'value2' } + end + + it { is_expected.to eq(result) } + end + end +end diff --git a/spec/lib/gitlab/diff/file_collection_sorter_spec.rb b/spec/lib/gitlab/diff/file_collection_sorter_spec.rb index 8822fc55c6e..9ba9271cefc 100644 --- a/spec/lib/gitlab/diff/file_collection_sorter_spec.rb +++ b/spec/lib/gitlab/diff/file_collection_sorter_spec.rb @@ -5,11 +5,14 @@ require 'spec_helper' RSpec.describe Gitlab::Diff::FileCollectionSorter do let(:diffs) do [ + double(new_path: 'README', old_path: 'README'), double(new_path: '.dir/test', old_path: '.dir/test'), double(new_path: '', old_path: '.file'), double(new_path: '1-folder/A-file.ext', old_path: '1-folder/A-file.ext'), + double(new_path: '1-folder/README', old_path: '1-folder/README'), double(new_path: nil, old_path: '1-folder/M-file.ext'), double(new_path: '1-folder/Z-file.ext', old_path: '1-folder/Z-file.ext'), + double(new_path: '1-folder/README', old_path: '1-folder/README'), double(new_path: '', old_path: '1-folder/nested/A-file.ext'), double(new_path: '1-folder/nested/M-file.ext', old_path: '1-folder/nested/M-file.ext'), double(new_path: nil, old_path: '1-folder/nested/Z-file.ext'), @@ -19,7 +22,8 @@ RSpec.describe Gitlab::Diff::FileCollectionSorter do double(new_path: nil, old_path: '2-folder/nested/A-file.ext'), double(new_path: 'A-file.ext', old_path: 'A-file.ext'), double(new_path: '', old_path: 'M-file.ext'), - double(new_path: 'Z-file.ext', old_path: 'Z-file.ext') + double(new_path: 'Z-file.ext', old_path: 'Z-file.ext'), + double(new_path: 'README', old_path: 'README') ] end @@ -36,6 +40,8 @@ RSpec.describe Gitlab::Diff::FileCollectionSorter do '1-folder/nested/Z-file.ext', '1-folder/A-file.ext', '1-folder/M-file.ext', + '1-folder/README', + '1-folder/README', '1-folder/Z-file.ext', '2-folder/nested/A-file.ext', '2-folder/A-file.ext', @@ -44,6 +50,8 @@ RSpec.describe Gitlab::Diff::FileCollectionSorter do '.file', 'A-file.ext', 'M-file.ext', + 'README', + 'README', 'Z-file.ext' ]) end diff --git a/spec/serializers/pipeline_entity_spec.rb b/spec/serializers/ci/pipeline_entity_spec.rb index 61dbcaae77d..6ce3cef5f44 100644 --- a/spec/serializers/pipeline_entity_spec.rb +++ b/spec/serializers/ci/pipeline_entity_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe PipelineEntity do +RSpec.describe Ci::PipelineEntity do include Gitlab::Routing let_it_be(:project) { create(:project) } diff --git a/spec/serializers/pipeline_details_entity_spec.rb b/spec/serializers/pipeline_details_entity_spec.rb index 74e91cc9cdd..2f54f45866b 100644 --- a/spec/serializers/pipeline_details_entity_spec.rb +++ b/spec/serializers/pipeline_details_entity_spec.rb @@ -10,8 +10,8 @@ RSpec.describe PipelineDetailsEntity do described_class.represent(pipeline, request: request) end - it 'inherrits from PipelineEntity' do - expect(described_class).to be < PipelineEntity + it 'inherits from PipelineEntity' do + expect(described_class).to be < Ci::PipelineEntity end before do |