From d84f18d66c1fc46f244b0f4dec8bf65b90d9882a Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 19 May 2020 18:08:11 +0000 Subject: [PATCH] Add latest changes from gitlab-org/gitlab@master --- .../components/fields/description.vue | 32 +-- .../pipelines/pipeline_details_bundle.js | 69 +++--- .../pages/alert_management/list.scss | 2 +- .../admin/ci/variables_controller.rb | 48 ++++ app/models/release.rb | 6 - app/serializers/ci/basic_variable_entity.rb | 13 + .../ci/instance_variable_serializer.rb | 7 + app/serializers/group_variable_entity.rb | 9 +- app/serializers/variable_entity.rb | 9 +- .../ci/update_instance_variables_service.rb | 72 ++++++ app/services/releases/create_service.rb | 6 + app/workers/new_release_worker.rb | 2 + ...instance-level-ci-variables-controller.yml | 5 + .../unreleased/alert-management-colour.yml | 5 + changelogs/unreleased/mv-to-service.yml | 5 + ...p-assets-javascripts-issue_show-compon.yml | 5 + config/routes/admin.rb | 4 + .../geo/replication/troubleshooting.md | 2 +- doc/administration/incoming_email.md | 3 + .../packages/container_registry.md | 12 +- .../static_objects_external_storage.md | 2 +- .../troubleshooting/log_parsing.md | 34 +-- doc/api/freeze_periods.md | 2 +- doc/api/pipeline_schedules.md | 2 +- doc/api/remote_mirrors.md | 6 +- .../documentation/feature_flags.md | 8 +- doc/development/documentation/index.md | 36 +-- doc/development/documentation/structure.md | 10 +- doc/development/documentation/styleguide.md | 38 +-- doc/development/fe_guide/droplab/droplab.md | 18 +- .../fe_guide/droplab/plugins/ajax.md | 2 +- .../fe_guide/droplab/plugins/filter.md | 2 +- .../fe_guide/droplab/plugins/input_setter.md | 2 +- doc/development/fe_guide/graphql.md | 2 +- doc/development/fe_guide/vue3_migration.md | 2 +- doc/development/i18n/externalization.md | 22 +- doc/development/migration_style_guide.md | 2 +- .../new_fe_guide/modules/dirty_submit.md | 2 +- doc/development/pipelines.md | 52 ++-- doc/topics/airgap/index.md | 4 +- doc/topics/autodevops/upgrading_postgresql.md | 30 +-- doc/user/markdown.md | 12 +- doc/user/packages/container_registry/index.md | 8 +- doc/user/project/description_templates.md | 20 ++ doc/user/project/issues/managing_issues.md | 2 +- doc/user/project/releases/index.md | 7 +- .../repository/x509_signed_commits/index.md | 18 +- .../admin/ci/variables_controller_spec.rb | 70 ++++++ spec/models/release_spec.rb | 20 -- .../update_instance_variables_service_spec.rb | 230 ++++++++++++++++++ spec/services/notification_service_spec.rb | 4 +- spec/services/releases/create_service_spec.rb | 3 + .../controllers/variables_shared_examples.rb | 25 +- spec/workers/new_release_worker_spec.rb | 2 + 54 files changed, 753 insertions(+), 262 deletions(-) create mode 100644 app/controllers/admin/ci/variables_controller.rb create mode 100644 app/serializers/ci/basic_variable_entity.rb create mode 100644 app/serializers/ci/instance_variable_serializer.rb create mode 100644 app/services/ci/update_instance_variables_service.rb create mode 100644 changelogs/unreleased/14108-instance-level-ci-variables-controller.yml create mode 100644 changelogs/unreleased/alert-management-colour.yml create mode 100644 changelogs/unreleased/mv-to-service.yml create mode 100644 changelogs/unreleased/update-deprecated-slot-syntax-in-app-assets-javascripts-issue_show-compon.yml create mode 100644 spec/controllers/admin/ci/variables_controller_spec.rb create mode 100644 spec/services/ci/update_instance_variables_service_spec.rb diff --git a/app/assets/javascripts/issue_show/components/fields/description.vue b/app/assets/javascripts/issue_show/components/fields/description.vue index 447d7bf21a5..35165c9b481 100644 --- a/app/assets/javascripts/issue_show/components/fields/description.vue +++ b/app/assets/javascripts/issue_show/components/fields/description.vue @@ -45,22 +45,24 @@ export default { :markdown-docs-path="markdownDocsPath" :can-attach-file="canAttachFile" :enable-autocomplete="enableAutocomplete" + :textarea-value="formState.description" > - + diff --git a/app/assets/javascripts/pipelines/pipeline_details_bundle.js b/app/assets/javascripts/pipelines/pipeline_details_bundle.js index d76425c96b7..01295874e56 100644 --- a/app/assets/javascripts/pipelines/pipeline_details_bundle.js +++ b/app/assets/javascripts/pipelines/pipeline_details_bundle.js @@ -14,13 +14,7 @@ import axios from '~/lib/utils/axios_utils'; Vue.use(Translate); -export default () => { - const { dataset } = document.querySelector('.js-pipeline-details-vue'); - - const mediator = new PipelinesMediator({ endpoint: dataset.endpoint }); - - mediator.fetchPipeline(); - +const createPipelinesDetailApp = mediator => { // eslint-disable-next-line no-new new Vue({ el: '#js-pipeline-graph-vue', @@ -50,7 +44,9 @@ export default () => { }); }, }); +}; +const createPipelineHeaderApp = mediator => { // eslint-disable-next-line no-new new Vue({ el: '#js-pipeline-header-vue', @@ -94,7 +90,9 @@ export default () => { }); }, }); +}; +const createPipelinesTabs = dataset => { const tabsElement = document.querySelector('.pipelines-tabs'); const testReportsEnabled = window.gon && window.gon.features && window.gon.features.junitPipelineView; @@ -119,27 +117,40 @@ export default () => { tabsElement.addEventListener('click', tabClickHandler); } - - // eslint-disable-next-line no-new - new Vue({ - el: '#js-pipeline-tests-detail', - components: { - TestReports, - }, - render(createElement) { - return createElement('test-reports'); - }, - }); - - axios - .get(dataset.testReportsCountEndpoint) - .then(({ data }) => { - if (!data.total_count) { - return; - } - - document.querySelector('.js-test-report-badge-counter').innerHTML = data.total_count; - }) - .catch(() => {}); } }; + +const createTestDetails = detailsEndpoint => { + // eslint-disable-next-line no-new + new Vue({ + el: '#js-pipeline-tests-detail', + components: { + TestReports, + }, + render(createElement) { + return createElement('test-reports'); + }, + }); + + axios + .get(detailsEndpoint) + .then(({ data }) => { + if (!data.total_count) { + return; + } + + document.querySelector('.js-test-report-badge-counter').innerHTML = data.total_count; + }) + .catch(() => {}); +}; + +export default () => { + const { dataset } = document.querySelector('.js-pipeline-details-vue'); + const mediator = new PipelinesMediator({ endpoint: dataset.endpoint }); + mediator.fetchPipeline(); + + createPipelinesDetailApp(mediator); + createPipelineHeaderApp(mediator); + createPipelinesTabs(dataset); + createTestDetails(dataset.testReportsCountEndpoint); +}; diff --git a/app/assets/stylesheets/pages/alert_management/list.scss b/app/assets/stylesheets/pages/alert_management/list.scss index 3fda66adc87..dc181342def 100644 --- a/app/assets/stylesheets/pages/alert_management/list.scss +++ b/app/assets/stylesheets/pages/alert_management/list.scss @@ -56,7 +56,7 @@ min-height: 68px; &:last-child { - background-color: $gray-normal; + background-color: $gray-10; &::before { content: none !important; diff --git a/app/controllers/admin/ci/variables_controller.rb b/app/controllers/admin/ci/variables_controller.rb new file mode 100644 index 00000000000..ca9b393550d --- /dev/null +++ b/app/controllers/admin/ci/variables_controller.rb @@ -0,0 +1,48 @@ +# frozen_string_literal: true + +class Admin::Ci::VariablesController < Admin::ApplicationController + def show + respond_to do |format| + format.json { render_instance_variables } + end + end + + def update + service = Ci::UpdateInstanceVariablesService.new(variables_params) + + if service.execute + respond_to do |format| + format.json { render_instance_variables } + end + else + respond_to do |format| + format.json { render_error(service.errors) } + end + end + end + + private + + def variables + @variables ||= Ci::InstanceVariable.all + end + + def render_instance_variables + render status: :ok, + json: { + variables: Ci::InstanceVariableSerializer.new.represent(variables) + } + end + + def render_error(errors) + render status: :bad_request, json: errors + end + + def variables_params + params.permit(variables_attributes: [*variable_params_attributes]) + end + + def variable_params_attributes + %i[id variable_type key secret_value protected masked _destroy] + end +end diff --git a/app/models/release.rb b/app/models/release.rb index 20f34e9286f..a0245105cd9 100644 --- a/app/models/release.rb +++ b/app/models/release.rb @@ -34,8 +34,6 @@ class Release < ApplicationRecord delegate :repository, to: :project - after_commit :notify_new_release, on: :create, unless: :importing? - MAX_NUMBER_TO_DISPLAY = 3 def to_param @@ -92,10 +90,6 @@ class Release < ApplicationRecord repository.find_tag(tag) end end - - def notify_new_release - NewReleaseWorker.perform_async(id) - end end Release.prepend_if_ee('EE::Release') diff --git a/app/serializers/ci/basic_variable_entity.rb b/app/serializers/ci/basic_variable_entity.rb new file mode 100644 index 00000000000..dad59e8735b --- /dev/null +++ b/app/serializers/ci/basic_variable_entity.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module Ci + class BasicVariableEntity < Grape::Entity + expose :id + expose :key + expose :value + expose :variable_type + + expose :protected?, as: :protected + expose :masked?, as: :masked + end +end diff --git a/app/serializers/ci/instance_variable_serializer.rb b/app/serializers/ci/instance_variable_serializer.rb new file mode 100644 index 00000000000..b0b49aecdbd --- /dev/null +++ b/app/serializers/ci/instance_variable_serializer.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +module Ci + class InstanceVariableSerializer < BaseSerializer + entity BasicVariableEntity + end +end diff --git a/app/serializers/group_variable_entity.rb b/app/serializers/group_variable_entity.rb index 622106458c3..4f44723fefe 100644 --- a/app/serializers/group_variable_entity.rb +++ b/app/serializers/group_variable_entity.rb @@ -1,11 +1,4 @@ # frozen_string_literal: true -class GroupVariableEntity < Grape::Entity - expose :id - expose :key - expose :value - expose :variable_type - - expose :protected?, as: :protected - expose :masked?, as: :masked +class GroupVariableEntity < Ci::BasicVariableEntity end diff --git a/app/serializers/variable_entity.rb b/app/serializers/variable_entity.rb index 017035fa117..9b0db371acb 100644 --- a/app/serializers/variable_entity.rb +++ b/app/serializers/variable_entity.rb @@ -1,12 +1,5 @@ # frozen_string_literal: true -class VariableEntity < Grape::Entity - expose :id - expose :key - expose :value - expose :variable_type - - expose :protected?, as: :protected - expose :masked?, as: :masked +class VariableEntity < Ci::BasicVariableEntity expose :environment_scope end diff --git a/app/services/ci/update_instance_variables_service.rb b/app/services/ci/update_instance_variables_service.rb new file mode 100644 index 00000000000..ee513647d08 --- /dev/null +++ b/app/services/ci/update_instance_variables_service.rb @@ -0,0 +1,72 @@ +# frozen_string_literal: true + +# This class is a simplified version of assign_nested_attributes_for_collection_association from ActiveRecord +# https://github.com/rails/rails/blob/v6.0.2.1/activerecord/lib/active_record/nested_attributes.rb#L466 + +module Ci + class UpdateInstanceVariablesService + UNASSIGNABLE_KEYS = %w(id _destroy).freeze + + def initialize(params) + @params = params[:variables_attributes] + end + + def execute + instantiate_records + persist_records + end + + def errors + @records.to_a.flat_map { |r| r.errors.full_messages } + end + + private + + attr_reader :params + + def existing_records_by_id + @existing_records_by_id ||= Ci::InstanceVariable + .all + .index_by { |var| var.id.to_s } + end + + def instantiate_records + @records = params.map do |attributes| + find_or_initialize_record(attributes).tap do |record| + record.assign_attributes(attributes.except(*UNASSIGNABLE_KEYS)) + record.mark_for_destruction if has_destroy_flag?(attributes) + end + end + end + + def find_or_initialize_record(attributes) + id = attributes[:id].to_s + + if id.blank? + Ci::InstanceVariable.new + else + existing_records_by_id.fetch(id) { raise ActiveRecord::RecordNotFound } + end + end + + def persist_records + Ci::InstanceVariable.transaction do + success = @records.map do |record| + if record.marked_for_destruction? + record.destroy + else + record.save + end + end.all? + + raise ActiveRecord::Rollback unless success + + success + end + end + + def has_destroy_flag?(hash) + Gitlab::Utils.to_boolean(hash['_destroy']) + end + end +end diff --git a/app/services/releases/create_service.rb b/app/services/releases/create_service.rb index 9a0a876454f..81ca9d6d123 100644 --- a/app/services/releases/create_service.rb +++ b/app/services/releases/create_service.rb @@ -47,11 +47,17 @@ module Releases release.save! + notify_create_release(release) + success(tag: tag, release: release) rescue => e error(e.message, 400) end + def notify_create_release(release) + NotificationService.new.async.send_new_release_notifications(release) + end + def build_release(tag) project.releases.build( name: name, diff --git a/app/workers/new_release_worker.rb b/app/workers/new_release_worker.rb index 3c19e5f3d2b..fa4703d10f2 100644 --- a/app/workers/new_release_worker.rb +++ b/app/workers/new_release_worker.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +# TODO: Worker can be removed in 13.2: +# https://gitlab.com/gitlab-org/gitlab/-/issues/218231 class NewReleaseWorker # rubocop:disable Scalability/IdempotentWorker include ApplicationWorker diff --git a/changelogs/unreleased/14108-instance-level-ci-variables-controller.yml b/changelogs/unreleased/14108-instance-level-ci-variables-controller.yml new file mode 100644 index 00000000000..a95a6d3b9c8 --- /dev/null +++ b/changelogs/unreleased/14108-instance-level-ci-variables-controller.yml @@ -0,0 +1,5 @@ +--- +title: Add admin controller actions for interacting with instance variables +merge_request: 30385 +author: +type: added diff --git a/changelogs/unreleased/alert-management-colour.yml b/changelogs/unreleased/alert-management-colour.yml new file mode 100644 index 00000000000..c8541b5bcd4 --- /dev/null +++ b/changelogs/unreleased/alert-management-colour.yml @@ -0,0 +1,5 @@ +--- +title: Update alert management table background colour to correct gray +merge_request: 32068 +author: +type: other diff --git a/changelogs/unreleased/mv-to-service.yml b/changelogs/unreleased/mv-to-service.yml new file mode 100644 index 00000000000..ff279122a17 --- /dev/null +++ b/changelogs/unreleased/mv-to-service.yml @@ -0,0 +1,5 @@ +--- +title: Move release notification from model callbacks to service +merge_request: 29853 +author: Ravishankar +type: performance diff --git a/changelogs/unreleased/update-deprecated-slot-syntax-in-app-assets-javascripts-issue_show-compon.yml b/changelogs/unreleased/update-deprecated-slot-syntax-in-app-assets-javascripts-issue_show-compon.yml new file mode 100644 index 00000000000..7fcf63f7fca --- /dev/null +++ b/changelogs/unreleased/update-deprecated-slot-syntax-in-app-assets-javascripts-issue_show-compon.yml @@ -0,0 +1,5 @@ +--- +title: Update deprecated slot syntax in ./app/assets/javascripts/issue_show/components/fields/description.vue +merge_request: 31979 +author: Gilang Gumilar +type: other diff --git a/config/routes/admin.rb b/config/routes/admin.rb index 5809be67556..f3b7fb5ed45 100644 --- a/config/routes/admin.rb +++ b/config/routes/admin.rb @@ -154,6 +154,10 @@ namespace :admin do end end + namespace :ci do + resource :variables, only: [:show, :update] + end + concerns :clusterable get '/dashboard/stats', to: 'dashboard#stats' diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index 3adfc83ce06..293414a6e5e 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -499,7 +499,7 @@ to start again from scratch, there are a few steps that can help you: 1. Refresh Foreign Data Wrapper tables - ```sh + ```shell gitlab-rake geo:db:refresh_foreign_tables ``` diff --git a/doc/administration/incoming_email.md b/doc/administration/incoming_email.md index 9efee00e468..fcd69464b13 100644 --- a/doc/administration/incoming_email.md +++ b/doc/administration/incoming_email.md @@ -226,6 +226,9 @@ incoming_email: Example configuration for Gmail/G Suite. Assumes mailbox `gitlab-incoming@gmail.com`. +NOTE: **Note:** +`incoming_email_email` cannot be a Gmail alias account. + Example for Omnibus installs: ```ruby diff --git a/doc/administration/packages/container_registry.md b/doc/administration/packages/container_registry.md index f0d4d216d8e..1e7166da38f 100644 --- a/doc/administration/packages/container_registry.md +++ b/doc/administration/packages/container_registry.md @@ -716,7 +716,7 @@ built-in command: If you did not change the default location of the configuration file, run: -```sh +```shell sudo gitlab-ctl registry-garbage-collect ``` @@ -725,7 +725,7 @@ layers you have stored. If you changed the location of the Container Registry `config.yml`: -```sh +```shell sudo gitlab-ctl registry-garbage-collect /path/to/config.yml ``` @@ -749,7 +749,7 @@ referenced by the registry tag. The `registry-garbage-collect` command supports `-m` switch to allow you to remove all unreferenced manifests and layers that are not directly accessible via `tag`: -```sh +```shell sudo gitlab-ctl registry-garbage-collect -m ``` @@ -787,7 +787,7 @@ To enable the read-only mode: 1. Save and reconfigure GitLab: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -795,7 +795,7 @@ To enable the read-only mode: 1. Next, trigger one of the garbage collect commands: - ```sh + ```shell # Recycling unused tags sudo /opt/gitlab/embedded/bin/registry garbage-collect /var/opt/gitlab/registry/config.yml @@ -822,7 +822,7 @@ To enable the read-only mode: 1. Save and reconfigure GitLab: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` diff --git a/doc/administration/static_objects_external_storage.md b/doc/administration/static_objects_external_storage.md index f649a1ebcd2..973f4304115 100644 --- a/doc/administration/static_objects_external_storage.md +++ b/doc/administration/static_objects_external_storage.md @@ -63,7 +63,7 @@ other CDNs or Function as a Service (FaaS) systems should work using the same pr `pwgen -cn1 64` on a UNIX machine). Save this token for the admin panel, as described in the [configuring](#configuring) section. - ```js + ```javascript const ORIGIN_HOSTNAME = 'gitlab.installation.com' // FIXME: SET CORRECT VALUE const STORAGE_TOKEN = 'very-secure-token' // FIXME: SET CORRECT VALUE const CACHE_PRIVATE_OBJECTS = false diff --git a/doc/administration/troubleshooting/log_parsing.md b/doc/administration/troubleshooting/log_parsing.md index 0413e5ce953..dcd1df2f423 100644 --- a/doc/administration/troubleshooting/log_parsing.md +++ b/doc/administration/troubleshooting/log_parsing.md @@ -16,19 +16,19 @@ include use cases targeted for parsing GitLab log files. #### Pipe colorized `jq` output into `less` -```sh +```shell jq . -C | less -R ``` #### Search for a term and pretty-print all matching lines -```sh +```shell grep | jq . ``` #### Skip invalid lines of JSON -```sh +```shell jq -cR 'fromjson?' file.json | jq ``` @@ -39,49 +39,49 @@ This skips over all invalid lines and parses the rest. #### Find all requests with a 5XX status code -```sh +```shell jq 'select(status >= 500)' ``` #### Top 10 slowest requests -```sh +```shell jq -s 'sort_by(-.duration) | limit(10; .[])' ``` #### Find and pretty print all requests related to a project -```sh +```shell grep | jq . ``` #### Find all requests with a total duration > 5 seconds -```sh +```shell jq 'select(.duration > 5000)' ``` #### Find all project requests with more than 5 rugged calls -```sh +```shell grep | jq 'select(.rugged_calls > 5)' ``` #### Find all requests with a Gitaly duration > 10 seconds -```sh +```shell jq 'select(.gitaly_duration > 10000)' ``` #### Find all requests with a queue duration > 10 seconds -```sh +```shell jq 'select(.queue_duration > 10000)' ``` #### Top 10 requests by # of Gitaly calls -```sh +```shell jq -s 'map(select(.gitaly_calls != null)) | sort_by(-.gitaly_calls) | limit(10; .[])' ``` @@ -89,7 +89,7 @@ jq -s 'map(select(.gitaly_calls != null)) | sort_by(-.gitaly_calls) | limit(10; #### Print the top three controller methods by request volume and their three longest durations -```sh +```shell jq -s -r 'group_by(.controller+.action) | sort_by(-length) | limit(3; .[]) | sort_by(-.duration) | "CT: \(length)\tMETHOD: \(.[0].controller)#\(.[0].action)\tDURS: \(.[0].duration), \(.[1].duration), \(.[2].duration)"' production_json.log ``` @@ -105,7 +105,7 @@ CT: 1328 METHOD: Projects::NotesController#index DURS: 403.99, 386.29, 384.3 #### Print top three routes with request count and their three longest durations -```sh +```shell jq -s -r 'group_by(.route) | sort_by(-length) | limit(3; .[]) | sort_by(-.duration) | "CT: \(length)\tROUTE: \(.[0].route)\tDURS: \(.[0].duration), \(.[1].duration), \(.[2].duration)"' api_json.log ``` @@ -121,25 +121,25 @@ CT: 190 ROUTE: /api/:version/projects/:id/repository/commits DURS: 1079.02, #### Find all Gitaly requests sent from web UI -```sh +```shell jq 'select(."grpc.meta.client_name" == "gitlab-web")' current ``` #### Find all failed Gitaly requests -```sh +```shell jq 'select(."grpc.code" != null and ."grpc.code" != "OK")' current ``` #### Find all requests that took longer than 30 seconds -```sh +```shell jq 'select(."grpc.time_ms" > 30000)' current ``` #### Print top three projects by request volume and their three longest durations -```sh +```shell jq -s -r 'map(select(."grpc.request.glProjectPath" != null and ."grpc.request.glProjectPath" != "" and ."grpc.time_ms" != null)) | group_by(."grpc.request.glProjectPath") | sort_by(-length) | limit(3; .[]) | sort_by(-."grpc.time_ms") | "CT: \(length)\tPROJECT: \(.[0]."grpc.request.glProjectPath")\tDURS: \(.[0]."grpc.time_ms"), \(.[1]."grpc.time_ms"), \(.[2]."grpc.time_ms")"' current ``` diff --git a/doc/api/freeze_periods.md b/doc/api/freeze_periods.md index d5f165015e7..ee5e657c945 100644 --- a/doc/api/freeze_periods.md +++ b/doc/api/freeze_periods.md @@ -11,7 +11,7 @@ interact with the Freeze Period API endpoints. ## List Freeze Periods -Paginated list of Freeze Periods, sorted by `created_at`. +Paginated list of Freeze Periods, sorted by `created_at` in ascending order. ```plaintext GET /projects/:id/freeze_periods diff --git a/doc/api/pipeline_schedules.md b/doc/api/pipeline_schedules.md index 3a79268e889..6faaa95116d 100644 --- a/doc/api/pipeline_schedules.md +++ b/doc/api/pipeline_schedules.md @@ -297,7 +297,7 @@ POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/play Example request: -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/42/pipeline_schedules/1/play ``` diff --git a/doc/api/remote_mirrors.md b/doc/api/remote_mirrors.md index ecd35239e00..12b453007b0 100644 --- a/doc/api/remote_mirrors.md +++ b/doc/api/remote_mirrors.md @@ -17,7 +17,7 @@ GET /projects/:id/remote_mirrors Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/42/remote_mirrors' ``` @@ -63,7 +63,7 @@ POST /projects/:id/remote_mirrors Example request: -```sh +```shell curl --request POST --data "url=https://username:token@example.com/gitlab/example.git" --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/42/remote_mirrors' ``` @@ -104,7 +104,7 @@ PUT /projects/:id/remote_mirrors/:mirror_id Example request: -```sh +```shell curl --request PUT --data "enabled=false" --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/42/remote_mirrors/101486' ``` diff --git a/doc/development/documentation/feature_flags.md b/doc/development/documentation/feature_flags.md index 6b4fd1cbf40..373c5a4ee7d 100644 --- a/doc/development/documentation/feature_flags.md +++ b/doc/development/documentation/feature_flags.md @@ -49,7 +49,7 @@ For feature flags disabled by default, if they can be used by end users: For example, for a feature disabled by default, disabled on GitLab.com, and not ready for production use: -````md +````markdown # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. @@ -93,7 +93,7 @@ For features that became enabled by default: For example, for a feature initially deployed disabled by default, that became enabled by default, that is enabled on GitLab.com, and ready for production use: -````md +````markdown # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. @@ -138,7 +138,7 @@ For features enabled by default: For example, for a feature enabled by default, enabled on GitLab.com, and ready for production use: -````md +````markdown # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. @@ -177,7 +177,7 @@ Once the feature is ready and the flag has been removed, clean up the documentation. Remove the feature flag mention keeping only a note that mentions the flag in the version history notes: -````md +````markdown # Feature Name > - [Introduced](link-to-issue) in GitLab 12.0. diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md index ca393fbb63c..256d3f5d86c 100644 --- a/doc/development/documentation/index.md +++ b/doc/development/documentation/index.md @@ -79,7 +79,7 @@ change prior to merging. If you indeed need to change a document's location, do not remove the old document, but instead replace all of its content with the following: -```md +```markdown --- redirect_to: '../path/to/file/index.md' --- @@ -93,7 +93,7 @@ The `redirect_to` variable supports both full and relative URLs, for example `https://docs.gitlab.com/ee/path/to/file.html`, `../path/to/file.html`, `path/to/file.md`. It ensures that the redirect will work for and any `*.md` paths will be compiled to `*.html`. -The new line underneath the frontmatter informs the user that the document +The new line underneath the front matter informs the user that the document changed location and is useful for someone that browses that file from the repository. For example, if you move `doc/workflow/lfs/index.md` to @@ -102,7 +102,7 @@ For example, if you move `doc/workflow/lfs/index.md` to 1. Copy `doc/workflow/lfs/index.md` to `doc/administration/lfs.md` 1. Replace the contents of `doc/workflow/lfs/index.md` with: - ```md + ```markdown --- redirect_to: '../../administration/lfs.md' --- @@ -148,12 +148,12 @@ Disqus uses an identifier per page, and for , the page is configured to be the page URL. Therefore, when we change the document location, we need to preserve the old URL as the same Disqus identifier. -To do that, add to the frontmatter the variable `disqus_identifier`, -using the old URL as value. For example, let's say I moved the document +To do that, add to the front matter the variable `disqus_identifier`, +using the old URL as value. For example, let's say we moved the document available under `https://docs.gitlab.com/my-old-location/README.html` to a new location, `https://docs.gitlab.com/my-new-location/index.html`. -Into the **new document** frontmatter add the following: +Into the **new document** front matter, we add the following: ```yaml --- @@ -298,8 +298,8 @@ To preview your changes to documentation locally, follow this The live preview is currently enabled for the following projects: -- -- +- [`gitlab`](https://gitlab.com/gitlab-org/gitlab) +- [`gitlab-runner`](https://gitlab.com/gitlab-org/gitlab-runner) If your merge request has docs changes, you can use the manual `review-docs-deploy` job to deploy the docs review app for your merge request. @@ -485,14 +485,14 @@ markdownlint can be used [on the command line](https://github.com/igorshubovych/ either on a single Markdown file or on all Markdown files in a project. For example, to run markdownlint on all documentation in the [`gitlab` project](https://gitlab.com/gitlab-org/gitlab), run the following commands from within your `gitlab` project root directory, which will -automatically detect the [`.markdownlint.json`](#markdownlint-configuration) config +automatically detect the [`.markdownlint.json`](#markdownlint-configuration) configuration file in the root of the project, and test all files in `/doc` and its subdirectories: ```shell markdownlint 'doc/**/*.md' ``` -If you wish to use a different config file, use the `-c` flag: +If you wish to use a different configuration file, use the `-c` flag: ```shell markdownlint -c 'doc/**/*.md' @@ -506,7 +506,7 @@ such as: - [Atom](https://atom.io/packages/linter-node-markdownlint) It is best to use the [same configuration file](#markdownlint-configuration) as what -is in use in the four repos that are the sources for . Each +is in use in the four repositories that are the sources for . Each plugin/extension has different requirements regarding the configuration file, which is explained in each editor's docs. @@ -515,12 +515,12 @@ is explained in each editor's docs. Each formatting issue that markdownlint checks has an associated [rule](https://github.com/DavidAnson/markdownlint/blob/master/doc/Rules.md#rules). These rules are configured in the `.markdownlint.json` files located in the root of -four repos that are the sources for : +four repositories that are the sources for : -- -- -- -- +- [`gitlab`](https://gitlab.com/gitlab-org/gitlab/blob/master/.markdownlint.json) +- [`gitlab-runner`](https://gitlab.com/gitlab-org/gitlab-runner/blob/master/.markdownlint.json) +- [`omnibus-gitlab`](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/.markdownlint.json) +- [`charts`](https://gitlab.com/charts/gitlab/blob/master/.markdownlint.json) By default all rules are enabled, so the configuration file is used to disable unwanted rules, and also to configure optional parameters for enabled rules as needed. You can @@ -550,7 +550,7 @@ You can also [configure the text editor of your choice](https://errata-ai.github.io/vale/#local-use-by-a-single-writer) to display the results. -Vale's test results are not currently displayed in CI, but may be displayed in the future. +Vale's test results [are displayed](#testing) in CI pipelines. ##### Disable a Vale test @@ -573,5 +573,5 @@ For more information, see [Vale's documentation](https://errata-ai.gitbook.io/va GitLab uses [Danger](https://github.com/danger/danger) for some elements in code review. For docs changes in merge requests, whenever a change to files under `/doc` is made, Danger Bot leaves a comment with further instructions about the documentation -process. This is configured in the Dangerfile in the GitLab repo under +process. This is configured in the `Dangerfile` in the GitLab repository under [/danger/documentation/](https://gitlab.com/gitlab-org/gitlab/tree/master/danger/documentation). diff --git a/doc/development/documentation/structure.md b/doc/development/documentation/structure.md index 84ba47eba78..d19383bee27 100644 --- a/doc/development/documentation/structure.md +++ b/doc/development/documentation/structure.md @@ -20,7 +20,7 @@ Every feature or use case document should include the following content in the f with exceptions and details noted below and in the template included on this page. - **Title**: Top-level heading with the feature name, or a use case name, which would start with - a verb, like Configuring, Enabling, etc. + a verb, like Configuring, Enabling, and so on. - **Introduction**: A couple sentences about the subject matter and what's to be found on this page. Describe what the feature or topic is, what it does, and in what context it should be used. There is no need to add a title called "Introduction" or "Overview," because people rarely @@ -41,7 +41,7 @@ and other logical divisions such as pre- and post-deployment steps. To start a new document, respect the file tree and file name guidelines, as well as the style guidelines. Use the following template: -```md +```markdown @@ -130,7 +130,7 @@ Notes: ## Help and feedback section The "help and feedback" section (introduced by [!319](https://gitlab.com/gitlab-org/gitlab-docs/-/merge_requests/319)) displayed at the end of each document -can be omitted from the doc by adding a key into the its frontmatter: +can be omitted from the doc by adding a key into the its front matter: ```yaml --- @@ -148,7 +148,7 @@ We also have integrated the docs site with Disqus (introduced by allowing our users to post comments. To omit only the comments from the feedback section, use the following -key on the frontmatter: +key on the front matter: ```yaml --- @@ -159,7 +159,7 @@ comments: false We are only hiding comments in main index pages, such as [the main documentation index](../../README.md), since its content is too broad to comment on. Before omitting Disqus, you must check with a technical writer. -Note that once `feedback: false` is added to the frontmatter, it will automatically omit +Note that once `feedback: false` is added to the front matter, it will automatically omit Disqus, therefore, don't add both keys to the same document. The click events in the feedback section are tracked with Google Tag Manager. The diff --git a/doc/development/documentation/styleguide.md b/doc/development/documentation/styleguide.md index c75eccd71c1..22c1d790b07 100644 --- a/doc/development/documentation/styleguide.md +++ b/doc/development/documentation/styleguide.md @@ -390,7 +390,7 @@ tenses, words, and phrases: - Insert an empty line for new paragraphs. - Insert an empty line between different markups (for example, after every paragraph, header, list, and so on). Example: - ```md + ```markdown ## Header Paragraph. @@ -447,7 +447,7 @@ Only use ordered lists when their items describe a sequence of steps to follow. Do: -```md +```markdown These are the steps to do something: 1. First, do the first step. @@ -457,7 +457,7 @@ These are the steps to do something: Don't: -```md +```markdown This is a list of available features: 1. Feature 1 @@ -483,7 +483,7 @@ This is a list of available features: all with a period. - Separate list items from explanatory text with a colon (`:`). For example: - ```md + ```markdown The list is as follows: - First item: this explains the first item. @@ -630,7 +630,7 @@ page), use the following phrases (based on the SVG icons): ## Quotes -Valid for Markdown content only, not for frontmatter entries: +Valid for Markdown content only, not for front matter entries: - Standard quotes: double quotes (`"`). Example: "This is wrapped in double quotes". - Quote within a quote: double quotes (`"`) wrap single quotes (`'`). Example: "I am 'quoting' something within a quote". @@ -792,7 +792,7 @@ Instead: Example: -```md +```markdown For more information, see the [confidential issue](../../user/project/issues/confidential_issues.md) `https://gitlab.com/gitlab-org/gitlab-foss/issues/`. ``` @@ -908,7 +908,7 @@ Do not upload videos to the product repositories. [Link](#link-to-video) or [emb To link out to a video, include a YouTube icon so that readers can quickly and easily scan the page for videos before reading: -```md +```markdown For an overview, see [Video Title](link-to-video). ``` @@ -1082,7 +1082,7 @@ This will ensure that the source Markdown remains readable and should help with The following are examples of source Markdown for menu items with their published output: -```md +```markdown 1. Go to **{home}** **Project overview > Details** 1. Go to **{doc-text}** **Repository > Branches** 1. Go to **{issues}** **Issues > List** @@ -1143,7 +1143,7 @@ of users. Weigh the costs of distracting users to whom the content is not relevant against the cost of users missing the content if it were not expressed as a note. -```md +```markdown NOTE: **Note:** This is something to note. ``` @@ -1155,7 +1155,7 @@ This is something to note. ### Tip -```md +```markdown TIP: **Tip:** This is a tip. ``` @@ -1167,7 +1167,7 @@ This is a tip. ### Caution -```md +```markdown CAUTION: **Caution:** This is something to be cautious about. ``` @@ -1179,7 +1179,7 @@ This is something to be cautious about. ### Danger -```md +```markdown DANGER: **Danger:** This is a breaking change, a bug, or something very important to note. ``` @@ -1193,7 +1193,7 @@ This is a breaking change, a bug, or something very important to note. For highlighting a text within a blue blockquote, use this format: -```md +```markdown > This is a blockquote. ``` @@ -1205,7 +1205,7 @@ If the text spans across multiple lines it's OK to split the line. For multiple paragraphs, use the symbol `>` before every line: -```md +```markdown > This is the first paragraph. > > This is the second paragraph. @@ -1298,14 +1298,14 @@ a helpful link back to how the feature was developed. - If listing information for multiple version as a feature evolves, add the information to a block-quoted bullet list. For example: - ```md + ```markdown > - [Introduced]() in GitLab 11.3. > - Enabled by default in GitLab 11.4. ``` - If a feature is moved to another tier: - ```md + ```markdown > - [Introduced]() in [GitLab Premium](https://about.gitlab.com/pricing/) 11.5. > - [Moved]() to [GitLab Starter](https://about.gitlab.com/pricing/) in 11.8. > - [Moved]() to GitLab Core in 12.0. @@ -1417,7 +1417,7 @@ avoid duplication, link to the special document that can be found in [`doc/administration/restart_gitlab.md`](../../administration/restart_gitlab.md). Usually the text will read like: -```md +```markdown Save the file and [reconfigure GitLab](../../administration/restart_gitlab.md) for the changes to take effect. ``` @@ -1453,7 +1453,7 @@ When there is a list of steps to perform, usually that entails editing the configuration file and reconfiguring/restarting GitLab. In such case, follow the style below as a guide: -````md +````markdown **For Omnibus installations** 1. Edit `/etc/gitlab/gitlab.rb`: @@ -1591,7 +1591,7 @@ You can use the following fake tokens as examples. Use the following table headers to describe the methods. Attributes should always be in code blocks using backticks (`` ` ``). -```md +```markdown | Attribute | Type | Required | Description | |:----------|:-----|:---------|:------------| ``` diff --git a/doc/development/fe_guide/droplab/droplab.md b/doc/development/fe_guide/droplab/droplab.md index 4d7c882dc09..83bc4216403 100644 --- a/doc/development/fe_guide/droplab/droplab.md +++ b/doc/development/fe_guide/droplab/droplab.md @@ -26,7 +26,7 @@ If you do not provide any arguments, it will globally query and instantiate all