Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml3
-rw-r--r--.gitlab/ci/verify-lockfile.gitlab-ci.yml11
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock4
-rw-r--r--app/controllers/admin/application_settings_controller.rb1
-rw-r--r--app/helpers/application_settings_helper.rb11
-rw-r--r--app/models/application_setting.rb37
-rw-r--r--app/models/application_setting_implementation.rb1
-rw-r--r--app/services/container_expiration_policies/cleanup_service.rb2
-rw-r--r--app/services/projects/container_repository/cleanup_tags_service.rb1
-rw-r--r--app/validators/json_schemas/application_setting_kroki_formats.json10
-rw-r--r--app/views/admin/application_settings/_kroki.html.haml8
-rw-r--r--app/workers/container_expiration_policies/cleanup_container_repository_worker.rb2
-rw-r--r--changelogs/unreleased/241744-additional-formats-kroki.yml5
-rw-r--r--db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb11
-rw-r--r--db/schema_migrations/202011200920001
-rw-r--r--db/structure.sql1
-rw-r--r--doc/administration/auth/img/okta_admin_panel_v13_9.pngbin152598 -> 49319 bytes
-rw-r--r--doc/administration/img/impersonated_audit_events_v13_8.pngbin30859 -> 11908 bytes
-rw-r--r--doc/administration/img/time_zone_settings.pngbin42339 -> 15330 bytes
-rw-r--r--doc/administration/maintenance_mode/maintenance_mode_error_message.pngbin41944 -> 14666 bytes
-rw-r--r--doc/api/graphql/img/users_query_example_v13_8.pngbin200017 -> 53659 bytes
-rw-r--r--doc/ci/pipeline_editor/img/pipeline_editor_commit_v13_8.pngbin18744 -> 8657 bytes
-rw-r--r--doc/ci/pipelines/img/job_artifacts_merge_request.pngbin40817 -> 13206 bytes
-rw-r--r--doc/development/cicd/img/ci_minutes.pngbin56801 -> 20223 bytes
-rw-r--r--doc/development/testing_guide/best_practices.md29
-rw-r--r--doc/university/training/gitlab_flow.md57
-rw-r--r--doc/user/admin_area/analytics/img/cohorts_v13_9.pngbin212318 -> 62434 bytes
-rw-r--r--doc/user/admin_area/analytics/img/dev_ops_adoption_v13_9.pngbin160572 -> 43719 bytes
-rw-r--r--doc/user/admin_area/img/impersonate_user_button_v13_8.pngbin45366 -> 23707 bytes
-rw-r--r--doc/user/admin_area/img/license_details_v13_8.pngbin187777 -> 69506 bytes
-rw-r--r--doc/user/discussions/img/apply_suggestion_v13_9.pngbin139434 -> 37127 bytes
-rw-r--r--doc/user/discussions/img/confidential_comments_v13_9.pngbin18739 -> 8311 bytes
-rw-r--r--doc/user/discussions/img/custom_commit_v13_9.pngbin153637 -> 41069 bytes
-rw-r--r--doc/user/discussions/img/make_suggestion_v13_9.pngbin118571 -> 30463 bytes
-rw-r--r--doc/user/discussions/img/resolve_thread_open_issue_v13_9.pngbin38064 -> 13410 bytes
-rw-r--r--doc/user/discussions/img/suggestion_button_v13_9.pngbin103559 -> 27319 bytes
-rw-r--r--doc/user/group/img/group_code_coverage_analytics_v13_9.pngbin93286 -> 29915 bytes
-rw-r--r--doc/user/group/import/img/bulk_imports_v13_8.pngbin61983 -> 22574 bytes
-rw-r--r--doc/user/group/import/img/import_panel_v13_8.pngbin107428 -> 39125 bytes
-rw-r--r--doc/user/img/activity_followed_users_v13_9.pngbin414639 -> 113807 bytes
-rw-r--r--doc/user/profile/img/profile_following_v13_9.pngbin652637 -> 162916 bytes
-rw-r--r--doc/user/project/img/optional_code_owners_sections_v13_8.pngbin104264 -> 27377 bytes
-rw-r--r--doc/user/project/integrations/img/mattermost_configuration_v2.pngbin218399 -> 75931 bytes
-rw-r--r--lib/gitlab/kroki.rb18
-rw-r--r--locale/gitlab.pot3
-rw-r--r--qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb1
-rw-r--r--spec/controllers/admin/application_settings_controller_spec.rb7
-rw-r--r--spec/helpers/application_settings_helper_spec.rb29
-rw-r--r--spec/lib/gitlab/asciidoc_spec.rb67
-rw-r--r--spec/models/application_setting_spec.rb44
-rw-r--r--spec/services/container_expiration_policies/cleanup_service_spec.rb6
-rw-r--r--spec/services/projects/container_repository/cleanup_tags_service_spec.rb4
-rw-r--r--spec/support/shared_contexts/services_shared_context.rb1
-rw-r--r--spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb5
55 files changed, 281 insertions, 101 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 530faada428..e38e2f765bd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -111,5 +111,4 @@ include:
- local: .gitlab/ci/dast.gitlab-ci.yml
- local: .gitlab/ci/workhorse.gitlab-ci.yml
- local: .gitlab/ci/graphql.gitlab-ci.yml
- - project: 'gitlab-org/frontend/untamper-my-lockfile'
- file: '.gitlab-ci-template.yml'
+ - local: .gitlab/ci/verify-lockfile.gitlab-ci.yml
diff --git a/.gitlab/ci/verify-lockfile.gitlab-ci.yml b/.gitlab/ci/verify-lockfile.gitlab-ci.yml
new file mode 100644
index 00000000000..6336a428b4b
--- /dev/null
+++ b/.gitlab/ci/verify-lockfile.gitlab-ci.yml
@@ -0,0 +1,11 @@
+verify_lockfile:
+ stage: test
+ image: registry.gitlab.com/gitlab-org/gitlab-build-images:ruby-2.7.2-git-2.29-lfs-2.9-node-14.15-yarn-1.22-graphicsmagick-1.3.34
+ needs: []
+ rules:
+ - changes:
+ - yarn.lock
+ script:
+ - npm config set @dappelt:registry https://gitlab.com/api/v4/projects/22564149/packages/npm/
+ - npx lockfile-lint@4.3.7 --path yarn.lock --allowed-hosts yarn --validate-https
+ - npx @dappelt/untamper-my-lockfile --lockfile yarn.lock
diff --git a/Gemfile b/Gemfile
index 66ca052dada..58eea956427 100644
--- a/Gemfile
+++ b/Gemfile
@@ -156,7 +156,7 @@ gem 'wikicloth', '0.8.1'
gem 'asciidoctor', '~> 2.0.10'
gem 'asciidoctor-include-ext', '~> 0.3.1', require: false
gem 'asciidoctor-plantuml', '~> 0.0.12'
-gem 'asciidoctor-kroki', '~> 0.2.2', require: false
+gem 'asciidoctor-kroki', '~> 0.3.0', require: false
gem 'rouge', '~> 3.26.0'
gem 'truncato', '~> 0.7.11'
gem 'bootstrap_form', '~> 4.2.0'
diff --git a/Gemfile.lock b/Gemfile.lock
index 3962fe27073..bea01cf000d 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -84,7 +84,7 @@ GEM
asciidoctor (2.0.12)
asciidoctor-include-ext (0.3.1)
asciidoctor (>= 1.5.6, < 3.0.0)
- asciidoctor-kroki (0.2.2)
+ asciidoctor-kroki (0.3.0)
asciidoctor (~> 2.0)
asciidoctor-plantuml (0.0.12)
asciidoctor (>= 1.5.6, < 3.0.0)
@@ -1291,7 +1291,7 @@ DEPENDENCIES
asana (~> 0.10.3)
asciidoctor (~> 2.0.10)
asciidoctor-include-ext (~> 0.3.1)
- asciidoctor-kroki (~> 0.2.2)
+ asciidoctor-kroki (~> 0.3.0)
asciidoctor-plantuml (~> 0.0.12)
atlassian-jwt (~> 0.2.0)
attr_encrypted (~> 3.1.0)
diff --git a/app/controllers/admin/application_settings_controller.rb b/app/controllers/admin/application_settings_controller.rb
index eb3de936fad..7f7d38a09c5 100644
--- a/app/controllers/admin/application_settings_controller.rb
+++ b/app/controllers/admin/application_settings_controller.rb
@@ -238,6 +238,7 @@ class Admin::ApplicationSettingsController < Admin::ApplicationController
*::ApplicationSettingsHelper.visible_attributes,
*::ApplicationSettingsHelper.external_authorization_service_attributes,
*ApplicationSetting.repository_storages_weighted_attributes,
+ *ApplicationSetting.kroki_formats_attributes.keys.map { |key| "kroki_formats_#{key}".to_sym },
:lets_encrypt_notification_email,
:lets_encrypt_terms_of_service_accepted,
:domain_denylist_file,
diff --git a/app/helpers/application_settings_helper.rb b/app/helpers/application_settings_helper.rb
index b3b90c79076..30ae535b06f 100644
--- a/app/helpers/application_settings_helper.rb
+++ b/app/helpers/application_settings_helper.rb
@@ -26,6 +26,16 @@ module ApplicationSettingsHelper
end
end
+ def kroki_available_formats
+ ApplicationSetting.kroki_formats_attributes.map do |key, value|
+ {
+ name: "kroki_formats_#{key}",
+ label: value[:label],
+ value: @application_setting.kroki_formats[key] || false
+ }
+ end
+ end
+
def storage_weights
ApplicationSetting.repository_storages_weighted_attributes.map do |attribute|
storage = attribute.to_s.delete_prefix('repository_storages_weighted_')
@@ -259,6 +269,7 @@ module ApplicationSettingsHelper
:personal_access_token_prefix,
:kroki_enabled,
:kroki_url,
+ :kroki_formats,
:plantuml_enabled,
:plantuml_url,
:polling_interval_multiplier,
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index 6d375a19ffb..33c058dab96 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -29,6 +29,21 @@ class ApplicationSetting < ApplicationRecord
@repository_storages_weighted_atributes ||= Gitlab.config.repositories.storages.keys.map { |k| "repository_storages_weighted_#{k}".to_sym }.freeze
end
+ def self.kroki_formats_attributes
+ {
+ blockdiag: {
+ label: 'BlockDiag (includes BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag and RackDiag)'
+ },
+ bpmn: {
+ label: 'BPMN'
+ },
+ excalidraw: {
+ label: 'Excalidraw'
+ }
+ }
+ end
+
+ store_accessor :kroki_formats, *ApplicationSetting.kroki_formats_attributes.keys, prefix: true
store_accessor :repository_storages_weighted, *Gitlab.config.repositories.storages.keys, prefix: true
# Include here so it can override methods from
@@ -54,6 +69,7 @@ class ApplicationSetting < ApplicationRecord
default_value_for :id, 1
default_value_for :repository_storages_weighted, {}
+ default_value_for :kroki_formats, {}
chronic_duration_attr_writer :archive_builds_in_human_readable, :archive_builds_in_seconds
@@ -135,6 +151,8 @@ class ApplicationSetting < ApplicationRecord
validate :validate_kroki_url, if: :kroki_enabled
+ validates :kroki_formats, json_schema: { filename: 'application_setting_kroki_formats' }
+
validates :plantuml_url,
presence: true,
if: :plantuml_enabled
@@ -570,6 +588,25 @@ class ApplicationSetting < ApplicationRecord
end
end
+ kroki_formats_attributes.keys.each do |key|
+ define_method :"kroki_formats_#{key}=" do |value|
+ super(::Gitlab::Utils.to_boolean(value))
+ end
+ end
+
+ def kroki_format_supported?(diagram_type)
+ case diagram_type
+ when 'excalidraw'
+ return kroki_formats_excalidraw
+ when 'bpmn'
+ return kroki_formats_bpmn
+ end
+
+ return kroki_formats_blockdiag if ::Gitlab::Kroki::BLOCKDIAG_FORMATS.include?(diagram_type)
+
+ ::AsciidoctorExtensions::Kroki::SUPPORTED_DIAGRAM_NAMES.include?(diagram_type)
+ end
+
private
def parsed_grafana_url
diff --git a/app/models/application_setting_implementation.rb b/app/models/application_setting_implementation.rb
index e5284d15a49..2911ae6b1c8 100644
--- a/app/models/application_setting_implementation.rb
+++ b/app/models/application_setting_implementation.rb
@@ -176,6 +176,7 @@ module ApplicationSettingImplementation
container_registry_expiration_policies_worker_capacity: 0,
kroki_enabled: false,
kroki_url: nil,
+ kroki_formats: { blockdiag: false, bpmn: false, excalidraw: false },
rate_limiting_response_text: nil
}
end
diff --git a/app/services/container_expiration_policies/cleanup_service.rb b/app/services/container_expiration_policies/cleanup_service.rb
index 83a4d422a4f..69e5620d986 100644
--- a/app/services/container_expiration_policies/cleanup_service.rb
+++ b/app/services/container_expiration_policies/cleanup_service.rb
@@ -4,7 +4,7 @@ module ContainerExpirationPolicies
class CleanupService
attr_reader :repository
- SERVICE_RESULT_FIELDS = %i[original_size before_truncate_size after_truncate_size before_delete_size].freeze
+ SERVICE_RESULT_FIELDS = %i[original_size before_truncate_size after_truncate_size before_delete_size deleted_size].freeze
def initialize(repository)
@repository = repository
diff --git a/app/services/projects/container_repository/cleanup_tags_service.rb b/app/services/projects/container_repository/cleanup_tags_service.rb
index af0107436c8..793d2fec033 100644
--- a/app/services/projects/container_repository/cleanup_tags_service.rb
+++ b/app/services/projects/container_repository/cleanup_tags_service.rb
@@ -25,6 +25,7 @@ module Projects
result[:before_truncate_size] = before_truncate_size
result[:after_truncate_size] = after_truncate_size
result[:before_delete_size] = tags.size
+ result[:deleted_size] = result[:deleted]&.size
result[:status] = :error if before_truncate_size != after_truncate_size
end
diff --git a/app/validators/json_schemas/application_setting_kroki_formats.json b/app/validators/json_schemas/application_setting_kroki_formats.json
new file mode 100644
index 00000000000..460dc74069f
--- /dev/null
+++ b/app/validators/json_schemas/application_setting_kroki_formats.json
@@ -0,0 +1,10 @@
+{
+ "description": "Kroki formats",
+ "type": "object",
+ "properties": {
+ "bpmn": { "type": "boolean" },
+ "excalidraw": { "type": "boolean" },
+ "blockdiag": { "type": "boolean" }
+ },
+ "additionalProperties": false
+}
diff --git a/app/views/admin/application_settings/_kroki.html.haml b/app/views/admin/application_settings/_kroki.html.haml
index 23848fb8b9b..cd57d4cca65 100644
--- a/app/views/admin/application_settings/_kroki.html.haml
+++ b/app/views/admin/application_settings/_kroki.html.haml
@@ -21,5 +21,13 @@
= f.text_field :kroki_url, class: 'form-control gl-form-input', placeholder: 'http://your-kroki-instance:8000'
.form-text.text-muted
= (_('When Kroki is enabled, GitLab sends diagrams to an instance of Kroki to display them as images. You can use the free public cloud instance %{kroki_public_url} or you can %{install_link} on your own infrastructure. Once you\'ve installed Kroki, make sure to update the server URL to point to your instance.') % { kroki_public_url: '<code>https://kroki.io</code>', install_link: link_to('install Kroki', 'https://docs.kroki.io/kroki/setup/install/', target: '_blank') }).html_safe
+ .form-group
+ = f.label :kroki_formats, 'Additional diagram formats', class: 'label-bold'
+ .form-text.text-muted
+ = (_('Using additional formats requires starting the companion containers. Make sure that all %{kroki_images} are running.') % { kroki_images: link_to('required containers', 'https://docs.kroki.io/kroki/setup/install/#_images', target: '_blank') }).html_safe
+ - kroki_available_formats.each do |format|
+ .form-check
+ = f.check_box format[:name], class: 'form-check-input'
+ = f.label format[:name], format[:label], class: 'form-check-label'
= f.submit _('Save changes'), class: "btn gl-button btn-success"
diff --git a/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb b/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
index b4afe53d4bc..53220a7afed 100644
--- a/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
+++ b/app/workers/container_expiration_policies/cleanup_container_repository_worker.rb
@@ -18,6 +18,7 @@ module ContainerExpirationPolicies
cleanup_tags_service_before_truncate_size
cleanup_tags_service_after_truncate_size
cleanup_tags_service_before_delete_size
+ cleanup_tags_service_deleted_size
].freeze
def perform_work
@@ -117,6 +118,7 @@ module ContainerExpirationPolicies
after_truncate_size &&
before_truncate_size != after_truncate_size
log_extra_metadata_on_done(:cleanup_tags_service_truncated, !!truncated)
+ log_extra_metadata_on_done(:running_jobs_count, running_jobs_count)
end
end
end
diff --git a/changelogs/unreleased/241744-additional-formats-kroki.yml b/changelogs/unreleased/241744-additional-formats-kroki.yml
new file mode 100644
index 00000000000..f305ee13553
--- /dev/null
+++ b/changelogs/unreleased/241744-additional-formats-kroki.yml
@@ -0,0 +1,5 @@
+---
+title: "Enable/disable additional diagram formats on Kroki"
+merge_request: 49304
+author: Guillaume Grossetie
+type: added
diff --git a/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb b/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb
new file mode 100644
index 00000000000..a059099dbc4
--- /dev/null
+++ b/db/migrate/20201120092000_add_kroki_formats_to_application_settings_table.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddKrokiFormatsToApplicationSettingsTable < ActiveRecord::Migration[6.0]
+ DOWNTIME = false
+
+ def change
+ change_table :application_settings do |t|
+ t.jsonb :kroki_formats, null: false, default: {}
+ end
+ end
+end
diff --git a/db/schema_migrations/20201120092000 b/db/schema_migrations/20201120092000
new file mode 100644
index 00000000000..eaa6c37cff2
--- /dev/null
+++ b/db/schema_migrations/20201120092000
@@ -0,0 +1 @@
+c8f837a5fe7a1959af41f19f93b6dd96d8907a476626f124876ee8b10b120b71 \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index e8d94c87b7c..d582c343e73 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -9398,6 +9398,7 @@ CREATE TABLE application_settings (
keep_latest_artifact boolean DEFAULT true NOT NULL,
notes_create_limit integer DEFAULT 300 NOT NULL,
notes_create_limit_allowlist text[] DEFAULT '{}'::text[] NOT NULL,
+ kroki_formats jsonb DEFAULT '{}'::jsonb NOT NULL,
CONSTRAINT app_settings_container_reg_cleanup_tags_max_list_size_positive CHECK ((container_registry_cleanup_tags_service_max_list_size >= 0)),
CONSTRAINT app_settings_registry_exp_policies_worker_capacity_positive CHECK ((container_registry_expiration_policies_worker_capacity >= 0)),
CONSTRAINT check_17d9558205 CHECK ((char_length((kroki_url)::text) <= 1024)),
diff --git a/doc/administration/auth/img/okta_admin_panel_v13_9.png b/doc/administration/auth/img/okta_admin_panel_v13_9.png
index bba859c80af..2ebb1f0112c 100644
--- a/doc/administration/auth/img/okta_admin_panel_v13_9.png
+++ b/doc/administration/auth/img/okta_admin_panel_v13_9.png
Binary files differ
diff --git a/doc/administration/img/impersonated_audit_events_v13_8.png b/doc/administration/img/impersonated_audit_events_v13_8.png
index 8d7d13942d0..0a8548d515d 100644
--- a/doc/administration/img/impersonated_audit_events_v13_8.png
+++ b/doc/administration/img/impersonated_audit_events_v13_8.png
Binary files differ
diff --git a/doc/administration/img/time_zone_settings.png b/doc/administration/img/time_zone_settings.png
index 73961b1090c..e735a8bc5ec 100644
--- a/doc/administration/img/time_zone_settings.png
+++ b/doc/administration/img/time_zone_settings.png
Binary files differ
diff --git a/doc/administration/maintenance_mode/maintenance_mode_error_message.png b/doc/administration/maintenance_mode/maintenance_mode_error_message.png
index 0a98d36beb8..4b422a719ca 100644
--- a/doc/administration/maintenance_mode/maintenance_mode_error_message.png
+++ b/doc/administration/maintenance_mode/maintenance_mode_error_message.png
Binary files differ
diff --git a/doc/api/graphql/img/users_query_example_v13_8.png b/doc/api/graphql/img/users_query_example_v13_8.png
index b4c2b4e999a..155824cad6e 100644
--- a/doc/api/graphql/img/users_query_example_v13_8.png
+++ b/doc/api/graphql/img/users_query_example_v13_8.png
Binary files differ
diff --git a/doc/ci/pipeline_editor/img/pipeline_editor_commit_v13_8.png b/doc/ci/pipeline_editor/img/pipeline_editor_commit_v13_8.png
index cc1f666f319..fcafc984ce4 100644
--- a/doc/ci/pipeline_editor/img/pipeline_editor_commit_v13_8.png
+++ b/doc/ci/pipeline_editor/img/pipeline_editor_commit_v13_8.png
Binary files differ
diff --git a/doc/ci/pipelines/img/job_artifacts_merge_request.png b/doc/ci/pipelines/img/job_artifacts_merge_request.png
index fa1ed9acbf8..e87839ceeca 100644
--- a/doc/ci/pipelines/img/job_artifacts_merge_request.png
+++ b/doc/ci/pipelines/img/job_artifacts_merge_request.png
Binary files differ
diff --git a/doc/development/cicd/img/ci_minutes.png b/doc/development/cicd/img/ci_minutes.png
index e65a856a248..d47406fb445 100644
--- a/doc/development/cicd/img/ci_minutes.png
+++ b/doc/development/cicd/img/ci_minutes.png
Binary files differ
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index 0ccf513f5d8..79ff46ae352 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -521,35 +521,6 @@ let_it_be_with_refind(:project) { create(:project) }
let_it_be(:project, refind: true) { create(:project) }
```
-### License stubbing with `let_it_be`
-
-`let_it_be_with_refind` is also useful when using `stub_licensed_features` in your tests:
-
-```ruby
-let_it_be_with_refind(:project) { create(:project) }
-# Project#licensed_feature_available? is memoized, and so we need to refind
-# the project for license updates to be applied.
-# An alternative is `project.clear_memoization(:licensed_feature_available)`.
-
-subject { project.allows_multiple_assignees? }
-
-context 'with license multiple_issue_assignees disabled' do
- before do
- stub_licensed_features(multiple_issue_assignees: true)
- end
-
- it { is_expected.to eq(true) }
-end
-
-context 'with license multiple_issue_assignees disabled' do
- before do
- stub_licensed_features(multiple_issue_assignees: false)
- end
-
- it { is_expected.to eq(false) }
-end
-```
-
### Time-sensitive tests
[`ActiveSupport::Testing::TimeHelpers`](https://api.rubyonrails.org/v6.0.3.1/classes/ActiveSupport/Testing/TimeHelpers.html)
diff --git a/doc/university/training/gitlab_flow.md b/doc/university/training/gitlab_flow.md
index f25bff03926..bdc97ff8d28 100644
--- a/doc/university/training/gitlab_flow.md
+++ b/doc/university/training/gitlab_flow.md
@@ -1,57 +1,8 @@
---
-stage: none
-group: unassigned
-info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
-comments: false
-type: reference
+redirect_to: '../../topics/gitlab_flow.md'
---
-# What is the GitLab Flow
+This document was moved to [another location](../../topics/gitlab_flow.md).
-- A simplified branching strategy
-- All features and fixes first go to master
-- Allows for 'production' or 'stable' branches
-- Bug fixes/hot fix patches are cherry-picked from master
-
-## Feature branches
-
-- Create a feature/bugfix branch to do all work
-- Use merge requests to merge to master
-
-![inline](gitlab_flow/feature_branches.png)
-
-## Production branch
-
-- One, long-running production release branch
- as opposed to individual stable branches
-- Consider creating a tag for each version that gets deployed
-
-![inline](gitlab_flow/production_branch.png)
-
-## Release branch
-
-- Useful if you release software to customers
-- When preparing a new release, create stable branch
- from master
-- Consider creating a tag for each version
-- Cherry-pick critical bug fixes to stable branch for patch release
-- Never commit bug fixes directly to stable branch
-
-![inline](gitlab_flow/release_branches.png)
-
-## More details
-
-For more information, read through the [GitLab Flow](../../topics/gitlab_flow.md)
-documentation.
-
-<!-- ## Troubleshooting
-
-Include any troubleshooting steps that you can foresee. If you know beforehand what issues
-one might have when setting this up, or when something is changed, or on upgrading, it's
-important to describe those, too. Think of things that may go wrong and include them here.
-This is important to minimize requests for support, and to avoid doc comments with
-questions that you know someone might ask.
-
-Each scenario can be a third-level heading, e.g. `### Getting error message X`.
-If you have none to add when creating a doc, leave this section in place
-but commented out to help encourage others to add to it in the future. -->
+<!-- This redirect file can be deleted after <2021-05-16>. -->
+<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
diff --git a/doc/user/admin_area/analytics/img/cohorts_v13_9.png b/doc/user/admin_area/analytics/img/cohorts_v13_9.png
index 3e141f24950..6a616b201c9 100644
--- a/doc/user/admin_area/analytics/img/cohorts_v13_9.png
+++ b/doc/user/admin_area/analytics/img/cohorts_v13_9.png
Binary files differ
diff --git a/doc/user/admin_area/analytics/img/dev_ops_adoption_v13_9.png b/doc/user/admin_area/analytics/img/dev_ops_adoption_v13_9.png
index 0f96af4ef38..a295179dda3 100644
--- a/doc/user/admin_area/analytics/img/dev_ops_adoption_v13_9.png
+++ b/doc/user/admin_area/analytics/img/dev_ops_adoption_v13_9.png
Binary files differ
diff --git a/doc/user/admin_area/img/impersonate_user_button_v13_8.png b/doc/user/admin_area/img/impersonate_user_button_v13_8.png
index 2c44c2bd28c..475315a0c0f 100644
--- a/doc/user/admin_area/img/impersonate_user_button_v13_8.png
+++ b/doc/user/admin_area/img/impersonate_user_button_v13_8.png
Binary files differ
diff --git a/doc/user/admin_area/img/license_details_v13_8.png b/doc/user/admin_area/img/license_details_v13_8.png
index dc12649fbe9..00421d8a41d 100644
--- a/doc/user/admin_area/img/license_details_v13_8.png
+++ b/doc/user/admin_area/img/license_details_v13_8.png
Binary files differ
diff --git a/doc/user/discussions/img/apply_suggestion_v13_9.png b/doc/user/discussions/img/apply_suggestion_v13_9.png
index 932855a8c97..e27fa629672 100644
--- a/doc/user/discussions/img/apply_suggestion_v13_9.png
+++ b/doc/user/discussions/img/apply_suggestion_v13_9.png
Binary files differ
diff --git a/doc/user/discussions/img/confidential_comments_v13_9.png b/doc/user/discussions/img/confidential_comments_v13_9.png
index d3e13f37ae9..b5be5a622a9 100644
--- a/doc/user/discussions/img/confidential_comments_v13_9.png
+++ b/doc/user/discussions/img/confidential_comments_v13_9.png
Binary files differ
diff --git a/doc/user/discussions/img/custom_commit_v13_9.png b/doc/user/discussions/img/custom_commit_v13_9.png
index 547a6534ea1..170c04542dd 100644
--- a/doc/user/discussions/img/custom_commit_v13_9.png
+++ b/doc/user/discussions/img/custom_commit_v13_9.png
Binary files differ
diff --git a/doc/user/discussions/img/make_suggestion_v13_9.png b/doc/user/discussions/img/make_suggestion_v13_9.png
index dc6889cfcd6..92d5ba5ddda 100644
--- a/doc/user/discussions/img/make_suggestion_v13_9.png
+++ b/doc/user/discussions/img/make_suggestion_v13_9.png
Binary files differ
diff --git a/doc/user/discussions/img/resolve_thread_open_issue_v13_9.png b/doc/user/discussions/img/resolve_thread_open_issue_v13_9.png
index 6611ca7b1ff..8ff0f5e84dd 100644
--- a/doc/user/discussions/img/resolve_thread_open_issue_v13_9.png
+++ b/doc/user/discussions/img/resolve_thread_open_issue_v13_9.png
Binary files differ
diff --git a/doc/user/discussions/img/suggestion_button_v13_9.png b/doc/user/discussions/img/suggestion_button_v13_9.png
index 4fbdac4f66d..58e0508d8cf 100644
--- a/doc/user/discussions/img/suggestion_button_v13_9.png
+++ b/doc/user/discussions/img/suggestion_button_v13_9.png
Binary files differ
diff --git a/doc/user/group/img/group_code_coverage_analytics_v13_9.png b/doc/user/group/img/group_code_coverage_analytics_v13_9.png
index 20db7921041..8cd71396381 100644
--- a/doc/user/group/img/group_code_coverage_analytics_v13_9.png
+++ b/doc/user/group/img/group_code_coverage_analytics_v13_9.png
Binary files differ
diff --git a/doc/user/group/import/img/bulk_imports_v13_8.png b/doc/user/group/import/img/bulk_imports_v13_8.png
index 31234f9fcea..ae4d8567d80 100644
--- a/doc/user/group/import/img/bulk_imports_v13_8.png
+++ b/doc/user/group/import/img/bulk_imports_v13_8.png
Binary files differ
diff --git a/doc/user/group/import/img/import_panel_v13_8.png b/doc/user/group/import/img/import_panel_v13_8.png
index 1fb7fbad291..28d61785098 100644
--- a/doc/user/group/import/img/import_panel_v13_8.png
+++ b/doc/user/group/import/img/import_panel_v13_8.png
Binary files differ
diff --git a/doc/user/img/activity_followed_users_v13_9.png b/doc/user/img/activity_followed_users_v13_9.png
index 7f54f17821c..3c0a9de74b4 100644
--- a/doc/user/img/activity_followed_users_v13_9.png
+++ b/doc/user/img/activity_followed_users_v13_9.png
Binary files differ
diff --git a/doc/user/profile/img/profile_following_v13_9.png b/doc/user/profile/img/profile_following_v13_9.png
index 85d54ff3aad..878dce83997 100644
--- a/doc/user/profile/img/profile_following_v13_9.png
+++ b/doc/user/profile/img/profile_following_v13_9.png
Binary files differ
diff --git a/doc/user/project/img/optional_code_owners_sections_v13_8.png b/doc/user/project/img/optional_code_owners_sections_v13_8.png
index 7a5a2fab6e3..50916466226 100644
--- a/doc/user/project/img/optional_code_owners_sections_v13_8.png
+++ b/doc/user/project/img/optional_code_owners_sections_v13_8.png
Binary files differ
diff --git a/doc/user/project/integrations/img/mattermost_configuration_v2.png b/doc/user/project/integrations/img/mattermost_configuration_v2.png
index e05b34fd77a..0470869c4f7 100644
--- a/doc/user/project/integrations/img/mattermost_configuration_v2.png
+++ b/doc/user/project/integrations/img/mattermost_configuration_v2.png
Binary files differ
diff --git a/lib/gitlab/kroki.rb b/lib/gitlab/kroki.rb
index 8c5652fb766..38090786836 100644
--- a/lib/gitlab/kroki.rb
+++ b/lib/gitlab/kroki.rb
@@ -13,9 +13,7 @@ module Gitlab
packetdiag
rackdiag
].freeze
- # Diagrams that require a companion container are disabled for now
DIAGRAMS_FORMATS = ::AsciidoctorExtensions::Kroki::SUPPORTED_DIAGRAM_NAMES
- .reject { |diagram_type| diagram_type == 'mermaid' || diagram_type == 'bpmn' || BLOCKDIAG_FORMATS.include?(diagram_type) }
DIAGRAMS_FORMATS_WO_PLANTUML = DIAGRAMS_FORMATS
.reject { |diagram_type| diagram_type == 'plantuml' }
@@ -28,10 +26,18 @@ module Gitlab
# If PlantUML is enabled, PlantUML diagrams will be processed by the PlantUML server.
# In other words, the PlantUML server has precedence over Kroki since both can process PlantUML diagrams.
- if current_settings.plantuml_enabled
- DIAGRAMS_FORMATS_WO_PLANTUML
- else
- DIAGRAMS_FORMATS
+ diagram_formats = if current_settings.plantuml_enabled
+ DIAGRAMS_FORMATS_WO_PLANTUML
+ else
+ DIAGRAMS_FORMATS
+ end
+
+ # No additional diagram formats
+ return diagram_formats unless current_settings.kroki_formats.present?
+
+ # Diagrams that require a companion container must be explicitly enabled from the settings
+ diagram_formats.select do |diagram_type|
+ current_settings.kroki_format_supported?(diagram_type)
end
end
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index a91b1857244..79d393fd222 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -32271,6 +32271,9 @@ msgstr ""
msgid "Using %{code_start}::%{code_end} denotes a %{link_start}scoped label set%{link_end}"
msgstr ""
+msgid "Using additional formats requires starting the companion containers. Make sure that all %{kroki_images} are running."
+msgstr ""
+
msgid "Using required encryption strategy when encrypted field is missing!"
msgstr ""
diff --git a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb
index c3cb503ed3f..9bf3474ba5a 100644
--- a/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb
+++ b/qa/qa/specs/features/api/3_create/gitaly/distributed_reads_spec.rb
@@ -88,6 +88,7 @@ module QA
read_from_project(project, number_of_reads)
praefect_manager.query_read_distribution.each_with_index do |data, index|
+ diff_found[index] = {} unless diff_found[index]
diff_found[index][:diff] = true if data[:value] > praefect_manager.value_for_node(pre_read_data, data[:node])
end
diff_found.all? { |node| node.key?(:diff) && node[:diff] }
diff --git a/spec/controllers/admin/application_settings_controller_spec.rb b/spec/controllers/admin/application_settings_controller_spec.rb
index f0b224484c6..71abf3191b8 100644
--- a/spec/controllers/admin/application_settings_controller_spec.rb
+++ b/spec/controllers/admin/application_settings_controller_spec.rb
@@ -150,6 +150,13 @@ RSpec.describe Admin::ApplicationSettingsController do
expect(ApplicationSetting.current.repository_storages_weighted_default).to eq(75)
end
+ it 'updates kroki_formats setting' do
+ put :update, params: { application_setting: { kroki_formats_excalidraw: '1' } }
+
+ expect(response).to redirect_to(general_admin_application_settings_path)
+ expect(ApplicationSetting.current.kroki_formats_excalidraw).to eq(true)
+ end
+
it "updates default_branch_name setting" do
put :update, params: { application_setting: { default_branch_name: "example_branch_name" } }
diff --git a/spec/helpers/application_settings_helper_spec.rb b/spec/helpers/application_settings_helper_spec.rb
index 479e2d7ef9d..2cd01451e0d 100644
--- a/spec/helpers/application_settings_helper_spec.rb
+++ b/spec/helpers/application_settings_helper_spec.rb
@@ -194,4 +194,33 @@ RSpec.describe ApplicationSettingsHelper do
it { is_expected.to be false }
end
end
+
+ describe '.kroki_available_formats' do
+ let(:application_setting) { build(:application_setting) }
+
+ before do
+ helper.instance_variable_set(:@application_setting, application_setting)
+ stub_application_setting(kroki_formats: { 'blockdiag' => true, 'bpmn' => false, 'excalidraw' => false })
+ end
+
+ it 'returns available formats correctly' do
+ expect(helper.kroki_available_formats).to eq([
+ {
+ name: 'kroki_formats_blockdiag',
+ label: 'BlockDiag (includes BlockDiag, SeqDiag, ActDiag, NwDiag, PacketDiag and RackDiag)',
+ value: true
+ },
+ {
+ name: 'kroki_formats_bpmn',
+ label: 'BPMN',
+ value: false
+ },
+ {
+ name: 'kroki_formats_excalidraw',
+ label: 'Excalidraw',
+ value: false
+ }
+ ])
+ end
+ end
end
diff --git a/spec/lib/gitlab/asciidoc_spec.rb b/spec/lib/gitlab/asciidoc_spec.rb
index 36e4decdead..08510d4652b 100644
--- a/spec/lib/gitlab/asciidoc_spec.rb
+++ b/spec/lib/gitlab/asciidoc_spec.rb
@@ -510,6 +510,73 @@ module Gitlab
expect(render(input, context)).to include(output.strip)
end
+
+ it 'does not convert a blockdiag diagram to image' do
+ input = <<~ADOC
+ [blockdiag]
+ ....
+ blockdiag {
+ Kroki -> generates -> "Block diagrams";
+ Kroki -> is -> "very easy!";
+
+ Kroki [color = "greenyellow"];
+ "Block diagrams" [color = "pink"];
+ "very easy!" [color = "orange"];
+ }
+ ....
+ ADOC
+
+ output = <<~HTML
+ <div>
+ <div>
+ <pre>blockdiag {
+ Kroki -&gt; generates -&gt; "Block diagrams";
+ Kroki -&gt; is -&gt; "very easy!";
+
+ Kroki [color = "greenyellow"];
+ "Block diagrams" [color = "pink"];
+ "very easy!" [color = "orange"];
+ }</pre>
+ </div>
+ </div>
+ HTML
+
+ expect(render(input, context)).to include(output.strip)
+ end
+ end
+
+ context 'with Kroki and BlockDiag (additional format) enabled' do
+ before do
+ allow_any_instance_of(ApplicationSetting).to receive(:kroki_enabled).and_return(true)
+ allow_any_instance_of(ApplicationSetting).to receive(:kroki_url).and_return('https://kroki.io')
+ allow_any_instance_of(ApplicationSetting).to receive(:kroki_formats_blockdiag).and_return(true)
+ end
+
+ it 'converts a blockdiag diagram to image' do
+ input = <<~ADOC
+ [blockdiag]
+ ....
+ blockdiag {
+ Kroki -> generates -> "Block diagrams";
+ Kroki -> is -> "very easy!";
+
+ Kroki [color = "greenyellow"];
+ "Block diagrams" [color = "pink"];
+ "very easy!" [color = "orange"];
+ }
+ ....
+ ADOC
+
+ output = <<~HTML
+ <div>
+ <div>
+ <a class="no-attachment-icon" href="https://kroki.io/blockdiag/svg/eNpdzDEKQjEQhOHeU4zpPYFoYesRxGJ9bwghMSsbUYJ4d10UCZbDfPynolOek0Q8FsDeNCestoisNLmy-Qg7R3Blcm5hPcr0ITdaB6X15fv-_YdJixo2CNHI2lmK3sPRA__RwV5SzV80ZAegJjXSyfMFptc71w==" target="_blank" rel="noopener noreferrer"><img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" alt="Diagram" class="lazy" data-src="https://kroki.io/blockdiag/svg/eNpdzDEKQjEQhOHeU4zpPYFoYesRxGJ9bwghMSsbUYJ4d10UCZbDfPynolOek0Q8FsDeNCestoisNLmy-Qg7R3Blcm5hPcr0ITdaB6X15fv-_YdJixo2CNHI2lmK3sPRA__RwV5SzV80ZAegJjXSyfMFptc71w=="></a>
+ </div>
+ </div>
+ HTML
+
+ expect(render(input, context)).to include(output.strip)
+ end
end
end
diff --git a/spec/models/application_setting_spec.rb b/spec/models/application_setting_spec.rb
index efa9125bff9..9a4dd2c799b 100644
--- a/spec/models/application_setting_spec.rb
+++ b/spec/models/application_setting_spec.rb
@@ -964,6 +964,50 @@ RSpec.describe ApplicationSetting do
end
end
+ describe 'kroki_format_supported?' do
+ it 'returns true when Excalidraw is enabled' do
+ subject.kroki_formats_excalidraw = true
+ expect(subject.kroki_format_supported?('excalidraw')).to eq(true)
+ end
+
+ it 'returns true when BlockDiag is enabled' do
+ subject.kroki_formats_blockdiag = true
+ # format "blockdiag" aggregates multiple diagram types: actdiag, blockdiag, nwdiag...
+ expect(subject.kroki_format_supported?('actdiag')).to eq(true)
+ expect(subject.kroki_format_supported?('blockdiag')).to eq(true)
+ end
+
+ it 'returns false when BlockDiag is disabled' do
+ subject.kroki_formats_blockdiag = false
+ # format "blockdiag" aggregates multiple diagram types: actdiag, blockdiag, nwdiag...
+ expect(subject.kroki_format_supported?('actdiag')).to eq(false)
+ expect(subject.kroki_format_supported?('blockdiag')).to eq(false)
+ end
+
+ it 'returns false when the diagram type is optional and not enabled' do
+ expect(subject.kroki_format_supported?('bpmn')).to eq(false)
+ end
+
+ it 'returns true when the diagram type is enabled by default' do
+ expect(subject.kroki_format_supported?('vegalite')).to eq(true)
+ expect(subject.kroki_format_supported?('nomnoml')).to eq(true)
+ expect(subject.kroki_format_supported?('unknown-diagram-type')).to eq(false)
+ end
+
+ it 'returns false when the diagram type is unknown' do
+ expect(subject.kroki_format_supported?('unknown-diagram-type')).to eq(false)
+ end
+ end
+
+ describe 'kroki_formats' do
+ it 'returns the value for kroki_formats' do
+ subject.kroki_formats = { blockdiag: true, bpmn: false, excalidraw: true }
+ expect(subject.kroki_formats_blockdiag).to eq(true)
+ expect(subject.kroki_formats_bpmn).to eq(false)
+ expect(subject.kroki_formats_excalidraw).to eq(true)
+ end
+ end
+
it 'does not allow to set weight for non existing storage' do
setting.repository_storages_weighted = { invalid_storage: 100 }
diff --git a/spec/services/container_expiration_policies/cleanup_service_spec.rb b/spec/services/container_expiration_policies/cleanup_service_spec.rb
index bd48a93009c..746e3464427 100644
--- a/spec/services/container_expiration_policies/cleanup_service_spec.rb
+++ b/spec/services/container_expiration_policies/cleanup_service_spec.rb
@@ -61,7 +61,8 @@ RSpec.describe ContainerExpirationPolicies::CleanupService do
original_size: 1000,
before_truncate_size: 800,
after_truncate_size: 200,
- before_delete_size: 100
+ before_delete_size: 100,
+ deleted_size: 100
}
end
@@ -77,7 +78,8 @@ RSpec.describe ContainerExpirationPolicies::CleanupService do
cleanup_tags_service_original_size: 1000,
cleanup_tags_service_before_truncate_size: 800,
cleanup_tags_service_after_truncate_size: 200,
- cleanup_tags_service_before_delete_size: 100
+ cleanup_tags_service_before_delete_size: 100,
+ cleanup_tags_service_deleted_size: 100
)
expect(ContainerRepository.waiting_for_cleanup.count).to eq(1)
expect(repository.reload.cleanup_unfinished?).to be_truthy
diff --git a/spec/services/projects/container_repository/cleanup_tags_service_spec.rb b/spec/services/projects/container_repository/cleanup_tags_service_spec.rb
index 17c2f0f6c17..eed22416868 100644
--- a/spec/services/projects/container_repository/cleanup_tags_service_spec.rb
+++ b/spec/services/projects/container_repository/cleanup_tags_service_spec.rb
@@ -284,7 +284,7 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService do
deleted: nil
)
- expect(result).to eq(service_response.compact)
+ expect(result).to eq(service_response)
end
end
@@ -369,6 +369,6 @@ RSpec.describe Projects::ContainerRepository::CleanupTagsService do
before_truncate_size: before_truncate_size,
after_truncate_size: after_truncate_size,
before_delete_size: before_delete_size
- }.compact
+ }.compact.merge(deleted_size: deleted&.size)
end
end
diff --git a/spec/support/shared_contexts/services_shared_context.rb b/spec/support/shared_contexts/services_shared_context.rb
index 320f7564cf9..3322c6ef01a 100644
--- a/spec/support/shared_contexts/services_shared_context.rb
+++ b/spec/support/shared_contexts/services_shared_context.rb
@@ -62,7 +62,6 @@ Service.available_services_names.each do |service|
stub_licensed_features(licensed_feature => true)
project.clear_memoization(:disabled_services)
- project.clear_memoization(:licensed_feature_available)
end
end
end
diff --git a/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb b/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
index ba6cf133b0c..eb4faaed769 100644
--- a/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
+++ b/spec/workers/container_expiration_policies/cleanup_container_repository_worker_spec.rb
@@ -199,7 +199,7 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
end
end
- def cleanup_service_response(status: :finished, repository:, cleanup_tags_service_original_size: 100, cleanup_tags_service_before_truncate_size: 80, cleanup_tags_service_after_truncate_size: 80, cleanup_tags_service_before_delete_size: 50)
+ def cleanup_service_response(status: :finished, repository:, cleanup_tags_service_original_size: 100, cleanup_tags_service_before_truncate_size: 80, cleanup_tags_service_after_truncate_size: 80, cleanup_tags_service_before_delete_size: 50, cleanup_tags_service_deleted_size: 50)
ServiceResponse.success(
message: "cleanup #{status}",
payload: {
@@ -218,11 +218,12 @@ RSpec.describe ContainerExpirationPolicies::CleanupContainerRepositoryWorker do
expect(worker).to receive(:log_extra_metadata_on_done).with(:project_id, repository.project.id)
expect(worker).to receive(:log_extra_metadata_on_done).with(:cleanup_status, cleanup_status)
- %i[cleanup_tags_service_original_size cleanup_tags_service_before_truncate_size cleanup_tags_service_after_truncate_size cleanup_tags_service_before_delete_size].each do |field|
+ %i[cleanup_tags_service_original_size cleanup_tags_service_before_truncate_size cleanup_tags_service_after_truncate_size cleanup_tags_service_before_delete_size cleanup_tags_service_deleted_size].each do |field|
value = service_response.payload[field]
expect(worker).to receive(:log_extra_metadata_on_done).with(field, value) unless value.nil?
end
expect(worker).to receive(:log_extra_metadata_on_done).with(:cleanup_tags_service_truncated, truncated)
+ expect(worker).to receive(:log_extra_metadata_on_done).with(:running_jobs_count, 0)
end
end