diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-07 00:08:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-07 00:08:57 +0300 |
commit | 63c5b4906b330d3ad4100446d149eaf6f65e6d82 (patch) | |
tree | 8aa81689666f1b93724ed9714f9c4e778e61494e | |
parent | f3db01da507f86cfed412c7d337e3747744cc914 (diff) |
Add latest changes from gitlab-org/gitlab@master
13 files changed, 153 insertions, 107 deletions
diff --git a/GITLAB_SHELL_VERSION b/GITLAB_SHELL_VERSION index fbda4b8d751..6665a53d3b5 100644 --- a/GITLAB_SHELL_VERSION +++ b/GITLAB_SHELL_VERSION @@ -1 +1 @@ -13.11.0 +13.12.0 diff --git a/app/assets/javascripts/notes/components/comment_form.vue b/app/assets/javascripts/notes/components/comment_form.vue index a33cdfc6e28..9cc53a320b8 100644 --- a/app/assets/javascripts/notes/components/comment_form.vue +++ b/app/assets/javascripts/notes/components/comment_form.vue @@ -343,7 +343,7 @@ export default { <ul v-else-if="canCreateNote" class="notes notes-form timeline"> <timeline-entry-item class="note-form"> <div class="flash-container error-alert timeline-content"></div> - <div class="timeline-icon d-none d-sm-none d-md-block"> + <div class="timeline-icon d-none d-md-block"> <user-avatar-link v-if="author" :link-href="author.path" diff --git a/app/assets/javascripts/registry/explorer/components/list_page/cli_commands.vue b/app/assets/javascripts/registry/explorer/components/list_page/cli_commands.vue index 85d87dab042..ba55822f0ca 100644 --- a/app/assets/javascripts/registry/explorer/components/list_page/cli_commands.vue +++ b/app/assets/javascripts/registry/explorer/components/list_page/cli_commands.vue @@ -1,5 +1,5 @@ <script> -import { GlDeprecatedDropdown } from '@gitlab/ui'; +import { GlDropdown } from '@gitlab/ui'; import { mapGetters } from 'vuex'; import Tracking from '~/tracking'; import CodeInstruction from '~/vue_shared/components/registry/code_instruction.vue'; @@ -17,7 +17,7 @@ const trackingLabel = 'quickstart_dropdown'; export default { components: { - GlDeprecatedDropdown, + GlDropdown, CodeInstruction, }, mixins: [Tracking.mixin({ label: trackingLabel })], @@ -37,15 +37,14 @@ export default { }; </script> <template> - <gl-deprecated-dropdown + <gl-dropdown :text="$options.i18n.QUICK_START" - variant="primary" - size="sm" + variant="info" right @shown="track('click_dropdown')" > <!-- This li is used as a container since gl-dropdown produces a root ul, this mimics the functionality exposed by b-dropdown-form --> - <li role="presentation" class="px-2 py-1 dropdown-menu-large"> + <li role="presentation" class="px-2 py-1"> <code-instruction :label="$options.i18n.LOGIN_COMMAND_LABEL" :instruction="dockerLoginCommand" @@ -71,5 +70,5 @@ export default { :tracking-label="$options.trackingLabel" /> </li> - </gl-deprecated-dropdown> + </gl-dropdown> </template> diff --git a/app/views/admin/dev_ops_report/_report.html.haml b/app/views/admin/dev_ops_report/_report.html.haml index 444b1db1500..24c805d273a 100644 --- a/app/views/admin/dev_ops_report/_report.html.haml +++ b/app/views/admin/dev_ops_report/_report.html.haml @@ -13,9 +13,9 @@ %h2.devops-header-title{ class: "devops-#{score_level(@metric.average_percentage_score)}-score" } = number_to_percentage(@metric.average_percentage_score, precision: 1) .devops-header-subtitle - = _('DevOps') + = s_('DevopsReport|DevOps') %br - = _('Score') + = s_('DevopsReport|Score') = link_to sprite_icon('question-o', css_class: 'devops-header-icon'), help_page_path('user/admin_area/analytics/dev_ops_report') .devops-cards.board-card-container diff --git a/app/workers/background_migration_worker.rb b/app/workers/background_migration_worker.rb index 74a12dbff77..17aa43856c0 100644 --- a/app/workers/background_migration_worker.rb +++ b/app/workers/background_migration_worker.rb @@ -24,10 +24,14 @@ class BackgroundMigrationWorker # rubocop:disable Scalability/IdempotentWorker # class_name - The class name of the background migration to run. # arguments - The arguments to pass to the migration class. # lease_attempts - The number of times we will try to obtain an exclusive - # lease on the class before running anyway. Pass 0 to always run. + # lease on the class before giving up. See MR for more discussion. + # https://gitlab.com/gitlab-org/gitlab/-/merge_requests/45298#note_434304956 def perform(class_name, arguments = [], lease_attempts = 5) with_context(caller_id: class_name.to_s) do - should_perform, ttl = perform_and_ttl(class_name) + attempts_left = lease_attempts - 1 + should_perform, ttl = perform_and_ttl(class_name, attempts_left) + + break if should_perform.nil? if should_perform Gitlab::BackgroundMigration.perform(class_name, arguments) @@ -37,32 +41,39 @@ class BackgroundMigrationWorker # rubocop:disable Scalability/IdempotentWorker # we'll reschedule the job in such a way that it is picked up again around # the time the lease expires. self.class - .perform_in(ttl || self.class.minimum_interval, class_name, arguments) + .perform_in(ttl || self.class.minimum_interval, class_name, arguments, attempts_left) end end end - def perform_and_ttl(class_name) - if always_perform? - # In test environments `perform_in` will run right away. This can then - # lead to stack level errors in the above `#perform`. To work around this - # we'll just perform the migration right away in the test environment. - [true, nil] - else - lease = lease_for(class_name) - perform = !!lease.try_obtain - - # If we managed to acquire the lease but the DB is not healthy, then we - # want to simply reschedule our job and try again _after_ the lease - # expires. - if perform && !healthy_database? - database_unhealthy_counter.increment - - perform = false - end + def perform_and_ttl(class_name, attempts_left) + # In test environments `perform_in` will run right away. This can then + # lead to stack level errors in the above `#perform`. To work around this + # we'll just perform the migration right away in the test environment. + return [true, nil] if always_perform? + + lease = lease_for(class_name) + lease_obtained = !!lease.try_obtain + healthy_db = healthy_database? + perform = lease_obtained && healthy_db + + database_unhealthy_counter.increment if lease_obtained && !healthy_db - [perform, lease.ttl] + # If we've tried several times to get a lease with a healthy DB without success, just give up. + # Otherwise we could end up in an infinite rescheduling loop. + if !perform && attempts_left < 0 + msg = if !lease_obtained + 'Job could not get an exclusive lease after several tries. Giving up.' + else + 'Database was unhealthy after several tries. Giving up.' + end + + Sidekiq.logger.warn(class: class_name, message: msg, job_id: jid) + + return [nil, nil] end + + [perform, lease.ttl] end def lease_for(class_name) diff --git a/changelogs/unreleased/267828-remove-minimum_interval-from-backgroundmigrationworker.yml b/changelogs/unreleased/267828-remove-minimum_interval-from-backgroundmigrationworker.yml new file mode 100644 index 00000000000..09fc66a511c --- /dev/null +++ b/changelogs/unreleased/267828-remove-minimum_interval-from-backgroundmigrationworker.yml @@ -0,0 +1,5 @@ +--- +title: Limit number of times a background migration is rescheduled +merge_request: 45298 +author: +type: fixed diff --git a/changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-re.yml b/changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-re.yml new file mode 100644 index 00000000000..31b8452a758 --- /dev/null +++ b/changelogs/unreleased/Replace-GlDeprecatedDropdown-with-GlDropdown-in-app-assets-javascripts-re.yml @@ -0,0 +1,5 @@ +--- +title: Replace Deprecated Dropdown in Container Registry Explorer Page +merge_request: 41425 +author: nuwe1 +type: other diff --git a/changelogs/unreleased/sh-bump-gitlab-shell-13-12.yml b/changelogs/unreleased/sh-bump-gitlab-shell-13-12.yml new file mode 100644 index 00000000000..c393bdba59d --- /dev/null +++ b/changelogs/unreleased/sh-bump-gitlab-shell-13-12.yml @@ -0,0 +1,5 @@ +--- +title: Bump gitlab-shell version to 13.12.0 +merge_request: 47084 +author: +type: other diff --git a/doc/user/admin_area/credentials_inventory.md b/doc/user/admin_area/credentials_inventory.md index a34fb38b71b..fc04f9786b6 100644 --- a/doc/user/admin_area/credentials_inventory.md +++ b/doc/user/admin_area/credentials_inventory.md @@ -40,39 +40,13 @@ If you see a **Revoke** button, you can revoke that user's PAT. Whether you see | Revoked | Yes | No | Not applicable; token is already revoked | | Revoked | No | No | Not applicable; token is already revoked | +When a PAT is revoked from the credentials inventory, the instance notifies the user by email. + ## Delete a user's SSH key > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/225248) in GitLab 13.5. You can **Delete** a user's SSH key by navigating to the credentials inventory's SSH Keys tab. +The instance then notifies the user. ![Credentials inventory page - SSH keys](img/credentials_inventory_ssh_keys_v13_5.png) - -## Revocation or deletion notification - -> - [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/250354) in GitLab 13.6. -> - It's [deployed behind a feature flag](../../user/feature_flags.md), disabled by default. -> - It's disabled on GitLab.com. -> - It's not recommended for production use. -> - To use it in GitLab self-managed instances, ask a GitLab administrator to [enable it](#enable-or-disable-revocation-or-deletion-notification). - -CAUTION: **Warning:** -This feature might not be available to you. Check the **version history** note above for details. - -### Enable or disable revocation or deletion notification **(ULTIMATE ONLY)** - -Revocation or deletion notification is under development and not ready for production use. It is deployed behind a feature flag that is **disabled by default**. -[GitLab administrators with access to the GitLab Rails console](../../administration/feature_flags.md) -can enable it. - -To enable it: - -```ruby -Feature.enable(:credentials_inventory_revocation_emails) -``` - -To disable it: - -```ruby -Feature.disable(:credentials_inventory_revocation_emails) -``` diff --git a/doc/user/application_security/api_fuzzing/index.md b/doc/user/application_security/api_fuzzing/index.md index 069ff682d2e..eedad0aaedb 100644 --- a/doc/user/application_security/api_fuzzing/index.md +++ b/doc/user/application_security/api_fuzzing/index.md @@ -8,9 +8,10 @@ type: reference, howto # Web API Fuzz Testing **(ULTIMATE)** You can add web API fuzzing to your [GitLab CI/CD](../../../ci/README.md) -pipelines. This helps you discover bugs and potential security issues that other QA processes may miss. -API fuzzing performs fuzz testing of API operation parameters. -Fuzz testing sets operation parameters to unexpected values in an effort to cause unexpected behavior and errors in the API backend. +pipelines. This helps you discover bugs and potential security issues that other QA processes may +miss. API fuzzing performs fuzz testing of API operation parameters. Fuzz testing sets operation +parameters to unexpected values in an effort to cause unexpected behavior and errors in the API +backend. We recommend that you use fuzz testing in addition to [GitLab Secure](../index.md)'s other security scanners and your own test processes. If you're using [GitLab CI/CD](../../../ci/README.md), @@ -61,7 +62,7 @@ Examples of both configurations can be found here: - [Example OpenAPI v2 specification project](https://gitlab.com/gitlab-org/security-products/demos/api-fuzzing-example/-/tree/openapi) - [Example HTTP Archive (HAR) project](https://gitlab.com/gitlab-org/security-products/demos/api-fuzzing-example/-/tree/har) -- [Example Postman Collection project](https://gitlab.com/gitlab-org/security-products/demos/api-fuzzing/postman-collection/) +- [Example Postman Collection project](https://gitlab.com/gitlab-org/security-products/demos/api-fuzzing/postman-api-fuzzing-example) ### OpenAPI Specification diff --git a/locale/gitlab.pot b/locale/gitlab.pot index af33e6cb876..ad354bd2cfd 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -2276,9 +2276,6 @@ msgstr "" msgid "Administration" msgstr "" -msgid "Adoption" -msgstr "" - msgid "Advanced" msgstr "" @@ -9398,15 +9395,9 @@ msgstr "" msgid "Detect host keys" msgstr "" -msgid "DevOps" -msgstr "" - msgid "DevOps Report" msgstr "" -msgid "DevOps Score" -msgstr "" - msgid "DevopsAdoptionSegmentSelection|The maximum number of selections has been reached" msgstr "" @@ -9425,6 +9416,18 @@ msgstr "" msgid "DevopsAdoption|DevOps adoption uses segments to track adoption across key features. Segments are a way to track multiple related projects and groups at once. For example, you could create a segment for the engineering department or a particular product team." msgstr "" +msgid "DevopsReport|Adoption" +msgstr "" + +msgid "DevopsReport|DevOps" +msgstr "" + +msgid "DevopsReport|DevOps Score" +msgstr "" + +msgid "DevopsReport|Score" +msgstr "" + msgid "Diff content limits" msgstr "" @@ -23464,9 +23467,6 @@ msgstr "" msgid "Scopes: %{scope_list}" msgstr "" -msgid "Score" -msgstr "" - msgid "Scroll down" msgstr "" diff --git a/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js b/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js index b4471ab8122..551d1eee68d 100644 --- a/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js +++ b/spec/frontend/registry/explorer/components/list_page/cli_commands_spec.js @@ -1,6 +1,6 @@ import Vuex from 'vuex'; import { mount, createLocalVue } from '@vue/test-utils'; -import { GlDeprecatedDropdown } from '@gitlab/ui'; +import { GlDropdown } from '@gitlab/ui'; import Tracking from '~/tracking'; import * as getters from '~/registry/explorer/stores/getters'; import QuickstartDropdown from '~/registry/explorer/components/list_page/cli_commands.vue'; @@ -23,7 +23,7 @@ describe('cli_commands', () => { let wrapper; let store; - const findDropdownButton = () => wrapper.find(GlDeprecatedDropdown); + const findDropdownButton = () => wrapper.find(GlDropdown); const findCodeInstruction = () => wrapper.findAll(CodeInstruction); const mountComponent = () => { diff --git a/spec/workers/background_migration_worker_spec.rb b/spec/workers/background_migration_worker_spec.rb index 15e93d62c7d..8094efcaf04 100644 --- a/spec/workers/background_migration_worker_spec.rb +++ b/spec/workers/background_migration_worker_spec.rb @@ -12,45 +12,91 @@ RSpec.describe BackgroundMigrationWorker, :clean_gitlab_redis_shared_state do end describe '#perform' do - it 'performs a background migration' do - expect(Gitlab::BackgroundMigration) - .to receive(:perform) - .with('Foo', [10, 20]) + before do + allow(worker).to receive(:jid).and_return(1) + expect(worker).to receive(:always_perform?).and_return(false) + end - worker.perform('Foo', [10, 20]) + context 'when lease can be obtained' do + before do + expect(Gitlab::BackgroundMigration) + .to receive(:perform) + .with('Foo', [10, 20]) + end + + it 'performs a background migration' do + worker.perform('Foo', [10, 20]) + end + + context 'when lease_attempts is 1' do + it 'performs a background migration' do + worker.perform('Foo', [10, 20], 1) + end + end end - it 'reschedules a migration if it was performed recently' do - expect(worker) - .to receive(:always_perform?) - .and_return(false) + context 'when lease not obtained (migration of same class was performed recently)' do + before do + expect(Gitlab::BackgroundMigration).not_to receive(:perform) + + worker.lease_for('Foo').try_obtain + end - worker.lease_for('Foo').try_obtain + it 'reschedules the migration and decrements the lease_attempts' do + expect(described_class) + .to receive(:perform_in) + .with(a_kind_of(Numeric), 'Foo', [10, 20], 4) - expect(Gitlab::BackgroundMigration) - .not_to receive(:perform) + worker.perform('Foo', [10, 20], 5) + end - expect(described_class) - .to receive(:perform_in) - .with(a_kind_of(Numeric), 'Foo', [10, 20]) + context 'when lease_attempts is 1' do + it 'reschedules the migration and decrements the lease_attempts' do + expect(described_class) + .to receive(:perform_in) + .with(a_kind_of(Numeric), 'Foo', [10, 20], 0) - worker.perform('Foo', [10, 20]) + worker.perform('Foo', [10, 20], 1) + end + end + + context 'when lease_attempts is 0' do + it 'gives up performing the migration' do + expect(described_class).not_to receive(:perform_in) + expect(Sidekiq.logger).to receive(:warn).with( + class: 'Foo', + message: 'Job could not get an exclusive lease after several tries. Giving up.', + job_id: 1) + + worker.perform('Foo', [10, 20], 0) + end + end end - it 'reschedules a migration if the database is not healthy' do - allow(worker) - .to receive(:always_perform?) - .and_return(false) + context 'when database is not healthy' do + before do + allow(worker).to receive(:healthy_database?).and_return(false) + end - allow(worker) - .to receive(:healthy_database?) - .and_return(false) + it 'reschedules a migration if the database is not healthy' do + expect(described_class) + .to receive(:perform_in) + .with(a_kind_of(Numeric), 'Foo', [10, 20], 4) - expect(described_class) - .to receive(:perform_in) - .with(a_kind_of(Numeric), 'Foo', [10, 20]) + worker.perform('Foo', [10, 20]) + end - worker.perform('Foo', [10, 20]) + context 'when lease_attempts is 0' do + it 'gives up performing the migration' do + expect(described_class).not_to receive(:perform_in) + expect(Sidekiq.logger).to receive(:warn).with( + class: 'Foo', + message: 'Database was unhealthy after several tries. Giving up.', + job_id: 1) + + worker.perform('Foo', [10, 20], 0) + end + end end it 'sets the class that will be executed as the caller_id' do |