From 536aa3a1f4b96abc4ca34489bf2cbe503afcded7 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 30 Jan 2020 15:09:15 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/lib/graphql.js | 13 + app/assets/javascripts/monitoring/stores/utils.js | 9 +- app/assets/stylesheets/pages/diff.scss | 5 - .../projects/serverless/functions_finder.rb | 46 +++- app/helpers/explore_helper.rb | 12 + app/helpers/sorting_helper.rb | 7 + app/models/audit_event.rb | 2 + app/models/clusters/applications/runner.rb | 2 +- app/services/akismet_service.rb | 73 ------ app/services/concerns/akismet_methods.rb | 2 +- app/services/notes/update_service.rb | 2 +- app/services/spam/akismet_service.rb | 75 ++++++ .../shared/boards/components/_board.html.haml | 2 +- ...ds-list-not-cropped-when-longer-than-board-.yml | 5 + changelogs/unreleased/198411-jira-http-error.yml | 5 + ...w-mr-changes-tab-edit-file-button-ui-polish.yml | 5 + .../unreleased/refactoring-entities-file-5.yml | 5 + .../update-gitlab-runner-helm-chart-to-0-13-1.yml | 5 + config/initializers/rails_host_authorization.rb | 7 + doc/administration/audit_events.md | 2 +- doc/administration/auth/authentiq.md | 4 +- doc/administration/auth/crowd.md | 4 +- .../auth/how_to_configure_ldap_gitlab_ce/index.md | 8 +- doc/administration/auth/jwt.md | 4 +- doc/administration/auth/ldap-ee.md | 12 +- doc/administration/auth/ldap.md | 4 +- doc/administration/auth/oidc.md | 4 +- doc/administration/auth/okta.md | 4 +- doc/administration/file_hooks.md | 2 +- .../disaster_recovery/background_verification.md | 16 +- .../geo/disaster_recovery/bring_primary_back.md | 2 +- doc/administration/geo/disaster_recovery/index.md | 32 +-- .../geo/disaster_recovery/planned_failover.md | 6 +- .../geo/replication/configuration.md | 40 +-- doc/administration/geo/replication/database.md | 44 ++-- .../geo/replication/docker_registry.md | 8 +- .../geo/replication/external_database.md | 14 +- .../geo/replication/high_availability.md | 4 +- .../geo/replication/remove_geo_node.md | 6 +- .../geo/replication/troubleshooting.md | 42 +-- .../geo/replication/updating_the_geo_nodes.md | 2 +- .../geo/replication/using_a_geo_server.md | 2 +- .../geo/replication/version_specific_updates.md | 48 ++-- doc/administration/git_annex.md | 6 +- doc/administration/git_protocol.md | 12 +- doc/administration/gitaly/index.md | 24 +- doc/administration/high_availability/consul.md | 2 +- doc/administration/high_availability/database.md | 52 ++-- doc/administration/high_availability/gitlab.md | 2 +- doc/administration/high_availability/nfs.md | 6 +- .../high_availability/nfs_host_client_setup.md | 12 +- doc/administration/high_availability/pgbouncer.md | 6 +- doc/administration/high_availability/redis.md | 8 +- doc/administration/incoming_email.md | 12 +- doc/administration/integration/plantuml.md | 6 +- doc/administration/invalidate_markdown_cache.md | 2 +- doc/administration/job_artifacts.md | 8 +- doc/administration/job_logs.md | 2 +- doc/administration/lfs/lfs_administration.md | 8 +- .../lfs/manage_large_binaries_with_git_lfs.md | 32 +-- .../lfs/migrate_from_git_annex_to_git_lfs.md | 28 +- .../monitoring/performance/gitlab_configuration.md | 2 +- .../performance/grafana_configuration.md | 2 +- .../performance/influxdb_configuration.md | 8 +- .../operations/extra_sidekiq_processes.md | 20 +- .../operations/fast_ssh_key_lookup.md | 2 +- .../operations/filesystem_benchmarking.md | 12 +- doc/administration/packages/container_registry.md | 8 +- doc/administration/packages/index.md | 4 +- doc/administration/pages/index.md | 4 +- doc/administration/pages/source.md | 20 +- doc/administration/pseudonymizer.md | 2 +- doc/administration/raketasks/check.md | 14 +- doc/administration/raketasks/geo.md | 16 +- doc/administration/raketasks/github_import.md | 4 +- doc/administration/raketasks/ldap.md | 22 +- doc/administration/raketasks/maintenance.md | 36 +-- .../raketasks/project_import_export.md | 4 +- doc/administration/raketasks/storage.md | 44 ++-- doc/administration/raketasks/uploads/migrate.md | 16 +- doc/administration/raketasks/uploads/sanitize.md | 8 +- doc/administration/reply_by_email_postfix_setup.md | 66 ++--- doc/administration/repository_storage_types.md | 4 +- doc/administration/restart_gitlab.md | 10 +- doc/administration/server_hooks.md | 2 +- doc/administration/smime_signing_email.md | 2 +- doc/administration/snippets/index.md | 6 +- doc/administration/timezone.md | 2 +- doc/administration/troubleshooting/debug.md | 4 +- .../troubleshooting/elasticsearch.md | 2 +- .../troubleshooting/gitlab_rails_cheat_sheet.md | 24 +- .../troubleshooting/kubernetes_cheat_sheet.md | 42 +-- .../troubleshooting/linux_cheat_sheet.md | 32 +-- doc/administration/troubleshooting/ssl.md | 6 +- .../troubleshooting/test_environments.md | 10 +- doc/api/README.md | 12 +- doc/api/access_requests.md | 8 +- doc/api/appearance.md | 4 +- doc/api/applications.md | 6 +- doc/api/audit_events.md | 8 +- doc/api/avatar.md | 2 +- doc/api/award_emoji.md | 16 +- doc/api/boards.md | 20 +- doc/api/branches.md | 10 +- doc/api/broadcast_messages.md | 12 +- doc/api/commits.md | 28 +- doc/api/container_registry.md | 18 +- doc/api/custom_attributes.md | 8 +- doc/api/dependencies.md | 2 +- doc/api/deploy_keys.md | 22 +- doc/api/deployments.md | 10 +- doc/api/discussions.md | 66 ++--- doc/api/environments.md | 12 +- doc/api/epic_issues.md | 8 +- doc/api/epic_links.md | 10 +- doc/api/epics.md | 12 +- doc/api/error_tracking.md | 2 +- doc/api/events.md | 6 +- doc/api/feature_flag_specs.md | 12 +- doc/api/feature_flags.md | 8 +- doc/api/features.md | 4 +- doc/api/geo_nodes.md | 12 +- doc/api/graphql/getting_started.md | 2 +- doc/api/group_badges.md | 12 +- doc/api/group_boards.md | 20 +- doc/api/group_clusters.md | 10 +- doc/api/group_labels.md | 14 +- doc/api/group_milestones.md | 2 +- doc/api/groups.md | 6 +- doc/api/import.md | 2 +- doc/api/issue_links.md | 2 +- doc/api/issues.md | 40 +-- doc/api/issues_statistics.md | 6 +- doc/api/jobs.md | 28 +- doc/api/keys.md | 8 +- doc/api/labels.md | 16 +- doc/api/license.md | 4 +- doc/api/lint.md | 2 +- doc/api/managed_licenses.md | 10 +- doc/api/markdown.md | 2 +- doc/api/members.md | 14 +- doc/api/merge_request_context_commits.md | 10 +- doc/api/merge_requests.md | 26 +- doc/api/milestones.md | 2 +- doc/api/namespaces.md | 8 +- doc/api/notes.md | 38 +-- doc/api/notification_settings.md | 8 +- doc/api/oauth2.md | 2 +- doc/api/packages.md | 10 +- doc/api/pages.md | 2 +- doc/api/pages_domains.md | 24 +- doc/api/pipeline_schedules.md | 18 +- doc/api/project_badges.md | 12 +- doc/api/project_clusters.md | 16 +- doc/api/project_import_export.md | 12 +- doc/api/project_snippets.md | 10 +- doc/api/projects.md | 24 +- doc/api/protected_branches.md | 12 +- doc/api/protected_tags.md | 8 +- doc/api/releases/index.md | 10 +- doc/api/releases/links.md | 10 +- doc/api/repositories.md | 4 +- doc/api/repository_files.md | 16 +- doc/api/repository_submodules.md | 2 +- doc/api/resource_label_events.md | 12 +- doc/api/scim.md | 10 +- doc/api/search.md | 52 ++-- doc/api/settings.md | 4 +- doc/api/sidekiq_metrics.md | 8 +- doc/api/snippets.md | 16 +- doc/api/statistics.md | 2 +- doc/api/suggestions.md | 2 +- doc/api/system_hooks.md | 8 +- doc/api/tags.md | 4 +- doc/api/templates/dockerfiles.md | 4 +- doc/api/templates/gitignores.md | 4 +- doc/api/templates/gitlab_ci_ymls.md | 4 +- doc/api/templates/licenses.md | 4 +- doc/api/todos.md | 6 +- doc/api/users.md | 28 +- doc/api/version.md | 2 +- doc/api/visual_review_discussions.md | 2 +- doc/api/vulnerability_findings.md | 2 +- doc/api/wikis.md | 12 +- .../bitbucket_integration.md | 2 +- doc/ci/docker/using_docker_build.md | 26 +- doc/ci/docker/using_docker_images.md | 16 +- doc/ci/docker/using_kaniko.md | 2 +- doc/ci/enable_or_disable_ci.md | 4 +- .../devops_and_game_dev_with_gitlab_ci_cd/index.md | 4 +- .../laravel_with_gitlab_and_envoy/index.md | 28 +- doc/ci/examples/php.md | 8 +- ...test-and-deploy-python-application-to-heroku.md | 2 +- .../test-and-deploy-ruby-application-to-heroku.md | 2 +- .../test_phoenix_app_with_gitlab_ci_cd/index.md | 14 +- .../merge_trains/index.md | 1 + doc/ci/quick_start/README.md | 2 +- doc/ci/services/mysql.md | 16 +- doc/ci/services/postgres.md | 12 +- doc/ci/services/redis.md | 4 +- doc/ci/ssh_keys/README.md | 4 +- doc/ci/triggers/README.md | 8 +- doc/ci/variables/README.md | 8 +- doc/development/README.md | 5 +- doc/development/architecture.md | 2 +- doc/development/chaos_endpoints.md | 12 +- doc/development/cicd/index.md | 59 +++++ doc/development/database_debugging.md | 6 +- doc/development/database_helpers.md | 63 ----- doc/development/distributed_tracing.md | 10 +- doc/development/documentation/index.md | 8 +- .../site_architecture/release_process.md | 16 +- doc/development/documentation/styleguide.md | 18 +- doc/development/emails.md | 4 +- doc/development/fe_guide/frontend_faq.md | 2 +- doc/development/fe_guide/graphql.md | 15 ++ doc/development/feature_flags/controls.md | 4 +- doc/development/geo.md | 2 +- doc/development/gitaly.md | 10 +- doc/development/gotchas.md | 2 +- doc/development/i18n/externalization.md | 10 +- doc/development/import_export.md | 10 +- doc/development/import_project.md | 8 +- doc/development/internal_api.md | 16 +- doc/development/kubernetes.md | 2 +- doc/development/new_fe_guide/dependencies.md | 4 +- doc/development/performance.md | 14 +- doc/development/post_deployment_migrations.md | 8 +- doc/development/profiling.md | 4 +- doc/development/python_guide/index.md | 12 +- doc/development/shell_commands.md | 2 +- doc/development/shell_scripting_guide/index.md | 2 +- doc/development/testing_guide/best_practices.md | 4 +- doc/development/testing_guide/frontend_testing.md | 8 +- doc/development/utilities.md | 287 +++++++++++++++++---- doc/downgrade_ee_to_ce/README.md | 6 +- doc/gitlab-basics/add-file.md | 14 +- doc/gitlab-basics/create-project.md | 2 +- doc/gitlab-basics/feature_branch_workflow.md | 8 +- doc/gitlab-basics/start-using-git.md | 50 ++-- doc/install/aws/index.md | 18 +- doc/install/azure/index.md | 4 +- doc/install/digitaloceandocker.md | 16 +- doc/install/installation.md | 126 ++++----- doc/install/openshift_and_gitlab/index.md | 40 +-- doc/integration/auth0.md | 4 +- doc/integration/azure.md | 4 +- doc/integration/cas.md | 4 +- doc/integration/elasticsearch.md | 48 ++-- doc/integration/facebook.md | 4 +- doc/integration/gitlab.md | 4 +- doc/integration/google.md | 4 +- doc/integration/kerberos.md | 2 +- doc/integration/oauth2_generic.md | 4 +- doc/integration/omniauth.md | 12 +- doc/integration/salesforce.md | 4 +- doc/integration/saml.md | 4 +- doc/integration/sourcegraph.md | 2 +- doc/integration/twitter.md | 4 +- doc/integration/ultra_auth.md | 4 +- doc/integration/vault.md | 12 +- doc/migrate_ci_to_ce/README.md | 6 +- doc/raketasks/backup_restore.md | 44 ++-- doc/raketasks/import.md | 4 +- doc/raketasks/user_management.md | 10 +- doc/raketasks/web_hooks.md | 12 +- doc/security/asset_proxy.md | 2 +- doc/security/password_length_limits.md | 2 +- doc/security/rack_attack.md | 6 +- doc/security/reset_root_password.md | 10 +- doc/security/two_factor_authentication.md | 2 +- doc/security/unlock_user.md | 2 +- doc/ssh/README.md | 26 +- doc/topics/autodevops/index.md | 6 +- doc/topics/git/how_to_install_git/index.md | 4 +- doc/topics/git/migrate_to_git_lfs/index.md | 16 +- .../numerous_undo_possibilities_in_git/index.md | 2 +- doc/topics/git/partial_clone.md | 8 +- doc/topics/git/troubleshooting_git.md | 6 +- doc/topics/git/useful_git_commands.md | 50 ++-- doc/university/training/end-user/README.md | 30 +-- doc/university/training/topics/bisect.md | 6 +- doc/university/training/topics/cherry_picking.md | 2 +- doc/university/training/topics/env_setup.md | 14 +- .../training/topics/feature_branching.md | 2 +- doc/university/training/topics/getting_started.md | 10 +- doc/university/training/topics/git_add.md | 10 +- doc/university/training/topics/git_log.md | 12 +- doc/university/training/topics/merge_conflicts.md | 4 +- doc/university/training/topics/rollback_commits.md | 12 +- doc/university/training/topics/stash.md | 12 +- doc/university/training/topics/subtree.md | 4 +- doc/university/training/topics/tags.md | 2 +- doc/university/training/topics/unstage.md | 8 +- doc/university/training/user_training.md | 22 +- doc/update/README.md | 2 +- doc/update/mysql_to_postgresql.md | 32 +-- doc/update/patch_versions.md | 20 +- doc/update/upgrading_from_ce_to_ee.md | 18 +- doc/update/upgrading_from_source.md | 46 ++-- doc/user/admin_area/license.md | 2 +- doc/user/admin_area/monitoring/health_check.md | 6 +- doc/user/clusters/applications.md | 14 +- doc/user/group/saml_sso/scim_setup.md | 4 +- doc/user/packages/conan_repository/index.md | 32 +-- doc/user/packages/container_registry/index.md | 12 +- doc/user/packages/dependency_proxy/index.md | 6 +- doc/user/packages/maven_repository/index.md | 2 +- doc/user/packages/npm_registry/index.md | 28 +- doc/user/packages/nuget_repository/index.md | 6 +- doc/user/packages/workflows/monorepo.md | 2 +- doc/user/packages/workflows/project_registry.md | 2 +- .../profile/account/two_factor_authentication.md | 4 +- doc/user/profile/index.md | 2 +- doc/user/project/clusters/add_remove_clusters.md | 18 +- doc/user/project/clusters/serverless/aws.md | 4 +- doc/user/project/clusters/serverless/index.md | 38 +-- doc/user/project/deploy_tokens/index.md | 6 +- doc/user/project/file_lock.md | 2 +- doc/user/project/import/svn.md | 10 +- doc/user/project/integrations/generic_alerts.md | 2 +- doc/user/project/integrations/jira.md | 2 +- doc/user/project/integrations/slack.md | 2 +- doc/user/project/issues/associate_zoom_meeting.md | 4 +- doc/user/project/issues/design_management.md | 6 + doc/user/project/issues/managing_issues.md | 2 +- .../project/merge_requests/allow_collaboration.md | 4 +- .../project/merge_requests/cherry_pick_changes.md | 2 +- .../merge_requests/creating_merge_requests.md | 8 +- doc/user/project/merge_requests/revert_changes.md | 2 +- .../project/pages/getting_started_part_four.md | 2 +- .../project/pages/lets_encrypt_for_gitlab_pages.md | 20 +- doc/user/project/pipelines/settings.md | 2 +- doc/user/project/repository/git_blame.md | 4 +- doc/user/project/repository/git_history.md | 4 +- .../project/repository/repository_mirroring.md | 4 +- lib/api/entities.rb | 95 ------- lib/api/entities/basic_project_details.rb | 55 ++++ lib/api/entities/container_expiration_policy.rb | 14 + lib/api/entities/project_import_status.rb | 14 + lib/api/entities/project_statistics.rb | 14 + lib/api/entities/remote_mirror.rb | 17 ++ lib/api/merge_requests.rb | 8 +- .../user_mentions/create_resource_user_mention.rb | 5 +- .../models/concerns/isolated_mentionable.rb | 95 +++++++ .../concerns/mentionable_migration_methods.rb | 24 ++ .../user_mentions/models/epic.rb | 1 + .../user_mentions/models/isolated_mentionable.rb | 95 ------- lib/gitlab/database/subquery.rb | 16 -- lib/gitlab/jira/http_client.rb | 2 +- locale/gitlab.pot | 18 ++ .../controllers/admin/spam_logs_controller_spec.rb | 2 +- .../controllers/projects/issues_controller_spec.rb | 12 +- .../projects/snippets_controller_spec.rb | 6 +- spec/controllers/snippets_controller_spec.rb | 6 +- .../features/projects/serverless/functions_spec.rb | 5 + .../projects/serverless/functions_finder_spec.rb | 66 ++++- spec/lib/gitlab/database/subquery_spec.rb | 17 -- .../api/issues/post_projects_issues_spec.rb | 2 +- .../api/issues/put_projects_issues_spec.rb | 2 +- spec/requests/api/merge_requests_spec.rb | 6 + spec/requests/api/project_snippets_spec.rb | 4 +- spec/requests/api/snippets_spec.rb | 4 +- spec/services/akismet_service_spec.rb | 136 ---------- spec/services/issues/create_service_spec.rb | 6 +- spec/services/notes/update_service_spec.rb | 6 + spec/services/snippets/create_service_spec.rb | 2 +- spec/services/spam/akismet_service_spec.rb | 136 ++++++++++ spec/services/spam/spam_check_service_spec.rb | 6 +- spec/support/helpers/kubernetes_helpers.rb | 13 + 370 files changed, 2798 insertions(+), 2356 deletions(-) delete mode 100644 app/services/akismet_service.rb create mode 100644 app/services/spam/akismet_service.rb create mode 100644 changelogs/unreleased/197309-milestone-in-issue-boards-list-not-cropped-when-longer-than-board-.yml create mode 100644 changelogs/unreleased/198411-jira-http-error.yml create mode 100644 changelogs/unreleased/199526-new-mr-changes-tab-edit-file-button-ui-polish.yml create mode 100644 changelogs/unreleased/refactoring-entities-file-5.yml create mode 100644 changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-13-1.yml create mode 100644 config/initializers/rails_host_authorization.rb create mode 100644 doc/development/cicd/index.md delete mode 100644 doc/development/database_helpers.md create mode 100644 lib/api/entities/basic_project_details.rb create mode 100644 lib/api/entities/container_expiration_policy.rb create mode 100644 lib/api/entities/project_import_status.rb create mode 100644 lib/api/entities/project_statistics.rb create mode 100644 lib/api/entities/remote_mirror.rb create mode 100644 lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb create mode 100644 lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb delete mode 100644 lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb delete mode 100644 lib/gitlab/database/subquery.rb delete mode 100644 spec/lib/gitlab/database/subquery_spec.rb delete mode 100644 spec/services/akismet_service_spec.rb create mode 100644 spec/services/spam/akismet_service_spec.rb diff --git a/app/assets/javascripts/lib/graphql.js b/app/assets/javascripts/lib/graphql.js index 2c5278d16ae..b49fe9362c2 100644 --- a/app/assets/javascripts/lib/graphql.js +++ b/app/assets/javascripts/lib/graphql.js @@ -5,6 +5,14 @@ import { ApolloLink } from 'apollo-link'; import { BatchHttpLink } from 'apollo-link-batch-http'; import csrf from '~/lib/utils/csrf'; +export const fetchPolicies = { + CACHE_FIRST: 'cache-first', + CACHE_AND_NETWORK: 'cache-and-network', + NETWORK_ONLY: 'network-only', + NO_CACHE: 'no-cache', + CACHE_ONLY: 'cache-only', +}; + export default (resolvers = {}, config = {}) => { let uri = `${gon.relative_url_root}/api/graphql`; @@ -32,5 +40,10 @@ export default (resolvers = {}, config = {}) => { }), resolvers, assumeImmutableResults: config.assumeImmutableResults, + defaultOptions: { + query: { + fetchPolicy: config.fetchPolicy || fetchPolicies.CACHE_FIRST, + }, + }, }); }; diff --git a/app/assets/javascripts/monitoring/stores/utils.js b/app/assets/javascripts/monitoring/stores/utils.js index 56244a4ca66..cd586c6af3e 100644 --- a/app/assets/javascripts/monitoring/stores/utils.js +++ b/app/assets/javascripts/monitoring/stores/utils.js @@ -1,8 +1,13 @@ import { omit } from 'lodash'; -import createGqClient from '~/lib/graphql'; +import createGqClient, { fetchPolicies } from '~/lib/graphql'; import { getIdFromGraphQLId } from '~/graphql_shared/utils'; -export const gqClient = createGqClient(); +export const gqClient = createGqClient( + {}, + { + fetchPolicy: fetchPolicies.NO_CACHE, + }, +); export const uniqMetricsId = metric => `${metric.metric_id}_${metric.id}`; diff --git a/app/assets/stylesheets/pages/diff.scss b/app/assets/stylesheets/pages/diff.scss index f394e4ab58a..d30f113c01f 100644 --- a/app/assets/stylesheets/pages/diff.scss +++ b/app/assets/stylesheets/pages/diff.scss @@ -63,11 +63,6 @@ background-color: $gray-normal; } - a, - button { - color: $gray-700; - } - svg { vertical-align: middle; top: -1px; diff --git a/app/finders/projects/serverless/functions_finder.rb b/app/finders/projects/serverless/functions_finder.rb index e8c50ef1a88..4e0b69f47e5 100644 --- a/app/finders/projects/serverless/functions_finder.rb +++ b/app/finders/projects/serverless/functions_finder.rb @@ -4,9 +4,15 @@ module Projects module Serverless class FunctionsFinder include Gitlab::Utils::StrongMemoize + include ReactiveCaching attr_reader :project + self.reactive_cache_key = ->(finder) { finder.cache_key } + self.reactive_cache_worker_finder = ->(_id, *args) { from_cache(*args) } + + MAX_CLUSTERS = 10 + def initialize(project) @project = project end @@ -15,8 +21,9 @@ module Projects knative_services.flatten.compact end - # Possible return values: Clusters::KnativeServicesFinder::KNATIVE_STATE def knative_installed + return knative_installed_from_cluster?(*cache_key) if available_environments.empty? + states = services_finders.map do |finder| finder.knative_detected.tap do |state| return state if state == ::Clusters::KnativeServicesFinder::KNATIVE_STATES['checking'] # rubocop:disable Cop/AvoidReturnFromBlocks @@ -45,8 +52,41 @@ module Projects end end + def self.from_cache(project_id) + project = Project.find(project_id) + + new(project) + end + + def cache_key(*args) + [project.id] + end + + def calculate_reactive_cache(*) + # rubocop: disable CodeReuse/ActiveRecord + project.all_clusters.enabled.take(MAX_CLUSTERS).any? do |cluster| + cluster.kubeclient.knative_client.discover + rescue Kubeclient::ResourceNotFoundError + next + end + end + private + def knative_installed_from_cluster?(*cache_key) + cached_data = with_reactive_cache_memoized(*cache_key) { |data| data } + + return ::Clusters::KnativeServicesFinder::KNATIVE_STATES['checking'] if cached_data.nil? + + cached_data ? true : false + end + + def with_reactive_cache_memoized(*cache_key) + strong_memoize(:reactive_cache) do + with_reactive_cache(*cache_key) { |data| data } + end + end + def knative_service(environment_scope, name) finders_for_scope(environment_scope).map do |finder| services = finder @@ -95,6 +135,10 @@ module Projects environment_scope == finder.cluster.environment_scope end end + + def id + nil + end end end end diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb index 62be591ec47..1b36f60c316 100644 --- a/app/helpers/explore_helper.rb +++ b/app/helpers/explore_helper.rb @@ -19,6 +19,18 @@ module ExploreHelper request_path_with_options(options) end + def filter_audit_path(options = {}) + exist_opts = { + entity_type: params[:entity_type], + entity_id: params[:entity_id], + created_before: params[:created_before], + created_after: params[:created_after], + sort: params[:sort] + } + options = exist_opts.merge(options).delete_if { |key, value| value.blank? } + request_path_with_options(options) + end + def filter_groups_path(options = {}) request_path_with_options(options) end diff --git a/app/helpers/sorting_helper.rb b/app/helpers/sorting_helper.rb index 33f3bb0b749..3e448087db0 100644 --- a/app/helpers/sorting_helper.rb +++ b/app/helpers/sorting_helper.rb @@ -207,6 +207,13 @@ module SortingHelper }.merge(issuable_sort_option_overrides) end + def audit_logs_sort_order_hash + { + sort_value_recently_created => sort_title_recently_created, + sort_value_oldest_created => sort_title_oldest_created + } + end + def issuable_sort_option_title(sort_value) sort_value = issuable_sort_option_overrides[sort_value] || sort_value diff --git a/app/models/audit_event.rb b/app/models/audit_event.rb index 06a607b75a4..03eb7462ece 100644 --- a/app/models/audit_event.rb +++ b/app/models/audit_event.rb @@ -13,6 +13,8 @@ class AuditEvent < ApplicationRecord scope :by_entity_type, -> (entity_type) { where(entity_type: entity_type) } scope :by_entity_id, -> (entity_id) { where(entity_id: entity_id) } + scope :order_by_id_desc, -> { order(id: :desc) } + scope :order_by_id_asc, -> { order(id: :asc) } after_initialize :initialize_details diff --git a/app/models/clusters/applications/runner.rb b/app/models/clusters/applications/runner.rb index 42b63fbef92..6a9cd77d356 100644 --- a/app/models/clusters/applications/runner.rb +++ b/app/models/clusters/applications/runner.rb @@ -3,7 +3,7 @@ module Clusters module Applications class Runner < ApplicationRecord - VERSION = '0.13.0' + VERSION = '0.13.1' self.table_name = 'clusters_applications_runners' diff --git a/app/services/akismet_service.rb b/app/services/akismet_service.rb deleted file mode 100644 index d8098c4a8f5..00000000000 --- a/app/services/akismet_service.rb +++ /dev/null @@ -1,73 +0,0 @@ -# frozen_string_literal: true - -class AkismetService - attr_accessor :text, :options - - def initialize(owner_name, owner_email, text, options = {}) - @owner_name = owner_name - @owner_email = owner_email - @text = text - @options = options - end - - def spam? - return false unless akismet_enabled? - - params = { - type: 'comment', - text: text, - created_at: DateTime.now, - author: owner_name, - author_email: owner_email, - referrer: options[:referrer] - } - - begin - is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params) - is_spam || is_blatant - rescue => e - Rails.logger.error("Unable to connect to Akismet: #{e}, skipping check") # rubocop:disable Gitlab/RailsLogger - false - end - end - - def submit_ham - submit(:ham) - end - - def submit_spam - submit(:spam) - end - - private - - attr_accessor :owner_name, :owner_email - - def akismet_client - @akismet_client ||= ::Akismet::Client.new(Gitlab::CurrentSettings.akismet_api_key, - Gitlab.config.gitlab.url) - end - - def akismet_enabled? - Gitlab::CurrentSettings.akismet_enabled - end - - def submit(type) - return false unless akismet_enabled? - - params = { - type: 'comment', - text: text, - author: owner_name, - author_email: owner_email - } - - begin - akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend - true - rescue => e - Rails.logger.error("Unable to connect to Akismet: #{e}, skipping!") # rubocop:disable Gitlab/RailsLogger - false - end - end -end diff --git a/app/services/concerns/akismet_methods.rb b/app/services/concerns/akismet_methods.rb index 508a165b065..48c4e329944 100644 --- a/app/services/concerns/akismet_methods.rb +++ b/app/services/concerns/akismet_methods.rb @@ -6,7 +6,7 @@ module AkismetMethods end def akismet - @akismet ||= AkismetService.new( + @akismet ||= Spam::AkismetService.new( spammable_owner.name, spammable_owner.email, spammable.spammable_text, diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb index 15c556498ec..c8b0dc30209 100644 --- a/app/services/notes/update_service.rb +++ b/app/services/notes/update_service.rb @@ -3,7 +3,7 @@ module Notes class UpdateService < BaseService def execute(note) - return note unless note.editable? + return note unless note.editable? && params.present? old_mentioned_users = note.mentioned_users(current_user).to_a diff --git a/app/services/spam/akismet_service.rb b/app/services/spam/akismet_service.rb new file mode 100644 index 00000000000..7d16743b3ed --- /dev/null +++ b/app/services/spam/akismet_service.rb @@ -0,0 +1,75 @@ +# frozen_string_literal: true + +module Spam + class AkismetService + attr_accessor :text, :options + + def initialize(owner_name, owner_email, text, options = {}) + @owner_name = owner_name + @owner_email = owner_email + @text = text + @options = options + end + + def spam? + return false unless akismet_enabled? + + params = { + type: 'comment', + text: text, + created_at: DateTime.now, + author: owner_name, + author_email: owner_email, + referrer: options[:referrer] + } + + begin + is_spam, is_blatant = akismet_client.check(options[:ip_address], options[:user_agent], params) + is_spam || is_blatant + rescue => e + Rails.logger.error("Unable to connect to Akismet: #{e}, skipping check") # rubocop:disable Gitlab/RailsLogger + false + end + end + + def submit_ham + submit(:ham) + end + + def submit_spam + submit(:spam) + end + + private + + attr_accessor :owner_name, :owner_email + + def akismet_client + @akismet_client ||= ::Akismet::Client.new(Gitlab::CurrentSettings.akismet_api_key, + Gitlab.config.gitlab.url) + end + + def akismet_enabled? + Gitlab::CurrentSettings.akismet_enabled + end + + def submit(type) + return false unless akismet_enabled? + + params = { + type: 'comment', + text: text, + author: owner_name, + author_email: owner_email + } + + begin + akismet_client.public_send(type, options[:ip_address], options[:user_agent], params) # rubocop:disable GitlabSecurity/PublicSend + true + rescue => e + Rails.logger.error("Unable to connect to Akismet: #{e}, skipping!") # rubocop:disable Gitlab/RailsLogger + false + end + end + end +end diff --git a/app/views/shared/boards/components/_board.html.haml b/app/views/shared/boards/components/_board.html.haml index a62c385d711..1c2ba6639cf 100644 --- a/app/views/shared/boards/components/_board.html.haml +++ b/app/views/shared/boards/components/_board.html.haml @@ -22,7 +22,7 @@ %span.board-title-main-text.block-truncated{ "v-if": "list.type !== \"label\"", ":title" => '((list.label && list.label.description) || list.title || "")', data: { container: "body" }, - ":class": "{ 'has-tooltip': !['backlog', 'closed'].includes(list.type) }" } + ":class": "{ 'has-tooltip': !['backlog', 'closed'].includes(list.type), 'd-block': list.type === 'milestone' }" } {{ list.title }} %span.board-title-sub-text.prepend-left-5.has-tooltip{ "v-if": "list.type === \"assignee\"", diff --git a/changelogs/unreleased/197309-milestone-in-issue-boards-list-not-cropped-when-longer-than-board-.yml b/changelogs/unreleased/197309-milestone-in-issue-boards-list-not-cropped-when-longer-than-board-.yml new file mode 100644 index 00000000000..352f4426128 --- /dev/null +++ b/changelogs/unreleased/197309-milestone-in-issue-boards-list-not-cropped-when-longer-than-board-.yml @@ -0,0 +1,5 @@ +--- +title: Allow long milestone titles on board lists to be truncated +merge_request: +author: +type: fixed diff --git a/changelogs/unreleased/198411-jira-http-error.yml b/changelogs/unreleased/198411-jira-http-error.yml new file mode 100644 index 00000000000..3d7b8bfd2cd --- /dev/null +++ b/changelogs/unreleased/198411-jira-http-error.yml @@ -0,0 +1,5 @@ +--- +title: Fix JIRA::HTTPError initialize parameter +merge_request: 24060 +author: +type: fixed diff --git a/changelogs/unreleased/199526-new-mr-changes-tab-edit-file-button-ui-polish.yml b/changelogs/unreleased/199526-new-mr-changes-tab-edit-file-button-ui-polish.yml new file mode 100644 index 00000000000..c3bbec9f64b --- /dev/null +++ b/changelogs/unreleased/199526-new-mr-changes-tab-edit-file-button-ui-polish.yml @@ -0,0 +1,5 @@ +--- +title: Remove gray color from diff buttons +merge_request: 24041 +author: +type: fixed diff --git a/changelogs/unreleased/refactoring-entities-file-5.yml b/changelogs/unreleased/refactoring-entities-file-5.yml new file mode 100644 index 00000000000..53740cd2381 --- /dev/null +++ b/changelogs/unreleased/refactoring-entities-file-5.yml @@ -0,0 +1,5 @@ +--- +title: Add separate classes for project related classes +merge_request: 23887 +author: Rajendra Kadam +type: added diff --git a/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-13-1.yml b/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-13-1.yml new file mode 100644 index 00000000000..62a2bc6ebd2 --- /dev/null +++ b/changelogs/unreleased/update-gitlab-runner-helm-chart-to-0-13-1.yml @@ -0,0 +1,5 @@ +--- +title: Update GitLab Runner Helm Chart to 0.13.1 (GitLab Runner 12.7.1) +merge_request: 23588 +author: +type: other diff --git a/config/initializers/rails_host_authorization.rb b/config/initializers/rails_host_authorization.rb new file mode 100644 index 00000000000..6afcec374db --- /dev/null +++ b/config/initializers/rails_host_authorization.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +# This file requires config/initializers/1_settings.rb + +if Rails.env.development? + Rails.application.config.hosts << Gitlab.config.gitlab.host +end diff --git a/doc/administration/audit_events.md b/doc/administration/audit_events.md index 6366ed21865..fa217c31eb2 100644 --- a/doc/administration/audit_events.md +++ b/doc/administration/audit_events.md @@ -144,7 +144,7 @@ the steps bellow. 1. Enter the Rails console: - ```sh + ```shell sudo gitlab-rails console ``` diff --git a/doc/administration/auth/authentiq.md b/doc/administration/auth/authentiq.md index b84eca4ef0d..d15beb4f6fc 100644 --- a/doc/administration/auth/authentiq.md +++ b/doc/administration/auth/authentiq.md @@ -14,13 +14,13 @@ Authentiq will generate a Client ID and the accompanying Client Secret for you t For omnibus installation - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell sudo -u git -H editor /home/git/gitlab/config/gitlab.yml ``` diff --git a/doc/administration/auth/crowd.md b/doc/administration/auth/crowd.md index 8704782e78f..da6c01ec382 100644 --- a/doc/administration/auth/crowd.md +++ b/doc/administration/auth/crowd.md @@ -20,13 +20,13 @@ Authenticate to GitLab using the Atlassian Crowd OmniAuth provider. **Omnibus:** - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` **Source:** - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/administration/auth/how_to_configure_ldap_gitlab_ce/index.md b/doc/administration/auth/how_to_configure_ldap_gitlab_ce/index.md index a5a102d888b..35620be7d7e 100644 --- a/doc/administration/auth/how_to_configure_ldap_gitlab_ce/index.md +++ b/doc/administration/auth/how_to_configure_ldap_gitlab_ce/index.md @@ -149,7 +149,7 @@ You can use the [`AdFind`](https://social.technet.microsoft.com/wiki/contents/ar You can use the filter `objectclass=*` to return all directory objects. -```sh +```shell adfind -h ad.example.org:636 -ssl -u "CN=GitLabSRV,CN=Users,DC=GitLab,DC=org" -up Password1 -b "OU=GitLab INT,DC=GitLab,DC=org" -f (objectClass=*) ``` @@ -157,7 +157,7 @@ adfind -h ad.example.org:636 -ssl -u "CN=GitLabSRV,CN=Users,DC=GitLab,DC=org" -u You can also retrieve a single object by **specifying** the object name or full **DN**. In this example we specify the object name only `CN=Leroy Fox`. -```sh +```shell adfind -h ad.example.org:636 -ssl -u "CN=GitLabSRV,CN=Users,DC=GitLab,DC=org" -up Password1 -b "OU=GitLab INT,DC=GitLab,DC=org" -f (&(objectcategory=person)(CN=Leroy Fox))” ``` @@ -169,7 +169,7 @@ You can use the `ldapsearch` utility (on Unix based systems) to test that your L You can use the filter `objectclass=*` to return all directory objects. -```sh +```shell ldapsearch -D "CN=GitLabSRV,CN=Users,DC=GitLab,DC=org" \ -w Password1 -p 636 -h ad.example.org \ -b "OU=GitLab INT,DC=GitLab,DC=org" -Z \ @@ -180,7 +180,7 @@ ldapsearch -D "CN=GitLabSRV,CN=Users,DC=GitLab,DC=org" \ You can also retrieve a single object by **specifying** the object name or full **DN**. In this example we specify the object name only `CN=Leroy Fox`. -```sh +```shell ldapsearch -D "CN=GitLabSRV,CN=Users,DC=GitLab,DC=org" -w Password1 -p 389 -h ad.example.org -b "OU=GitLab INT,DC=GitLab,DC=org" -Z -s sub "CN=Leroy Fox" ``` diff --git a/doc/administration/auth/jwt.md b/doc/administration/auth/jwt.md index 146baeba6d1..15eee50c771 100644 --- a/doc/administration/auth/jwt.md +++ b/doc/administration/auth/jwt.md @@ -11,13 +11,13 @@ JWT will provide you with a secret key for you to use. For Omnibus GitLab: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/administration/auth/ldap-ee.md b/doc/administration/auth/ldap-ee.md index a15e34c33a5..5217cd5114a 100644 --- a/doc/administration/auth/ldap-ee.md +++ b/doc/administration/auth/ldap-ee.md @@ -465,7 +465,7 @@ step of the sync. 1. Start a Rails console: - ```bash + ```shell # For Omnibus installations sudo gitlab-rails console @@ -540,7 +540,7 @@ statements. Indicates the point where syncing actually begins: -```bash +```shell Started syncing all providers for 'my_group' group ``` @@ -551,7 +551,7 @@ log entries like this - one for each LDAP group. If you don't see an LDAP user DN in this log entry, LDAP is not returning the user when we do the lookup. Verify the user is actually in the LDAP group. -```bash +```shell Members in 'ldap_group_1' LDAP group: ["uid=john0,ou=people,dc=example,dc=com", "uid=mary0,ou=people,dc=example,dc=com", "uid=john1,ou=people,dc=example,dc=com", "uid=mary1,ou=people,dc=example,dc=com", "uid=john2,ou=people,dc=example,dc=com", @@ -571,7 +571,7 @@ NOTE: **Note:** 10 is 'Guest', 20 is 'Reporter', 30 is 'Developer', 40 is 'Maintainer' and 50 is 'Owner'. -```bash +```shell Resolved 'my_group' group member access: {"uid=john0,ou=people,dc=example,dc=com"=>30, "uid=mary0,ou=people,dc=example,dc=com"=>30, "uid=john1,ou=people,dc=example,dc=com"=>30, "uid=mary1,ou=people,dc=example,dc=com"=>30, "uid=john2,ou=people,dc=example,dc=com"=>30, @@ -588,7 +588,7 @@ If you think a particular user should already exist in GitLab, but you're seeing this entry, it could be due to a mismatched DN stored in GitLab. See [User DN has changed](#User-DN-has-changed) to update the user's LDAP identity. -```bash +```shell User with DN `uid=john0,ou=people,dc=example,dc=com` should have access to 'my_group' group but there is no user in GitLab with that identity. Membership will be updated once the user signs in for @@ -597,6 +597,6 @@ the first time. Finally, the following entry says syncing has finished for this group: -```bash +```shell Finished syncing all providers for 'my_group' group ``` diff --git a/doc/administration/auth/ldap.md b/doc/administration/auth/ldap.md index 857f554f2fe..6f6c2e0068e 100644 --- a/doc/administration/auth/ldap.md +++ b/doc/administration/auth/ldap.md @@ -564,7 +564,7 @@ This example uses `ldapsearch` and assumes you are using ActiveDirectory. The following query returns the login names of the users that will be allowed to log in to GitLab if you configure your own user_filter. -```sh +```shell ldapsearch -H ldaps://$host:$port -D "$bind_dn" -y bind_dn_password.txt -b "$base" "$user_filter" sAMAccountName ``` @@ -583,7 +583,7 @@ ldapsearch -H ldaps://$host:$port -D "$bind_dn" -y bind_dn_password.txt -b "$ba - Run the following check command to make sure that the LDAP settings are correct and GitLab can see your users: - ```bash + ```shell # For Omnibus installations sudo gitlab-rake gitlab:ldap:check diff --git a/doc/administration/auth/oidc.md b/doc/administration/auth/oidc.md index 698a5506b83..6f59cffc3cc 100644 --- a/doc/administration/auth/oidc.md +++ b/doc/administration/auth/oidc.md @@ -13,13 +13,13 @@ The OpenID Connect will provide you with a client details and secret for you to For Omnibus GitLab: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/administration/auth/okta.md b/doc/administration/auth/okta.md index 41745e8caae..7b5effe3d77 100644 --- a/doc/administration/auth/okta.md +++ b/doc/administration/auth/okta.md @@ -46,13 +46,13 @@ Now that the Okta app is configured, it's time to enable it in GitLab. **For Omnibus GitLab installations** - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` **For installations from source** - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/administration/file_hooks.md b/doc/administration/file_hooks.md index 89b454a73a0..5c8fb2f9d74 100644 --- a/doc/administration/file_hooks.md +++ b/doc/administration/file_hooks.md @@ -94,7 +94,7 @@ The rake task will use a sample data and execute each of file hook. The output should be enough to determine if the system sees your file hook and if it was executed without errors. -```bash +```shell # Omnibus installations sudo gitlab-rake file_hooks:validate diff --git a/doc/administration/geo/disaster_recovery/background_verification.md b/doc/administration/geo/disaster_recovery/background_verification.md index 5caf1d53a2c..ca2cfec6e13 100644 --- a/doc/administration/geo/disaster_recovery/background_verification.md +++ b/doc/administration/geo/disaster_recovery/background_verification.md @@ -27,7 +27,7 @@ the node more time before scheduling a planned failover. Run the following commands in a Rails console on the **primary** node: -```sh +```shell gitlab-rails console ``` @@ -95,7 +95,7 @@ The automatic background re-verification is enabled by default, but you can disable if you need. Run the following commands in a Rails console on the **primary** node: -```sh +```shell gitlab-rails console ``` @@ -120,13 +120,13 @@ to be resynced without the backoff period: For repositories: -```sh +```shell sudo gitlab-rake geo:verification:repository:reset ``` For wikis: -```sh +```shell sudo gitlab-rake geo:verification:wiki:reset ``` @@ -146,25 +146,25 @@ If the **primary** and **secondary** nodes have a checksum verification mismatch (the path is usually `/var/opt/gitlab/git-data/repositories`). Note that if `git_data_dirs` is customized, check the directory layout on your server to be sure. - ```sh + ```shell cd /var/opt/gitlab/git-data/repositories ``` 1. Run the following command on the **primary** node, redirecting the output to a file: - ```sh + ```shell git show-ref --head | grep -E "HEAD|(refs/(heads|tags|keep-around|merge-requests|environments|notes)/)" > primary-node-refs ``` 1. Run the following command on the **secondary** node, redirecting the output to a file: - ```sh + ```shell git show-ref --head | grep -E "HEAD|(refs/(heads|tags|keep-around|merge-requests|environments|notes)/)" > secondary-node-refs ``` 1. Copy the files from the previous steps on the same system, and do a diff between the contents: - ```sh + ```shell diff primary-node-refs secondary-node-refs ``` diff --git a/doc/administration/geo/disaster_recovery/bring_primary_back.md b/doc/administration/geo/disaster_recovery/bring_primary_back.md index 64d7ef2d609..96280e4570b 100644 --- a/doc/administration/geo/disaster_recovery/bring_primary_back.md +++ b/doc/administration/geo/disaster_recovery/bring_primary_back.md @@ -21,7 +21,7 @@ To bring the former **primary** node up to date: 1. SSH into the former **primary** node that has fallen behind. 1. Make sure all the services are up: - ```sh + ```shell sudo gitlab-ctl start ``` diff --git a/doc/administration/geo/disaster_recovery/index.md b/doc/administration/geo/disaster_recovery/index.md index a3014c0a21e..2999e0b6f1d 100644 --- a/doc/administration/geo/disaster_recovery/index.md +++ b/doc/administration/geo/disaster_recovery/index.md @@ -39,13 +39,13 @@ must disable the **primary** node. 1. SSH into the **primary** node to stop and disable GitLab, if possible: - ```sh + ```shell sudo gitlab-ctl stop ``` Prevent GitLab from starting up again if the server unexpectedly reboots: - ```sh + ```shell sudo systemctl disable gitlab-runsvdir ``` @@ -54,7 +54,7 @@ must disable the **primary** node. started if the machine reboots isn't available (see [Omnibus GitLab issue #3058](https://gitlab.com/gitlab-org/omnibus-gitlab/issues/3058)). It may be safest to uninstall the GitLab package completely: - ```sh + ```shell yum remove gitlab-ee ``` @@ -63,7 +63,7 @@ must disable the **primary** node. or any other distro based on the Upstart init system, you can prevent GitLab from starting if the machine reboots by doing the following: - ```sh + ```shell initctl stop gitlab-runsvvdir echo 'manual' > /etc/init/gitlab-runsvdir.override initctl reload-configuration @@ -100,7 +100,7 @@ Note the following when promoting a secondary: 1. SSH in to your **secondary** node and login as root: - ```sh + ```shell sudo -i ``` @@ -117,7 +117,7 @@ Note the following when promoting a secondary: 1. Promote the **secondary** node to the **primary** node. Execute: - ```sh + ```shell gitlab-ctl promote-to-primary-node ``` @@ -135,7 +135,7 @@ do this manually. 1. SSH in to the database node in the **secondary** and trigger PostgreSQL to promote to read-write: - ```bash + ```shell sudo gitlab-pg-ctl promote ``` @@ -157,7 +157,7 @@ do this manually. 1. Promote the **secondary** to **primary**. SSH into a single application server and execute: - ```bash + ```shell sudo gitlab-rake geo:set_secondary_as_primary ``` @@ -173,7 +173,7 @@ secondary domain, like changing Git remotes and API URLs. 1. SSH into the **secondary** node and login as root: - ```sh + ```shell sudo -i ``` @@ -192,13 +192,13 @@ secondary domain, like changing Git remotes and API URLs. 1. Reconfigure the **secondary** node for the change to take effect: - ```sh + ```shell gitlab-ctl reconfigure ``` 1. Execute the command below to update the newly promoted **primary** node URL: - ```sh + ```shell gitlab-rake geo:update_primary_node_url ``` @@ -223,7 +223,7 @@ Because the **secondary** is already promoted, that data in the tracking databas The data can be removed with the following command: -```sh +```shell sudo rm -rf /var/opt/gitlab/geo-postgresql ``` @@ -237,7 +237,7 @@ and after that you also need two extra steps. 1. SSH into the new **primary** node and login as root: - ```sh + ```shell sudo -i ``` @@ -268,13 +268,13 @@ and after that you also need two extra steps. 1. Save the file and reconfigure GitLab for the database listen changes and the replication slot changes to be applied. - ```sh + ```shell gitlab-ctl reconfigure ``` Restart PostgreSQL for its changes to take effect: - ```sh + ```shell gitlab-ctl restart postgresql ``` @@ -289,7 +289,7 @@ and after that you also need two extra steps. Save the file and reconfigure GitLab: - ```sh + ```shell gitlab-ctl reconfigure ``` diff --git a/doc/administration/geo/disaster_recovery/planned_failover.md b/doc/administration/geo/disaster_recovery/planned_failover.md index 8fee172ec64..cd3d5a88de7 100644 --- a/doc/administration/geo/disaster_recovery/planned_failover.md +++ b/doc/administration/geo/disaster_recovery/planned_failover.md @@ -65,7 +65,7 @@ supports everything the **primary** node does **before** scheduling a planned fa Run the following on both **primary** and **secondary** nodes: -```sh +```shell gitlab-rake gitlab:check gitlab-rake gitlab:geo:check ``` @@ -79,7 +79,7 @@ The SSH host keys and `/etc/gitlab/gitlab-secrets.json` files should be identical on all nodes. Check this by running the following on all nodes and comparing the output: -```sh +```shell sudo sha256sum /etc/ssh/ssh_host* /etc/gitlab/gitlab-secrets.json ``` @@ -136,7 +136,7 @@ access to the **primary** node during the maintenance window. For instance, you might run the following commands on the server(s) making up your **primary** node: - ```sh + ```shell sudo iptables -A INPUT -p tcp -s --destination-port 22 -j ACCEPT sudo iptables -A INPUT -p tcp -s --destination-port 22 -j ACCEPT sudo iptables -A INPUT --destination-port 22 -j REJECT diff --git a/doc/administration/geo/replication/configuration.md b/doc/administration/geo/replication/configuration.md index 44baab40153..58507d2c487 100644 --- a/doc/administration/geo/replication/configuration.md +++ b/doc/administration/geo/replication/configuration.md @@ -30,7 +30,7 @@ they must be manually replicated to the **secondary** node. 1. SSH into the **primary** node, and execute the command below: - ```sh + ```shell sudo cat /etc/gitlab/gitlab-secrets.json ``` @@ -38,20 +38,20 @@ they must be manually replicated to the **secondary** node. 1. SSH into the **secondary** node and login as the `root` user: - ```sh + ```shell sudo -i ``` 1. Make a backup of any existing secrets: - ```sh + ```shell mv /etc/gitlab/gitlab-secrets.json /etc/gitlab/gitlab-secrets.json.`date +%F` ``` 1. Copy `/etc/gitlab/gitlab-secrets.json` from the **primary** node to the **secondary** node, or copy-and-paste the file contents between nodes: - ```sh + ```shell sudo editor /etc/gitlab/gitlab-secrets.json # paste the output of the `cat` command you ran on the primary @@ -60,14 +60,14 @@ they must be manually replicated to the **secondary** node. 1. Ensure the file permissions are correct: - ```sh + ```shell chown root:root /etc/gitlab/gitlab-secrets.json chmod 0600 /etc/gitlab/gitlab-secrets.json ``` 1. Reconfigure the **secondary** node for the change to take effect: - ```sh + ```shell gitlab-ctl reconfigure gitlab-ctl restart ``` @@ -88,13 +88,13 @@ keys must be manually replicated to the **secondary** node. 1. SSH into the **secondary** node and login as the `root` user: - ```sh + ```shell sudo -i ``` 1. Make a backup of any existing SSH host keys: - ```sh + ```shell find /etc/ssh -iname ssh_host_* -exec cp {} {}.backup.`date +%F` \; ``` @@ -102,14 +102,14 @@ keys must be manually replicated to the **secondary** node. If you can access your **primary** node using the **root** user: - ```sh + ```shell # Run this from the secondary node, change `` for the IP or FQDN of the server scp root@:/etc/ssh/ssh_host_*_key* /etc/ssh ``` If you only have access through a user with **sudo** privileges: - ```sh + ```shell # Run this from your primary node: sudo tar --transform 's/.*\///g' -zcvf ~/geo-host-key.tar.gz /etc/ssh/ssh_host_*_key* @@ -120,20 +120,20 @@ keys must be manually replicated to the **secondary** node. 1. On your **secondary** node, ensure the file permissions are correct: - ```sh + ```shell chown root:root /etc/ssh/ssh_host_*_key* chmod 0600 /etc/ssh/ssh_host_*_key* ``` 1. To verify key fingerprint matches, execute the following command on both nodes: - ```sh + ```shell for file in /etc/ssh/ssh_host_*_key; do ssh-keygen -lf $file; done ``` You should get an output similar to this one and they should be identical on both nodes: - ```sh + ```shell 1024 SHA256:FEZX2jQa2bcsd/fn/uxBzxhKdx4Imc4raXrHwsbtP0M root@serverhostname (DSA) 256 SHA256:uw98R35Uf+fYEQ/UnJD9Br4NXUFPv7JAUln5uHlgSeY root@serverhostname (ECDSA) 256 SHA256:sqOUWcraZQKd89y/QQv/iynPTOGQxcOTIXU/LsoPmnM root@serverhostname (ED25519) @@ -142,7 +142,7 @@ keys must be manually replicated to the **secondary** node. 1. Verify that you have the correct public keys for the existing private keys: - ```sh + ```shell # This will print the fingerprint for private keys: for file in /etc/ssh/ssh_host_*_key; do ssh-keygen -lf $file; done @@ -155,7 +155,7 @@ keys must be manually replicated to the **secondary** node. 1. Restart sshd on your **secondary** node: - ```sh + ```shell # Debian or Ubuntu installations sudo service ssh reload @@ -167,7 +167,7 @@ keys must be manually replicated to the **secondary** node. 1. SSH into your GitLab **secondary** server and login as root: - ```sh + ```shell sudo -i ``` @@ -180,7 +180,7 @@ keys must be manually replicated to the **secondary** node. 1. Reconfigure the **secondary** node for the change to take effect: - ```sh + ```shell gitlab-ctl reconfigure ``` @@ -201,20 +201,20 @@ keys must be manually replicated to the **secondary** node. 1. Click the **Add node** button to add the **secondary** node. 1. SSH into your GitLab **secondary** server and restart the services: - ```sh + ```shell gitlab-ctl restart ``` Check if there are any common issue with your Geo setup by running: - ```sh + ```shell gitlab-rake gitlab:geo:check ``` 1. SSH into your **primary** server and login as root to verify the **secondary** node is reachable or there are any common issue with your Geo setup: - ```sh + ```shell gitlab-rake gitlab:geo:check ``` diff --git a/doc/administration/geo/replication/database.md b/doc/administration/geo/replication/database.md index bddd30dbb2a..0e6583741bc 100644 --- a/doc/administration/geo/replication/database.md +++ b/doc/administration/geo/replication/database.md @@ -49,7 +49,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. SSH into your GitLab **primary** server and login as root: - ```sh + ```shell sudo -i ``` @@ -62,13 +62,13 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. Reconfigure the **primary** node for the change to take effect: - ```sh + ```shell gitlab-ctl reconfigure ``` 1. Execute the command below to define the node as **primary** node: - ```sh + ```shell gitlab-ctl set-geo-primary-node ``` @@ -78,7 +78,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o Generate a MD5 hash of the desired password: - ```sh + ```shell gitlab-ctl pg-password-md5 gitlab # Enter password: # Confirm password: @@ -101,7 +101,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o called `gitlab_replicator`. You must set the password for this user manually. You will be prompted to enter a password: - ```sh + ```shell gitlab-ctl set-replication-password ``` @@ -134,7 +134,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o To lookup the address of a Geo node, SSH in to the Geo node and execute: - ```sh + ```shell ## ## Private address ## @@ -219,13 +219,13 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. Save the file and reconfigure GitLab for the database listen changes and the replication slot changes to be applied: - ```sh + ```shell gitlab-ctl reconfigure ``` Restart PostgreSQL for its changes to take effect: - ```sh + ```shell gitlab-ctl restart postgresql ``` @@ -240,7 +240,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o Save the file and reconfigure GitLab: - ```sh + ```shell gitlab-ctl reconfigure ``` @@ -254,7 +254,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o the **secondary** node needs a copy of the certificate. Make a copy of the PostgreSQL `server.crt` file on the **primary** node by running this command: - ```sh + ```shell cat ~gitlab-psql/data/server.crt ``` @@ -266,13 +266,13 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. SSH into your GitLab **secondary** server and login as root: - ```sh + ```shell sudo -i ``` 1. Stop application server and Sidekiq - ```sh + ```shell gitlab-ctl stop unicorn gitlab-ctl stop sidekiq ``` @@ -282,7 +282,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. [Check TCP connectivity][rake-maintenance] to the **primary** node's PostgreSQL server: - ```sh + ```shell gitlab-rake gitlab:tcp_check[,5432] ``` @@ -295,7 +295,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. Create a file `server.crt` in the **secondary** server, with the content you got on the last step of the **primary** node's setup: - ```sh + ```shell editor server.crt ``` @@ -303,7 +303,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o Install the `server.crt` file: - ```sh + ```shell install \ -D \ -o gitlab-psql \ @@ -319,7 +319,7 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. Test that the `gitlab-psql` user can connect to the **primary** node's database (the default Omnibus database name is gitlabhq_production): - ```sh + ```shell sudo \ -u gitlab-psql /opt/gitlab/embedded/bin/psql \ --list \ @@ -377,13 +377,13 @@ There is an [issue where support is being discussed](https://gitlab.com/gitlab-o 1. Reconfigure GitLab for the changes to take effect: - ```sh + ```shell gitlab-ctl reconfigure ``` 1. Restart PostgreSQL for the IP change to take effect and reconfigure again: - ```sh + ```shell gitlab-ctl restart postgresql gitlab-ctl reconfigure ``` @@ -405,7 +405,7 @@ data before running `pg_basebackup`. 1. SSH into your GitLab **secondary** server and login as root: - ```sh + ```shell sudo -i ``` @@ -419,7 +419,7 @@ data before running `pg_basebackup`. CAUTION: **Warning:** Each Geo **secondary** node must have its own unique replication slot name. Using the same slot name between two secondaries will break PostgreSQL replication. - ```sh + ```shell gitlab-ctl replicate-geo-database \ --slot-name= \ --host= @@ -471,7 +471,7 @@ work: admin user. If you are using an Omnibus-managed database, log onto the **primary** node that is running the PostgreSQL database (the default Omnibus database name is gitlabhq_production): - ```sh + ```shell sudo \ -u gitlab-psql /opt/gitlab/embedded/bin/psql \ -h /var/opt/gitlab/postgresql gitlabhq_production @@ -501,7 +501,7 @@ work: 1. Save the file and reconfigure GitLab for the changes to be applied: - ```sh + ```shell gitlab-ctl reconfigure ``` diff --git a/doc/administration/geo/replication/docker_registry.md b/doc/administration/geo/replication/docker_registry.md index 95db766e482..7d041d97ed2 100644 --- a/doc/administration/geo/replication/docker_registry.md +++ b/doc/administration/geo/replication/docker_registry.md @@ -36,7 +36,7 @@ We need to make Docker Registry send notification events to the 1. SSH into your GitLab **primary** server and login as root: - ```sh + ```shell sudo -i ``` @@ -70,7 +70,7 @@ We need to make Docker Registry send notification events to the 1. Reconfigure the **primary** node for the change to take effect: - ```sh + ```shell gitlab-ctl reconfigure ``` @@ -90,7 +90,7 @@ generate a short-lived JWT that is pull-only-capable to access the 1. SSH into the **secondary** node and login as the `root` user: - ```sh + ```shell sudo -i ``` @@ -105,7 +105,7 @@ generate a short-lived JWT that is pull-only-capable to access the 1. Reconfigure the **secondary** node for the change to take effect: - ```sh + ```shell gitlab-ctl reconfigure ``` diff --git a/doc/administration/geo/replication/external_database.md b/doc/administration/geo/replication/external_database.md index 6948dcc0c68..210c3a77128 100644 --- a/doc/administration/geo/replication/external_database.md +++ b/doc/administration/geo/replication/external_database.md @@ -13,13 +13,13 @@ developed and tested. We aim to be compatible with most external 1. SSH into a GitLab **primary** application server and login as root: - ```bash + ```shell sudo -i ``` 1. Execute the command below to define the node as **primary** node: - ```bash + ```shell gitlab-ctl set-geo-primary-node ``` @@ -100,7 +100,7 @@ To configure the connection to the external read-replica database and enable Log 1. SSH into a GitLab **secondary** application server and login as root: - ```bash + ```shell sudo -i ``` @@ -147,7 +147,7 @@ the tracking database on port 5432. 1. SSH into a GitLab **secondary** server and login as root: - ```bash + ```shell sudo -i ``` @@ -168,7 +168,7 @@ the tracking database on port 5432. 1. Run the tracking database migrations: - ```bash + ```shell gitlab-rake geo:db:create gitlab-rake geo:db:migrate ``` @@ -179,7 +179,7 @@ the tracking database on port 5432. Save the script below in a file, ex. `/tmp/geo_fdw.sh` and modify the connection params to match your environment. Execute it to set up the FDW connection. - ```bash + ```shell #!/bin/bash # Secondary Database connection params: @@ -213,6 +213,6 @@ the tracking database on port 5432. 1. Save the file and [restart GitLab](../../restart_gitlab.md#omnibus-gitlab-restart) 1. Populate the FDW tables: - ```bash + ```shell gitlab-rake geo:db:refresh_foreign_tables ``` diff --git a/doc/administration/geo/replication/high_availability.md b/doc/administration/geo/replication/high_availability.md index 19266a6b358..5c124e9c6dc 100644 --- a/doc/administration/geo/replication/high_availability.md +++ b/doc/administration/geo/replication/high_availability.md @@ -128,7 +128,7 @@ the **primary** database. Use the following as a guide. Note that the username (`gitlab` by default) is incorporated into the hash. - ```sh + ```shell gitlab-ctl pg-password-md5 gitlab # Enter password: # Confirm password: @@ -187,7 +187,7 @@ Configure the tracking database. Note that the username (`gitlab_geo` by default) is incorporated into the hash. - ```sh + ```shell gitlab-ctl pg-password-md5 gitlab_geo # Enter password: # Confirm password: diff --git a/doc/administration/geo/replication/remove_geo_node.md b/doc/administration/geo/replication/remove_geo_node.md index e24eb2bd428..c3ff0ef47c1 100644 --- a/doc/administration/geo/replication/remove_geo_node.md +++ b/doc/administration/geo/replication/remove_geo_node.md @@ -10,13 +10,13 @@ Once removed from the Geo admin page, you must stop and uninstall the **secondar 1. On the **secondary** node, stop GitLab: - ```bash + ```shell sudo gitlab-ctl stop ``` 1. On the **secondary** node, uninstall GitLab: - ```bash + ```shell # Stop gitlab and remove its supervision process sudo gitlab-ctl uninstall @@ -31,7 +31,7 @@ Once GitLab has been uninstalled from the **secondary** node, the replication sl 1. On the **primary** node, start a PostgreSQL console session: - ```bash + ```shell sudo gitlab-psql ``` diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index 46fd5eb7ca7..1a4c37dc709 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -40,7 +40,7 @@ health check manually to get this information as well as a few more details. This rake task can be run on an app node in the **primary** or **secondary** Geo nodes: -```sh +```shell sudo gitlab-rake gitlab:geo:check ``` @@ -73,7 +73,7 @@ Checking Geo ... Finished Current sync information can be found manually by running this rake task on any **secondary** app node: -```sh +```shell sudo gitlab-rake geo:status ``` @@ -127,7 +127,7 @@ This name is used to look up the node with the same **Name** in To check if the current machine has a node name that matches a node in the database, run the check task: -```sh +```shell sudo gitlab-rake gitlab:geo:check ``` @@ -151,7 +151,7 @@ This machine's Geo node name matches a database record ... no When running this rake task, you may see errors if the nodes are not properly configured: -```sh +```shell sudo gitlab-rake gitlab:geo:check ``` @@ -279,7 +279,7 @@ and indicates that your initial dataset is too large to be replicated in the def Re-run `gitlab-ctl replicate-geo-database`, but include a larger value for `--backup-timeout`: -```sh +```shell sudo gitlab-ctl \ replicate-geo-database \ --host= \ @@ -297,7 +297,7 @@ log data to build up in `pg_xlog`. Removing the unused slots can reduce the amou 1. Start a PostgreSQL console session: - ```sh + ```shell sudo gitlab-psql ``` @@ -348,7 +348,7 @@ postgresql['hot_standby_feedback'] = 'on' Then reconfigure GitLab: -```sh +```shell sudo gitlab-ctl reconfigure ``` @@ -370,7 +370,7 @@ gitlab_rails['gitlab_shell_git_timeout'] = 10800 Then reconfigure GitLab: -```sh +```shell sudo gitlab-ctl reconfigure ``` @@ -390,7 +390,7 @@ to start again from scratch, there are a few steps that can help you: You need to send a **SIGTSTP** kill signal for the first phase and them a **SIGTERM** when all jobs have finished. Otherwise just use the `gitlab-ctl stop` commands. - ```sh + ```shell gitlab-ctl status sidekiq # run: sidekiq: (pid 10180) <- this is the PID you will use kill -TSTP 10180 # change to the correct PID @@ -401,13 +401,13 @@ to start again from scratch, there are a few steps that can help you: You can watch Sidekiq logs to know when Sidekiq jobs processing have finished: - ```sh + ```shell gitlab-ctl tail sidekiq ``` 1. Rename repository storage folders and create new ones. If you are not concerned about possible orphaned directories and files, then you can simply skip this step. - ```sh + ```shell mv /var/opt/gitlab/git-data/repositories /var/opt/gitlab/git-data/repositories.old mkdir -p /var/opt/gitlab/git-data/repositories chown git:git /var/opt/gitlab/git-data/repositories @@ -432,7 +432,7 @@ to start again from scratch, there are a few steps that can help you: To rename all of them: - ```sh + ```shell gitlab-ctl stop mv /var/opt/gitlab/gitlab-rails/shared /var/opt/gitlab/gitlab-rails/shared.old @@ -447,13 +447,13 @@ to start again from scratch, there are a few steps that can help you: Reconfigure in order to recreate the folders and make sure permissions and ownership are correctly - ```sh + ```shell gitlab-ctl reconfigure ``` 1. Reset the Tracking Database - ```sh + ```shell gitlab-rake geo:db:drop gitlab-ctl reconfigure gitlab-rake geo:db:setup @@ -461,7 +461,7 @@ to start again from scratch, there are a few steps that can help you: 1. Restart previously stopped services - ```sh + ```shell gitlab-ctl start ``` @@ -537,7 +537,7 @@ To check the configuration: 1. SSH into an app node in the **secondary**: - ```sh + ```shell sudo -i ``` @@ -552,14 +552,14 @@ To check the configuration: If the tracking database is running on the same node: - ```sh + ```shell gitlab-geo-psql ``` Or, if the tracking database is running on a different node, you must specify the user and host when entering the database console: - ```sh + ```shell gitlab-geo-psql -U gitlab_geo -h ``` @@ -646,7 +646,7 @@ To check the configuration: Make sure the password is correct. You can test that logins work by running `psql`: - ```sh + ```shell # Connect to the tracking database as the `gitlab_geo` user sudo \ -u git /opt/gitlab/embedded/bin/psql \ @@ -685,7 +685,7 @@ reload of the FDW schema. To manually reload the FDW schema: 1. On the node running the Geo tracking database, enter the PostgreSQL console via the `gitlab_geo` user: - ```sh + ```shell sudo \ -u git /opt/gitlab/embedded/bin/psql \ -h /var/opt/gitlab/geo-postgresql \ @@ -729,7 +729,7 @@ Geo database has an outdated FDW remote schema. It contains 229 of 236 expected To resolve this, run the following command: -```sh +```shell sudo gitlab-rake geo:db:refresh_foreign_tables ``` diff --git a/doc/administration/geo/replication/updating_the_geo_nodes.md b/doc/administration/geo/replication/updating_the_geo_nodes.md index fda0ebbbeac..426eb54c66a 100644 --- a/doc/administration/geo/replication/updating_the_geo_nodes.md +++ b/doc/administration/geo/replication/updating_the_geo_nodes.md @@ -42,7 +42,7 @@ everything is working correctly: 1. Run the Geo raketask on all nodes, everything should be green: - ```sh + ```shell sudo gitlab-rake gitlab:geo:check ``` diff --git a/doc/administration/geo/replication/using_a_geo_server.md b/doc/administration/geo/replication/using_a_geo_server.md index b814bcf8459..b1ba5b3e876 100644 --- a/doc/administration/geo/replication/using_a_geo_server.md +++ b/doc/administration/geo/replication/using_a_geo_server.md @@ -8,7 +8,7 @@ Pushing directly to a **secondary** node (for both HTTP, SSH including Git LFS) Example of the output you will see when pushing to a **secondary** node: -```bash +```shell $ git push remote: remote: You're pushing to a Geo secondary. We'll help you by proxying this diff --git a/doc/administration/geo/replication/version_specific_updates.md b/doc/administration/geo/replication/version_specific_updates.md index 772defe0191..5fb9391af99 100644 --- a/doc/administration/geo/replication/version_specific_updates.md +++ b/doc/administration/geo/replication/version_specific_updates.md @@ -16,7 +16,7 @@ This update will occur even if major PostgreSQL updates are disabled. Before [refreshing Foreign Data Wrapper during a Geo HA upgrade](https://docs.gitlab.com/omnibus/update/README.html#run-post-deployment-migrations-and-checks), restart the Geo tracking database: -```sh +```shell sudo gitlab-ctl restart geo-postgresql ``` @@ -31,7 +31,7 @@ for the recommended procedure. This can be temporarily disabled by running the following before updating: -```sh +```shell sudo touch /etc/gitlab/disable-postgresql-upgrade ``` @@ -41,7 +41,7 @@ Before 10.8, broadcast messages would not propagate without flushing the cache on the **secondary** nodes. This has been fixed in 10.8, but requires one last cache flush on each **secondary** node: -```sh +```shell sudo gitlab-rake cache:clear ``` @@ -55,7 +55,7 @@ authentication method. 1. **(primary)** Login to your **primary** node and run: - ```sh + ```shell gitlab-ctl pg-password-md5 gitlab # Enter password: # Confirm password: @@ -82,7 +82,7 @@ authentication method. 1. **(primary)** Reconfigure and restart: - ```sh + ```shell sudo gitlab-ctl reconfigure sudo gitlab-ctl restart ``` @@ -113,7 +113,7 @@ authentication method. 1. **(secondary)** Reconfigure and restart: - ```sh + ```shell sudo gitlab-ctl reconfigure sudo gitlab-ctl restart ``` @@ -129,7 +129,7 @@ contents of `/etc/gitlab/gitlab-secrets.json` on each **secondary** node with th contents of `/etc/gitlab/gitlab-secrets.json` on the **primary** node, then run the following command on each **secondary** node: -```sh +```shell sudo gitlab-ctl reconfigure ``` @@ -228,7 +228,7 @@ following to clean this up. On the **secondary** Geo nodes, run as root: -```sh +```shell mv /var/opt/gitlab/gitlab-rails/working /var/opt/gitlab/gitlab-rails/working.old mkdir /var/opt/gitlab/gitlab-rails/working chmod 700 /var/opt/gitlab/gitlab-rails/working @@ -240,7 +240,7 @@ You may delete `/var/opt/gitlab/gitlab-rails/working.old` any time. Once this is done, we advise restarting GitLab on the **secondary** nodes for the new working directory to be used: -```sh +```shell sudo gitlab-ctl restart ``` @@ -289,7 +289,7 @@ is prepended with the relevant node for better clarity: 1. **(secondary)** Make a backup of the `recovery.conf` file on **all** **secondary** nodes to preserve PostgreSQL's credentials: - ```sh + ```shell sudo cp /var/opt/gitlab/postgresql/data/recovery.conf /var/opt/gitlab/ ``` @@ -301,7 +301,7 @@ is prepended with the relevant node for better clarity: stop all services except `postgresql` as we will use it to re-initialize the **secondary** node's database: - ```sh + ```shell sudo gitlab-ctl stop sudo gitlab-ctl start postgresql ``` @@ -310,19 +310,19 @@ is prepended with the relevant node for better clarity: 1. **(secondary)** Stop all services: - ```sh + ```shell sudo gitlab-ctl stop ``` 1. **(secondary)** Prevent running database migrations: - ```sh + ```shell sudo touch /etc/gitlab/skip-auto-migrations ``` 1. **(secondary)** Move the old database to another directory: - ```sh + ```shell sudo mv /var/opt/gitlab/postgresql{,.bak} ``` @@ -331,33 +331,33 @@ is prepended with the relevant node for better clarity: 1. **(secondary)** Make sure all services are up: - ```sh + ```shell sudo gitlab-ctl start ``` 1. **(secondary)** Reconfigure GitLab: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` 1. **(secondary)** Run the PostgreSQL upgrade command: - ```sh + ```shell sudo gitlab-ctl pg-upgrade ``` 1. **(secondary)** See the stored credentials for the database that you will need to re-initialize the replication: - ```sh + ```shell sudo grep -s primary_conninfo /var/opt/gitlab/recovery.conf ``` 1. **(secondary)** Save the snippet below in a file, let's say `/tmp/replica.sh`. Modify the embedded paths if necessary: - ```bash + ```shell #!/bin/bash PORT="5432" @@ -404,19 +404,19 @@ is prepended with the relevant node for better clarity: 1. **(secondary)** Run the recovery script using the credentials from the previous step: - ```sh + ```shell sudo bash /tmp/replica.sh ``` 1. **(secondary)** Reconfigure GitLab: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` 1. **(secondary)** Start all services: - ```sh + ```shell sudo gitlab-ctl start ``` @@ -425,7 +425,7 @@ is prepended with the relevant node for better clarity: 1. **(primary)** After all **secondary** nodes are updated, start all services in **primary** node: - ```sh + ```shell sudo gitlab-ctl start ``` @@ -437,7 +437,7 @@ and it is required since 10.0. 1. Run database migrations on tracking database: - ```sh + ```shell sudo gitlab-rake geo:db:migrate ``` diff --git a/doc/administration/git_annex.md b/doc/administration/git_annex.md index 52d848efa27..87e1d3b1e8e 100644 --- a/doc/administration/git_annex.md +++ b/doc/administration/git_annex.md @@ -96,7 +96,7 @@ one is located in `config.yml` of GitLab Shell. Here is an example workflow of uploading a very large file and then checking it into your Git repository: -```bash +```shell git clone git@example.com:group/project.git git annex init 'My Laptop' # initialize the annex project and give an optional description @@ -165,7 +165,7 @@ repository. Downloading a single large file is also very simple: -```bash +```shell git clone git@gitlab.example.com:group/project.git git annex sync # sync Git branches but not the large file @@ -174,7 +174,7 @@ git annex get debian.iso # download the large file To download all files: -```bash +```shell git clone git@gitlab.example.com:group/project.git git annex sync --content # sync Git branches and download all the large files diff --git a/doc/administration/git_protocol.md b/doc/administration/git_protocol.md index 436f1a55369..2e5c362a3ab 100644 --- a/doc/administration/git_protocol.md +++ b/doc/administration/git_protocol.md @@ -45,7 +45,7 @@ AcceptEnv GIT_PROTOCOL Once configured, restart the SSH daemon. In Ubuntu, run: -```sh +```shell sudo service ssh restart ``` @@ -54,7 +54,7 @@ sudo service ssh restart In order to use the new protocol, clients need to either pass the configuration `-c protocol.version=2` to the Git command, or set it globally: -```sh +```shell git config --global protocol.version 2 ``` @@ -62,7 +62,7 @@ git config --global protocol.version 2 Verify Git v2 is used by the client: -```sh +```shell GIT_TRACE_CURL=1 git -c protocol.version=2 ls-remote https://your-gitlab-instance.com/group/repo.git 2>&1 | grep Git-Protocol ``` @@ -74,13 +74,13 @@ You should see that the `Git-Protocol` header is sent: Verify Git v2 is used by the server: -```sh +```shell GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote https://your-gitlab-instance.com/group/repo.git 2>&1 | head ``` Example response using Git protocol v2: -```sh +```shell $ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote https://your-gitlab-instance.com/group/repo.git 2>&1 | head 10:42:50.574485 pkt-line.c:80 packet: git< # service=git-upload-pack 10:42:50.574653 pkt-line.c:80 packet: git< 0000 @@ -98,7 +98,7 @@ $ GIT_TRACE_PACKET=1 git -c protocol.version=2 ls-remote https://your-gitlab-ins Verify Git v2 is used by the client: -```sh +```shell GIT_SSH_COMMAND="ssh -v" git -c protocol.version=2 ls-remote ssh://your-gitlab-instance.com:group/repo.git 2>&1 |grep GIT_PROTOCOL ``` diff --git a/doc/administration/gitaly/index.md b/doc/administration/gitaly/index.md index f1c9604b77f..ec5b8e57870 100644 --- a/doc/administration/gitaly/index.md +++ b/doc/administration/gitaly/index.md @@ -309,7 +309,7 @@ can read and write to `/mnt/gitlab/storage2`. 1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure). 1. Tail the logs to see the requests: - ```sh + ```shell sudo gitlab-ctl tail gitaly ``` @@ -343,7 +343,7 @@ can read and write to `/mnt/gitlab/storage2`. 1. Save the file and [restart GitLab](../restart_gitlab.md#installations-from-source). 1. Tail the logs to see the requests: - ```sh + ```shell tail -f /home/git/gitlab/log/gitaly.log ``` @@ -435,7 +435,7 @@ To configure Gitaly with TLS: 1. Save the file and [reconfigure GitLab](../restart_gitlab.md#omnibus-gitlab-reconfigure) on client node(s). 1. On the Gitaly server, create the `/etc/gitlab/ssl` directory and copy your key and certificate there: - ```sh + ```shell sudo mkdir -p /etc/gitlab/ssl sudo chmod 755 /etc/gitlab/ssl sudo cp key.pem cert.pem /etc/gitlab/ssl/ @@ -491,7 +491,7 @@ To configure Gitaly with TLS: 1. Save the file and [restart GitLab](../restart_gitlab.md#installations-from-source) on client node(s). 1. Create the `/etc/gitlab/ssl` directory and copy your key and certificate there: - ```sh + ```shell sudo mkdir -p /etc/gitlab/ssl sudo chmod 700 /etc/gitlab/ssl sudo cp key.pem cert.pem /etc/gitlab/ssl/ @@ -856,7 +856,7 @@ your GitLab / Gitaly server already at `/opt/gitlab/embedded/bin/gitaly-debug`. If you're investigating an older GitLab version you can compile this tool offline and copy the executable to your server: -```sh +```shell git clone https://gitlab.com/gitlab-org/gitaly.git cd cmd/gitaly-debug GOOS=linux GOARCH=amd64 go build -o gitaly-debug @@ -864,7 +864,7 @@ GOOS=linux GOARCH=amd64 go build -o gitaly-debug To see the help page of `gitaly-debug` for a list of supported sub-commands, run: -```sh +```shell gitaly-debug -h ``` @@ -887,7 +887,7 @@ default level is `WARN`. You can run a GRPC trace with: -```sh +```shell GRPC_TRACE=all GRPC_VERBOSITY=DEBUG sudo gitlab-rake gitlab:gitaly:check ``` @@ -925,7 +925,7 @@ Confirm the following are all true: - When any user performs a `git push` to any repository on this Gitaly node, it fails with the following error (note the `401 Unauthorized`): - ```sh + ```shell remote: GitLab: 401 Unauthorized To ! [remote rejected] branch-name -> branch-name (pre-receive hook declined) @@ -939,7 +939,7 @@ Confirm the following are all true: - When [tailing the logs](https://docs.gitlab.com/omnibus/settings/logs.html#tail-logs-in-a-console-on-the-server) on an app node and reproducing the error, you get `401` errors when reaching the `/api/v4/internal/allowed` endpoint: - ```sh + ```shell # api_json.log { "time": "2019-07-18T00:30:14.967Z", @@ -1009,7 +1009,7 @@ If you are having trouble connecting to a Gitaly node with command line (CLI) to Verify that you can reach Gitaly via TCP: -```bash +```shell sudo gitlab-rake gitlab:tcp_check[GITALY_SERVER_IP,GITALY_LISTEN_PORT] ``` @@ -1019,7 +1019,7 @@ If you use proxy servers in your command line environment, such as Bash, these c If you use Bash or a compatible command line environment, run the following commands to determine whether you have proxy servers configured: -```bash +```shell echo $http_proxy echo $https_proxy ``` @@ -1028,7 +1028,7 @@ If either of these variables have a value, your Gitaly CLI connections may be ge To remove the proxy setting, run the following commands (depending on which variables had values): -```bash +```shell unset http_proxy unset https_proxy ``` diff --git a/doc/administration/high_availability/consul.md b/doc/administration/high_availability/consul.md index 71d380dbec7..0ea5e55cc35 100644 --- a/doc/administration/high_availability/consul.md +++ b/doc/administration/high_availability/consul.md @@ -58,7 +58,7 @@ On each Consul node perform the following: Before moving on, make sure Consul is configured correctly. Run the following command to verify all server nodes are communicating: -```sh +```shell /opt/gitlab/embedded/bin/consul members ``` diff --git a/doc/administration/high_availability/database.md b/doc/administration/high_availability/database.md index 8e57b049730..daeb0f9baf5 100644 --- a/doc/administration/high_availability/database.md +++ b/doc/administration/high_availability/database.md @@ -46,7 +46,7 @@ deploy the bundled PostgreSQL. and confirmation. Use the value that is output by this command in the next step as the value of `POSTGRESQL_PASSWORD_HASH`. - ```sh + ```shell sudo gitlab-ctl pg-password-md5 gitlab ``` @@ -202,7 +202,7 @@ When using default setup, minimum configuration requires: - `CONSUL_PASSWORD_HASH`. This is a hash generated out of Consul username/password pair. Can be generated with: - ```sh + ```shell sudo gitlab-ctl pg-password-md5 CONSUL_USERNAME ``` @@ -245,7 +245,7 @@ We will need the following password information for the application's database u - `POSTGRESQL_PASSWORD_HASH`. This is a hash generated out of the username/password pair. Can be generated with: - ```sh + ```shell sudo gitlab-ctl pg-password-md5 POSTGRESQL_USERNAME ``` @@ -258,7 +258,7 @@ When using default setup, minimum configuration requires: - `PGBOUNCER_PASSWORD_HASH`. This is a hash generated out of PgBouncer username/password pair. Can be generated with: - ```sh + ```shell sudo gitlab-ctl pg-password-md5 PGBOUNCER_USERNAME ``` @@ -376,13 +376,13 @@ Select one node as a primary node. 1. Open a database prompt: - ```sh + ```shell gitlab-psql -d gitlabhq_production ``` 1. Enable the `pg_trgm` extension: - ```sh + ```shell CREATE EXTENSION pg_trgm; ``` @@ -390,7 +390,7 @@ Select one node as a primary node. 1. Verify the cluster is initialized with one node: - ```sh + ```shell gitlab-ctl repmgr cluster show ``` @@ -411,7 +411,7 @@ Select one node as a primary node. 1. Set up the repmgr standby: - ```sh + ```shell gitlab-ctl repmgr standby setup MASTER_NODE_NAME ``` @@ -436,7 +436,7 @@ Select one node as a primary node. 1. Verify the node now appears in the cluster: - ```sh + ```shell gitlab-ctl repmgr cluster show ``` @@ -457,7 +457,7 @@ Before moving on, make sure the databases are configured correctly. Run the following command on the **primary** node to verify that replication is working properly: -```sh +```shell gitlab-ctl repmgr cluster show ``` @@ -475,7 +475,7 @@ If the 'Role' column for any node says "FAILED", check the Also, check that the check master command works successfully on each node: -```sh +```shell su - gitlab-consul gitlab-ctl repmgr-check-master || echo 'This node is a standby repmgr node' ``` @@ -512,7 +512,7 @@ attributes set, but the following need to be set. Ensure that all migrations ran: -```sh +```shell gitlab-rake gitlab:db:configure ``` @@ -702,7 +702,7 @@ After deploying the configuration follow these steps: Enable the `pg_trgm` extension - ```sh + ```shell gitlab-psql -d gitlabhq_production ``` @@ -714,7 +714,7 @@ After deploying the configuration follow these steps: Make this node a standby of the primary - ```sh + ```shell gitlab-ctl repmgr standby setup 10.6.0.21 ``` @@ -722,7 +722,7 @@ After deploying the configuration follow these steps: Make this node a standby of the primary - ```sh + ```shell gitlab-ctl repmgr standby setup 10.6.0.21 ``` @@ -730,13 +730,13 @@ After deploying the configuration follow these steps: Set `gitlab-consul` user's PgBouncer password to `toomanysecrets` - ```sh + ```shell gitlab-ctl write-pgpass --host 127.0.0.1 --database pgbouncer --user pgbouncer --hostuser gitlab-consul ``` Run database migrations - ```sh + ```shell gitlab-rake gitlab:db:configure ``` @@ -863,7 +863,7 @@ If you need to failover manually, you have two options: Run: -```sh +```shell gitlab-ctl stop postgresql ``` @@ -875,14 +875,14 @@ standby nodes. 1. Ensure the old master node is not still active. 1. Login to the server that should become the new master and run: - ```sh + ```shell gitlab-ctl repmgr standby promote ``` 1. If there are any other standby servers in the cluster, have them follow the new master server: - ```sh + ```shell gitlab-ctl repmgr standby follow NEW_MASTER ``` @@ -894,7 +894,7 @@ after it has been restored to service. - If you want to remove the node from the cluster, on any other node in the cluster, run: - ```sh + ```shell gitlab-ctl repmgr standby unregister --node=X ``` @@ -902,7 +902,7 @@ after it has been restored to service. To find this, you can use: - ```sh + ```shell awk -F = '$1 == "node" { print $2 }' /var/opt/gitlab/postgresql/repmgr.conf ``` @@ -914,13 +914,13 @@ after it has been restored to service. Then you will use this id to unregister the node: - ```sh + ```shell gitlab-ctl repmgr standby unregister --node=959789412 ``` - To add the node as a standby server: - ```sh + ```shell gitlab-ctl repmgr standby follow NEW_MASTER gitlab-ctl restart repmgrd ``` @@ -972,7 +972,7 @@ the previous section: 1. On the current master node, create a password for the `gitlab` and `gitlab_repmgr` user: - ```sh + ```shell gitlab-psql -d template1 template1=# \password gitlab_repmgr Enter password: **** @@ -992,7 +992,7 @@ the previous section: 1. Create a `.pgpass` file. Enter the `gitlab_repmgr` password twice to when asked: - ```sh + ```shell gitlab-ctl write-pgpass --user gitlab_repmgr --hostuser gitlab-psql --database '*' ``` diff --git a/doc/administration/high_availability/gitlab.md b/doc/administration/high_availability/gitlab.md index b4269cd4e38..ad00cb8df9f 100644 --- a/doc/administration/high_availability/gitlab.md +++ b/doc/administration/high_availability/gitlab.md @@ -101,7 +101,7 @@ these additional steps before proceeding with GitLab installation. On the first application server, run: -```sh +```shell sudo gitlab-ctl reconfigure ``` diff --git a/doc/administration/high_availability/nfs.md b/doc/administration/high_availability/nfs.md index 1d0dc420987..0d88191151a 100644 --- a/doc/administration/high_availability/nfs.md +++ b/doc/administration/high_availability/nfs.md @@ -55,7 +55,7 @@ NOTE: **Note:** From GitLab 12.1, it will automatically be detected if Rugged ca If you previously enabled Rugged using the feature flag, you will need to unset the feature flag by using: -```sh +```shell sudo gitlab-rake gitlab:features:unset_rugged ``` @@ -82,7 +82,7 @@ on an Linux NFS server, do the following: 1. On the NFS server, run: - ```sh + ```shell echo 0 > /proc/sys/fs/leases-enable sysctl -w fs.leases-enable=0 ``` @@ -186,7 +186,7 @@ single NFS mount point as you normally would in `/etc/fstab`. Let's assume your NFS mount point is `/gitlab-nfs`. Then, add the following bind mounts in `/etc/fstab`: -```bash +```shell /gitlab-nfs/gitlab-data/git-data /var/opt/gitlab/git-data none bind 0 0 /gitlab-nfs/gitlab-data/.ssh /var/opt/gitlab/.ssh none bind 0 0 /gitlab-nfs/gitlab-data/uploads /var/opt/gitlab/gitlab-rails/uploads none bind 0 0 diff --git a/doc/administration/high_availability/nfs_host_client_setup.md b/doc/administration/high_availability/nfs_host_client_setup.md index 5b6b28bf633..75dec1eef29 100644 --- a/doc/administration/high_availability/nfs_host_client_setup.md +++ b/doc/administration/high_availability/nfs_host_client_setup.md @@ -27,7 +27,7 @@ Using EFS may negatively impact performance. Please review the [relevant documen Installing the nfs-kernel-server package allows you to share directories with the clients running the GitLab application. -```sh +```shell apt-get update apt-get install nfs-kernel-server ``` @@ -47,7 +47,7 @@ In this setup we will share the home directory on the host with the client. Edit Restart the NFS server after making changes to the `exports` file for the changes to take effect. -```sh +```shell systemctl restart nfs-kernel-server ``` @@ -64,7 +64,7 @@ inside your HA environment to the NFS server configured above. The nfs-common provides NFS functionality without installing server components which we don't need running on the application nodes. -```sh +```shell apt-get update apt-get install nfs-common ``` @@ -76,14 +76,14 @@ Please note that if your mount point directory contains any files they will be h once the remote shares are mounted. An empty/new directory on the client is recommended for this purpose. -```sh +```shell mkdir -p /nfs/home ``` Confirm that the mount point works by mounting it on the client and checking that it is mounted with the command below: -```sh +```shell mount :/home df -h ``` @@ -134,7 +134,7 @@ Check that NFS traffic from the client is allowed by the firewall on the host by the command: `sudo ufw status`. If it's being blocked, then you can allow traffic from a specific client with the command below. -```sh +```shell sudo ufw allow from to any port nfs ``` diff --git a/doc/administration/high_availability/pgbouncer.md b/doc/administration/high_availability/pgbouncer.md index 7b93159628d..cea55e6c9b4 100644 --- a/doc/administration/high_availability/pgbouncer.md +++ b/doc/administration/high_availability/pgbouncer.md @@ -57,7 +57,7 @@ In a HA setup, it's recommended to run a PgBouncer node separately for each data 1. Create a `.pgpass` file so Consul is able to reload PgBouncer. Enter the `PGBOUNCER_PASSWORD` twice when asked: - ```sh + ```shell gitlab-ctl write-pgpass --host 127.0.0.1 --database pgbouncer --user pgbouncer --hostuser gitlab-consul ``` @@ -65,7 +65,7 @@ In a HA setup, it's recommended to run a PgBouncer node separately for each data 1. Ensure each node is talking to the current master: - ```sh + ```shell gitlab-ctl pgb-console # You will be prompted for PGBOUNCER_PASSWORD ``` @@ -77,7 +77,7 @@ In a HA setup, it's recommended to run a PgBouncer node separately for each data 1. Once the console prompt is available, run the following queries: - ```sh + ```shell show databases ; show clients ; ``` diff --git a/doc/administration/high_availability/redis.md b/doc/administration/high_availability/redis.md index 8e94b56a940..01ee94ce208 100644 --- a/doc/administration/high_availability/redis.md +++ b/doc/administration/high_availability/redis.md @@ -8,8 +8,10 @@ type: reference The following are the requirements for providing your own Redis instance: -- Redis version 2.8 or higher. Version 3.2 or higher is recommend as this is - what ships with the GitLab Omnibus package. +- GitLab 12.0 and later requires Redis version 3.2 or higher. Version 3.2 or higher is recommend as this is + what ships with the GitLab Omnibus package. Older Redis versions do not + support an optional count argument to SPOP which is now required for + [Merge Trains](../../ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md). - Standalone Redis or Redis high availability with Sentinel are supported. Redis Cluster is not supported. - Managed Redis from cloud providers such as AWS Elasticache will work. If these @@ -978,7 +980,7 @@ To make sure your configuration is correct: 1. To simulate a failover on master Redis, SSH into the Redis server and run: - ```bash + ```shell # port must match your master redis port, and the sleep time must be a few seconds bigger than defined one redis-cli -h localhost -p 6379 DEBUG sleep 20 ``` diff --git a/doc/administration/incoming_email.md b/doc/administration/incoming_email.md index 1550787d532..07b6f79a0fa 100644 --- a/doc/administration/incoming_email.md +++ b/doc/administration/incoming_email.md @@ -102,14 +102,14 @@ for a real-world example of this exploit. 1. Reconfigure GitLab for the changes to take effect: - ```sh + ```shell sudo gitlab-ctl reconfigure sudo gitlab-ctl restart ``` 1. Verify that everything is configured correctly: - ```sh + ```shell sudo gitlab-rake gitlab:incoming_email:check ``` @@ -119,7 +119,7 @@ Reply by email should now be working. 1. Go to the GitLab installation directory: - ```sh + ```shell cd /home/git/gitlab ``` @@ -128,20 +128,20 @@ Reply by email should now be working. 1. Enable `mail_room` in the init script at `/etc/default/gitlab`: - ```sh + ```shell sudo mkdir -p /etc/default echo 'mail_room_enabled=true' | sudo tee -a /etc/default/gitlab ``` 1. Restart GitLab: - ```sh + ```shell sudo service gitlab restart ``` 1. Verify that everything is configured correctly: - ```sh + ```shell sudo -u git -H bundle exec rake gitlab:incoming_email:check RAILS_ENV=production ``` diff --git a/doc/administration/integration/plantuml.md b/doc/administration/integration/plantuml.md index 33ac925748f..4e34e9923e1 100644 --- a/doc/administration/integration/plantuml.md +++ b/doc/administration/integration/plantuml.md @@ -15,7 +15,7 @@ server that will generate the diagrams. With Docker, you can just run a container like this: -```sh +```shell docker run -d --name plantuml -p 8080:8080 plantuml/plantuml-server:tomcat ``` @@ -50,7 +50,7 @@ own PlantUML server is easy in Debian/Ubuntu distributions using Tomcat. First you need to create a `plantuml.war` file from the source code: -```sh +```shell sudo apt-get install graphviz openjdk-8-jdk git-core maven git clone https://github.com/plantuml/plantuml-server.git cd plantuml-server @@ -101,7 +101,7 @@ nginx['custom_gitlab_server_config'] = "location /-/plantuml { \n rewrite ^/-/(p To activate the changes, run the following command: -```sh +```shell sudo gitlab-ctl reconfigure ``` diff --git a/doc/administration/invalidate_markdown_cache.md b/doc/administration/invalidate_markdown_cache.md index ebd8578e410..7bebf555a6c 100644 --- a/doc/administration/invalidate_markdown_cache.md +++ b/doc/administration/invalidate_markdown_cache.md @@ -11,6 +11,6 @@ increasing the `local_markdown_version` setting in application settings. This c be done by [changing the application settings through the API](../api/settings.md#change-application-settings): -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/settings?local_markdown_version= ``` diff --git a/doc/administration/job_artifacts.md b/doc/administration/job_artifacts.md index 04974c6ea8b..ad17e9064e6 100644 --- a/doc/administration/job_artifacts.md +++ b/doc/administration/job_artifacts.md @@ -156,7 +156,7 @@ _The artifacts are stored by default in 1. Save the file and [reconfigure GitLab][] for the changes to take effect. 1. Migrate any existing local artifacts to the object storage: - ```bash + ```shell gitlab-rake gitlab:artifacts:migrate ``` @@ -184,7 +184,7 @@ _The artifacts are stored by default in 1. Save the file and [restart GitLab][] for the changes to take effect. 1. Migrate any existing local artifacts to the object storage: - ```bash + ```shell sudo -u git -H bundle exec rake gitlab:artifacts:migrate RAILS_ENV=production ``` @@ -239,7 +239,7 @@ you can flip the feature flag from a Rails console. 1. Enter the Rails console: - ```sh + ```shell sudo gitlab-rails console ``` @@ -253,7 +253,7 @@ you can flip the feature flag from a Rails console. 1. Enter the Rails console: - ```sh + ```shell cd /home/git/gitlab RAILS_ENV=production sudo -u git -H bundle exec rails console ``` diff --git a/doc/administration/job_logs.md b/doc/administration/job_logs.md index fc37fbb170d..7f56f98db08 100644 --- a/doc/administration/job_logs.md +++ b/doc/administration/job_logs.md @@ -100,7 +100,7 @@ Here is the detailed data flow: The following commands are to be issued in a Rails console: -```sh +```shell # Omnibus GitLab gitlab-rails console diff --git a/doc/administration/lfs/lfs_administration.md b/doc/administration/lfs/lfs_administration.md index fbf48619854..68a5939dcd1 100644 --- a/doc/administration/lfs/lfs_administration.md +++ b/doc/administration/lfs/lfs_administration.md @@ -138,13 +138,13 @@ There are two ways to manually do the same thing as automatic uploading (describ **Option 1: rake task** -```sh +```shell rake gitlab:lfs:migrate ``` **Option 2: rails console** -```sh +```shell $ sudo gitlab-rails console # Login to rails console > # Upload LFS files manually @@ -178,7 +178,7 @@ On Omnibus installations, the settings are prefixed by `lfs_object_store_`: 1. Save the file and [reconfigure GitLab]s for the changes to take effect. 1. Migrate any existing local LFS objects to the object storage: - ```bash + ```shell gitlab-rake gitlab:lfs:migrate ``` @@ -214,7 +214,7 @@ For source installations the settings are nested under `lfs:` and then 1. Save the file and [restart GitLab][] for the changes to take effect. 1. Migrate any existing local LFS objects to the object storage: - ```bash + ```shell sudo -u git -H bundle exec rake gitlab:lfs:migrate RAILS_ENV=production ``` diff --git a/doc/administration/lfs/manage_large_binaries_with_git_lfs.md b/doc/administration/lfs/manage_large_binaries_with_git_lfs.md index 1fd3077ecb9..025b547c37e 100644 --- a/doc/administration/lfs/manage_large_binaries_with_git_lfs.md +++ b/doc/administration/lfs/manage_large_binaries_with_git_lfs.md @@ -50,7 +50,7 @@ Lets take a look at the workflow when you need to check large files into your Gi repository with Git LFS. For example, if you want to upload a very large file and check it into your Git repository: -```bash +```shell git clone git@gitlab.example.com:group/project.git git lfs install # initialize the Git LFS project git lfs track "*.iso" # select the file extensions that you want to treat as large files @@ -59,7 +59,7 @@ git lfs track "*.iso" # select the file extensions that you want Once a certain file extension is marked for tracking as a LFS object you can use Git as usual without having to redo the command to track a file with the same extension: -```bash +```shell cp ~/tmp/debian.iso ./ # copy a large file into the current directory git add . # add the large file to the project git commit -am "Added Debian iso" # commit the file meta data @@ -69,7 +69,7 @@ git push origin master # sync the git repo and large file to the **Make sure** that `.gitattributes` is tracked by Git. Otherwise Git LFS will not be working properly for people cloning the project: -```bash +```shell git add .gitattributes ``` @@ -78,14 +78,14 @@ LFS-tracked files and clones them via HTTP. If you performed the `git clone` command with a SSH URL, you have to enter your GitLab credentials for HTTP authentication. -```bash +```shell git clone git@gitlab.example.com:group/project.git ``` If you already cloned the repository and you want to get the latest LFS object that are on the remote repository, eg. for a branch from origin: -```bash +```shell git lfs fetch origin master ``` @@ -101,14 +101,14 @@ The first thing to do before using File Locking is to tell Git LFS which kind of files are lockable. The following command will store PNG files in LFS and flag them as lockable: -```bash +```shell git lfs track "*.png" --lockable ``` After executing the above command a file named `.gitattributes` will be created or updated with the following content: -```bash +```shell *.png filter=lfs diff=lfs merge=lfs -text lockable ``` @@ -116,7 +116,7 @@ You can also register a file type as lockable without using LFS (In order to be able to lock/unlock a file you need a remote server that implements the LFS File Locking API), in order to do that you can edit the `.gitattributes` file manually: -```bash +```shell *.pdf lockable ``` @@ -128,14 +128,14 @@ need to lock the file before editing it. Once you're ready to edit your file you need to lock it first: -```bash +```shell git lfs lock images/banner.png Locked images/banner.png ``` This will register the file as locked in your name on the server: -```bash +```shell git lfs locks images/banner.png joe ID:123 ``` @@ -143,13 +143,13 @@ images/banner.png joe ID:123 Once you have pushed your changes, you can unlock the file so others can also edit it: -```bash +```shell git lfs unlock images/banner.png ``` You can also unlock by id: -```bash +```shell git lfs unlock --id=123 ``` @@ -157,7 +157,7 @@ If for some reason you need to unlock a file that was not locked by you, you can use the `--force` flag as long as you have a `maintainer` access on the project: -```bash +```shell git lfs unlock --id=123 --force ``` @@ -183,7 +183,7 @@ available to the project anymore. Probably the object was removed from the serve Git LFS will log the failures into a log file. To view this log file, while in project directory: -```bash +```shell git lfs logs last ``` @@ -215,7 +215,7 @@ This behaviour is caused by Git LFS using HTTPS connections by default when a To prevent this from happening, set the lfs url in project Git config: -```bash +```shell git config --add lfs.url "http://gitlab.example.com/group/project.git/info/lfs" ``` @@ -235,7 +235,7 @@ you use. This is described in [Git credentials man pages](https://git-scm.com/do For example, you can tell Git to remember the password for a period of time in which you expect to push the objects: -```bash +```shell git config --global credential.helper 'cache --timeout=3600' ``` diff --git a/doc/administration/lfs/migrate_from_git_annex_to_git_lfs.md b/doc/administration/lfs/migrate_from_git_annex_to_git_lfs.md index cf798472d62..3f983bebf27 100644 --- a/doc/administration/lfs/migrate_from_git_annex_to_git_lfs.md +++ b/doc/administration/lfs/migrate_from_git_annex_to_git_lfs.md @@ -48,7 +48,7 @@ Fire up a terminal, navigate to your Git repository and: 1. Disable `git-annex`: - ```bash + ```shell git annex sync --content git annex direct git annex uninit @@ -85,7 +85,7 @@ if the server also has Git Annex 6 installed. Read more in the 1. Backup your repository - ```bash + ```shell cd repository git annex sync --content cd .. @@ -97,14 +97,14 @@ if the server also has Git Annex 6 installed. Read more in the 1. Use `annex direct`: - ```bash + ```shell cd repository git annex direct ``` The output should be similar to this: - ```bash + ```shell commit On branch master Your branch is up-to-date with 'origin/master'. @@ -116,13 +116,13 @@ if the server also has Git Annex 6 installed. Read more in the 1. Disable Git Annex with [`annex uninit`][uninit]: - ```bash + ```shell git annex uninit ``` The output should be similar to this: - ```bash + ```shell unannex debian.iso ok Deleted branch git-annex (was 2534d2c). ``` @@ -131,13 +131,13 @@ if the server also has Git Annex 6 installed. Read more in the 1. Switch back to `indirect` mode: - ```bash + ```shell git annex indirect ``` The output should be similar to this: - ```bash + ```shell (merging origin/git-annex into git-annex...) (recording state in git...) commit (recording state in git...) @@ -165,7 +165,7 @@ GitLab.com), therefore, you don't need to do anything server-side. 1. First, make sure you have `git-lfs` installed locally: - ```bash + ```shell git lfs help ``` @@ -174,7 +174,7 @@ GitLab.com), therefore, you don't need to do anything server-side. 1. Inside the repo, run the following command to initiate LFS: - ```bash + ```shell git lfs install ``` @@ -182,7 +182,7 @@ GitLab.com), therefore, you don't need to do anything server-side. can track specific files, all files containing the same extension, or an entire directory: - ```bash + ```shell git lfs track images/01.png # per file git lfs track **/*.png # per extension git lfs track images/ # per directory @@ -194,7 +194,7 @@ GitLab.com), therefore, you don't need to do anything server-side. 1. Add the files, commit and push them to GitLab: - ```bash + ```shell git add . git commit -m "commit message" git push @@ -217,7 +217,7 @@ branches created by Git Annex: `git-annex`, and all under `synced/`. You can also do this on the command line with: -```bash +```shell git branch -d synced/master git branch -d synced/git-annex git push origin :synced/master @@ -229,7 +229,7 @@ git remote prune origin If there are still some Annex objects inside your repository (`.git/annex/`) or references inside `.git/config`, run `annex uninit` again: -```bash +```shell git annex uninit ``` diff --git a/doc/administration/monitoring/performance/gitlab_configuration.md b/doc/administration/monitoring/performance/gitlab_configuration.md index 1bff170768a..e8a6c661464 100644 --- a/doc/administration/monitoring/performance/gitlab_configuration.md +++ b/doc/administration/monitoring/performance/gitlab_configuration.md @@ -17,7 +17,7 @@ changes. Finally, a restart of all GitLab processes is required for the changes to take effect: -```bash +```shell # For Omnibus installations sudo gitlab-ctl restart diff --git a/doc/administration/monitoring/performance/grafana_configuration.md b/doc/administration/monitoring/performance/grafana_configuration.md index 2fbbeb0b774..2fdeeae302b 100644 --- a/doc/administration/monitoring/performance/grafana_configuration.md +++ b/doc/administration/monitoring/performance/grafana_configuration.md @@ -133,7 +133,7 @@ After upgrading, the Grafana dashboard will be disabled and the location of your To prevent the data from being relocated, you can run the following command prior to upgrading: -```sh +```shell echo "0" > /var/opt/gitlab/grafana/CVE_reset_status ``` diff --git a/doc/administration/monitoring/performance/influxdb_configuration.md b/doc/administration/monitoring/performance/influxdb_configuration.md index b18be09ef4b..234d0dc2e88 100644 --- a/doc/administration/monitoring/performance/influxdb_configuration.md +++ b/doc/administration/monitoring/performance/influxdb_configuration.md @@ -110,14 +110,14 @@ buffer size is set to the same value, the default value is almost never enough. To set the OS buffer size to 200 MB, on Linux you can run the following command: -```bash +```shell sysctl -w net.core.rmem_max=209715200 ``` To make this permanent, add the following to `/etc/sysctl.conf` and restart the server: -```bash +```shell net.core.rmem_max=209715200 ``` @@ -154,7 +154,7 @@ and password (`-password `) you set earlier to the commands below._ Run the following command to create a database named `gitlab`: -```bash +```shell influx -execute 'CREATE DATABASE gitlab' ``` @@ -162,7 +162,7 @@ The name **must** be `gitlab`, do not use any other name. Next, make sure that the database was successfully created: -```bash +```shell influx -execute 'SHOW DATABASES' ``` diff --git a/doc/administration/operations/extra_sidekiq_processes.md b/doc/administration/operations/extra_sidekiq_processes.md index fd5f9fe6c26..5cdd33ba507 100644 --- a/doc/administration/operations/extra_sidekiq_processes.md +++ b/doc/administration/operations/extra_sidekiq_processes.md @@ -55,7 +55,7 @@ To start extra Sidekiq processes, you must enable `sidekiq-cluster`: 1. Save the file and reconfigure GitLab for the changes to take effect: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -78,7 +78,7 @@ you list: 1. Save the file and reconfigure GitLab for the changes to take effect: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -113,7 +113,7 @@ use all of its resources to perform those operations. To set up a separate 1. Save the file and reconfigure GitLab for the changes to take effect: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -145,7 +145,7 @@ details. 1. Save the file and reconfigure GitLab for the changes to take effect: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -162,7 +162,7 @@ This will set the concurrency (number of threads) for the Sidekiq process. 1. Save the file and reconfigure GitLab for the changes to take effect: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -207,7 +207,7 @@ For debugging purposes, you can start extra Sidekiq processes by using the comma `/opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster`. This command takes arguments using the following syntax: -```bash +```shell /opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster [QUEUE,QUEUE,...] [QUEUE, ...] ``` @@ -225,14 +225,14 @@ For example, say you want to start 2 extra processes: one to process the `process_commit` queue, and one to process the `post_receive` queue. This can be done as follows: -```bash +```shell /opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster process_commit post_receive ``` If you instead want to start one process processing both queues, you'd use the following syntax: -```bash +```shell /opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster process_commit,post_receive ``` @@ -240,7 +240,7 @@ If you want to have one Sidekiq process dealing with the `process_commit` and `post_receive` queues, and one process to process the `gitlab_shell` queue, you'd use the following: -```bash +```shell /opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster process_commit,post_receive gitlab_shell ``` @@ -272,7 +272,7 @@ The `sidekiq-cluster` command can store its PID in a file. By default no PID file is written, but this can be changed by passing the `--pidfile` option to `sidekiq-cluster`. For example: -```bash +```shell /opt/gitlab/embedded/service/gitlab-rails/ee/bin/sidekiq-cluster --pidfile /var/run/gitlab/sidekiq_cluster.pid process_commit ``` diff --git a/doc/administration/operations/fast_ssh_key_lookup.md b/doc/administration/operations/fast_ssh_key_lookup.md index 96571b0a5d9..7d0fc43f810 100644 --- a/doc/administration/operations/fast_ssh_key_lookup.md +++ b/doc/administration/operations/fast_ssh_key_lookup.md @@ -60,7 +60,7 @@ AuthorizedKeysCommandUser git Reload OpenSSH: -```bash +```shell # Debian or Ubuntu installations sudo service ssh reload diff --git a/doc/administration/operations/filesystem_benchmarking.md b/doc/administration/operations/filesystem_benchmarking.md index b5922d9d99d..0a20e94a778 100644 --- a/doc/administration/operations/filesystem_benchmarking.md +++ b/doc/administration/operations/filesystem_benchmarking.md @@ -25,7 +25,7 @@ To install: Then run the following: -```sh +```shell fio --randrepeat=1 --ioengine=libaio --direct=1 --gtod_reduce=1 --name=test --filename=/path/to/git-data/testfile --bs=4k --iodepth=64 --size=4G --readwrite=randrw --rwmixread=75 ``` @@ -78,32 +78,32 @@ executed, and then read the same 1,000 files. [repository storage path](../repository_storage_paths.md). 1. Create a temporary directory for the test so it's easy to remove the files later: - ```sh + ```shell mkdir test; cd test ``` 1. Run the command: - ```sh + ```shell time for i in {0..1000}; do echo 'test' > "test${i}.txt"; done ``` 1. To benchmark read performance, run the command: - ```sh + ```shell time for i in {0..1000}; do cat "test${i}.txt" > /dev/null; done ``` 1. Remove the test files: - ```sh + ```shell cd ../; rm -rf test ``` The output of the `time for ...` commands will look similar to the following. The important metric is the `real` time. -```sh +```shell $ time for i in {0..1000}; do echo 'test' > "test${i}.txt"; done real 0m0.116s diff --git a/doc/administration/packages/container_registry.md b/doc/administration/packages/container_registry.md index 3804319f60d..b325fc59469 100644 --- a/doc/administration/packages/container_registry.md +++ b/doc/administration/packages/container_registry.md @@ -169,7 +169,7 @@ If your certificate provider provides the CA Bundle certificates, append them to Users should now be able to login to the Container Registry with their GitLab credentials using: -```bash +```shell docker login gitlab.example.com:4567 ``` @@ -194,7 +194,7 @@ Let's assume that you want the container Registry to be accessible at `/etc/gitlab/ssl/registry.gitlab.example.com.key` and make sure they have correct permissions: - ```bash + ```shell chmod 600 /etc/gitlab/ssl/registry.gitlab.example.com.* ``` @@ -234,7 +234,7 @@ registry_nginx['ssl_certificate_key'] = "/etc/gitlab/ssl/certificate.key" Users should now be able to login to the Container Registry using their GitLab credentials: -```bash +```shell docker login registry.gitlab.example.com ``` @@ -793,7 +793,7 @@ After adding the setting, [reconfigure GitLab](../restart_gitlab.md#omnibus-gitl Use curl to request debug output from the debug server: -```bash +```shell curl localhost:5001/debug/health curl localhost:5001/debug/vars ``` diff --git a/doc/administration/packages/index.md b/doc/administration/packages/index.md index 2d2a6f3de3a..421b70709b5 100644 --- a/doc/administration/packages/index.md +++ b/doc/administration/packages/index.md @@ -166,12 +166,12 @@ The processing will be done in a background worker and requires **no downtime**. For Omnibus GitLab: -```sh +```shell sudo gitlab-rake "gitlab:packages:migrate" ``` For installations from source: -```bash +```shell RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:packages:migrate ``` diff --git a/doc/administration/pages/index.md b/doc/administration/pages/index.md index 1521c48f6fd..5ed0965115e 100644 --- a/doc/administration/pages/index.md +++ b/doc/administration/pages/index.md @@ -360,14 +360,14 @@ that method from working. Use the following workaround: 1. Append your GitLab server TLS/SSL certficate to `/opt/gitlab/embedded/ssl/certs/cacert.pem` where `gitlab-domain-example.com` is your GitLab application URL - ```bash + ```shell printf "\ngitlab-domain-example.com\n===========================\n" | sudo tee --append /opt/gitlab/embedded/ssl/certs/cacert.pem echo -n | openssl s_client -connect gitlab-domain-example.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee --append /opt/gitlab/embedded/ssl/certs/cacert.pem ``` 1. [Restart](../restart_gitlab.md) the GitLab Pages Daemon. For GitLab Omnibus instances: - ```bash + ```shell sudo gitlab-ctl restart gitlab-pages ``` diff --git a/doc/administration/pages/source.md b/doc/administration/pages/source.md index 3689a604840..1f38a71efe1 100644 --- a/doc/administration/pages/source.md +++ b/doc/administration/pages/source.md @@ -98,7 +98,7 @@ The Pages daemon doesn't listen to the outside world. 1. Install the Pages daemon: - ```bash + ```shell cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages @@ -108,7 +108,7 @@ The Pages daemon doesn't listen to the outside world. 1. Go to the GitLab installation directory: - ```bash + ```shell cd /home/git/gitlab ``` @@ -138,7 +138,7 @@ The Pages daemon doesn't listen to the outside world. 1. Copy the `gitlab-pages` NGINX configuration file: - ```bash + ```shell sudo cp lib/support/nginx/gitlab-pages /etc/nginx/sites-available/gitlab-pages.conf sudo ln -sf /etc/nginx/sites-{available,enabled}/gitlab-pages.conf ``` @@ -160,7 +160,7 @@ outside world. 1. Install the Pages daemon: - ```bash + ```shell cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages @@ -170,7 +170,7 @@ outside world. 1. In `gitlab.yml`, set the port to `443` and https to `true`: - ```bash + ```shell ## GitLab Pages pages: enabled: true @@ -195,7 +195,7 @@ outside world. 1. Copy the `gitlab-pages-ssl` NGINX configuration file: - ```bash + ```shell sudo cp lib/support/nginx/gitlab-pages-ssl /etc/nginx/sites-available/gitlab-pages-ssl.conf sudo ln -sf /etc/nginx/sites-{available,enabled}/gitlab-pages-ssl.conf ``` @@ -225,7 +225,7 @@ world. Custom domains are supported, but no TLS. 1. Install the Pages daemon: - ```bash + ```shell cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages @@ -263,7 +263,7 @@ world. Custom domains are supported, but no TLS. 1. Copy the `gitlab-pages-ssl` NGINX configuration file: - ```bash + ```shell sudo cp lib/support/nginx/gitlab-pages /etc/nginx/sites-available/gitlab-pages.conf sudo ln -sf /etc/nginx/sites-{available,enabled}/gitlab-pages.conf ``` @@ -290,7 +290,7 @@ world. Custom domains and TLS are supported. 1. Install the Pages daemon: - ```bash + ```shell cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages @@ -332,7 +332,7 @@ world. Custom domains and TLS are supported. 1. Copy the `gitlab-pages-ssl` NGINX configuration file: - ```bash + ```shell sudo cp lib/support/nginx/gitlab-pages-ssl /etc/nginx/sites-available/gitlab-pages-ssl.conf sudo ln -sf /etc/nginx/sites-{available,enabled}/gitlab-pages-ssl.conf ``` diff --git a/doc/administration/pseudonymizer.md b/doc/administration/pseudonymizer.md index fd42f6a6363..eac4dc26b4e 100644 --- a/doc/administration/pseudonymizer.md +++ b/doc/administration/pseudonymizer.md @@ -85,7 +85,7 @@ You can optionally run the pseudonymizer using the following environment variabl - `PSEUDONYMIZER_OUTPUT_DIR` - where to store the output CSV files (defaults to `/tmp`) - `PSEUDONYMIZER_BATCH` - the batch size when querying the DB (defaults to `100000`) -```bash +```shell ## Omnibus sudo gitlab-rake gitlab:db:pseudonymizer diff --git a/doc/administration/raketasks/check.md b/doc/administration/raketasks/check.md index 7f3405df060..6f9a7f4293d 100644 --- a/doc/administration/raketasks/check.md +++ b/doc/administration/raketasks/check.md @@ -33,13 +33,13 @@ integrity check described previously. **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:git:fsck ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:git:fsck RAILS_ENV=production ``` @@ -58,7 +58,7 @@ Currently, integrity checks are supported for the following types of file: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:artifacts:check sudo gitlab-rake gitlab:lfs:check sudo gitlab-rake gitlab:uploads:check @@ -66,7 +66,7 @@ sudo gitlab-rake gitlab:uploads:check **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:artifacts:check RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:lfs:check RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:uploads:check RAILS_ENV=production @@ -82,7 +82,7 @@ Variable | Type | Description `ID_TO` | integer | Specifies the ID value to end at, inclusive of the value. `VERBOSE` | boolean | Causes failures to be listed individually, rather than being summarized. -```bash +```shell sudo gitlab-rake gitlab:artifacts:check BATCH=100 ID_FROM=50 ID_TO=250 sudo gitlab-rake gitlab:lfs:check BATCH=100 ID_FROM=50 ID_TO=250 sudo gitlab-rake gitlab:uploads:check BATCH=100 ID_FROM=50 ID_TO=250 @@ -90,7 +90,7 @@ sudo gitlab-rake gitlab:uploads:check BATCH=100 ID_FROM=50 ID_TO=250 Example output: -```bash +```shell $ sudo gitlab-rake gitlab:uploads:check Checking integrity of Uploads - 1..1350: Failures: 0 @@ -107,7 +107,7 @@ Done! Example verbose output: -```bash +```shell $ sudo gitlab-rake gitlab:uploads:check VERBOSE=1 Checking integrity of Uploads - 1..1350: Failures: 0 diff --git a/doc/administration/raketasks/geo.md b/doc/administration/raketasks/geo.md index 8bf720d2872..91c83b5f6ba 100644 --- a/doc/administration/raketasks/geo.md +++ b/doc/administration/raketasks/geo.md @@ -11,13 +11,13 @@ This is equivalent of running `git repack -d` on a _bare_ repository. **Omnibus Installation** -```bash +```shell sudo gitlab-rake geo:git:housekeeping:incremental_repack ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake geo:git:housekeeping:incremental_repack RAILS_ENV=production ``` @@ -29,13 +29,13 @@ when this is enabled in GitLab. **Omnibus Installation** -```bash +```shell sudo gitlab-rake geo:git:housekeeping:full_repack ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake geo:git:housekeeping:full_repack RAILS_ENV=production ``` @@ -46,13 +46,13 @@ a reachability bitmap index when this is enabled in GitLab. **Omnibus Installation** -```bash +```shell sudo gitlab-rake geo:git:housekeeping:gc ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake geo:git:housekeeping:gc RAILS_ENV=production ``` @@ -63,12 +63,12 @@ can remove them using the rake task `geo:run_orphaned_project_registry_cleaner`: **Omnibus Installation** -```bash +```shell sudo gitlab-rake geo:run_orphaned_project_registry_cleaner ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake geo:run_orphaned_project_registry_cleaner RAILS_ENV=production ``` diff --git a/doc/administration/raketasks/github_import.md b/doc/administration/raketasks/github_import.md index d6dd39cb1bc..6bf77b1fa0b 100644 --- a/doc/administration/raketasks/github_import.md +++ b/doc/administration/raketasks/github_import.md @@ -16,7 +16,7 @@ before/after the brackets. Also, Some shells (e.g., zsh) can interpret the open/ To import a project from the list of your GitHub projects available: -```bash +```shell # Omnibus installations sudo gitlab-rake "import:github[access_token,root,foo/bar]" @@ -32,7 +32,7 @@ will get created from your GitHub project. Subgroups are also possible: `foo/foo To import a specific GitHub project (named `foo/github_repo` here): -```bash +```shell # Omnibus installations sudo gitlab-rake "import:github[access_token,root,foo/bar,foo/github_repo]" diff --git a/doc/administration/raketasks/ldap.md b/doc/administration/raketasks/ldap.md index 41a9a4192cf..899b1ef9f4d 100644 --- a/doc/administration/raketasks/ldap.md +++ b/doc/administration/raketasks/ldap.md @@ -9,20 +9,20 @@ using the command below. **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:ldap:check ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:ldap:check RAILS_ENV=production ``` By default, the task will return a sample of 100 LDAP users. Change this limit by passing a number to the check task: -```bash +```shell rake gitlab:ldap:check[50] ``` @@ -41,13 +41,13 @@ instead. **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:ldap:group_sync ``` **Source Installation** -```bash +```shell bundle exec rake gitlab:ldap:group_sync ``` @@ -79,13 +79,13 @@ as the `old_provider` and the correct provider as the `new_provider`. **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] ``` **Source Installation** -```bash +```shell bundle exec rake gitlab:ldap:rename_provider[old_provider,new_provider] RAILS_ENV=production ``` @@ -95,7 +95,7 @@ Consider beginning with the default server ID `main` (full provider `ldapmain`). If we change `main` to `mycompany`, the `new_provider` is `ldapmycompany`. To rename all user identities run the following command: -```bash +```shell sudo gitlab-rake gitlab:ldap:rename_provider[ldapmain,ldapmycompany] ``` @@ -116,13 +116,13 @@ for them: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:ldap:rename_provider ``` **Source Installation** -```bash +```shell bundle exec rake gitlab:ldap:rename_provider RAILS_ENV=production ``` @@ -136,6 +136,6 @@ What is the new provider? Ex. 'ldapcustom': ldapmycompany This tasks also accepts the `force` environment variable which will skip the confirmation dialog: -```bash +```shell sudo gitlab-rake gitlab:ldap:rename_provider[old_provider,new_provider] force=yes ``` diff --git a/doc/administration/raketasks/maintenance.md b/doc/administration/raketasks/maintenance.md index efc7a84a80e..6dc5542466f 100644 --- a/doc/administration/raketasks/maintenance.md +++ b/doc/administration/raketasks/maintenance.md @@ -6,13 +6,13 @@ This command gathers information about your GitLab installation and the System i **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:env:info ``` **Source Installation** -```bash +```shell bundle exec rake gitlab:env:info RAILS_ENV=production ``` @@ -66,13 +66,13 @@ You may also have a look at our Troubleshooting Guides: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:check ``` **Source Installation** -```bash +```shell bundle exec rake gitlab:check RAILS_ENV=production ``` @@ -129,13 +129,13 @@ In some case it is necessary to rebuild the `authorized_keys` file. **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:shell:setup ``` **Source Installation** -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:shell:setup RAILS_ENV=production ``` @@ -153,13 +153,13 @@ clear Redis' cache. **Omnibus Installation** -```bash +```shell sudo gitlab-rake cache:clear ``` **Source Installation** -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production ``` @@ -174,7 +174,7 @@ Omnibus packages. **Source Installation** -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production ``` @@ -194,13 +194,13 @@ in the GitLab Performance Monitoring database. **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:track_deployment ``` **Source Installation** -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:track_deployment RAILS_ENV=production ``` @@ -213,13 +213,13 @@ is included to help you with this: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:tcp_check[example.com,80] ``` **Source Installation** -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:tcp_check[example.com,80] RAILS_ENV=production ``` @@ -238,13 +238,13 @@ To clear all exclusive leases: DANGER: **DANGER**: Don't run it while GitLab or Sidekiq is running -```bash +```shell sudo gitlab-rake gitlab:exclusive_lease:clear ``` To specify a lease `type` or lease `type + id`, specify a scope: -```bash +```shell # to clear all leases for repository garbage collection: sudo gitlab-rake gitlab:exclusive_lease:clear[project_housekeeping:*] @@ -256,14 +256,14 @@ sudo gitlab-rake gitlab:exclusive_lease:clear[project_housekeeping:4] To check the status of migrations, you can use the following rake task: -```bash +```shell sudo gitlab-rake db:migrate:status ``` This will output a table with a `Status` of `up` or `down` for each Migration ID. -```bash +```shell database: gitlabhq_production Status Migration ID Migration Name @@ -279,6 +279,6 @@ This could be as a result of [updating existing metrics](../../development/prome To re-import the metrics you can run: -```bash +```shell sudo gitlab-rake metrics:setup_common_metrics ``` diff --git a/doc/administration/raketasks/project_import_export.md b/doc/administration/raketasks/project_import_export.md index 2857f5a27aa..f782a24e654 100644 --- a/doc/administration/raketasks/project_import_export.md +++ b/doc/administration/raketasks/project_import_export.md @@ -13,7 +13,7 @@ The GitLab Import/Export version can be checked by using: -```bash +```shell # Omnibus installations sudo gitlab-rake gitlab:import_export:version @@ -23,7 +23,7 @@ bundle exec rake gitlab:import_export:version RAILS_ENV=production The current list of DB tables that will get exported can be listed by using: -```bash +```shell # Omnibus installations sudo gitlab-rake gitlab:import_export:data diff --git a/doc/administration/raketasks/storage.md b/doc/administration/raketasks/storage.md index 1198f3414c5..a14c8ed7969 100644 --- a/doc/administration/raketasks/storage.md +++ b/doc/administration/raketasks/storage.md @@ -16,19 +16,19 @@ This task will schedule all your existing projects and attachments associated wi **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:migrate_to_hashed ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:migrate_to_hashed RAILS_ENV=production ``` They both also accept a range as environment variable: -```bash +```shell # to migrate any non migrated project from ID 20 to 50. export ID_FROM=20 export ID_TO=50 @@ -63,19 +63,19 @@ Legacy storage type. For Omnibus installations, run the following: -```bash +```shell sudo gitlab-rake gitlab:storage:rollback_to_legacy ``` For source installations, run the following: -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:rollback_to_legacy RAILS_ENV=production ``` Both commands accept a range as environment variable: -```bash +```shell # to rollback any migrated project from ID 20 to 50. export ID_FROM=20 export ID_TO=50 @@ -95,13 +95,13 @@ To have a simple summary of projects using **Legacy** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:legacy_projects ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:legacy_projects RAILS_ENV=production ``` @@ -109,13 +109,13 @@ To list projects using **Legacy** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:list_legacy_projects ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:list_legacy_projects RAILS_ENV=production ``` @@ -126,13 +126,13 @@ To have a simple summary of projects using **Hashed** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:hashed_projects ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:hashed_projects RAILS_ENV=production ``` @@ -140,13 +140,13 @@ To list projects using **Hashed** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:list_hashed_projects ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:list_hashed_projects RAILS_ENV=production ``` @@ -156,13 +156,13 @@ To have a simple summary of project attachments using **Legacy** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:legacy_attachments ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:legacy_attachments RAILS_ENV=production ``` @@ -170,13 +170,13 @@ To list project attachments using **Legacy** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:list_legacy_attachments ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:list_legacy_attachments RAILS_ENV=production ``` @@ -186,13 +186,13 @@ To have a simple summary of project attachments using **Hashed** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:hashed_attachments ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:hashed_attachments RAILS_ENV=production ``` @@ -200,13 +200,13 @@ To list project attachments using **Hashed** storage: **Omnibus Installation** -```bash +```shell sudo gitlab-rake gitlab:storage:list_hashed_attachments ``` **Source Installation** -```bash +```shell sudo -u git -H bundle exec rake gitlab:storage:list_hashed_attachments RAILS_ENV=production ``` diff --git a/doc/administration/raketasks/uploads/migrate.md b/doc/administration/raketasks/uploads/migrate.md index aef15e3f388..adef6251a27 100644 --- a/doc/administration/raketasks/uploads/migrate.md +++ b/doc/administration/raketasks/uploads/migrate.md @@ -17,13 +17,13 @@ described in the next section. **Omnibus Installation** -```bash +```shell gitlab-rake "gitlab:uploads:migrate:all" ``` **Source Installation** -```bash +```shell sudo RAILS_ENV=production -u git -H bundle exec rake gitlab:uploads:migrate:all ``` @@ -52,7 +52,7 @@ Variable | Type | Description **Omnibus Installation** -```bash +```shell # gitlab-rake gitlab:uploads:migrate[uploader_class, model_class, mount_point] # Avatars @@ -80,7 +80,7 @@ gitlab-rake "gitlab:uploads:migrate[FileUploader, MergeRequest]" >**Note:** Use `RAILS_ENV=production` for every task. -```bash +```shell # sudo -u git -H bundle exec rake gitlab:uploads:migrate # Avatars @@ -112,13 +112,13 @@ To migrate all uploads created by legacy uploaders, run: **Omnibus Installation** -```bash +```shell gitlab-rake gitlab:uploads:legacy:migrate ``` **Source Installation** -```bash +```shell bundle exec rake gitlab:uploads:legacy:migrate ``` @@ -145,13 +145,13 @@ keeping in mind the task name in this case is `gitlab:uploads:migrate_to_local`. **Omnibus Installation** -```bash +```shell gitlab-rake "gitlab:uploads:migrate_to_local:all" ``` **Source Installation** -```bash +```shell sudo RAILS_ENV=production -u git -H bundle exec rake gitlab:uploads:migrate_to_local:all ``` diff --git a/doc/administration/raketasks/uploads/sanitize.md b/doc/administration/raketasks/uploads/sanitize.md index 98cc1ddcff9..3e9b44a24fb 100644 --- a/doc/administration/raketasks/uploads/sanitize.md +++ b/doc/administration/raketasks/uploads/sanitize.md @@ -7,7 +7,7 @@ You need `exiftool` installed on your system. If you installed GitLab: - Using the Omnibus package, you're all set. - From source, make sure `exiftool` is installed: - ```sh + ```shell # Debian/Ubuntu sudo apt-get install libimage-exiftool-perl @@ -22,7 +22,7 @@ Because EXIF data may contain sensitive information (e.g. GPS location), you can remove EXIF data also from existing images which were uploaded before with the following command: -```bash +```shell sudo RAILS_ENV=production -u git -H bundle exec rake gitlab:uploads:sanitize:remove_exif ``` @@ -46,13 +46,13 @@ each with a separate range of upload IDs (by setting `start_id` and `stop_id`). To run the command without dry mode and remove EXIF data from all uploads, you can use: -```bash +```shell sudo RAILS_ENV=production -u git -H bundle exec rake gitlab:uploads:sanitize:remove_exif[,,false,] 2>&1 | tee exif.log ``` To run the command without dry mode on uploads with ID between 100 and 5000 and pause for 0.1 second, you can use: -```bash +```shell sudo RAILS_ENV=production -u git -H bundle exec rake gitlab:uploads:sanitize:remove_exif[100,5000,false,0.1] 2>&1 | tee exif.log ``` diff --git a/doc/administration/reply_by_email_postfix_setup.md b/doc/administration/reply_by_email_postfix_setup.md index 56cd23b2eb8..3a28e37cfc0 100644 --- a/doc/administration/reply_by_email_postfix_setup.md +++ b/doc/administration/reply_by_email_postfix_setup.md @@ -14,7 +14,7 @@ The instructions make the assumption that you will be using the email address `i 1. Install the `postfix` package if it is not installed already: - ```sh + ```shell sudo apt-get install postfix ``` @@ -22,7 +22,7 @@ The instructions make the assumption that you will be using the email address `i 1. Install the `mailutils` package. - ```sh + ```shell sudo apt-get install mailutils ``` @@ -30,13 +30,13 @@ The instructions make the assumption that you will be using the email address `i 1. Create a user for incoming email. - ```sh + ```shell sudo useradd -m -s /bin/bash incoming ``` 1. Set a password for this user. - ```sh + ```shell sudo passwd incoming ``` @@ -46,13 +46,13 @@ The instructions make the assumption that you will be using the email address `i 1. Connect to the local SMTP server: - ```sh + ```shell telnet localhost 25 ``` You should see a prompt like this: - ```sh + ```shell Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. @@ -61,13 +61,13 @@ The instructions make the assumption that you will be using the email address `i If you get a `Connection refused` error instead, verify that `postfix` is running: - ```sh + ```shell sudo postfix status ``` If it is not, start it: - ```sh + ```shell sudo postfix start ``` @@ -94,7 +94,7 @@ The instructions make the assumption that you will be using the email address `i 1. Check if the `incoming` user received the email: - ```sh + ```shell su - incoming mail ``` @@ -108,13 +108,13 @@ The instructions make the assumption that you will be using the email address `i Quit the mail app: - ```sh + ```shell q ``` 1. Log out of the `incoming` account and go back to being `root`: - ```sh + ```shell logout ``` @@ -124,13 +124,13 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Configure Postfix to use Maildir-style mailboxes: - ```sh + ```shell sudo postconf -e "home_mailbox = Maildir/" ``` 1. Restart Postfix: - ```sh + ```shell sudo /etc/init.d/postfix restart ``` @@ -139,7 +139,7 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Follow steps 1 and 2 of _[Test the out-of-the-box setup](#test-the-out-of-the-box-setup)_. 1. Check if the `incoming` user received the email: - ```sh + ```shell su - incoming MAIL=/home/incoming/Maildir mail @@ -154,7 +154,7 @@ Courier, which we will install later to add IMAP authentication, requires mailbo Quit the mail app: - ```sh + ```shell q ``` @@ -166,7 +166,7 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Log out of the `incoming` account and go back to being `root`: - ```sh + ```shell logout ``` @@ -174,25 +174,25 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Install the `courier-imap` package: - ```sh + ```shell sudo apt-get install courier-imap ``` And start `imapd`: - ```sh + ```shell imapd start ``` 1. The courier-authdaemon isn't started after installation. Without it, imap authentication will fail: - ```sh + ```shell sudo service courier-authdaemon start ``` You can also configure courier-authdaemon to start on boot: - ```sh + ```shell sudo systemctl enable courier-authdaemon ``` @@ -200,7 +200,7 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Let Postfix know about the domains that it should consider local: - ```sh + ```shell sudo postconf -e "mydestination = gitlab.example.com, localhost.localdomain, localhost" ``` @@ -208,25 +208,25 @@ Courier, which we will install later to add IMAP authentication, requires mailbo We'll assume `192.168.1.0/24` is your local LAN. You can safely skip this step if you don't have other machines in the same local network. - ```sh + ```shell sudo postconf -e "mynetworks = 127.0.0.0/8, 192.168.1.0/24" ``` 1. Configure Postfix to receive mail on all interfaces, which includes the internet: - ```sh + ```shell sudo postconf -e "inet_interfaces = all" ``` 1. Configure Postfix to use the `+` delimiter for sub-addressing: - ```sh + ```shell sudo postconf -e "recipient_delimiter = +" ``` 1. Restart Postfix: - ```sh + ```shell sudo service postfix restart ``` @@ -236,13 +236,13 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Connect to the SMTP server: - ```sh + ```shell telnet gitlab.example.com 25 ``` You should see a prompt like this: - ```sh + ```shell Trying 123.123.123.123... Connected to gitlab.example.com. Escape character is '^]'. @@ -269,7 +269,7 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Check if the `incoming` user received the email: - ```sh + ```shell su - incoming MAIL=/home/incoming/Maildir mail @@ -284,13 +284,13 @@ Courier, which we will install later to add IMAP authentication, requires mailbo Quit the mail app: - ```sh + ```shell q ``` 1. Log out of the `incoming` account and go back to being `root`: - ```sh + ```shell logout ``` @@ -298,13 +298,13 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Connect to the IMAP server: - ```sh + ```shell telnet gitlab.example.com 143 ``` You should see a prompt like this: - ```sh + ```shell Trying 123.123.123.123... Connected to mail.example.gitlab.com. Escape character is '^]'. @@ -327,7 +327,7 @@ Courier, which we will install later to add IMAP authentication, requires mailbo 1. Disconnect from the IMAP server: - ```sh + ```shell a logout ``` diff --git a/doc/administration/repository_storage_types.md b/doc/administration/repository_storage_types.md index 9c7b5bc6b87..3e887e11ca6 100644 --- a/doc/administration/repository_storage_types.md +++ b/doc/administration/repository_storage_types.md @@ -118,7 +118,7 @@ to validate. You can do so by specifying a range with the operation. This is an example of how to limit the rollout to Project IDs 50 to 100, running in an Omnibus GitLab installation: -```bash +```shell sudo gitlab-rake gitlab:storage:migrate_to_hashed ID_FROM=50 ID_TO=100 ``` @@ -139,7 +139,7 @@ To schedule a complete rollback, see the The rollback task also supports specifying a range of Project IDs. Here is an example of limiting the rollout to Project IDs 50 to 100, in an Omnibus GitLab installation: -```bash +```shell sudo gitlab-rake gitlab:storage:rollback_to_legacy ID_FROM=50 ID_TO=100 ``` diff --git a/doc/administration/restart_gitlab.md b/doc/administration/restart_gitlab.md index 6f3c6028f71..bd3a52d487a 100644 --- a/doc/administration/restart_gitlab.md +++ b/doc/administration/restart_gitlab.md @@ -31,7 +31,7 @@ GitLab Rails application (Unicorn) as well as the other components, like: There may be times in the documentation where you will be asked to _restart_ GitLab. In that case, you need to run the following command: -```bash +```shell sudo gitlab-ctl restart ``` @@ -51,13 +51,13 @@ ok: run: unicorn: (pid 11338) 0s To restart a component separately, you can append its service name to the `restart` command. For example, to restart **only** NGINX you would run: -```bash +```shell sudo gitlab-ctl restart nginx ``` To check the status of GitLab services, run: -```bash +```shell sudo gitlab-ctl status ``` @@ -79,7 +79,7 @@ GitLab. Remember that this method applies only for the Omnibus packages. Reconfigure Omnibus GitLab with: -```bash +```shell sudo gitlab-ctl reconfigure ``` @@ -152,7 +152,7 @@ the [cloud native Helm Chart](https://docs.gitlab.com/charts/). Usually, it shou enough to restart a specific component separately (`gitaly`, `unicorn`, `workhorse`, `gitlab-shell`, etc.) by deleting all the pods related to it: -```bash +```shell kubectl delete pods -l release=,app= ``` diff --git a/doc/administration/server_hooks.md b/doc/administration/server_hooks.md index 7fded3dd41e..dbaf6047552 100644 --- a/doc/administration/server_hooks.md +++ b/doc/administration/server_hooks.md @@ -111,7 +111,7 @@ declined or an error occurs during the Git hook, your script should: This hook script written in bash will generate the following message in GitLab's UI: -```bash +```shell #!/bin/sh echo "GL-HOOK-ERR: My custom error message."; exit 1 diff --git a/doc/administration/smime_signing_email.md b/doc/administration/smime_signing_email.md index 60cab22d1f4..ed7447c0da9 100644 --- a/doc/administration/smime_signing_email.md +++ b/doc/administration/smime_signing_email.md @@ -67,7 +67,7 @@ extensions), which contain the following in a single encrypted file: In order to export the required files in PEM encoding from the PKCS#12 file, the `openssl` command can be used: -```bash +```shell #-- Extract private key in PEM encoding (no password, unencrypted) $ openssl pkcs12 -in gitlab.p12 -nocerts -nodes -out gitlab.key diff --git a/doc/administration/snippets/index.md b/doc/administration/snippets/index.md index 2e17db7b1f6..7632d685dc0 100644 --- a/doc/administration/snippets/index.md +++ b/doc/administration/snippets/index.md @@ -35,7 +35,7 @@ The steps to configure this setting through the Rails console are: 1. Start the Rails console: - ```bash + ```shell # For Omnibus installations sudo gitlab-rails console @@ -60,12 +60,12 @@ To retrieve the current value, start the Rails console and run: The process to set the snippets size limit through the Application Settings API is exactly the same as you would do to [update any other setting](../../api/settings.md#change-application-settings). -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/settings?snippet_size_limit=52428800 ``` You can also use the API to [retrieve the current value](../../api/settings.md#get-current-application-settings). -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/settings ``` diff --git a/doc/administration/timezone.md b/doc/administration/timezone.md index 3594ba19181..bc6eaf57a23 100644 --- a/doc/administration/timezone.md +++ b/doc/administration/timezone.md @@ -31,7 +31,7 @@ gitlab_rails['time_zone'] = 'America/New_York' After adding the configuration parameter, reconfigure and restart your GitLab instance: -```sh +```shell gitlab-ctl reconfigure gitlab-ctl restart ``` diff --git a/doc/administration/troubleshooting/debug.md b/doc/administration/troubleshooting/debug.md index b754b954391..01d143d045e 100644 --- a/doc/administration/troubleshooting/debug.md +++ b/doc/administration/troubleshooting/debug.md @@ -10,13 +10,13 @@ an SMTP server, but you're not seeing mail delivered. Here's how to check the se 1. Run a Rails console: - ```sh + ```shell sudo gitlab-rails console production ``` or for source installs: - ```sh + ```shell bundle exec rails console production ``` diff --git a/doc/administration/troubleshooting/elasticsearch.md b/doc/administration/troubleshooting/elasticsearch.md index a582e07b141..0fdd5314a9d 100644 --- a/doc/administration/troubleshooting/elasticsearch.md +++ b/doc/administration/troubleshooting/elasticsearch.md @@ -332,7 +332,7 @@ bind ports 9200/9300 so it can be used. The following is an example of running a docker container of Elasticsearch v7.2.0: -```bash +```shell docker pull docker.elastic.co/elasticsearch/elasticsearch:7.2.0 docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.2.0 ``` diff --git a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md index c4b7324ce05..7bffe00a969 100644 --- a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md +++ b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md @@ -30,7 +30,7 @@ should and, if needed, update the script for the latest version of GitLab. If the script you want to run is short, you can use the Rails Runner to avoid entering the rails console in the first place. Here's an example of its use: -```bash +```shell gitlab-rails runner "RAILS_COMMAND" # Example with a 2-line script @@ -130,19 +130,19 @@ end ### Check the GitLab version fast -```bash +```shell grep -m 1 gitlab /opt/gitlab/version-manifest.txt ``` ### Debugging SSH -```bash +```shell GIT_SSH_COMMAND="ssh -vvv" git clone ``` ### Debugging over HTTPS -```bash +```shell GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone ``` @@ -301,19 +301,19 @@ correctly named empty project using the steps below. Move the new repository to the empty repository: -```bash +```shell mv /var/opt/gitlab/git-data/repositories// /var/opt/gitlab/git-data/repositories// ``` Make sure the permissions are correct: -```bash +```shell chown -R git:git .git ``` Clear the cache: -```bash +```shell sudo gitlab-rake cache:clear ``` @@ -489,7 +489,7 @@ User.active.count ::HistoricalData.max_historical_user_count ``` -```bash +```shell # Using curl and jq (up to a max 100, see pagination docs https://docs.gitlab.com/ee/api/#pagination curl --silent --header "Private-Token: ********************" "https://gitlab.example.com/api/v4/users?per_page=100&active" | jq --compact-output '.[] | [.id,.name,.username]' ``` @@ -995,13 +995,13 @@ See . ### Connect to Redis (omnibus) -```sh +```shell /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket ``` ### Connect to Redis (HA) -```sh +```shell /opt/gitlab/embedded/bin/redis-cli -h -a ``` @@ -1034,7 +1034,7 @@ This script will go through all the encrypted variables and count how many are n to be decrypted. Might be helpful to run on multiple nodes to see which `gitlab-secrets.json` file is most up to date: -```bash +```shell wget -O /tmp/bad-decrypt.rb https://gitlab.com/snippets/1730735/raw gitlab-rails runner /tmp/bad-decrypt.rb ``` @@ -1075,7 +1075,7 @@ two-factor authentication. This script will search for all encrypted tokens that are causing decryption errors, and update or reset as needed: -```bash +```shell wget -O /tmp/encrypted-tokens.rb https://gitlab.com/snippets/1876342/raw gitlab-rails runner /tmp/encrypted-tokens.rb ``` diff --git a/doc/administration/troubleshooting/kubernetes_cheat_sheet.md b/doc/administration/troubleshooting/kubernetes_cheat_sheet.md index 7c2c2050b12..dfd5e82a159 100644 --- a/doc/administration/troubleshooting/kubernetes_cheat_sheet.md +++ b/doc/administration/troubleshooting/kubernetes_cheat_sheet.md @@ -20,13 +20,13 @@ and they will assist you with any issues you are having. - How to authorize to your GCP project (can be especially useful if you have projects under different GCP accounts): - ```bash + ```shell gcloud auth login ``` - How to access Kubernetes dashboard: - ```bash + ```shell # for minikube: minikube dashboard —url # for non-local installations if access via Kubectl is configured: @@ -42,7 +42,7 @@ and they will assist you with any issues you are having. - How to copy a file from local machine to a pod: - ```bash + ```shell kubectl cp file-name pod-name:./destination-path ``` @@ -51,19 +51,19 @@ and they will assist you with any issues you are having. - Check logs via Kubernetes dashboard. - Check logs via Kubectl: - ```bash + ```shell kubectl logs -c dependencies ``` - How to tail all Kubernetes cluster events in real time: - ```bash + ```shell kubectl get events -w --all-namespaces ``` - How to get logs of the previously terminated pod instance: - ```bash + ```shell kubectl logs --previous ``` @@ -79,13 +79,13 @@ and they will assist you with any issues you are having. - Tailing logs of a separate pod. An example for a Unicorn pod: - ```bash + ```shell kubectl logs gitlab-unicorn-7656fdd6bf-jqzfs -c unicorn ``` - Tail and follow all pods that share a label (in this case, `unicorn`): - ```bash + ```shell # all containers in the unicorn pods kubectl logs -f -l app=unicorn --all-containers=true --max-log-requests=50 @@ -96,21 +96,21 @@ and they will assist you with any issues you are having. - One can stream logs from all containers at once, similar to the Omnibus command `gitlab-ctl tail`: - ```bash + ```shell kubectl logs -f -l release=gitlab --all-containers=true --max-log-requests=100 ``` - Check all events in the `gitlab` namespace (the namespace name can be different if you specified a different one when deploying the Helm chart): - ```bash + ```shell kubectl get events -w --namespace=gitlab ``` - Most of the useful GitLab tools (console, rake tasks, etc) are found in the task-runner pod. You may enter it and run commands inside or run them from the outside: - ```bash + ```shell # find the pod kubectl get pods | grep task-runner @@ -145,7 +145,7 @@ and they will assist you with any issues you are having. - How to get your initial admin password : - ```bash + ```shell # find the name of the secret containing the password kubectl get secrets | grep initial-root # decode it @@ -154,19 +154,19 @@ and they will assist you with any issues you are having. - How to connect to a GitLab Postgres database: - ```bash + ```shell kubectl exec -it -- /srv/gitlab/bin/rails dbconsole -p ``` - How to get info about Helm installation status: - ```bash + ```shell helm status name-of-installation ``` - How to update GitLab installed using Helm Chart: - ```bash + ```shell helm repo upgrade # get current values and redirect them to yaml file (analogue of gitlab.rb values) @@ -185,7 +185,7 @@ and they will assist you with any issues you are having. - Modify the `gitlab.yaml` file. - Run the following command to apply changes: - ```bash + ```shell helm upgrade -f gitlab.yaml ``` @@ -197,20 +197,20 @@ to those documents for details. - Install Kubectl via Homebrew: - ```bash + ```shell brew install kubernetes-cli ``` - Install Minikube via Homebrew: - ```bash + ```shell brew cask install minikube ``` - Start Minikube and configure it. If Minikube cannot start, try running `minikube delete && minikube start` and repeat the steps: - ```bash + ```shell minikube start --cpus 3 --memory 8192 # minimum amount for GitLab to work minikube addons enable ingress minikube addons enable kube-dns @@ -218,7 +218,7 @@ to those documents for details. - Install Helm via Homebrew and initialize it: - ```bash + ```shell brew install kubernetes-helm helm init --service-account tiller ``` @@ -231,7 +231,7 @@ to those documents for details. - Install the GitLab Helm Chart: - ```bash + ```shell helm repo add gitlab https://charts.gitlab.io helm install --name gitlab -f gitlab/gitlab ``` diff --git a/doc/administration/troubleshooting/linux_cheat_sheet.md b/doc/administration/troubleshooting/linux_cheat_sheet.md index 853f553571c..0ad1f028f20 100644 --- a/doc/administration/troubleshooting/linux_cheat_sheet.md +++ b/doc/administration/troubleshooting/linux_cheat_sheet.md @@ -23,7 +23,7 @@ on. Contributions are welcome to help add them. ### Distro Information -```bash +```shell # Debian/Ubuntu uname -a lsb_release -a @@ -38,14 +38,14 @@ cat /etc/os-release ### Shut down or Reboot -```bash +```shell shutdown -h now reboot ``` ### Permissions -```bash +```shell # change the user:group ownership of a file/dir chown root:git @@ -55,7 +55,7 @@ chmod u+x ### Files & Dirs -```bash +```shell # create a new directory and all subdirectories mkdir -p dir/dir2/dir3 @@ -71,7 +71,7 @@ sed -i 's/original-text/new-text/g' ### See all set environment variables -```bash +```shell env ``` @@ -79,7 +79,7 @@ env ### File names -```bash +```shell # search for a file in a filesystem find . -name 'filename.rb' -print @@ -95,7 +95,7 @@ history ### File contents -```bash +```shell # -B/A = show 2 lines before/after search_term grep -B 2 -A 2 search_term @@ -114,7 +114,7 @@ fgrep -R string_pattern ### CLI -```bash +```shell # View command history history @@ -132,7 +132,7 @@ sudo !! ### Memory, Disk, & CPU usage -```bash +```shell # disk space info. The '-h' gives the data in human-readable values df -h @@ -157,7 +157,7 @@ top -o %CPU ### Strace -```bash +```shell # strace a process strace -tt -T -f -y -s 1024 -p @@ -200,7 +200,7 @@ can also sort based on total time, # of syscalls made, PID #, and # of child pro using the `-S` or `--sort` flag. The number of results defaults to 25 processes, but can be changed using the `-c`/`--count` option. See `--help` for full details. -```sh +```shell $ ./strace-parser strace.txt Top 25 PIDs @@ -218,7 +218,7 @@ Based on the summary, you can then view the details of syscalls made by one or m procsses using the `-p`/`--pid` for a specific process, or `-s`/`--stats` flags for a sorted list. `--stats` takes the same sorting and count options as summary. -```sh +```shell $ ./strace-parse strace.text -p 6423 PID 6423 @@ -274,7 +274,7 @@ small differences should not be considered significant. ### Ports -```bash +```shell # Find the programs that are listening on ports netstat -plnt ss -plnt @@ -283,7 +283,7 @@ lsof -i -P | grep ### Internet/DNS -```bash +```shell # Show domain IP address dig +short example.com nslookup example.com @@ -302,7 +302,7 @@ curl --head --location https://example.com ## Package Management -```bash +```shell # Debian/Ubuntu # List packages @@ -332,7 +332,7 @@ rpm -qa | grep ## Logs -```bash +```shell # Print last lines in log file where 'n' # is the number of lines to print tail -n /path/to/log/file diff --git a/doc/administration/troubleshooting/ssl.md b/doc/administration/troubleshooting/ssl.md index dcda4fbb7a9..98d144e012f 100644 --- a/doc/administration/troubleshooting/ssl.md +++ b/doc/administration/troubleshooting/ssl.md @@ -83,13 +83,13 @@ To fix this problem: If your GitLab instance is using a self-signed certificate, or the certificate is signed by an internal certificate authority (CA), you might run into the following errors when attempting to perform Git operations: -```bash +```shell $ git clone https://gitlab.domain.tld/group/project.git Cloning into 'project'... fatal: unable to access 'https://gitlab.domain.tld/group/project.git/': SSL certificate problem: self signed certificate ``` -```bash +```shell $ git clone https://gitlab.domain.tld/group/project.git Cloning into 'project'... fatal: unable to access 'https://gitlab.domain.tld/group/project.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none @@ -107,6 +107,6 @@ To fix this problem: - Disable SSL verification in your Git client. Note that this intended as a temporary measure as it could be considered a **security risk**. - ```bash + ```shell git config --global http.sslVerify false ``` diff --git a/doc/administration/troubleshooting/test_environments.md b/doc/administration/troubleshooting/test_environments.md index d0f670a5663..e9db5f64446 100644 --- a/doc/administration/troubleshooting/test_environments.md +++ b/doc/administration/troubleshooting/test_environments.md @@ -37,7 +37,7 @@ you change a few things: For example, when the `docker-machine` host we want to use is `do-docker`: -```sh +```shell docker run --detach --name gitlab \ --env GITLAB_OMNIBUS_CONFIG="external_url 'http://$(docker-machine ip do-docker)'; gitlab_rails['gitlab_shell_ssh_port'] = 2222;" \ --hostname $(docker-machine ip do-docker) \ @@ -52,7 +52,7 @@ gitlab/gitlab-ee:11.5.3-ee.0 We can use the [`test-saml-idp` Docker image](https://hub.docker.com/r/jamedjo/test-saml-idp) to do the work for us: -```sh +```shell docker run --name gitlab_saml -p 8080:8080 -p 8443:8443 \ -e SIMPLESAMLPHP_SP_ENTITY_ID= \ -e SIMPLESAMLPHP_SP_ASSERTION_CONSUMER_SERVICE=/users/auth/saml/callback \ @@ -93,7 +93,7 @@ See [the GDK SAML documentation](https://gitlab.com/gitlab-org/gitlab-developmen ### Elasticsearch -```sh +```shell docker run -d --name elasticsearch \ -p 9200:9200 -p 9300:9300 \ -e "discovery.type=single-node" \ @@ -110,7 +110,7 @@ on running PlantUML in Docker. ### Jira -```sh +```shell docker run -d -p 8081:8080 cptactionhank/atlassian-jira:latest ``` @@ -119,7 +119,7 @@ Jira license. ### Grafana -```sh +```shell docker run -d --name grafana -e "GF_SECURITY_ADMIN_PASSWORD=gitlab" -p 3000:3000 grafana/grafana ``` diff --git a/doc/api/README.md b/doc/api/README.md index ef3b578f04e..30e1f1ed79c 100644 --- a/doc/api/README.md +++ b/doc/api/README.md @@ -335,7 +335,7 @@ resources you can pass the following parameters: In the example below, we list 50 [namespaces](namespaces.md) per page. -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/namespaces?per_page=50" ``` @@ -349,7 +349,7 @@ In the cURL example below, we limit the output to 3 items per page (`per_page=3` and we request the second page (`page=2`) of [comments](notes.md) of the issue with ID `8` which belongs to the project with ID `8`: -```bash +```shell curl --head --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/8/issues/8/notes?per_page=3&page=2 ``` @@ -409,7 +409,7 @@ This method is controlled by the following parameters: In the example below, we list 50 [projects](projects.md) per page, ordered by `id` ascending. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects?pagination=keyset&per_page=50&order_by=id&sort=asc" ``` @@ -472,7 +472,7 @@ We can call the API with `array` and `hash` types parameters as shown below: `import_sources` is a parameter of type `array`: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " \ -d "import_sources[]=github" \ -d "import_sources[]=bitbucket" \ @@ -483,7 +483,7 @@ https://gitlab.example.com/api/v4/some_endpoint `override_params` is a parameter of type `hash`: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " \ --form "namespace=email" \ --form "path=impapi" \ @@ -497,7 +497,7 @@ https://gitlab.example.com/api/v4/projects/import `variables` is a parameter of type `array` containing hash key/value pairs `[{ 'key' => 'UPLOAD_TO_S3', 'value' => 'true' }]`: -```bash +```shell curl --globoff --request POST --header "PRIVATE-TOKEN: ********************" \ "https://gitlab.example.com/api/v4/projects/169/pipeline?ref=master&variables[][key]=VAR1&variables[][value]=hello&variables[][key]=VAR2&variables[][value]=world" diff --git a/doc/api/access_requests.md b/doc/api/access_requests.md index a9ebffbc606..75622fcc2de 100644 --- a/doc/api/access_requests.md +++ b/doc/api/access_requests.md @@ -29,7 +29,7 @@ GET /projects/:id/access_requests Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/access_requests curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/access_requests ``` @@ -72,7 +72,7 @@ POST /projects/:id/access_requests Example request: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/access_requests curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/access_requests ``` @@ -107,7 +107,7 @@ PUT /projects/:id/access_requests/:user_id/approve Example request: -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/access_requests/:user_id/approve?access_level=20 curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/access_requests/:user_id/approve?access_level=20 ``` @@ -141,7 +141,7 @@ DELETE /projects/:id/access_requests/:user_id Example request: -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/access_requests/:user_id curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/access_requests/:user_id ``` diff --git a/doc/api/appearance.md b/doc/api/appearance.md index e2c10fa2574..354a69cb604 100644 --- a/doc/api/appearance.md +++ b/doc/api/appearance.md @@ -13,7 +13,7 @@ List the current appearance configuration of the GitLab instance. GET /application/appearance ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/appearance ``` @@ -57,7 +57,7 @@ PUT /application/appearance | `message_font_color` | string | no | Font color for the system header / footer bar | `email_header_and_footer_enabled` | boolean | no | Add header and footer to all outgoing emails if enabled -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/appearance?email_header_and_footer_enabled=true&header_message=test ``` diff --git a/doc/api/applications.md b/doc/api/applications.md index 549828a983e..cb45fc742ca 100644 --- a/doc/api/applications.md +++ b/doc/api/applications.md @@ -31,7 +31,7 @@ Parameters: Example request: -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " --data "name=MyApplication&redirect_uri=http://redirect.uri&scopes=" https://gitlab.example.com/api/v4/applications ``` @@ -58,7 +58,7 @@ GET /applications Example request: -```sh +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/applications ``` @@ -97,6 +97,6 @@ Parameters: Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/applications/:id ``` diff --git a/doc/api/audit_events.md b/doc/api/audit_events.md index a06a300e149..5af2bdc1d29 100644 --- a/doc/api/audit_events.md +++ b/doc/api/audit_events.md @@ -24,7 +24,7 @@ are paginated. Read more on [pagination](README.md#pagination). -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/audit_events ``` @@ -91,7 +91,7 @@ Example response: GET /audit_events/:id ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/audit_events/1 ``` @@ -141,7 +141,7 @@ are paginated. Read more on [pagination](README.md#pagination). -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/groups/60/audit_events ``` @@ -197,7 +197,7 @@ GET /groups/:id/audit_events/:audit_event_id | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) | | `audit_event_id` | integer | yes | ID of the audit event | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/groups/60/audit_events/2 ``` diff --git a/doc/api/avatar.md b/doc/api/avatar.md index 376d8e930c7..fb664ccad82 100644 --- a/doc/api/avatar.md +++ b/doc/api/avatar.md @@ -28,7 +28,7 @@ Parameters: Example request: -```sh +```shell curl https://gitlab.example.com/api/v4/avatar?email=admin@example.com&size=32 ``` diff --git a/doc/api/award_emoji.md b/doc/api/award_emoji.md index 41dbedf1ee2..0b1593aba26 100644 --- a/doc/api/award_emoji.md +++ b/doc/api/award_emoji.md @@ -35,7 +35,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji ``` @@ -98,7 +98,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/1 ``` @@ -141,7 +141,7 @@ Parameters: | `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. | | `name` | string | yes | Name of the emoji without colons. | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji?name=blowfish ``` @@ -187,7 +187,7 @@ Parameters: | `issue_iid`/`merge_request_iid`/`snippet_id` | integer | yes | ID (`iid` for merge requests/issues, `id` for snippets) of an awardable. | | `award_id` | integer | yes | ID of an award emoji. | -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/344 ``` @@ -218,7 +218,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji ``` @@ -264,7 +264,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji/2 ``` @@ -308,7 +308,7 @@ Parameters: Example request: -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/notes/1/award_emoji?name=rocket ``` @@ -355,6 +355,6 @@ Parameters: Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/80/award_emoji/345 ``` diff --git a/doc/api/boards.md b/doc/api/boards.md index 9ebe1570a59..326c8476ffc 100644 --- a/doc/api/boards.md +++ b/doc/api/boards.md @@ -17,7 +17,7 @@ GET /projects/:id/boards | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards ``` @@ -92,7 +92,7 @@ GET /projects/:id/boards/:board_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `board_id` | integer | yes | The ID of a board | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1 ``` @@ -166,7 +166,7 @@ POST /projects/:id/boards | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `name` | string | yes | The name of the new board | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards?name=newboard ``` @@ -247,7 +247,7 @@ PUT /projects/:id/boards/:board_id | `labels` | string | no | Comma-separated list of label names which the board should be scoped to | | `weight` | integer | no | The weight range from 0 to 9, to which the board should be scoped to | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1?name=new_name&milestone_id=43&assignee_id=1&labels=Doing&weight=4 ``` @@ -321,7 +321,7 @@ DELETE /projects/:id/boards/:board_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `board_id` | integer | yes | The ID of a board | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1 ``` @@ -339,7 +339,7 @@ GET /projects/:id/boards/:board_id/lists | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `board_id` | integer | yes | The ID of a board | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1/lists ``` @@ -397,7 +397,7 @@ GET /projects/:id/boards/:board_id/lists/:list_id | `board_id` | integer | yes | The ID of a board | | `list_id`| integer | yes | The ID of a board's list | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1/lists/1 ``` @@ -439,7 +439,7 @@ that is, only one of them are accepted in a request. Check the [Issue Board docs](../user/project/issue_board.md#summary-of-features-per-tier) for more information regarding the required license for each list type. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1/lists?label_id=5 ``` @@ -474,7 +474,7 @@ PUT /projects/:id/boards/:board_id/lists/:list_id | `list_id` | integer | yes | The ID of a board's list | | `position` | integer | yes | The position of the list | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1/lists/1?position=2 ``` @@ -508,7 +508,7 @@ DELETE /projects/:id/boards/:board_id/lists/:list_id | `board_id` | integer | yes | The ID of a board | | `list_id` | integer | yes | The ID of a board's list | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/boards/1/lists/1 ``` diff --git a/doc/api/branches.md b/doc/api/branches.md index bba8876163e..2f9ca62ced6 100644 --- a/doc/api/branches.md +++ b/doc/api/branches.md @@ -25,7 +25,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/repository/branches ``` @@ -81,7 +81,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/repository/branches/master ``` @@ -142,7 +142,7 @@ Parameters: Example request: -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/repository/branches?branch=newbranch&ref=master ``` @@ -195,7 +195,7 @@ Parameters: Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/repository/branches/newbranch ``` @@ -218,6 +218,6 @@ Parameters: Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/repository/merged_branches ``` diff --git a/doc/api/broadcast_messages.md b/doc/api/broadcast_messages.md index 6a9a0ba745a..9a15e3ab89d 100644 --- a/doc/api/broadcast_messages.md +++ b/doc/api/broadcast_messages.md @@ -19,7 +19,7 @@ GET /broadcast_messages Example request: -```sh +```shell curl https://gitlab.example.com/api/v4/broadcast_messages ``` @@ -56,7 +56,7 @@ Parameters: Example request: -```sh +```shell curl https://gitlab.example.com/api/v4/broadcast_messages/1 ``` @@ -95,7 +95,7 @@ Parameters: Example request: -```sh +```shell curl --data "message=Deploy in progress&color=#cecece" --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/broadcast_messages ``` @@ -135,7 +135,7 @@ Parameters: Example request: -```sh +```shell curl --request PUT --data "message=Update message&color=#000" --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/broadcast_messages/1 ``` @@ -158,7 +158,7 @@ Example response: Delete a broadcast message. -```sh +```shell DELETE /broadcast_messages/:id ``` @@ -170,6 +170,6 @@ Parameters: Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/broadcast_messages/1 ``` diff --git a/doc/api/commits.md b/doc/api/commits.md index f4bb09843c8..8eb90d10536 100644 --- a/doc/api/commits.md +++ b/doc/api/commits.md @@ -19,7 +19,7 @@ GET /projects/:id/repository/commits | `with_stats` | boolean | no | Stats about each commit will be added to the response | | `first_parent` | boolean | no | Follow only the first parent commit upon seeing a merge commit | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/commits" ``` @@ -94,7 +94,7 @@ POST /projects/:id/repository/commits | `last_commit_id` | string | no | Last known file commit id. Will be only considered in update, move and delete actions. | | `execute_filemode` | boolean | no | When `true/false` enables/disables the execute flag on the file. Only considered for `chmod` action. | -```bash +```shell PAYLOAD=$(cat << 'JSON' { "branch": "master", @@ -161,7 +161,7 @@ Example response: GitLab supports [form encoding](README.md#encoding-api-parameters-of-array-and-hash-types). The following is an example using Commit API with form encoding: -```bash +```shell curl --request POST \ --form "branch=master" \ --form "commit_message=some commit message" \ @@ -201,7 +201,7 @@ Parameters: | `sha` | string | yes | The commit hash or name of a repository branch or tag | | `stats` | boolean | no | Include commit stats. Default is true | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/commits/master ``` @@ -257,7 +257,7 @@ Parameters: | `sha` | string | yes | The commit hash | | `type` | string | no | The scope of commits. Possible values `branch`, `tag`, `all`. Default is `all`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/commits/5937ac0a7beb003549fc5fd26fc247adbce4a52e/refs?type=all" ``` @@ -291,7 +291,7 @@ Parameters: | `sha` | string | yes | The commit hash | | `branch` | string | yes | The name of the branch | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/cherry_pick" ``` @@ -350,7 +350,7 @@ Parameters: | `sha` | string | yes | Commit SHA to revert | | `branch` | string | yes | Target branch name | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "branch=master" "https://gitlab.example.com/api/v4/projects/5/repository/commits/a738f717824ff53aebad8b090c1b79a14f2bd9e8/revert" ``` @@ -401,7 +401,7 @@ Parameters: | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | `sha` | string | yes | The commit hash or name of a repository branch or tag | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/diff" ``` @@ -437,7 +437,7 @@ Parameters: | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | `sha` | string | yes | The commit hash or name of a repository branch or tag | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/commits/master/comments" ``` @@ -490,7 +490,7 @@ POST /projects/:id/repository/commits/:sha/comments | `line` | integer | no | The line number where the comment should be placed | | `line_type` | string | no | The line type. Takes `new` or `old` as arguments | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "note=Nice picture man\!" --form "path=dudeism.md" --form "line=11" --form "line_type=new" https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/comments ``` @@ -536,7 +536,7 @@ GET /projects/:id/repository/commits/:sha/statuses | `name` | string | no | Filter by [job name](../ci/yaml/README.md#introduction), e.g., `bundler:audit` | `all` | boolean | no | Return all statuses, not only the latest ones -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/statuses ``` @@ -613,7 +613,7 @@ POST /projects/:id/statuses/:sha | `coverage` | float | no | The total code coverage | `pipeline_id` | integer | no | The ID of the pipeline to set status. Use in case of several pipeline on same SHA. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/17/statuses/18f3e63d05582537db6d183d9d557be09e1f90c8?state=success" ``` @@ -659,7 +659,7 @@ GET /projects/:id/repository/commits/:sha/merge_requests | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | `sha` | string | yes | The commit SHA -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/commits/af5b13261899fb2c0db30abdd0af8b07cb44fdc5/merge_requests" ``` @@ -730,7 +730,7 @@ Parameters: | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | `sha` | string | yes | The commit hash or name of a repository branch or tag | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/repository/commits/da738facbc19eb2fc2cef57c49be0e6038570352/signature" ``` diff --git a/doc/api/container_registry.md b/doc/api/container_registry.md index 7e5e265351e..4baeec3653c 100644 --- a/doc/api/container_registry.md +++ b/doc/api/container_registry.md @@ -19,7 +19,7 @@ GET /projects/:id/registry/repositories | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) accessible by the authenticated user. | | `tags` | boolean | no | If the param is included as true, each repository will include an array of `"tags"` in the response. | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories" ``` @@ -59,7 +59,7 @@ GET /groups/:id/registry/repositories | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) accessible by the authenticated user. | | `tags` | boolean | no | If the param is included as true, each repository will include an array of `"tags"` in the response. | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/groups/2/registry/repositories?tags=1" ``` @@ -125,7 +125,7 @@ DELETE /projects/:id/registry/repositories/:repository_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | `repository_id` | integer | yes | The ID of registry repository. | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2" ``` @@ -144,7 +144,7 @@ GET /projects/:id/registry/repositories/:repository_id/tags | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) accessible by the authenticated user. | | `repository_id` | integer | yes | The ID of registry repository. | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags" ``` @@ -179,7 +179,7 @@ GET /projects/:id/registry/repositories/:repository_id/tags/:tag_name | `repository_id` | integer | yes | The ID of registry repository. | | `tag_name` | string | yes | The name of tag. | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags/v10.0.0" ``` @@ -212,7 +212,7 @@ DELETE /projects/:id/registry/repositories/:repository_id/tags/:tag_name | `repository_id` | integer | yes | The ID of registry repository. | | `tag_name` | string | yes | The name of tag. | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags/v10.0.0" ``` @@ -260,18 +260,18 @@ Examples: 1. Remove tag names that are matching the regex (Git SHA), keep always at least 5, and remove ones that are older than 2 days: - ```bash + ```shell curl --request DELETE --data 'name_regex=[0-9a-z]{40}' --data 'keep_n=5' --data 'older_than=2d' --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags" ``` 1. Remove all tags, but keep always the latest 5: - ```bash + ```shell curl --request DELETE --data 'name_regex=.*' --data 'keep_n=5' --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags" ``` 1. Remove all tags that are older than 1 month: - ```bash + ```shell curl --request DELETE --data 'name_regex=.*' --data 'older_than=1month' --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/registry/repositories/2/tags" ``` diff --git a/doc/api/custom_attributes.md b/doc/api/custom_attributes.md index d270b804ad5..983b2381ae0 100644 --- a/doc/api/custom_attributes.md +++ b/doc/api/custom_attributes.md @@ -19,7 +19,7 @@ GET /projects/:id/custom_attributes | --------- | ---- | -------- | ----------- | | `id` | integer | yes | The ID of a resource | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/42/custom_attributes ``` @@ -53,7 +53,7 @@ GET /projects/:id/custom_attributes/:key | `id` | integer | yes | The ID of a resource | | `key` | string | yes | The key of the custom attribute | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/42/custom_attributes/location ``` @@ -83,7 +83,7 @@ PUT /projects/:id/custom_attributes/:key | `key` | string | yes | The key of the custom attribute | | `value` | string | yes | The value of the custom attribute | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --data "value=Greenland" https://gitlab.example.com/api/v4/users/42/custom_attributes/location ``` @@ -111,6 +111,6 @@ DELETE /projects/:id/custom_attributes/:key | `id` | integer | yes | The ID of a resource | | `key` | string | yes | The key of the custom attribute | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/42/custom_attributes/location ``` diff --git a/doc/api/dependencies.md b/doc/api/dependencies.md index 5296d4e316f..561645d7697 100644 --- a/doc/api/dependencies.md +++ b/doc/api/dependencies.md @@ -27,7 +27,7 @@ GET /projects/:id/dependencies?package_manager=yarn,bundler | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `package_manager` | string array | no | Returns dependencies belonging to specified package manager. Valid values: `bundler`, `composer`, `maven`, `npm`, `pip` or `yarn`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/dependencies ``` diff --git a/doc/api/deploy_keys.md b/doc/api/deploy_keys.md index 2e2e1bb5e1e..492777fb785 100644 --- a/doc/api/deploy_keys.md +++ b/doc/api/deploy_keys.md @@ -8,7 +8,7 @@ Get a list of all deploy keys across all projects of the GitLab instance. This e GET /deploy_keys ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/deploy_keys" ``` @@ -43,7 +43,7 @@ GET /projects/:id/deploy_keys | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/deploy_keys" ``` @@ -83,7 +83,7 @@ Parameters: | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `key_id` | integer | yes | The ID of the deploy key | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/deploy_keys/11" ``` @@ -117,7 +117,7 @@ POST /projects/:id/deploy_keys | `key` | string | yes | New deploy key | | `can_push` | boolean | no | Can deploy key push to the project's repository | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" --data '{"title": "My deploy key", "key": "ssh-rsa AAAA...", "can_push": "true"}' "https://gitlab.example.com/api/v4/projects/5/deploy_keys/" ``` @@ -147,7 +147,7 @@ PUT /projects/:id/deploy_keys/:key_id | `title` | string | no | New deploy key's title | | `can_push` | boolean | no | Can deploy key push to the project's repository | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" --data '{"title": "New deploy key", "can_push": true}' "https://gitlab.example.com/api/v4/projects/5/deploy_keys/11" ``` @@ -176,7 +176,7 @@ DELETE /projects/:id/deploy_keys/:key_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `key_id` | integer | yes | The ID of the deploy key | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/deploy_keys/13" ``` @@ -184,7 +184,7 @@ curl --request DELETE --header "PRIVATE-TOKEN: " "https://git Enables a deploy key for a project so this can be used. Returns the enabled key, with a status code 201 when successful. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/deploy_keys/13/enable ``` @@ -212,25 +212,25 @@ group, this can be achieved quite easily with the API. First, find the ID of the projects you're interested in, by either listing all projects: -```bash +```shell curl --header 'PRIVATE-TOKEN: ' https://gitlab.example.com/api/v4/projects ``` Or finding the ID of a group: -```bash +```shell curl --header 'PRIVATE-TOKEN: ' https://gitlab.example.com/api/v4/groups ``` Then listing all projects in that group (for example, group 1234): -```bash +```shell curl --header 'PRIVATE-TOKEN: ' https://gitlab.example.com/api/v4/groups/1234 ``` With those IDs, add the same deploy key to all: -```bash +```shell for project_id in 321 456 987; do curl --request POST --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" \ --data '{"title": "my key", "key": "ssh-rsa AAAA..."}' https://gitlab.example.com/api/v4/projects/${project_id}/deploy_keys diff --git a/doc/api/deployments.md b/doc/api/deployments.md index 3890a71f283..02c7e178aaf 100644 --- a/doc/api/deployments.md +++ b/doc/api/deployments.md @@ -26,7 +26,7 @@ The status attribute can be one of the following values: - failed - canceled -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/deployments" ``` @@ -186,7 +186,7 @@ GET /projects/:id/deployments/:deployment_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `deployment_id` | integer | yes | The ID of the deployment | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/deployments/1" ``` @@ -286,7 +286,7 @@ The status can be one of the following values: - failed - canceled -```bash +```shell curl --data "environment=production&sha=a91957a858320c0e17f3a0eca7cfacbff50ea29a&ref=master&tag=false&status=success" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/deployments" ``` @@ -329,7 +329,7 @@ PUT /projects/:id/deployments/:deployment_id | `deployment_id` | integer | yes | The ID of the deployment to update | | `status` | string | yes | The new status of the deployment | -```bash +```shell curl --request PUT --data "status=success" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/deployments/42" ``` @@ -372,6 +372,6 @@ GET /projects/:id/deployments/:deployment_id/merge_requests It supports the same parameters as the [Merge Requests API](./merge_requests.md#list-merge-requests) and will return a response using the same format: -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/deployments/42" ``` diff --git a/doc/api/discussions.md b/doc/api/discussions.md index 12dbba78291..285d1699a95 100644 --- a/doc/api/discussions.md +++ b/doc/api/discussions.md @@ -110,7 +110,7 @@ GET /projects/:id/issues/:issue_iid/discussions ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/discussions ``` @@ -130,7 +130,7 @@ Parameters: | `issue_iid` | integer | yes | The IID of an issue | | `discussion_id` | integer | yes | The ID of a discussion item | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7 ``` @@ -151,7 +151,7 @@ Parameters: | `body` | string | yes | The content of the thread | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/discussions?body=comment ``` @@ -177,7 +177,7 @@ Parameters: | `body` | string | yes | The content of the note/reply | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment ``` @@ -199,7 +199,7 @@ Parameters: | `note_id` | integer | yes | The ID of a thread note | | `body` | string | yes | The content of the note/reply | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment ``` @@ -220,7 +220,7 @@ Parameters: | `discussion_id` | integer | yes | The ID of a discussion | | `note_id` | integer | yes | The ID of a discussion note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/discussions/636 ``` @@ -318,7 +318,7 @@ GET /projects/:id/snippets/:snippet_id/discussions ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions ``` @@ -338,7 +338,7 @@ Parameters: | `snippet_id` | integer | yes | The ID of an snippet | | `discussion_id` | integer | yes | The ID of a discussion item | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7 ``` @@ -360,7 +360,7 @@ Parameters: | `body` | string | yes | The content of a discussion | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions?body=comment ``` @@ -383,7 +383,7 @@ Parameters: | `body` | string | yes | The content of the note/reply | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment ``` @@ -405,7 +405,7 @@ Parameters: | `note_id` | integer | yes | The ID of a thread note | | `body` | string | yes | The content of the note/reply | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment ``` @@ -426,7 +426,7 @@ Parameters: | `discussion_id` | integer | yes | The ID of a discussion | | `note_id` | integer | yes | The ID of a discussion note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/discussions/636 ``` @@ -525,7 +525,7 @@ GET /groups/:id/epics/:epic_id/discussions ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/discussions ``` @@ -545,7 +545,7 @@ Parameters: | `epic_id` | integer | yes | The ID of an epic | | `discussion_id` | integer | yes | The ID of a discussion item | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7 ``` @@ -567,7 +567,7 @@ Parameters: | `body` | string | yes | The content of the thread | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/discussions?body=comment ``` @@ -591,7 +591,7 @@ Parameters: | `body` | string | yes | The content of the note/reply | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment ``` @@ -613,7 +613,7 @@ Parameters: | `note_id` | integer | yes | The ID of a thread note | | `body` | string | yes | The content of note/reply | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment ``` @@ -634,7 +634,7 @@ Parameters: | `discussion_id` | integer | yes | The ID of a thread | | `note_id` | integer | yes | The ID of a thread note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/discussions/636 ``` @@ -785,7 +785,7 @@ Diff comments contain also position: ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions ``` @@ -805,7 +805,7 @@ Parameters: | `merge_request_iid` | integer | yes | The IID of a merge request | | `discussion_id` | integer | yes | The ID of a discussion item | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7 ``` @@ -840,7 +840,7 @@ Parameters: | `position[x]` | integer | no | X coordinate (for 'image' diff notes) | | `position[y]` | integer | no | Y coordinate (for 'image' diff notes) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions?body=comment ``` @@ -861,7 +861,7 @@ Parameters: | `discussion_id` | integer | yes | The ID of a thread | | `resolved` | boolean | yes | Resolve/unresolve the discussion | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7?resolved=true ``` @@ -885,7 +885,7 @@ Parameters: | `body` | string | yes | The content of the note/reply | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment ``` @@ -908,13 +908,13 @@ Parameters: | `body` | string | no | The content of the note/reply (exactly one of `body` or `resolved` must be set | | `resolved` | boolean | no | Resolve/unresolve the note (exactly one of `body` or `resolved` must be set | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment ``` Resolving a note: -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?resolved=true ``` @@ -935,7 +935,7 @@ Parameters: | `discussion_id` | integer | yes | The ID of a thread | | `note_id` | integer | yes | The ID of a thread note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/discussions/636 ``` @@ -1078,7 +1078,7 @@ Diff comments contain also position: ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions ``` @@ -1098,7 +1098,7 @@ Parameters: | `commit_id` | integer | yes | The ID of a commit | | `discussion_id` | integer | yes | The ID of a discussion item | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7 ``` @@ -1133,7 +1133,7 @@ Parameters: | `position[x]` | integer | no | X coordinate (for 'image' diff notes) | | `position[y]` | integer | no | Y coordinate (for 'image' diff notes) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions?body=comment ``` @@ -1156,7 +1156,7 @@ Parameters: | `body` | string | yes | The content of the note/reply | | `created_at` | string | no | Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes?body=comment ``` @@ -1178,13 +1178,13 @@ Parameters: | `note_id` | integer | yes | The ID of a thread note | | `body` | string | no | The content of a note | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?body=comment ``` Resolving a note: -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/6a9c1750b37d513a43987b574953fceb50b03ce7/notes/1108?resolved=true ``` @@ -1205,6 +1205,6 @@ Parameters: | `discussion_id` | integer | yes | The ID of a thread | | `note_id` | integer | yes | The ID of a thread note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/commits/11/discussions/636 ``` diff --git a/doc/api/environments.md b/doc/api/environments.md index 3f46c11ed69..6817b904618 100644 --- a/doc/api/environments.md +++ b/doc/api/environments.md @@ -14,7 +14,7 @@ GET /projects/:id/environments | `name` | string | no | Return the environment with this name. Mutually exclusive with `search` | | `search` | string | no | Return list of environments matching the search criteria. Mutually exclusive with `name` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/environments?name=review%2Ffix-foo ``` @@ -43,7 +43,7 @@ GET /projects/:id/environments/:environment_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `environment_id` | integer | yes | The ID of the environment | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/environments/1" ``` @@ -155,7 +155,7 @@ POST /projects/:id/environments | `name` | string | yes | The name of the environment | | `external_url` | string | no | Place to link to for this environment | -```bash +```shell curl --data "name=deploy&external_url=https://deploy.example.gitlab.com" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/environments" ``` @@ -188,7 +188,7 @@ PUT /projects/:id/environments/:environments_id | `name` | string | no | The new name of the environment | | `external_url` | string | no | The new external_url | -```bash +```shell curl --request PUT --data "name=staging&external_url=https://staging.example.gitlab.com" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/environments/1" ``` @@ -217,7 +217,7 @@ DELETE /projects/:id/environments/:environment_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `environment_id` | integer | yes | The ID of the environment | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/environments/1" ``` @@ -234,7 +234,7 @@ POST /projects/:id/environments/:environment_id/stop | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `environment_id` | integer | yes | The ID of the environment | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/environments/1/stop" ``` diff --git a/doc/api/epic_issues.md b/doc/api/epic_issues.md index 02317cc6c09..cea6da43add 100644 --- a/doc/api/epic_issues.md +++ b/doc/api/epic_issues.md @@ -19,7 +19,7 @@ GET /groups/:id/epics/:epic_iid/issues | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `epic_iid` | integer/string | yes | The internal ID of the epic. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/issues/ ``` @@ -116,7 +116,7 @@ POST /groups/:id/epics/:epic_iid/issues/:issue_id | `epic_iid` | integer/string | yes | The internal ID of the epic. | | `issue_id` | integer/string | yes | The ID of the issue. | -```bash +```shell curl --header POST "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/issues/55 ``` @@ -222,7 +222,7 @@ DELETE /groups/:id/epics/:epic_iid/issues/:epic_issue_id | `epic_iid` | integer/string | yes | The internal ID of the epic. | | `epic_issue_id` | integer/string | yes | The ID of the issue - epic association. | -```bash +```shell curl --header DELETE "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/issues/11 ``` @@ -330,7 +330,7 @@ PUT /groups/:id/epics/:epic_iid/issues/:epic_issue_id | `move_before_id` | integer/string | no | The ID of the issue - epic association that should be placed before the link in the question. | | `move_after_id` | integer/string | no | The ID of the issue - epic association that should be placed after the link in the question. | -```bash +```shell curl --header PUT "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/issues/11?move_before_id=20 ``` diff --git a/doc/api/epic_links.md b/doc/api/epic_links.md index e81dc88da81..4b88de6a37d 100644 --- a/doc/api/epic_links.md +++ b/doc/api/epic_links.md @@ -24,7 +24,7 @@ GET /groups/:id/epics/:epic_iid/epics | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `epic_iid` | integer | yes | The internal ID of the epic. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/epics/ ``` @@ -79,7 +79,7 @@ POST /groups/:id/epics/:epic_iid/epics | `epic_iid` | integer | yes | The internal ID of the epic. | | `child_epic_id` | integer | yes | The global ID of the child epic. Internal ID can't be used because they can conflict with epics from other groups. | -```bash +```shell curl --header POST "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/epics/6 ``` @@ -132,7 +132,7 @@ POST /groups/:id/epics/:epic_iid/epics | `epic_iid` | integer | yes | The internal ID of the (future parent) epic. | | `title` | string | yes | The title of a newly created epic. | -```bash +```shell curl --header POST "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/epics?title=Newpic ``` @@ -167,7 +167,7 @@ PUT /groups/:id/epics/:epic_iid/epics/:child_epic_id | `move_before_id` | integer | no | The global ID of a sibling epic that should be placed before the child epic. | | `move_after_id` | integer | no | The global ID of a sibling epic that should be placed after the child epic. | -```bash +```shell curl --header PUT "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5 ``` @@ -222,7 +222,7 @@ DELETE /groups/:id/epics/:epic_iid/epics/:child_epic_id | `epic_iid` | integer | yes | The internal ID of the epic. | | `child_epic_id` | integer | yes | The global ID of the child epic. Internal ID can't be used because they can conflict with epics from other groups. | -```bash +```shell curl --header DELETE "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/4/epics/5 ``` diff --git a/doc/api/epics.md b/doc/api/epics.md index 109c12c1052..34b0bcba303 100644 --- a/doc/api/epics.md +++ b/doc/api/epics.md @@ -65,7 +65,7 @@ GET /groups/:id/epics?state=opened | `include_ancestor_groups` | boolean | no | Include epics from the requested group's ancestors. Default is `false` | | `include_descendant_groups` | boolean | no | Include epics from the requested group's descendants. Default is `true` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics ``` @@ -169,7 +169,7 @@ GET /groups/:id/epics/:epic_iid | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `epic_iid` | integer/string | yes | The internal ID of the epic. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5 ``` @@ -244,7 +244,7 @@ POST /groups/:id/epics | `due_date_fixed` | string | no | The fixed due date of an epic (since 11.3) | | `parent_id` | integer/string | no | The id of a parent epic (since 11.11) | -```bash +```shell curl --header POST "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics?title=Epic&description=Epic%20description ``` @@ -319,7 +319,7 @@ PUT /groups/:id/epics/:epic_iid | `due_date_fixed` | string | no | The fixed due date of an epic (since 11.3) | | `state_event` | string | no | State event for an epic. Set `close` to close the epic and `reopen` to reopen it (since 11.4) | -```bash +```shell curl --header PUT "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5?title=New%20Title ``` @@ -381,7 +381,7 @@ DELETE /groups/:id/epics/:epic_iid | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `epic_iid` | integer/string | yes | The internal ID of the epic. | -```bash +```shell curl --header DELETE "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5 ``` @@ -400,7 +400,7 @@ POST /groups/:id/epics/:epic_iid/todo | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `epic_iid` | integer | yes | The internal ID of a group's epic | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/5/todo ``` diff --git a/doc/api/error_tracking.md b/doc/api/error_tracking.md index 3c1fbb7dc7a..6efafd4189a 100644 --- a/doc/api/error_tracking.md +++ b/doc/api/error_tracking.md @@ -16,7 +16,7 @@ GET /projects/:id/error_tracking/settings | --------- | ------- | -------- | --------------------- | | `id` | integer | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/error_tracking/settings ``` diff --git a/doc/api/events.md b/doc/api/events.md index 1dc0b054ee6..f3963bcf970 100644 --- a/doc/api/events.md +++ b/doc/api/events.md @@ -71,7 +71,7 @@ Parameters: Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/events?target_type=issue&action=created&after=2017-01-31&before=2017-03-01&scope=all ``` @@ -143,7 +143,7 @@ Parameters: | `after` | date | no | Include only events created after a particular date. Please see [here for the supported format][date-formatting] | | `sort` | string | no | Sort events in `asc` or `desc` order by `created_at`. Default is `desc` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/:id/events ``` @@ -276,7 +276,7 @@ Parameters: Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:project_id/events?target_type=issue&action=created&after=2017-01-31&before=2017-03-01 ``` diff --git a/doc/api/feature_flag_specs.md b/doc/api/feature_flag_specs.md index 6a2cd047f85..e41bbea0e66 100644 --- a/doc/api/feature_flag_specs.md +++ b/doc/api/feature_flag_specs.md @@ -25,7 +25,7 @@ GET /projects/:id/feature_flag_scopes | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `environment` | string | yes | The [environment](../ci/environments.md) name | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/feature_flag_scopes?environment=production ``` @@ -93,7 +93,7 @@ GET /projects/:id/feature_flags/:name/scopes | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `name` | string | yes | The name of the feature flag. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace/scopes ``` @@ -159,7 +159,7 @@ POST /projects/:id/feature_flags/:name/scopes | `active` | boolean | yes | Whether the spec is active. | | `strategies` | json | yes | The [strategies](../user/project/operations/feature_flags.md#feature-flag-strategies) of the feature flag spec. | -```bash +```shell curl https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace/scopes \ --header "PRIVATE-TOKEN: " \ --header "Content-type: application/json" \ @@ -204,7 +204,7 @@ GET /projects/:id/feature_flags/:name/scopes/:environment_scope | `name` | string | yes | The name of the feature flag. | | `environment_scope` | string | yes | The URL-encoded [environment spec](../ci/environments.md#scoping-environments-with-specs) of the feature flag. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/feature_flags/new_live_trace/scopes/production ``` @@ -242,7 +242,7 @@ PUT /projects/:id/feature_flags/:name/scopes/:environment_scope | `active` | boolean | yes | Whether the spec is active. | | `strategies` | json | yes | The [strategies](../user/project/operations/feature_flags.md#feature-flag-strategies) of the feature flag spec. | -```bash +```shell curl https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace/scopes/production \ --header "PRIVATE-TOKEN: " \ --header "Content-type: application/json" \ @@ -286,6 +286,6 @@ DELETE /projects/:id/feature_flags/:name/scopes/:environment_scope | `name` | string | yes | The name of the feature flag. | | `environment_scope` | string | yes | The URL-encoded [environment spec](../ci/environments.md#scoping-environments-with-specs) of the feature flag. | -```bash +```shell curl --header "PRIVATE-TOKEN: " --request DELETE https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace/scopes/production ``` diff --git a/doc/api/feature_flags.md b/doc/api/feature_flags.md index def452d36fb..384708be5df 100644 --- a/doc/api/feature_flags.md +++ b/doc/api/feature_flags.md @@ -24,7 +24,7 @@ GET /projects/:id/feature_flags | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `scope` | string | no | The condition of feature flags, one of: `enabled`, `disabled`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/feature_flags ``` @@ -159,7 +159,7 @@ POST /projects/:id/feature_flags | `scopes:active` | boolean | no | Whether the spec is active. | | `scopes:strategies` | JSON | no | The [strategies](../user/project/operations/feature_flags.md#feature-flag-strategies) of the feature flag spec. | -```bash +```shell curl https://gitlab.example.com/api/v4/projects/1/feature_flags \ --header "PRIVATE-TOKEN: " \ --header "Content-type: application/json" \ @@ -228,7 +228,7 @@ GET /projects/:id/feature_flags/:name | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `name` | string | yes | The name of the feature flag. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/feature_flags/new_live_trace ``` @@ -303,6 +303,6 @@ DELETE /projects/:id/feature_flags/:name | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `name` | string | yes | The name of the feature flag. | -```bash +```shell curl --header "PRIVATE-TOKEN: " --request DELETE https://gitlab.example.com/api/v4/projects/1/feature_flags/awesome_feature ``` diff --git a/doc/api/features.md b/doc/api/features.md index 8b5ea27007d..d3c585f67c9 100644 --- a/doc/api/features.md +++ b/doc/api/features.md @@ -13,7 +13,7 @@ Get a list of all persisted features, with its gate values. GET /features ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/features ``` @@ -66,7 +66,7 @@ POST /features/:name Note that you can enable or disable a feature for a `feature_group`, a `user`, a `group`, and a `project` in a single API call. -```bash +```shell curl --data "value=30" --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/features/new_library ``` diff --git a/doc/api/geo_nodes.md b/doc/api/geo_nodes.md index 18c4dd1bc8f..83a00cf3f10 100644 --- a/doc/api/geo_nodes.md +++ b/doc/api/geo_nodes.md @@ -11,7 +11,7 @@ Creates a new Geo node. POST /geo_nodes ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/geo_nodes \ --request POST \ -d "name=himynameissomething" \ @@ -72,7 +72,7 @@ Example response: GET /geo_nodes ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/geo_nodes ``` @@ -139,7 +139,7 @@ Example response: GET /geo_nodes/:id ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/geo_nodes/1 ``` @@ -286,7 +286,7 @@ Example response: GET /geo_nodes/status ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/geo_nodes/status ``` @@ -445,7 +445,7 @@ In GitLab 12.0, deprecated fields `wikis_count` and `repositories_count` were re GET /geo_nodes/:id/status ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/geo_nodes/2/status ``` @@ -523,7 +523,7 @@ GET /geo_nodes/current/failures This endpoint uses [Pagination](README.md#pagination). -```bash +```shell curl --header "PRIVATE-TOKEN: " https://primary.example.com/api/v4/geo_nodes/current/failures ``` diff --git a/doc/api/graphql/getting_started.md b/doc/api/graphql/getting_started.md index 57c0fcc659c..ee0642b185b 100644 --- a/doc/api/graphql/getting_started.md +++ b/doc/api/graphql/getting_started.md @@ -21,7 +21,7 @@ to use as a bearer token. Example: -```sh +```shell GRAPHQL_TOKEN= curl 'https://gitlab.com/api/graphql' --header "Authorization: Bearer $GRAPHQL_TOKEN" --header "Content-Type: application/json" --request POST --data "{\"query\": \"query {currentUser {name}}\"}" ``` diff --git a/doc/api/group_badges.md b/doc/api/group_badges.md index 70179ecde29..d46f7198571 100644 --- a/doc/api/group_badges.md +++ b/doc/api/group_badges.md @@ -28,7 +28,7 @@ GET /groups/:id/badges | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `name` | string | no | Name of the badges to return (case-sensitive). | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/badges?name=Coverage ``` @@ -61,7 +61,7 @@ GET /groups/:id/badges/:badge_id | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `badge_id` | integer | yes | The badge ID | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/badges/:badge_id ``` @@ -92,7 +92,7 @@ POST /groups/:id/badges | `link_url` | string | yes | URL of the badge link | | `image_url` | string | yes | URL of the badge image | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --data "link_url=https://gitlab.com/gitlab-org/gitlab-foss/commits/master&image_url=https://shields.io/my/badge1&position=0" https://gitlab.example.com/api/v4/groups/:id/badges ``` @@ -124,7 +124,7 @@ PUT /groups/:id/badges/:badge_id | `link_url` | string | no | URL of the badge link | | `image_url` | string | no | URL of the badge image | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/badges/:badge_id ``` @@ -154,7 +154,7 @@ DELETE /groups/:id/badges/:badge_id | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `badge_id` | integer | yes | The badge ID | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/badges/:badge_id ``` @@ -172,7 +172,7 @@ GET /groups/:id/badges/render | `link_url` | string | yes | URL of the badge link| | `image_url` | string | yes | URL of the badge image | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/badges/render?link_url=http%3A%2F%2Fexample.com%2Fci_status.svg%3Fproject%3D%25%7Bproject_path%7D%26ref%3D%25%7Bdefault_branch%7D&image_url=https%3A%2F%2Fshields.io%2Fmy%2Fbadge ``` diff --git a/doc/api/group_boards.md b/doc/api/group_boards.md index 444cb90a7e8..f4d45f8f402 100644 --- a/doc/api/group_boards.md +++ b/doc/api/group_boards.md @@ -17,7 +17,7 @@ GET /groups/:id/boards | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards ``` @@ -135,7 +135,7 @@ GET /groups/:id/boards/:board_id | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `board_id` | integer | yes | The ID of a board | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1 ``` @@ -249,7 +249,7 @@ POST /groups/:id/boards | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `name` | string | yes | The name of the new board | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards?name=newboard ``` @@ -320,7 +320,7 @@ PUT /groups/:id/boards/:board_id | `labels` | string | no | Comma-separated list of label names which the board should be scoped to | | `weight` | integer | no | The weight range from 0 to 9, to which the board should be scoped to | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1?name=new_name&milestone_id=44&assignee_id=1&labels=GroupLabel&weight=4 ``` @@ -381,7 +381,7 @@ DELETE /groups/:id/boards/:board_id | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `board_id` | integer | yes | The ID of a board | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1 ``` @@ -399,7 +399,7 @@ GET /groups/:id/boards/:board_id/lists | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `board_id` | integer | yes | The ID of a board | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1/lists ``` @@ -451,7 +451,7 @@ GET /groups/:id/boards/:board_id/lists/:list_id | `board_id` | integer | yes | The ID of a board | | `list_id` | integer | yes | The ID of a board's list | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1/lists/1 ``` @@ -483,7 +483,7 @@ POST /groups/:id/boards/:board_id/lists | `board_id` | integer | yes | The ID of a board | | `label_id` | integer | yes | The ID of a label | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1/lists?label_id=5 ``` @@ -516,7 +516,7 @@ PUT /groups/:id/boards/:board_id/lists/:list_id | `list_id` | integer | yes | The ID of a board's list | | `position` | integer | yes | The position of the list | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/group/5/boards/1/lists/1?position=2 ``` @@ -548,6 +548,6 @@ DELETE /groups/:id/boards/:board_id/lists/:list_id | `board_id` | integer | yes | The ID of a board | | `list_id` | integer | yes | The ID of a board's list | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/boards/1/lists/1 ``` diff --git a/doc/api/group_clusters.md b/doc/api/group_clusters.md index 143f5762811..fd8b22b070b 100644 --- a/doc/api/group_clusters.md +++ b/doc/api/group_clusters.md @@ -22,7 +22,7 @@ Parameters: Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/groups/26/clusters ``` @@ -90,7 +90,7 @@ Parameters: Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/groups/26/clusters/18 ``` @@ -166,7 +166,7 @@ Parameters: Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/groups/26/clusters/user \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ @@ -237,7 +237,7 @@ through the ["Add existing cluster to group"](#add-existing-cluster-to-group) en Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/groups/26/clusters/24 \ -H "Content-Type:application/json" \ --request PUT --data '{"name":"new-cluster-name","domain":"new-domain.com","api_url":"https://new-api-url.com"}' @@ -307,6 +307,6 @@ Parameters: Example request: -```bash +```shell curl --request DELETE --header 'Private-Token: ' https://gitlab.example.com/api/v4/groups/26/clusters/23 ``` diff --git a/doc/api/group_labels.md b/doc/api/group_labels.md index f41f3a0a402..2c5406bbc21 100644 --- a/doc/api/group_labels.md +++ b/doc/api/group_labels.md @@ -21,7 +21,7 @@ GET /groups/:id/labels | `with_counts` | boolean | no | Whether or not to include issue and merge request counts. Defaults to `false`. _([Introduced in GitLab 12.2](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31543))_ | | `include_ancestor_groups` | boolean | no | Include ancestor groups. Defaults to `true`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/labels?with_counts=true ``` @@ -70,7 +70,7 @@ GET /groups/:id/labels/:label_id | `label_id` | integer or string | yes | The ID or title of a group's label. | | `include_ancestor_groups` | boolean | no | Include ancestor groups. Defaults to `true`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/labels/bug ``` @@ -106,7 +106,7 @@ POST /groups/:id/labels | `color` | string | yes | The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords) | | `description` | string | no | The description of the label, | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" --data '{"name": "Feature Proposal", "color": "#FFA500", "description": "Describes new ideas" }' https://gitlab.example.com/api/v4/groups/5/labels ``` @@ -143,7 +143,7 @@ PUT /groups/:id/labels/:label_id | `color` | string | no | The color of the label given in 6-digit hex notation with leading '#' sign (e.g. #FFAABB) or one of the [CSS color names](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_keywords) | | `description` | string | no | The description of the label. | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" --data '{"new_name": "Feature Idea" }' https://gitlab.example.com/api/v4/groups/5/labels/Feature%20Proposal ``` @@ -179,7 +179,7 @@ DELETE /groups/:id/labels/:label_id | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/labels/bug ``` @@ -199,7 +199,7 @@ POST /groups/:id/labels/:label_id/subscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/labels/9/subscribe ``` @@ -235,7 +235,7 @@ POST /groups/:id/labels/:label_id/unsubscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the group](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/labels/9/unsubscribe ``` diff --git a/doc/api/group_milestones.md b/doc/api/group_milestones.md index a77f12de5a1..e469217db78 100644 --- a/doc/api/group_milestones.md +++ b/doc/api/group_milestones.md @@ -26,7 +26,7 @@ Parameters: | `title` | string | optional | Return only the milestones having the given `title` | | `search` | string | optional | Return only milestones with a title or description matching the provided string | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/milestones ``` diff --git a/doc/api/groups.md b/doc/api/groups.md index 411e5e5f8ca..f74aa4c200f 100644 --- a/doc/api/groups.md +++ b/doc/api/groups.md @@ -251,7 +251,7 @@ Parameters: | `with_custom_attributes` | boolean | no | Include [custom attributes](custom_attributes.md) in response (admins only). | | `with_projects` | boolean | no | Include details from projects that belong to the specified group (defaults to `true`). | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/4 ``` @@ -431,7 +431,7 @@ Additional response parameters: When adding the parameter `with_projects=false`, projects will not be returned. -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/4?with_projects=false ``` @@ -542,7 +542,7 @@ PUT /groups/:id | `shared_runners_minutes_limit` | integer | no | **(STARTER ONLY)** Pipeline minutes quota for this group. | | `extra_shared_runners_minutes_limit` | integer | no | **(STARTER ONLY)** Extra pipeline minutes quota for this group. | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/groups/5?name=Experimental" ``` diff --git a/doc/api/import.md b/doc/api/import.md index 1deb26e8388..0f8a9bc71d1 100644 --- a/doc/api/import.md +++ b/doc/api/import.md @@ -15,7 +15,7 @@ POST /import/github | `new_name` | string | no | New repo name | | `target_namespace` | string | yes | Namespace to import repo into | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" --data "personal_access_token=abc123&repo_id=12345&target_namespace=root" https://gitlab.example.com/api/v4/import/github ``` diff --git a/doc/api/issue_links.md b/doc/api/issue_links.md index 7c7901d5551..941cc0b1347 100644 --- a/doc/api/issue_links.md +++ b/doc/api/issue_links.md @@ -69,7 +69,7 @@ POST /projects/:id/issues/:issue_iid/links | `target_issue_iid` | integer/string | yes | The internal ID of a target project's issue | | `link_type` | string | no | The type of the relation ("relates_to", "blocks", "is_blocked_by"), defaults to "relates_to"). Ignored unless `issue_link_types` feature flag is enabled. | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/4/issues/1/links?target_project_id=5&target_issue_iid=1" ``` diff --git a/doc/api/issues.md b/doc/api/issues.md index 3c28b55d1d6..68fcc55acf2 100644 --- a/doc/api/issues.md +++ b/doc/api/issues.md @@ -68,7 +68,7 @@ GET /issues?confidential=true | `confidential` | Boolean | no | Filter confidential or public issues. | | `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/issues ``` @@ -223,7 +223,7 @@ GET /groups/:id/issues?confidential=true | `confidential` | Boolean | no | Filter confidential or public issues. | | `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/4/issues ``` @@ -377,7 +377,7 @@ GET /projects/:id/issues?confidential=true | `confidential` | Boolean | no | Filter confidential or public issues. | | `not` | Hash | no | Return issues that do not match the parameters supplied. Accepts: `labels`, `milestone`, `author_id`, `author_username`, `assignee_id`, `assignee_username`, `my_reaction_emoji`, `search`, `in` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues ``` @@ -505,7 +505,7 @@ GET /projects/:id/issues/:issue_iid | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues/41 ``` @@ -658,7 +658,7 @@ POST /projects/:id/issues | `epic_id` **(ULTIMATE)** | integer | no | ID of the epic to add the issue to. Valid values are greater than or equal to 0. | | `epic_iid` **(ULTIMATE)** | integer | no | IID of the epic to add the issue to. Valid values are greater than or equal to 0. (deprecated, [will be removed in 13.0](https://gitlab.com/gitlab-org/gitlab/issues/35157)) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues?title=Issues%20with%20auth&labels=bug ``` @@ -766,7 +766,7 @@ PUT /projects/:id/issues/:issue_iid | `epic_id` **(ULTIMATE)** | integer | no | ID of the epic to add the issue to. Valid values are greater than or equal to 0. | | `epic_iid` **(ULTIMATE)** | integer | no | IID of the epic to add the issue to. Valid values are greater than or equal to 0. (deprecated, [will be removed in 13.0](https://gitlab.com/gitlab-org/gitlab/issues/35157)) | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues/85?state_event=close ``` @@ -867,7 +867,7 @@ DELETE /projects/:id/issues/:issue_iid | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues/85 ``` @@ -890,7 +890,7 @@ POST /projects/:id/issues/:issue_iid/move | `issue_iid` | integer | yes | The internal ID of a project's issue | | `to_project_id` | integer | yes | The ID of the new project | -```bash +```shell curl --header "PRIVATE-TOKEN: " --form to_project_id=5 https://gitlab.example.com/api/v4/projects/4/issues/85/move ``` @@ -996,7 +996,7 @@ POST /projects/:id/issues/:issue_iid/subscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/subscribe ``` @@ -1102,7 +1102,7 @@ POST /projects/:id/issues/:issue_iid/unsubscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/unsubscribe ``` @@ -1173,7 +1173,7 @@ POST /projects/:id/issues/:issue_iid/todo | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/todo ``` @@ -1288,7 +1288,7 @@ POST /projects/:id/issues/:issue_iid/time_estimate | `issue_iid` | integer | yes | The internal ID of a project's issue | | `duration` | string | yes | The duration in human format. e.g: 3h30m | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/time_estimate?duration=3h30m ``` @@ -1316,7 +1316,7 @@ POST /projects/:id/issues/:issue_iid/reset_time_estimate | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/reset_time_estimate ``` @@ -1345,7 +1345,7 @@ POST /projects/:id/issues/:issue_iid/add_spent_time | `issue_iid` | integer | yes | The internal ID of a project's issue | | `duration` | string | yes | The duration in human format. e.g: 3h30m | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/add_spent_time?duration=1h ``` @@ -1373,7 +1373,7 @@ POST /projects/:id/issues/:issue_iid/reset_spent_time | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/reset_spent_time ``` @@ -1399,7 +1399,7 @@ GET /projects/:id/issues/:issue_iid/time_stats | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/time_stats ``` @@ -1427,7 +1427,7 @@ GET /projects/:id/issues/:issue_id/related_merge_requests | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```sh +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/11/related_merge_requests ``` @@ -1583,7 +1583,7 @@ GET /projects/:id/issues/:issue_iid/closed_by | `id` | integer | yes | The ID of a project | | `issue_iid` | integer | yes | The internal ID of a project issue | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/issues/11/closed_by ``` @@ -1656,7 +1656,7 @@ GET /projects/:id/issues/:issue_iid/participants | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/participants ``` @@ -1700,7 +1700,7 @@ GET /projects/:id/issues/:issue_iid/user_agent_detail | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `issue_iid` | integer | yes | The internal ID of a project's issue | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/93/user_agent_detail ``` diff --git a/doc/api/issues_statistics.md b/doc/api/issues_statistics.md index d7edb296be2..2c391166088 100644 --- a/doc/api/issues_statistics.md +++ b/doc/api/issues_statistics.md @@ -45,7 +45,7 @@ GET /issues_statistics?confidential=true | `updated_before` | datetime | no | Return issues updated on or before the given time | | `confidential` | Boolean | no | Filter confidential or public issues. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/issues_statistics ``` @@ -101,7 +101,7 @@ GET /groups/:id/issues_statistics?confidential=true | `updated_before` | datetime | no | Return issues updated on or before the given time | | `confidential` | Boolean | no | Filter confidential or public issues. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/4/issues_statistics ``` @@ -157,7 +157,7 @@ GET /projects/:id/issues_statistics?confidential=true | `updated_before` | datetime | no | Return issues updated on or before the given time | | `confidential` | Boolean | no | Filter confidential or public issues. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/issues_statistics ``` diff --git a/doc/api/jobs.md b/doc/api/jobs.md index 5f661ac4c76..b9efb20d140 100644 --- a/doc/api/jobs.md +++ b/doc/api/jobs.md @@ -13,7 +13,7 @@ GET /projects/:id/jobs | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | `scope` | string **or** array of strings | no | Scope of jobs to show. Either one of or an array of the following: `created`, `pending`, `running`, `failed`, `success`, `canceled`, `skipped`, or `manual`. All jobs are returned if `scope` is not provided. | -```sh +```shell curl --globoff --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/1/jobs?scope[]=pending&scope[]=running' ``` @@ -148,7 +148,7 @@ GET /projects/:id/pipelines/:pipeline_id/jobs | `pipeline_id` | integer | yes | ID of a pipeline. | | `scope` | string **or** array of strings | no | Scope of jobs to show. Either one of or an array of the following: `created`, `pending`, `running`, `failed`, `success`, `canceled`, `skipped`, or `manual`. All jobs are returned if `scope` is not provided. | -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/1/pipelines/6/jobs?scope[]=pending&scope[]=running' ``` @@ -282,7 +282,7 @@ GET /projects/:id/jobs/:job_id | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | `job_id` | integer | yes | ID of a job. | -```sh +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/8" ``` @@ -363,7 +363,7 @@ GET /projects/:id/jobs/:job_id/artifacts Example request using the `PRIVATE-TOKEN` header: -```sh +```shell curl --output artifacts.zip --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/42/artifacts" ``` @@ -429,7 +429,7 @@ Parameters Example request using the `PRIVATE-TOKEN` header: -```sh +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/download?job=test" ``` @@ -490,7 +490,7 @@ Parameters Example request: -```sh +```shell curl --location --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/5/artifacts/some/release/file.pdf" ``` @@ -525,7 +525,7 @@ Parameters: Example request: -```sh +```shell curl --location --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/artifacts/master/raw/some/release/file.pdf?job=pdf" ``` @@ -550,7 +550,7 @@ GET /projects/:id/jobs/:job_id/trace | id | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | job_id | integer | yes | ID of a job. | -```sh +```shell curl --location --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/8/trace" ``` @@ -574,7 +574,7 @@ POST /projects/:id/jobs/:job_id/cancel | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | `job_id` | integer | yes | ID of a job. | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/1/cancel" ``` @@ -623,7 +623,7 @@ POST /projects/:id/jobs/:job_id/retry | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | `job_id` | integer | yes | ID of a job. | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/1/retry" ``` @@ -676,7 +676,7 @@ Parameters Example of request -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/1/erase" ``` @@ -730,7 +730,7 @@ Parameters Example request: -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/1/artifacts/keep" ``` @@ -784,7 +784,7 @@ DELETE /projects/:id/jobs/:job_id/artifacts Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/1/artifacts" ``` @@ -806,7 +806,7 @@ POST /projects/:id/jobs/:job_id/play | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user. | | `job_id` | integer | yes | ID of a job. | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/jobs/1/play" ``` diff --git a/doc/api/keys.md b/doc/api/keys.md index e05b1191715..05933e5a1d1 100644 --- a/doc/api/keys.md +++ b/doc/api/keys.md @@ -14,7 +14,7 @@ GET /keys/:id Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/keys/1 ``` @@ -72,7 +72,7 @@ GET /keys Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/keys?fingerprint=ba:81:59:68:d7:6c:cd:02:02:bf:6a:9b:55:4e:af:d1' ``` @@ -80,7 +80,7 @@ If using sha256 fingerprint API calls, make sure that the fingerprint is URL-enc For example, `/` is represented by `%2F` and `:` is represented by`%3A`: -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/keys?fingerprint=SHA256%3AnUhzNyftwADy8AH3wFY31tAKs7HufskYTte2aXo%2FlCg ``` @@ -138,7 +138,7 @@ fingerprint you get additional information about the projects using that key. Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/keys?fingerprint=SHA256%3AnUhzNyftwADy8AH3wFY31tAKs7HufskYTte2aXo%2FlCg ``` diff --git a/doc/api/labels.md b/doc/api/labels.md index ac5156e8c20..f8757b71339 100644 --- a/doc/api/labels.md +++ b/doc/api/labels.md @@ -17,7 +17,7 @@ GET /projects/:id/labels | `with_counts` | boolean | no | Whether or not to include issue and merge request counts. Defaults to `false`. _([Introduced in GitLab 12.2](https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/31543))_ | | `include_ancestor_groups` | boolean | no | Include ancestor groups. Defaults to `true`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/labels?with_counts=true ``` @@ -112,7 +112,7 @@ GET /projects/:id/labels/:label_id | `label_id` | integer or string | yes | The ID or title of a group's label. | | `include_ancestor_groups` | boolean | no | Include ancestor groups. Defaults to `true`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/labels/bug ``` @@ -151,7 +151,7 @@ POST /projects/:id/labels | `description` | string | no | The description of the label | | `priority` | integer | no | The priority of the label. Must be greater or equal than zero or `null` to remove the priority. | -```bash +```shell curl --data "name=feature&color=#5843AD" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/labels" ``` @@ -187,7 +187,7 @@ DELETE /projects/:id/labels/:label_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/labels/bug" ``` @@ -211,7 +211,7 @@ PUT /projects/:id/labels/:label_id | `description` | string | no | The new description of the label | | `priority` | integer | no | The new priority of the label. Must be greater or equal than zero or `null` to remove the priority. | -```bash +```shell curl --request PUT --data "new_name=docs&color=#8E44AD&description=Documentation" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/labels/documentation" ``` @@ -251,7 +251,7 @@ PUT /projects/:id/labels/:label_id/promote | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a group's label. | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/labels/documentation/promote" ``` @@ -288,7 +288,7 @@ POST /projects/:id/labels/:label_id/subscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a project's label | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/labels/1/subscribe ``` @@ -326,6 +326,6 @@ POST /projects/:id/labels/:label_id/unsubscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `label_id` | integer or string | yes | The ID or title of a project's label | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/labels/1/unsubscribe ``` diff --git a/doc/api/license.md b/doc/api/license.md index c56a5fee95a..2be26e1bddf 100644 --- a/doc/api/license.md +++ b/doc/api/license.md @@ -101,7 +101,7 @@ POST /license | --------- | ---- | -------- | ----------- | | `license` | string | yes | The license string | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/license?license=eyJkYXRhIjoiMHM5Q...S01Udz09XG4ifQ==" ``` @@ -145,7 +145,7 @@ DELETE /license/:id | --------- | ---- | -------- | ----------- | | `id` | integer | yes | ID of the GitLab license. | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/license/:id" ``` diff --git a/doc/api/lint.md b/doc/api/lint.md index 80750992c51..c24d891a7e2 100644 --- a/doc/api/lint.md +++ b/doc/api/lint.md @@ -12,7 +12,7 @@ POST /ci/lint | ---------- | ------- | -------- | -------- | | `content` | string | yes | the `.gitlab-ci.yaml` content| -```bash +```shell curl --header "Content-Type: application/json" https://gitlab.example.com/api/v4/ci/lint --data '{"content": "{ \"image\": \"ruby:2.6\", \"services\": [\"postgres\"], \"before_script\": [\"bundle install\", \"bundle exec rake db:create\"], \"variables\": {\"DB_NAME\": \"postgres\"}, \"types\": [\"test\", \"deploy\", \"notify\"], \"rspec\": { \"script\": \"rake spec\", \"tags\": [\"ruby\", \"postgres\"], \"only\": [\"branches\"]}}"}' ``` diff --git a/doc/api/managed_licenses.md b/doc/api/managed_licenses.md index 1af7567626f..34b1e5dc6dc 100644 --- a/doc/api/managed_licenses.md +++ b/doc/api/managed_licenses.md @@ -12,7 +12,7 @@ GET /projects/:id/managed_licenses | --------- | ------- | -------- | --------------------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/managed_licenses ``` @@ -46,7 +46,7 @@ GET /projects/:id/managed_licenses/:managed_license_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `managed_license_id` | integer/string | yes | The ID or URL-encoded name of the license belonging to the project | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/managed_licenses/6" ``` @@ -74,7 +74,7 @@ POST /projects/:id/managed_licenses | `name` | string | yes | The name of the managed license | | `approval_status` | string | yes | The approval status. "approved" or "blacklisted" | -```bash +```shell curl --data "name=MIT&approval_status=blacklisted" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/managed_licenses" ``` @@ -101,7 +101,7 @@ DELETE /projects/:id/managed_licenses/:managed_license_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `managed_license_id` | integer/string | yes | The ID or URL-encoded name of the license belonging to the project | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/managed_licenses/4" ``` @@ -121,7 +121,7 @@ PATCH /projects/:id/managed_licenses/:managed_license_id | `managed_license_id` | integer/string | yes | The ID or URL-encoded name of the license belonging to the project | | `approval_status` | string | yes | The approval status. "approved" or "blacklisted" | -```bash +```shell curl --request PATCH --data "approval_status=blacklisted" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/managed_licenses/6" ``` diff --git a/doc/api/markdown.md b/doc/api/markdown.md index f4ad1de9ad8..5f6aa72903b 100644 --- a/doc/api/markdown.md +++ b/doc/api/markdown.md @@ -16,7 +16,7 @@ POST /api/v4/markdown | `gfm` | boolean | no (optional) | Render text using GitLab Flavored Markdown. Default is `false` | | `project` | string | no (optional) | Use `project` as a context when creating references using GitLab Flavored Markdown. [Authentication](README.html#authentication) is required if a project is not public. | -```bash +```shell curl --header Content-Type:application/json --data '{"text":"Hello world! :tada:", "gfm":true, "project":"group_example/project_example"}' https://gitlab.example.com/api/v4/markdown ``` diff --git a/doc/api/members.md b/doc/api/members.md index 50dcf86c972..a81a9097c3f 100644 --- a/doc/api/members.md +++ b/doc/api/members.md @@ -28,7 +28,7 @@ GET /projects/:id/members | `query` | string | no | A query string to search for members | | `user_ids` | array of integers | no | Filter the results on the given user IDs | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/members curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/members ``` @@ -77,7 +77,7 @@ GET /projects/:id/members/all | `query` | string | no | A query string to search for members | | `user_ids` | array of integers | no | Filter the results on the given user IDs | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/members/all curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/members/all ``` @@ -133,7 +133,7 @@ GET /projects/:id/members/:user_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project or group](README.md#namespaced-path-encoding) owned by the authenticated user | | `user_id` | integer | yes | The user ID of the member | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/members/:user_id curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/members/:user_id ``` @@ -169,7 +169,7 @@ GET /projects/:id/members/all/:user_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project or group](README.md#namespaced-path-encoding) owned by the authenticated user | | `user_id` | integer | yes | The user ID of the member | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/members/all/:user_id curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/members/all/:user_id ``` @@ -205,7 +205,7 @@ POST /projects/:id/members | `access_level` | integer | yes | A valid access level | | `expires_at` | string | no | A date string in the format YEAR-MONTH-DAY | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --data "user_id=1&access_level=30" https://gitlab.example.com/api/v4/groups/:id/members curl --request POST --header "PRIVATE-TOKEN: " --data "user_id=1&access_level=30" https://gitlab.example.com/api/v4/projects/:id/members ``` @@ -241,7 +241,7 @@ PUT /projects/:id/members/:user_id | `access_level` | integer | yes | A valid access level | | `expires_at` | string | no | A date string in the format YEAR-MONTH-DAY | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/members/:user_id?access_level=40 curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/members/:user_id?access_level=40 ``` @@ -275,7 +275,7 @@ DELETE /projects/:id/members/:user_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project or group](README.md#namespaced-path-encoding) owned by the authenticated user | | `user_id` | integer | yes | The user ID of the member | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/members/:user_id curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/members/:user_id ``` diff --git a/doc/api/merge_request_context_commits.md b/doc/api/merge_request_context_commits.md index 4b8edf657e4..a4659204127 100644 --- a/doc/api/merge_request_context_commits.md +++ b/doc/api/merge_request_context_commits.md @@ -27,15 +27,7 @@ Parameters: "authored_date": "2017-04-11T10:08:59.000Z", "committer_name": "Luke \"Jared\" Bennett", "committer_email": "lbennett@gitlab.com", - "committed_date": "2017-04-11T10:08:59.000Z", - "author": null, - "author_gravatar_url": "https://www.gravatar.com/avatar/2acf1fb99417a2b3971def5a294abbeb?s=80&d=identicon", - "commit_url": "http://127.0.0.1:3000/gitlab-org/gitlab-test/commit/4a24d82dbca5c11c61556f3b35ca472b7463187e", - "commit_path": "/gitlab-org/gitlab-test/commit/4a24d82dbca5c11c61556f3b35ca472b7463187e", - "description_html": "", - "title_html": "Update README.md to include `Usage in testing and development`", - "signature_html": null, - "pipeline_status_path": null + "committed_date": "2017-04-11T10:08:59.000Z" } ] ``` diff --git a/doc/api/merge_requests.md b/doc/api/merge_requests.md index 127a510aae6..266f419e9be 100644 --- a/doc/api/merge_requests.md +++ b/doc/api/merge_requests.md @@ -1272,7 +1272,7 @@ DELETE /projects/:id/merge_requests/:merge_request_iid | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/merge_requests/85 ``` @@ -1630,7 +1630,7 @@ PUT /projects/:id/merge_requests/:merge_request_iid/rebase | `merge_request_iid` | integer | yes | The internal ID of the merge request | | `skip_ci` | boolean | no | Set to `true` to skip creating a CI pipeline | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/76/merge_requests/1/rebase ``` @@ -1692,7 +1692,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/closes_issues | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/76/merge_requests/1/closes_issues ``` @@ -1768,7 +1768,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/subscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/17/subscribe ``` @@ -1919,7 +1919,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/unsubscribe | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/17/unsubscribe ``` @@ -2070,7 +2070,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/todo | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/27/todo ``` @@ -2187,7 +2187,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/versions | `id` | String | yes | The ID of the project | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/merge_requests/1/versions ``` @@ -2229,7 +2229,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/versions/:version_id | `merge_request_iid` | integer | yes | The internal ID of the merge request | | `version_id` | integer | yes | The ID of the merge request diff version | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/merge_requests/1/versions/1 ``` @@ -2297,7 +2297,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/time_estimate | `merge_request_iid` | integer | yes | The internal ID of the merge request | | `duration` | string | yes | The duration in human format. e.g: 3h30m | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/93/time_estimate?duration=3h30m ``` @@ -2325,7 +2325,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/reset_time_estimate | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of a project's merge_request | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/93/reset_time_estimate ``` @@ -2354,7 +2354,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/add_spent_time | `merge_request_iid` | integer | yes | The internal ID of the merge request | | `duration` | string | yes | The duration in human format. e.g: 3h30m | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/93/add_spent_time?duration=1h ``` @@ -2382,7 +2382,7 @@ POST /projects/:id/merge_requests/:merge_request_iid/reset_spent_time | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of a project's merge_request | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/93/reset_spent_time ``` @@ -2408,7 +2408,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/time_stats | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `merge_request_iid` | integer | yes | The internal ID of the merge request | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/93/time_stats ``` diff --git a/doc/api/milestones.md b/doc/api/milestones.md index f3a1b7323ec..43faf04a709 100644 --- a/doc/api/milestones.md +++ b/doc/api/milestones.md @@ -24,7 +24,7 @@ Parameters: | `title` | string | optional | Return only the milestones having the given `title` | | `search` | string | optional | Return only milestones with a title or description matching the provided string | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/milestones ``` diff --git a/doc/api/namespaces.md b/doc/api/namespaces.md index 2b6eddf78a1..872385b8b5e 100644 --- a/doc/api/namespaces.md +++ b/doc/api/namespaces.md @@ -18,7 +18,7 @@ GET /namespaces Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/namespaces ``` @@ -84,7 +84,7 @@ GET /namespaces?search=foobar Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/namespaces?search=twitter ``` @@ -118,7 +118,7 @@ GET /namespaces/:id Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/namespaces/2 ``` @@ -138,7 +138,7 @@ Example response: Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/namespaces/group1 ``` diff --git a/doc/api/notes.md b/doc/api/notes.md index 2cace425ff2..abf1be171c9 100644 --- a/doc/api/notes.md +++ b/doc/api/notes.md @@ -79,7 +79,7 @@ GET /projects/:id/issues/:issue_iid/notes?sort=asc&order_by=updated_at ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/notes ``` @@ -97,7 +97,7 @@ Parameters: - `issue_iid` (required) - The IID of a project issue - `note_id` (required) - The ID of an issue note -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/notes/1 ``` @@ -116,7 +116,7 @@ Parameters: - `body` (required) - The content of a note. Limited to 1,000,000 characters. - `created_at` (optional) - Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z (requires admin or project/group owner rights) -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=note ``` @@ -135,7 +135,7 @@ Parameters: - `note_id` (required) - The ID of a note - `body` (required) - The content of a note. Limited to 1,000,000 characters. -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/notes?body=note ``` @@ -155,7 +155,7 @@ Parameters: | `issue_iid` | integer | yes | The IID of an issue | | `note_id` | integer | yes | The ID of a note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/notes/636 ``` @@ -177,7 +177,7 @@ GET /projects/:id/snippets/:snippet_id/notes?sort=asc&order_by=updated_at | `sort` | string | no | Return snippet notes sorted in `asc` or `desc` order. Default is `desc` | `order_by` | string | no | Return snippet notes ordered by `created_at` or `updated_at` fields. Default is `created_at` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/notes ``` @@ -214,7 +214,7 @@ Parameters: } ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/notes/11 ``` @@ -234,7 +234,7 @@ Parameters: - `body` (required) - The content of a note. Limited to 1,000,000 characters. - `created_at` (optional) - Date time string, ISO 8601 formatted, e.g. 2016-03-11T03:45:40Z -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippet/11/notes?body=note ``` @@ -253,7 +253,7 @@ Parameters: - `note_id` (required) - The ID of a note - `body` (required) - The content of a note. Limited to 1,000,000 characters. -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/11/notes?body=note ``` @@ -273,7 +273,7 @@ Parameters: | `snippet_id` | integer | yes | The ID of a snippet | | `note_id` | integer | yes | The ID of a note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippets/52/notes/1659 ``` @@ -295,7 +295,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/notes?sort=asc&order_by=upda | `sort` | string | no | Return merge request notes sorted in `asc` or `desc` order. Default is `desc` | `order_by` | string | no | Return merge request notes ordered by `created_at` or `updated_at` fields. Default is `created_at` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/notes ``` @@ -336,7 +336,7 @@ Parameters: } ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/notes/1 ``` @@ -372,7 +372,7 @@ Parameters: - `note_id` (required) - The ID of a note - `body` (required) - The content of a note. Limited to 1,000,000 characters. -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/notes?body=note ``` @@ -392,7 +392,7 @@ Parameters: | `merge_request_iid` | integer | yes | The IID of a merge request | | `note_id` | integer | yes | The ID of a note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/7/notes/1602 ``` @@ -414,7 +414,7 @@ GET /groups/:id/epics/:epic_id/notes?sort=asc&order_by=updated_at | `sort` | string | no | Return epic notes sorted in `asc` or `desc` order. Default is `desc` | | `order_by` | string | no | Return epic notes ordered by `created_at` or `updated_at` fields. Default is `created_at` | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/notes ``` @@ -453,7 +453,7 @@ Parameters: } ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/11/notes/1 ``` @@ -474,7 +474,7 @@ Parameters: | `epic_id` | integer | yes | The ID of an epic | | `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippet/11/notes?body=note ``` @@ -495,7 +495,7 @@ Parameters: | `note_id` | integer | yes | The ID of a note | | `body` | string | yes | The content of a note. Limited to 1,000,000 characters. | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/snippet/11/notes?body=note ``` @@ -515,6 +515,6 @@ Parameters: | `epic_id` | integer | yes | The ID of an epic | | `note_id` | integer | yes | The ID of a note | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/epics/52/notes/1659 ``` diff --git a/doc/api/notification_settings.md b/doc/api/notification_settings.md index 1bd9ea7bcfd..b6b74c8ee96 100644 --- a/doc/api/notification_settings.md +++ b/doc/api/notification_settings.md @@ -41,7 +41,7 @@ Get current notification settings and email address. GET /notification_settings ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/notification_settings ``` @@ -62,7 +62,7 @@ Update current notification settings and email address. PUT /notification_settings ``` -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/notification_settings?level=watch ``` @@ -104,7 +104,7 @@ GET /groups/:id/notification_settings GET /projects/:id/notification_settings ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/notification_settings curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/8/notification_settings ``` @@ -130,7 +130,7 @@ PUT /groups/:id/notification_settings PUT /projects/:id/notification_settings ``` -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/5/notification_settings?level=watch curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/8/notification_settings?level=custom&new_note=true ``` diff --git a/doc/api/oauth2.md b/doc/api/oauth2.md index 6b49a39b83a..9030feb13a7 100644 --- a/doc/api/oauth2.md +++ b/doc/api/oauth2.md @@ -175,7 +175,7 @@ the following parameters: Example cURL request: -```sh +```shell echo 'grant_type=password&username=&password=' > auth.txt curl --data "@auth.txt" --request POST https://gitlab.example.com/oauth/token ``` diff --git a/doc/api/packages.md b/doc/api/packages.md index cadd5f0dc75..798c83e65d4 100644 --- a/doc/api/packages.md +++ b/doc/api/packages.md @@ -19,7 +19,7 @@ GET /projects/:id/packages | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/packages ``` @@ -62,7 +62,7 @@ GET /groups/:id/packages | `id` | integer/string | yes | ID or [URL-encoded path of the group](README.md#namespaced-path-encoding). | | `exclude_subgroups` | boolean | false | If the param is included as true, packages from projects from subgroups are not listed. Default is `false`. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/:id/packages?exclude_subgroups=true ``` @@ -139,7 +139,7 @@ GET /projects/:id/packages/:package_id | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding). | | `package_id` | integer | yes | ID of a package. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/packages/:package_id ``` @@ -190,7 +190,7 @@ GET /projects/:id/packages/:package_id/package_files | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `package_id` | integer | yes | ID of a package. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/packages/4/package_files ``` @@ -245,7 +245,7 @@ DELETE /projects/:id/packages/:package_id | `id` | integer/string | yes | ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `package_id` | integer | yes | ID of a package. | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/packages/:package_id ``` diff --git a/doc/api/pages.md b/doc/api/pages.md index 0babca61650..a529dfe26ae 100644 --- a/doc/api/pages.md +++ b/doc/api/pages.md @@ -16,6 +16,6 @@ DELETE /projects/:id/pages | --------- | -------------- | -------- | ---------------------------------------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --request 'DELETE' --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/2/pages ``` diff --git a/doc/api/pages_domains.md b/doc/api/pages_domains.md index 9d482781cde..311d0eee722 100644 --- a/doc/api/pages_domains.md +++ b/doc/api/pages_domains.md @@ -12,7 +12,7 @@ Get a list of all pages domains. The user must have admin permissions. GET /pages/domains ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/pages/domains ``` @@ -43,7 +43,7 @@ GET /projects/:id/pages/domains | --------- | -------------- | -------- | ---------------------------------------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/pages/domains ``` @@ -80,7 +80,7 @@ GET /projects/:id/pages/domains/:domain | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `domain` | string | yes | The custom domain indicated by the user | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/pages/domains/www.domain.example ``` @@ -91,7 +91,7 @@ curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/ap } ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/pages/domains/ssl.domain.example ``` @@ -125,15 +125,15 @@ POST /projects/:id/pages/domains | `certificate` | file/string | no | The certificate in PEM format with intermediates following in most specific to least specific order.| | `key` | file/string | no | The certificate key in PEM format. | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "domain=ssl.domain.example" --form "certificate=@/path/to/cert.pem" --form "key=@/path/to/key.pem" https://gitlab.example.com/api/v4/projects/5/pages/domains ``` -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "domain=ssl.domain.example" --form "certificate=$CERT_PEM" --form "key=$KEY_PEM" https://gitlab.example.com/api/v4/projects/5/pages/domains ``` -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "domain=ssl.domain.example" --form "auto_ssl_enabled=true" https://gitlab.example.com/api/v4/projects/5/pages/domains ``` @@ -169,11 +169,11 @@ PUT /projects/:id/pages/domains/:domain ### Adding certificate -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --form "certificate=@/path/to/cert.pem" --form "key=@/path/to/key.pem" https://gitlab.example.com/api/v4/projects/5/pages/domains/ssl.domain.example ``` -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --form "certificate=$CERT_PEM" --form "key=$KEY_PEM" https://gitlab.example.com/api/v4/projects/5/pages/domains/ssl.domain.example ``` @@ -193,7 +193,7 @@ curl --request PUT --header "PRIVATE-TOKEN: " --form "certifi ### Enabling Let's Encrypt integration for Pages custom domains -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --form "auto_ssl_enabled=true" https://gitlab.example.com/api/v4/projects/5/pages/domains/ssl.domain.example ``` @@ -209,7 +209,7 @@ curl --request PUT --header "PRIVATE-TOKEN: " --form "auto_ss To remove the SSL certificate attached to the Pages domain, run: -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --form "certificate=" --form "key=" https://gitlab.example.com/api/v4/projects/5/pages/domains/ssl.domain.example ``` @@ -234,6 +234,6 @@ DELETE /projects/:id/pages/domains/:domain | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `domain` | string | yes | The custom domain indicated by the user | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/pages/domains/ssl.domain.example ``` diff --git a/doc/api/pipeline_schedules.md b/doc/api/pipeline_schedules.md index 59e89c3d256..f859a01cd37 100644 --- a/doc/api/pipeline_schedules.md +++ b/doc/api/pipeline_schedules.md @@ -15,7 +15,7 @@ GET /projects/:id/pipeline_schedules | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `scope` | string | no | The scope of pipeline schedules, one of: `active`, `inactive` | -```sh +```shell curl --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules" ``` @@ -56,7 +56,7 @@ GET /projects/:id/pipeline_schedules/:pipeline_schedule_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `pipeline_schedule_id` | integer | yes | The pipeline schedule id | -```sh +```shell curl --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13" ``` @@ -112,7 +112,7 @@ POST /projects/:id/pipeline_schedules | `cron_timezone` | string | no | The timezone supported by `ActiveSupport::TimeZone` (e.g. `Pacific Time (US & Canada)`) (default: `'UTC'`) | | `active` | boolean | no | The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially (default: `true`) | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" --form description="Build packages" --form ref="master" --form cron="0 1 * * 5" --form cron_timezone="UTC" --form active="true" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules" ``` @@ -157,7 +157,7 @@ PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id | `cron_timezone` | string | no | The timezone supported by `ActiveSupport::TimeZone` (e.g. `Pacific Time (US & Canada)`) or `TZInfo::Timezone` (e.g. `America/Los_Angeles`) | | `active` | boolean | no | The activation of pipeline schedule. If false is set, the pipeline schedule will deactivated initially. | -```sh +```shell curl --request PUT --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" --form cron="0 2 * * *" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13" ``` @@ -202,7 +202,7 @@ POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/take_ownership | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `pipeline_schedule_id` | integer | yes | The pipeline schedule id | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: hf2CvZXB9w8Uc5pZKpSB" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/take_ownership" ``` @@ -247,7 +247,7 @@ DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `pipeline_schedule_id` | integer | yes | The pipeline schedule id | -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13" ``` @@ -299,7 +299,7 @@ POST /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables | `value` | string | yes | The `value` of a variable | | `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" --form "key=NEW_VARIABLE" --form "value=new value" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables" ``` @@ -327,7 +327,7 @@ PUT /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key | `value` | string | yes | The `value` of a variable | | `variable_type` | string | no | The type of a variable. Available types are: `env_var` (default) and `file` | -```sh +```shell curl --request PUT --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" --form "value=updated value" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables/NEW_VARIABLE" ``` @@ -353,7 +353,7 @@ DELETE /projects/:id/pipeline_schedules/:pipeline_schedule_id/variables/:key | `pipeline_schedule_id` | integer | yes | The pipeline schedule id | | `key` | string | yes | The `key` of a variable | -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: k5ESFgWY2Qf5xEvDcFxZ" "https://gitlab.example.com/api/v4/projects/29/pipeline_schedules/13/variables/NEW_VARIABLE" ``` diff --git a/doc/api/project_badges.md b/doc/api/project_badges.md index 0cf22808036..df3a0b9f5af 100644 --- a/doc/api/project_badges.md +++ b/doc/api/project_badges.md @@ -25,7 +25,7 @@ GET /projects/:id/badges | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `name` | string | no | Name of the badges to return (case-sensitive). | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/badges ``` @@ -67,7 +67,7 @@ GET /projects/:id/badges/:badge_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `badge_id` | integer | yes | The badge ID | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/badges/:badge_id ``` @@ -98,7 +98,7 @@ POST /projects/:id/badges | `link_url` | string | yes | URL of the badge link | | `image_url` | string | yes | URL of the badge image | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --data "link_url=https://gitlab.com/gitlab-org/gitlab-foss/commits/master&image_url=https://shields.io/my/badge1&position=0" https://gitlab.example.com/api/v4/projects/:id/badges ``` @@ -130,7 +130,7 @@ PUT /projects/:id/badges/:badge_id | `link_url` | string | no | URL of the badge link | | `image_url` | string | no | URL of the badge image | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/badges/:badge_id ``` @@ -160,7 +160,7 @@ DELETE /projects/:id/badges/:badge_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `badge_id` | integer | yes | The badge ID | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/badges/:badge_id ``` @@ -178,7 +178,7 @@ GET /projects/:id/badges/render | `link_url` | string | yes | URL of the badge link| | `image_url` | string | yes | URL of the badge image | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/badges/render?link_url=http%3A%2F%2Fexample.com%2Fci_status.svg%3Fproject%3D%25%7Bproject_path%7D%26ref%3D%25%7Bdefault_branch%7D&image_url=https%3A%2F%2Fshields.io%2Fmy%2Fbadge ``` diff --git a/doc/api/project_clusters.md b/doc/api/project_clusters.md index 1aa225d30ab..b52f96d0f2e 100644 --- a/doc/api/project_clusters.md +++ b/doc/api/project_clusters.md @@ -21,7 +21,7 @@ Parameters: Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/projects/26/clusters ``` @@ -77,7 +77,7 @@ Example response: Gets a single project cluster. -```bash +```shell GET /projects/:id/clusters/:cluster_id ``` @@ -90,7 +90,7 @@ Parameters: Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/projects/26/clusters/18 ``` @@ -168,7 +168,7 @@ Example response: Adds an existing Kubernetes cluster to the project. -```bash +```shell POST /projects/:id/clusters/user ``` @@ -190,7 +190,7 @@ Parameters: Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/projects/26/clusters/user \ -H "Accept: application/json" \ -H "Content-Type:application/json" \ @@ -261,7 +261,7 @@ Example response: Updates an existing project cluster. -```bash +```shell PUT /projects/:id/clusters/:cluster_id ``` @@ -287,7 +287,7 @@ through the ["Add existing cluster to project"](#add-existing-cluster-to-project Example request: -```bash +```shell curl --header 'Private-Token: ' https://gitlab.example.com/api/v4/projects/26/clusters/24 \ -H "Content-Type:application/json" \ -X PUT --data '{"name":"new-cluster-name","domain":"new-domain.com","api_url":"https://new-api-url.com"}' @@ -381,6 +381,6 @@ Parameters: Example request: -```bash +```shell curl --request DELETE --header 'Private-Token: ' https://gitlab.example.com/api/v4/projects/26/clusters/23 ``` diff --git a/doc/api/project_import_export.md b/doc/api/project_import_export.md index cd02d423a9f..b239c59bc66 100644 --- a/doc/api/project_import_export.md +++ b/doc/api/project_import_export.md @@ -28,7 +28,7 @@ POST /projects/:id/export | `upload[url]` | string | yes | The URL to upload the project | | `upload[http_method]` | string | no | The HTTP method to upload the exported project. Only `PUT` and `POST` methods allowed. Default is `PUT` | -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/export \ --data "upload[http_method]=PUT" \ --data-urlencode "upload[url]=https://example-bucket.s3.eu-west-3.amazonaws.com/backup?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIMBJHN2O62W8IELQ%2F20180312%2Feu-west-3%2Fs3%2Faws4_request&X-Amz-Date=20180312T110328Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=8413facb20ff33a49a147a0b4abcff4c8487cc33ee1f7e450c46e8f695569dbd" @@ -52,7 +52,7 @@ GET /projects/:id/export | --------- | -------------- | -------- | ---------------------------------------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/export ``` @@ -93,11 +93,11 @@ GET /projects/:id/export/download | --------- | -------------- | -------- | ---------------------------------------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```sh +```shell curl --header "PRIVATE-TOKEN: " --remote-header-name --remote-name https://gitlab.example.com/api/v4/projects/5/export/download ``` -```sh +```shell ls *export.tar.gz 2017-12-05_22-11-148_namespace_project_export.tar.gz ``` @@ -124,7 +124,7 @@ cURL to post data using the header `Content-Type: multipart/form-data`. The `file=` parameter must point to a file on your file system and be preceded by `@`. For example: -```sh +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "path=api-project" --form "file=@/path/to/file" https://gitlab.example.com/api/v4/projects/import ``` @@ -174,7 +174,7 @@ GET /projects/:id/import | --------- | -------------- | -------- | ---------------------------------------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/import ``` diff --git a/doc/api/project_snippets.md b/doc/api/project_snippets.md index 7a6c90701ba..3f40845fddc 100644 --- a/doc/api/project_snippets.md +++ b/doc/api/project_snippets.md @@ -83,7 +83,7 @@ Parameters: Example request: -```bash +```shell curl --request POST https://gitlab.com/api/v4/projects/:id/snippets \ --header "PRIVATE-TOKEN: " \ --header "Content-Type: application/json" \ @@ -122,7 +122,7 @@ Parameters: Example request: -```bash +```shell curl --request PUT https://gitlab.com/api/v4/projects/:id/snippets \ --header "PRIVATE-TOKEN: " \ --header "Content-Type: application/json" \ @@ -156,7 +156,7 @@ Parameters: Example request: -```bash +```shell curl --request DELETE https://gitlab.com/api/v4/projects/:id/snippets \ --header "PRIVATE-TOKEN: " ``` @@ -176,7 +176,7 @@ Parameters: Example request: -```bash +```shell curl --request GET https://gitlab.com/api/v4/projects/:id/snippets/:snippet_id/raw \ --header "PRIVATE-TOKEN: " ``` @@ -198,7 +198,7 @@ GET /projects/:id/snippets/:snippet_id/user_agent_detail Example request: -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/snippets/2/user_agent_detail ``` diff --git a/doc/api/projects.md b/doc/api/projects.md index ad1cc4ea1b7..59d4a37f02c 100644 --- a/doc/api/projects.md +++ b/doc/api/projects.md @@ -552,7 +552,7 @@ GET /users/:user_id/starred_projects | `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature. | | `min_access_level` | integer | no | Limit by current user minimal [access level](members.md). | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/users/5/starred_projects" ``` @@ -1236,7 +1236,7 @@ GET /projects/:id/forks | `with_merge_requests_enabled` | boolean | no | Limit by enabled merge requests feature | | `min_access_level` | integer | no | Limit by current user minimal [access level](members.md) | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/forks" ``` @@ -1320,7 +1320,7 @@ POST /projects/:id/star | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/star" ``` @@ -1410,7 +1410,7 @@ POST /projects/:id/unstar | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/unstar" ``` @@ -1500,7 +1500,7 @@ GET /projects/:id/starrers | --------- | ---- | -------- | ----------- | | `search` | string | no | Search for specific users. | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/starrers" ``` @@ -1541,7 +1541,7 @@ Get languages used in a project with percentage value. GET /projects/:id/languages ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/languages" ``` @@ -1569,7 +1569,7 @@ POST /projects/:id/archive | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/archive" ``` @@ -1678,7 +1678,7 @@ POST /projects/:id/unarchive | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/unarchive" ``` @@ -1823,7 +1823,7 @@ cURL to post data using the header `Content-Type: multipart/form-data`. The `file=` parameter must point to a file on your filesystem and be preceded by `@`. For example: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/5/uploads ``` @@ -1869,7 +1869,7 @@ DELETE /projects/:id/share/:group_id | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `group_id` | integer | yes | The ID of the group | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/share/17 ``` @@ -2037,7 +2037,7 @@ GET /projects | `order_by` | string | no | Return requests ordered by `id`, `name`, `created_at` or `last_activity_at` fields | | `sort` | string | no | Return requests sorted in `asc` or `desc` order | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects?search=test ``` @@ -2196,7 +2196,7 @@ POST /projects/:id/mirror/pull | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/:id/mirror/pull ``` diff --git a/doc/api/protected_branches.md b/doc/api/protected_branches.md index e6844536c33..d95aa1323f7 100644 --- a/doc/api/protected_branches.md +++ b/doc/api/protected_branches.md @@ -25,7 +25,7 @@ GET /projects/:id/protected_branches | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_branches' ``` @@ -99,7 +99,7 @@ GET /projects/:id/protected_branches/:name | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `name` | string | yes | The name of the branch or wildcard | -```bash +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_branches/master' ``` @@ -163,7 +163,7 @@ branches using a wildcard protected branch. POST /projects/:id/protected_branches ``` -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_branches?name=*-stable&push_access_level=30&merge_access_level=30&unprotect_access_level=40' ``` @@ -249,7 +249,7 @@ Example response: Elements in the `allowed_to_push` / `allowed_to_merge` / `allowed_to_unprotect` array should take the form `{user_id: integer}`, `{group_id: integer}` or `{access_level: integer}`. Each user must have access to the project and each group must [have this project shared](../user/project/members/share_project_with_groups.md). These access levels allow [more granular control over protected branch access](../user/project/protected_branches.md#restricting-push-and-merge-access-to-certain-users-starter) and were [added to the API in](https://gitlab.com/gitlab-org/gitlab/merge_requests/3516) in GitLab 10.3 EE. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_branches?name=*-stable&allowed_to_push%5B%5D%5Buser_id%5D=1' ``` @@ -295,7 +295,7 @@ Unprotects the given protected branch or wildcard protected branch. DELETE /projects/:id/protected_branches/:name ``` -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_branches/*-stable' ``` @@ -312,7 +312,7 @@ Update the "code owner approval required" option for the given protected branch PATCH /projects/:id/protected_branches/:name ``` -```bash +```shell curl --request PATCH --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_branches/feature-branch' ``` diff --git a/doc/api/protected_tags.md b/doc/api/protected_tags.md index fb6fa040244..a5490094a44 100644 --- a/doc/api/protected_tags.md +++ b/doc/api/protected_tags.md @@ -25,7 +25,7 @@ GET /projects/:id/protected_tags | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | -```bash +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_tags' ``` @@ -60,7 +60,7 @@ GET /projects/:id/protected_tags/:name | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `name` | string | yes | The name of the tag or wildcard | -```bash +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_tags/release-1-0' ``` @@ -87,7 +87,7 @@ tags using a wildcard protected tag. POST /projects/:id/protected_tags ``` -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_tags?name=*-stable&create_access_level=30' ``` @@ -119,7 +119,7 @@ Unprotects the given protected tag or wildcard protected tag. DELETE /projects/:id/protected_tags/:name ``` -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/projects/5/protected_tags/*-stable' ``` diff --git a/doc/api/releases/index.md b/doc/api/releases/index.md index b5e24188043..e24dea3c278 100644 --- a/doc/api/releases/index.md +++ b/doc/api/releases/index.md @@ -19,7 +19,7 @@ GET /projects/:id/releases Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases" ``` @@ -202,7 +202,7 @@ GET /projects/:id/releases/:tag_name Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1" ``` @@ -322,7 +322,7 @@ POST /projects/:id/releases Example request: -```sh +```shell curl --header 'Content-Type: application/json' --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" \ --data '{ "name": "New release", "tag_name": "v0.3", "description": "Super nice release", "milestones": ["v1.0", "v1.0-rc"], "assets": { "links": [{ "name": "hoge", "url": "https://google.com" }] } }' \ --request POST https://gitlab.example.com/api/v4/projects/24/releases @@ -445,7 +445,7 @@ PUT /projects/:id/releases/:tag_name Example request: -```sh +```shell curl --header 'Content-Type: application/json' --request PUT --data '{"name": "new name", "milestones": ["v1.2"]}' --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1" ``` @@ -544,7 +544,7 @@ DELETE /projects/:id/releases/:tag_name Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1" ``` diff --git a/doc/api/releases/links.md b/doc/api/releases/links.md index 3392cf765c1..2a9e0ccb664 100644 --- a/doc/api/releases/links.md +++ b/doc/api/releases/links.md @@ -20,7 +20,7 @@ GET /projects/:id/releases/:tag_name/assets/links Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links" ``` @@ -59,7 +59,7 @@ GET /projects/:id/releases/:tag_name/assets/links/:link_id Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1" ``` @@ -91,7 +91,7 @@ POST /projects/:id/releases/:tag_name/assets/links Example request: -```sh +```shell curl --request POST \ --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" \ --data name="awesome-v0.2.dmg" \ @@ -131,7 +131,7 @@ You have to specify at least one of `name` or `url` Example request: -```sh +```shell curl --request PUT --data name="new name" --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1" ``` @@ -162,7 +162,7 @@ DELETE /projects/:id/releases/:tag_name/assets/links/:link_id Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: gDybLx3yrUK_HLp3qPjS" "https://gitlab.example.com/api/v4/projects/24/releases/v0.1/assets/links/1" ``` diff --git a/doc/api/repositories.md b/doc/api/repositories.md index faa30043423..3e34e1522e4 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -121,7 +121,7 @@ Parameters: - `id` (required) - The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user - `sha` (optional) - The commit SHA to download. A tag, branch reference, or SHA can be used. This defaults to the tip of the default branch if not specified. For example: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.com/api/v4/projects//repository/archive?sha= ``` @@ -227,7 +227,7 @@ GET /projects/:id/repository/merge_base | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `refs` | array | yes | The refs to find the common ancestor of, multiple refs can be passed | -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/merge_base?refs[]=304d257dcb821665ab5110318fc58a007bd104ed&refs[]=0031876facac3f2b2702a0e53a26e89939a42209" ``` diff --git a/doc/api/repository_files.md b/doc/api/repository_files.md index d2ad4558641..a4e63fbe21d 100644 --- a/doc/api/repository_files.md +++ b/doc/api/repository_files.md @@ -24,7 +24,7 @@ without authentication if the repository is publicly accessible. GET /projects/:id/repository/files/:file_path ``` -```bash +```shell curl --request GET --header 'PRIVATE-TOKEN: ' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb?ref=master' ``` @@ -59,7 +59,7 @@ In addition to the `GET` method, you can also use `HEAD` to get just file metada HEAD /projects/:id/repository/files/:file_path ``` -```bash +```shell curl --head --header 'PRIVATE-TOKEN: ' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb?ref=master' ``` @@ -88,7 +88,7 @@ Allows you to receive blame information. Each blame range contains lines and cor GET /projects/:id/repository/files/:file_path/blame ``` -```bash +```shell curl --request GET --header 'PRIVATE-TOKEN: ' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/path%2Fto%2Ffile.rb/blame?ref=master' ``` @@ -128,7 +128,7 @@ Parameters: NOTE: **Note:** `HEAD` method return just file metadata as in [Get file from repository](repository_files.md#get-file-from-repository). -```bash +```shell curl --head --header 'PRIVATE-TOKEN: ' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/path%2Fto%2Ffile.rb/blame?ref=master' ``` @@ -155,7 +155,7 @@ X-Gitlab-Size: 1476 GET /projects/:id/repository/files/:file_path/raw ``` -```bash +```shell curl --request GET --header 'PRIVATE-TOKEN: ' 'https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb/raw?ref=master' ``` @@ -175,7 +175,7 @@ This allows you to create a single file. For creating multiple files with a sing POST /projects/:id/repository/files/:file_path ``` -```bash +```shell curl --request POST --header 'PRIVATE-TOKEN: ' --header "Content-Type: application/json" \ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \ "content": "some content", "commit_message": "create a new file"}' \ @@ -210,7 +210,7 @@ This allows you to update a single file. For updating multiple files with a sing PUT /projects/:id/repository/files/:file_path ``` -```bash +```shell curl --request PUT --header 'PRIVATE-TOKEN: ' --header "Content-Type: application/json" \ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \ "content": "some content", "commit_message": "update file"}' \ @@ -256,7 +256,7 @@ This allows you to delete a single file. For deleting multiple files with a sing DELETE /projects/:id/repository/files/:file_path ``` -```bash +```shell curl --request DELETE --header 'PRIVATE-TOKEN: ' --header "Content-Type: application/json" \ --data '{"branch": "master", "author_email": "author@example.com", "author_name": "Firstname Lastname", \ "commit_message": "delete file"}' \ diff --git a/doc/api/repository_submodules.md b/doc/api/repository_submodules.md index 556a351ac1d..59f6131fc96 100644 --- a/doc/api/repository_submodules.md +++ b/doc/api/repository_submodules.md @@ -21,7 +21,7 @@ PUT /projects/:id/repository/submodules/:submodule | `commit_sha` | string | yes | Full commit SHA to update the submodule to | | `commit_message` | string | no | Commit message. If no message is provided, a default one will be set | -```sh +```shell curl --request PUT --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/submodules/lib%2Fmodules%2Fexample" --data "branch=master&commit_sha=3ddec28ea23acc5caa5d8331a6ecb2a65fc03e88&commit_message=Update submodule reference" ``` diff --git a/doc/api/resource_label_events.md b/doc/api/resource_label_events.md index 7ad4d78014c..4753b2e3c90 100644 --- a/doc/api/resource_label_events.md +++ b/doc/api/resource_label_events.md @@ -64,7 +64,7 @@ GET /projects/:id/issues/:issue_iid/resource_label_events ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/resource_label_events ``` @@ -84,7 +84,7 @@ Parameters: | `issue_iid` | integer | yes | The IID of an issue | | `resource_label_event_id` | integer | yes | The ID of a label event | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/issues/11/resource_label_events/1 ``` @@ -150,7 +150,7 @@ GET /groups/:id/epics/:epic_id/resource_label_events ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/11/resource_label_events ``` @@ -170,7 +170,7 @@ Parameters: | `epic_id` | integer | yes | The ID of an epic | | `resource_label_event_id` | integer | yes | The ID of a label event | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/1/epics/11/resource_label_events/107 ``` @@ -236,7 +236,7 @@ GET /projects/:id/merge_requests/:merge_request_iid/resource_label_events ] ``` -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/resource_label_events ``` @@ -256,6 +256,6 @@ Parameters: | `merge_request_iid` | integer | yes | The IID of a merge request | | `resource_label_event_id` | integer | yes | The ID of a label event | -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/resource_label_events/120 ``` diff --git a/doc/api/scim.md b/doc/api/scim.md index cf9d8ebbec2..be36f0e8053 100644 --- a/doc/api/scim.md +++ b/doc/api/scim.md @@ -31,7 +31,7 @@ Pagination follows the [SCIM spec](https://tools.ietf.org/html/rfc7644#section-3 Example request: -```sh +```shell curl 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users?filter=id%20eq%20"0b1d561c-21ff-4092-beab-8154b17f82f2"' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` @@ -82,7 +82,7 @@ Parameters: Example request: -```sh +```shell curl 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users/f0b1d561c-21ff-4092-beab-8154b17f82f2' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` @@ -126,7 +126,7 @@ Parameters: Example request: -```sh +```shell curl --verbose --request POST 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users' --data '{"externalId":"test_uid","active":null,"userName":"username","emails":[{"primary":true,"type":"work","value":"name@example.com"}],"name":{"formatted":"Test User","familyName":"User","givenName":"Test"},"schemas":["urn:ietf:params:scim:schemas:core:2.0:User"],"meta":{"resourceType":"User"}}' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` @@ -180,7 +180,7 @@ Parameters: Example request: -```sh +```shell curl --verbose --request PATCH 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users/f0b1d561c-21ff-4092-beab-8154b17f82f2' --data '{ "Operations": [{"op":"Add","path":"name.formatted","value":"New Name"}] }' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` @@ -203,7 +203,7 @@ Parameters: Example request: -```sh +```shell curl --verbose --request DELETE 'https://example.gitlab.com/api/scim/v2/groups/test_group/Users/f0b1d561c-21ff-4092-beab-8154b17f82f2' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` diff --git a/doc/api/search.md b/doc/api/search.md index 46209fb753f..bac259651f8 100644 --- a/doc/api/search.md +++ b/doc/api/search.md @@ -25,7 +25,7 @@ The response depends on the requested scope. ### Scope: projects -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=projects&search=flight ``` @@ -56,7 +56,7 @@ Example response: ### Scope: issues -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=issues&search=file ``` @@ -121,7 +121,7 @@ Example response: ### Scope: merge_requests -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=merge_requests&search=file ``` @@ -199,7 +199,7 @@ Example response: ### Scope: milestones -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=milestones&search=release ``` @@ -224,7 +224,7 @@ Example response: ### Scope: snippet_titles -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=snippet_titles&search=sample ``` @@ -255,7 +255,7 @@ Example response: ### Scope: snippet_blobs -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=snippet_blobs&search=test ``` @@ -288,7 +288,7 @@ Example response: This scope is available only if [Elasticsearch](../integration/elasticsearch.md) is enabled. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=wiki_blobs&search=bye ``` @@ -316,7 +316,7 @@ Example response: This scope is available only if [Elasticsearch](../integration/elasticsearch.md) is enabled. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=commits&search=bye ``` @@ -359,7 +359,7 @@ to use a filter simply include it in your query like so: `a query filename:some_ You may use wildcards (`*`) to use glob matching. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=blobs&search=installation ``` @@ -385,7 +385,7 @@ Example response: ### Scope: users -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/search?scope=users&search=doe ``` @@ -428,7 +428,7 @@ The response depends on the requested scope. ### Scope: projects -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/3/search?scope=projects&search=flight ``` @@ -459,7 +459,7 @@ Example response: ### Scope: issues -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/3/search?scope=issues&search=file ``` @@ -524,7 +524,7 @@ Example response: ### Scope: merge_requests -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/3/search?scope=merge_requests&search=file ``` @@ -602,7 +602,7 @@ Example response: ### Scope: milestones -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/3/search?scope=milestones&search=release ``` @@ -629,7 +629,7 @@ Example response: This scope is available only if [Elasticsearch](../integration/elasticsearch.md) is enabled. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/6/search?scope=wiki_blobs&search=bye ``` @@ -657,7 +657,7 @@ Example response: This scope is available only if [Elasticsearch](../integration/elasticsearch.md) is enabled. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/6/search?scope=commits&search=bye ``` @@ -700,7 +700,7 @@ to use a filter simply include it in your query like so: `a query filename:some_ You may use wildcards (`*`) to use glob matching. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/6/search?scope=blobs&search=installation ``` @@ -726,7 +726,7 @@ Example response: ### Scope: users -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/3/search?scope=users&search=doe ``` @@ -768,7 +768,7 @@ The response depends on the requested scope. ### Scope: issues -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/12/search?scope=issues&search=file ``` @@ -833,7 +833,7 @@ Example response: ### Scope: merge_requests -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/6/search?scope=merge_requests&search=file ``` @@ -911,7 +911,7 @@ Example response: ### Scope: milestones -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/12/search?scope=milestones&search=release ``` @@ -936,7 +936,7 @@ Example response: ### Scope: notes -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/6/search?scope=notes&search=maxime ``` @@ -985,7 +985,7 @@ results: might be found in both the filename and content, or might appear multiple times in the content. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/6/search?scope=wiki_blobs&search=bye ``` @@ -1011,7 +1011,7 @@ Example response: ### Scope: commits -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/6/search?scope=commits&search=bye ``` @@ -1058,7 +1058,7 @@ Blobs searches are performed on both filenames and contents. Search results: might be found in both the filename and content, or might appear multiple times in the content. -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/6/search?scope=blobs&search=installation&ref=feature ``` @@ -1084,7 +1084,7 @@ Example response: ### Scope: users -```bash +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/6/search?scope=users&search=doe ``` diff --git a/doc/api/settings.md b/doc/api/settings.md index ed07bbc575d..51680be88e8 100644 --- a/doc/api/settings.md +++ b/doc/api/settings.md @@ -14,7 +14,7 @@ of the GitLab instance. GET /application/settings ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/settings ``` @@ -94,7 +94,7 @@ Use an API call to modify GitLab instance PUT /application/settings ``` -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/settings?signup_enabled=false&default_project_visibility=internal ``` diff --git a/doc/api/sidekiq_metrics.md b/doc/api/sidekiq_metrics.md index 95449d1ff77..76aa04077c7 100644 --- a/doc/api/sidekiq_metrics.md +++ b/doc/api/sidekiq_metrics.md @@ -14,7 +14,7 @@ latency. GET /sidekiq/queue_metrics ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/sidekiq/queue_metrics ``` @@ -39,7 +39,7 @@ List information about all the Sidekiq workers registered to process your queues GET /sidekiq/process_metrics ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/sidekiq/process_metrics ``` @@ -81,7 +81,7 @@ List information about the jobs that Sidekiq has performed. GET /sidekiq/job_stats ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/sidekiq/job_stats ``` @@ -106,7 +106,7 @@ List all the currently available information about Sidekiq. GET /sidekiq/compound_metrics ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/sidekiq/compound_metrics ``` diff --git a/doc/api/snippets.md b/doc/api/snippets.md index b953c3c094a..5d9cc42d147 100644 --- a/doc/api/snippets.md +++ b/doc/api/snippets.md @@ -27,7 +27,7 @@ GET /snippets Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/snippets ``` @@ -94,7 +94,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/snippets/1 ``` @@ -138,7 +138,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/snippets/1/raw ``` @@ -171,7 +171,7 @@ Parameters: Example request: -```sh +```shell curl --request POST \ --data '{"title": "This is a snippet", "content": "Hello world", "description": "Hello World snippet", "file_name": "test.txt", "visibility": "internal" }' \ --header 'Content-Type: application/json' \ @@ -227,7 +227,7 @@ Parameters: Example request: -```sh +```shell curl --request PUT \ --data '{"title": "foo", "content": "bar"}' \ --header 'Content-Type: application/json' \ @@ -275,7 +275,7 @@ Parameters: Example request: -```sh +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/snippets/1" ``` @@ -303,7 +303,7 @@ Parameters: Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/snippets/public?per_page=2&page=1 ``` @@ -366,7 +366,7 @@ GET /snippets/:id/user_agent_detail Example request: -```sh +```shell curl --request GET --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/snippets/1/user_agent_detail ``` diff --git a/doc/api/statistics.md b/doc/api/statistics.md index 5078b2f26d4..c7713ab2dae 100644 --- a/doc/api/statistics.md +++ b/doc/api/statistics.md @@ -12,7 +12,7 @@ These statistics are approximate. GET /application/statistics ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/application/statistics ``` diff --git a/doc/api/suggestions.md b/doc/api/suggestions.md index 188989bc94e..f95ab82848a 100644 --- a/doc/api/suggestions.md +++ b/doc/api/suggestions.md @@ -15,7 +15,7 @@ PUT /suggestions/:id/apply | --------- | ---- | -------- | ----------- | | `id` | integer/string | yes | The ID of a suggestion | -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/suggestions/5/apply ``` diff --git a/doc/api/system_hooks.md b/doc/api/system_hooks.md index b09b11dfd2a..1e34adc5320 100644 --- a/doc/api/system_hooks.md +++ b/doc/api/system_hooks.md @@ -17,7 +17,7 @@ GET /hooks Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/hooks ``` @@ -58,7 +58,7 @@ POST /hooks Example request: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/hooks?url=https://gitlab.example.com/hook" ``` @@ -91,7 +91,7 @@ GET /hooks/:id Example request: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/hooks/2 ``` @@ -122,6 +122,6 @@ DELETE /hooks/:id Example request: -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/hooks/2 ``` diff --git a/doc/api/tags.md b/doc/api/tags.md index 11291065edc..a796b758328 100644 --- a/doc/api/tags.md +++ b/doc/api/tags.md @@ -68,7 +68,7 @@ Parameters: | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) owned by the authenticated user | | `tag_name` | string | yes | The name of the tag | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/repository/tags/v1.0.0 ``` @@ -116,7 +116,7 @@ Parameters: - `message` (optional) - Creates annotated tag. - `release_description` (optional) - Add release notes to the Git tag and store it in the GitLab database. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/5/repository/tags?tag_name=test&ref=master" ``` diff --git a/doc/api/templates/dockerfiles.md b/doc/api/templates/dockerfiles.md index ee271c31b49..4453d3692c7 100644 --- a/doc/api/templates/dockerfiles.md +++ b/doc/api/templates/dockerfiles.md @@ -16,7 +16,7 @@ Get all Dockerfile templates. GET /templates/dockerfiles ``` -```bash +```shell curl https://gitlab.example.com/api/v4/templates/dockerfiles ``` @@ -107,7 +107,7 @@ GET /templates/dockerfiles/:key | ---------- | ------ | -------- | ----------- | | `key` | string | yes | The key of the Dockerfile template | -```bash +```shell curl https://gitlab.example.com/api/v4/templates/dockerfiles/Binary ``` diff --git a/doc/api/templates/gitignores.md b/doc/api/templates/gitignores.md index 45820b24f10..3acd666ad66 100644 --- a/doc/api/templates/gitignores.md +++ b/doc/api/templates/gitignores.md @@ -18,7 +18,7 @@ GET /templates/gitignores Example request: -```bash +```shell curl https://gitlab.example.com/api/v4/templates/gitignores ``` @@ -123,7 +123,7 @@ GET /templates/gitignores/:key Example request: -```bash +```shell curl https://gitlab.example.com/api/v4/templates/gitignores/Ruby ``` diff --git a/doc/api/templates/gitlab_ci_ymls.md b/doc/api/templates/gitlab_ci_ymls.md index b8fdb9e233c..c88aee4d9a7 100644 --- a/doc/api/templates/gitlab_ci_ymls.md +++ b/doc/api/templates/gitlab_ci_ymls.md @@ -18,7 +18,7 @@ GET /templates/gitlab_ci_ymls Example request: -```bash +```shell curl https://gitlab.example.com/api/v4/templates/gitlab_ci_ymls ``` @@ -123,7 +123,7 @@ GET /templates/gitlab_ci_ymls/:key Example request: -```bash +```shell curl https://gitlab.example.com/api/v4/templates/gitlab_ci_ymls/Ruby ``` diff --git a/doc/api/templates/licenses.md b/doc/api/templates/licenses.md index 92466c73bd3..0b95e4d8065 100644 --- a/doc/api/templates/licenses.md +++ b/doc/api/templates/licenses.md @@ -21,7 +21,7 @@ GET /templates/licenses | --------- | ------- | -------- | --------------------- | | `popular` | boolean | no | If passed, returns only popular licenses | -```bash +```shell curl https://gitlab.example.com/api/v4/templates/licenses?popular=1 ``` @@ -124,7 +124,7 @@ GET /templates/licenses/:key If you omit the `fullname` parameter but authenticate your request, the name of the authenticated user will be used to replace the copyright holder placeholder. -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/templates/licenses/mit?project=My+Cool+Project ``` diff --git a/doc/api/todos.md b/doc/api/todos.md index b708b4391a2..5b92f4fb5f1 100644 --- a/doc/api/todos.md +++ b/doc/api/todos.md @@ -22,7 +22,7 @@ Parameters: | `state` | string | no | The state of the todo. Can be either `pending` or `done` | | `type` | string | no | The type of a todo. Can be either `Issue` or `MergeRequest` | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/todos ``` @@ -194,7 +194,7 @@ Parameters: | --------- | ---- | -------- | ----------- | | `id` | integer | yes | The ID of a todo | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/todos/130/mark_as_done ``` @@ -284,7 +284,7 @@ Marks all pending todos for the current user as done. It returns the HTTP status POST /todos/mark_as_done ``` -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/todos/mark_as_done ``` diff --git a/doc/api/users.md b/doc/api/users.md index 3f9ccc24054..e71278696de 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -554,7 +554,7 @@ Get the status of the currently signed in user. GET /user/status ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/user/status" ``` @@ -580,7 +580,7 @@ GET /users/:id_or_username/status | ---------------- | ------ | -------- | ----------- | | `id_or_username` | string | yes | The id or username of the user to get a status of | -```bash +```shell curl "https://gitlab.example.com/users/janedoe/status" ``` @@ -609,7 +609,7 @@ PUT /user/status When both parameters `emoji` and `message` are empty, the status will be cleared. -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --data "emoji=coffee" --data "message=I crave coffee" https://gitlab.example.com/api/v4/user/status ``` @@ -635,7 +635,7 @@ Get the counts (same as in top right menu) of the currently signed in user. GET /user_counts ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " "https://gitlab.example.com/user_counts" ``` @@ -799,7 +799,7 @@ Get a list of currently authenticated user's GPG keys. GET /user/gpg_keys ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/user/gpg_keys ``` @@ -829,7 +829,7 @@ Parameters: | --------- | ------- | -------- | ----------- | | `key_id` | integer | yes | The ID of the GPG key | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/user/gpg_keys/1 ``` @@ -857,7 +857,7 @@ Parameters: | --------- | ------ | -------- | ----------- | | key | string | yes | The new GPG key | -```bash +```shell curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/user/gpg_keys ``` @@ -887,7 +887,7 @@ Parameters: | --------- | ------- | -------- | ----------- | | `key_id` | integer | yes | The ID of the GPG key | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/user/gpg_keys/1 ``` @@ -907,7 +907,7 @@ Parameters: | --------- | ------- | -------- | ----------- | | `id` | integer | yes | The ID of the user | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/2/gpg_keys ``` @@ -938,7 +938,7 @@ Parameters: | `id` | integer | yes | The ID of the user | | `key_id` | integer | yes | The ID of the GPG key | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/2/gpg_keys/1 ``` @@ -967,7 +967,7 @@ Parameters: | `id` | integer | yes | The ID of the user | | `key_id` | integer | yes | The ID of the GPG key | -```bash +```shell curl --data "key=-----BEGIN PGP PUBLIC KEY BLOCK-----\r\n\r\nxsBNBFV..." --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/2/gpg_keys ``` @@ -998,7 +998,7 @@ Parameters: | `id` | integer | yes | The ID of the user | | `key_id` | integer | yes | The ID of the GPG key | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users/2/gpg_keys/1 ``` @@ -1386,7 +1386,7 @@ Parameters: | --------- | ---- | -------- | ----------- | | `from` | string | no | Date string in the format YEAR-MONTH-DAY, e.g. `2016-03-11`. Defaults to 6 months ago. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/user/activities ``` @@ -1441,7 +1441,7 @@ Returns: - `403 Forbidden` when not requested by an admin. - `400 Bad Request` when requested type is not supported. -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/users//memberships ``` diff --git a/doc/api/version.md b/doc/api/version.md index ac19178b7ad..a89b8878298 100644 --- a/doc/api/version.md +++ b/doc/api/version.md @@ -9,7 +9,7 @@ authenticated users. GET /version ``` -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/version ``` diff --git a/doc/api/visual_review_discussions.md b/doc/api/visual_review_discussions.md index 385c1bf201d..a1076e09fc8 100644 --- a/doc/api/visual_review_discussions.md +++ b/doc/api/visual_review_discussions.md @@ -35,6 +35,6 @@ Parameters: | `position[x]` | integer | no | X coordinate (Only stored for `image` diff notes) | | `position[y]` | integer | no | Y coordinate (Only stored for `image` diff notes) | -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/5/merge_requests/11/visual_review_discussions?body=comment ``` diff --git a/doc/api/vulnerability_findings.md b/doc/api/vulnerability_findings.md index 3d3f12aeef5..18b9fb6c630 100644 --- a/doc/api/vulnerability_findings.md +++ b/doc/api/vulnerability_findings.md @@ -55,7 +55,7 @@ GET /projects/:id/vulnerability_findings?pipeline_id=42 | `confidence` | string array | no | Returns vulnerability findings belonging to specified confidence level: `undefined`, `ignore`, `unknown`, `experimental`, `low`, `medium`, `high`, or `confirmed`. Defaults to all. | | `pipeline_id` | integer/string | no | Returns vulnerability findings belonging to specified pipeline. | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/4/vulnerability_findings ``` diff --git a/doc/api/wikis.md b/doc/api/wikis.md index 035a89d80a5..57e5621277f 100644 --- a/doc/api/wikis.md +++ b/doc/api/wikis.md @@ -17,7 +17,7 @@ GET /projects/:id/wikis | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `with_content` | boolean | no | Include pages' content | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/wikis?with_content=1 ``` @@ -58,7 +58,7 @@ GET /projects/:id/wikis/:slug | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `slug` | string | yes | The slug (a unique string) of the wiki page | -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/projects/1/wikis/home ``` @@ -88,7 +88,7 @@ POST /projects/:id/wikis | `title` | string | yes | The title of the wiki page | | `format` | string | no | The format of the wiki page. Available formats are: `markdown` (default), `rdoc`, `asciidoc` and `org` | -```bash +```shell curl --data "format=rdoc&title=Hello&content=Hello world" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/wikis" ``` @@ -119,7 +119,7 @@ PUT /projects/:id/wikis/:slug | `format` | string | no | The format of the wiki page. Available formats are: `markdown` (default), `rdoc`, `asciidoc` and `org` | | `slug` | string | yes | The slug (a unique string) of the wiki page | -```bash +```shell curl --request PUT --data "format=rdoc&content=documentation&title=Docs" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/wikis/foo" ``` @@ -147,7 +147,7 @@ DELETE /projects/:id/wikis/:slug | `id` | integer/string | yes | The ID or [URL-encoded path of the project](README.md#namespaced-path-encoding) | | `slug` | string | yes | The slug (a unique string) of the wiki page | -```bash +```shell curl --request DELETE --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/1/wikis/foo" ``` @@ -175,7 +175,7 @@ cURL to post data using the header `Content-Type: multipart/form-data`. The `file=` parameter must point to a file on your filesystem and be preceded by `@`. For example: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "file=@dk.png" https://gitlab.example.com/api/v4/projects/1/wikis/attachments ``` diff --git a/doc/ci/ci_cd_for_external_repos/bitbucket_integration.md b/doc/ci/ci_cd_for_external_repos/bitbucket_integration.md index dd474b09a9c..e013078fa2e 100644 --- a/doc/ci/ci_cd_for_external_repos/bitbucket_integration.md +++ b/doc/ci/ci_cd_for_external_repos/bitbucket_integration.md @@ -65,7 +65,7 @@ To use GitLab CI/CD with a Bitbucket Cloud repository: Create a file `build_status` and insert the script below and run `chmod +x build_status` in your terminal to make the script executable. - ```bash + ```shell #!/usr/bin/env bash # Push GitLab CI/CD build status to Bitbucket Cloud diff --git a/doc/ci/docker/using_docker_build.md b/doc/ci/docker/using_docker_build.md index b7d708b152e..2750e61ff96 100644 --- a/doc/ci/docker/using_docker_build.md +++ b/doc/ci/docker/using_docker_build.md @@ -16,7 +16,7 @@ One of the new trends in Continuous Integration/Deployment is to: It's also useful when your application already has the `Dockerfile` that can be used to create and test an image: -```bash +```shell docker build -t my-image dockerfiles/ docker run my-image /script/to/run/tests docker tag my-image my-registry:5000/my-image @@ -48,7 +48,7 @@ GitLab Runner then executes job scripts as the `gitlab-runner` user. 1. During GitLab Runner installation select `shell` as method of executing job scripts or use command: - ```bash + ```shell sudo gitlab-runner register -n \ --url https://gitlab.com/ \ --registration-token REGISTRATION_TOKEN \ @@ -63,13 +63,13 @@ GitLab Runner then executes job scripts as the `gitlab-runner` user. 1. Add `gitlab-runner` user to `docker` group: - ```bash + ```shell sudo usermod -aG docker gitlab-runner ``` 1. Verify that `gitlab-runner` has access to Docker: - ```bash + ```shell sudo -u gitlab-runner -H docker info ``` @@ -160,7 +160,7 @@ support this. 1. Register GitLab Runner from the command line to use `docker` and `privileged` mode: - ```bash + ```shell sudo gitlab-runner register -n \ --url https://gitlab.com/ \ --registration-token REGISTRATION_TOKEN \ @@ -320,7 +320,7 @@ In order to do that, follow the steps: 1. Register GitLab Runner from the command line to use `docker` and share `/var/run/docker.sock`: - ```bash + ```shell sudo gitlab-runner register -n \ --url https://gitlab.com/ \ --registration-token REGISTRATION_TOKEN \ @@ -384,7 +384,7 @@ aware of the following implications: work as expected since volume mounting is done in the context of the host machine, not the build container. For example: - ```sh + ```shell docker run --rm -t -i -v $(pwd)/src:/home/app/src test-image:latest run_app_tests ``` @@ -458,13 +458,13 @@ which can be avoided if a different driver is used, for example `overlay2`. 1. Make sure a recent kernel is used, preferably `>= 4.2`. 1. Check whether the `overlay` module is loaded: - ```sh + ```shell sudo lsmod | grep overlay ``` If you see no result, then it isn't loaded. To load it use: - ```sh + ```shell sudo modprobe overlay ``` @@ -542,7 +542,7 @@ For all projects, mostly suitable for public ones: your Docker images and has read/write access to the Registry. This is ephemeral, so it's only valid for one job. You can use the following example as-is: - ```sh + ```shell docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY ``` @@ -557,7 +557,7 @@ For private and internal projects: Replace the `` and `` in the following example: - ```sh + ```shell docker login -u -p $CI_REGISTRY ``` @@ -567,7 +567,7 @@ For private and internal projects: Once created, you can use the special environment variables, and GitLab CI/CD will fill them in for you. You can use the following example as-is: - ```sh + ```shell docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY ``` @@ -602,7 +602,7 @@ assuming you have it configured with [TLS enabled](#tls-enabled): If you forget to set the service alias, the `docker:19.03.1` image won't find the `dind` service, and an error like the following is thrown: -```sh +```shell $ docker info error during connect: Get http://docker:2376/v1.39/info: dial tcp: lookup docker on 192.168.0.1:53: no such host ``` diff --git a/doc/ci/docker/using_docker_images.md b/doc/ci/docker/using_docker_images.md index 8c6069bd939..630beec453c 100644 --- a/doc/ci/docker/using_docker_images.md +++ b/doc/ci/docker/using_docker_images.md @@ -28,7 +28,7 @@ to use the `docker` executor. A one-line example can be seen below: -```bash +```shell sudo gitlab-runner register \ --url "https://gitlab.example.com/" \ --registration-token "PROJECT_REGISTRATION_TOKEN" \ @@ -559,7 +559,7 @@ There are two ways to determine the value of `DOCKER_AUTH_CONFIG`: - **First way -** Do a `docker login` on your local machine: - ```bash + ```shell docker login registry.example.com:5000 --username my_username --password my_password ``` @@ -568,7 +568,7 @@ There are two ways to determine the value of `DOCKER_AUTH_CONFIG`: If you don't need access to the registry from your computer, you can do a `docker logout`: - ```bash + ```shell docker logout registry.example.com:5000 ``` @@ -579,7 +579,7 @@ There are two ways to determine the value of `DOCKER_AUTH_CONFIG`: `${username}:${password}` and create the Docker configuration JSON manually. Open a terminal and execute the following command: - ```bash + ```shell echo -n "my_username:my_password" | base64 # Example output to copy @@ -790,7 +790,7 @@ able to run Docker with your regular user account. First start with creating a file named `build_script`: -```bash +```shell cat < build_script git clone https://gitlab.com/gitlab-org/gitlab-runner.git /builds/gitlab-org/gitlab-runner cd /builds/gitlab-org/gitlab-runner @@ -805,7 +805,7 @@ is specific to your project. Then create some service containers: -```sh +```shell docker run -d --name service-mysql mysql:latest docker run -d --name service-postgres postgres:latest ``` @@ -817,7 +817,7 @@ respectively. They will both run in the background (`-d`). Finally, create a build container by executing the `build_script` file we created earlier: -```sh +```shell docker run --name build -i --link=service-mysql:mysql --link=service-postgres:postgres ruby:2.6 /bin/bash < build_script ``` @@ -829,7 +829,7 @@ piped using STDIN to the bash interpreter which in turn executes the When you finish testing and no longer need the containers, you can remove them with: -```sh +```shell docker rm -f -v build service-mysql service-postgres ``` diff --git a/doc/ci/docker/using_kaniko.md b/doc/ci/docker/using_kaniko.md index 45afd9c6223..dce5cd5b40d 100644 --- a/doc/ci/docker/using_kaniko.md +++ b/doc/ci/docker/using_kaniko.md @@ -72,7 +72,7 @@ build: When trying to push to a Docker registry that uses a certificate that is signed by a custom CA, you might get the following error: -```sh +```shell $ /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --no-push INFO[0000] Downloading base image registry.gitlab.example.com/group/docker-image error building image: getting stage builder for stage 0: Get https://registry.gitlab.example.com/v2/: x509: certificate signed by unknown authority diff --git a/doc/ci/enable_or_disable_ci.md b/doc/ci/enable_or_disable_ci.md index 7c7640e23c3..732b4676c56 100644 --- a/doc/ci/enable_or_disable_ci.md +++ b/doc/ci/enable_or_disable_ci.md @@ -75,7 +75,7 @@ default_projects_features: Save the file and restart GitLab: -```sh +```shell sudo service gitlab restart ``` @@ -87,7 +87,7 @@ gitlab_rails['gitlab_default_projects_features_builds'] = false Save the file and reconfigure GitLab: -```sh +```shell sudo gitlab-ctl reconfigure ``` diff --git a/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md b/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md index 788d57b81f8..946deb6a5ff 100644 --- a/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md +++ b/doc/ci/examples/devops_and_game_dev_with_gitlab_ci_cd/index.md @@ -54,7 +54,7 @@ CI/CD from every new push to master. The `master` branch for this game's [reposi contains a completed version with all configurations. If you would like to follow along with this article, you can clone and work from the `devops-article` branch: -```sh +```shell git clone git@gitlab.com:blitzgren/gitlab-game-demo.git git checkout devops-article ``` @@ -363,7 +363,7 @@ our repository. If all goes well you'll end up with a green check mark on each j You can confirm that the tests passed by clicking on the `test` job to enter the full build logs. Scroll to the bottom and observe, in all its passing glory: -```sh +```shell $ gulp run-test [18:37:24] Using gulpfile /builds/blitzgren/gitlab-game-demo/gulpfile.js [18:37:24] Starting 'run-test'... diff --git a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md index 5acdd273548..b8f191570bc 100644 --- a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md +++ b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md @@ -57,7 +57,7 @@ This test is as simple as asserting that the given value is true. Laravel uses `PHPUnit` for tests by default. If we run `vendor/bin/phpunit` we should see the green output: -```bash +```shell vendor/bin/phpunit OK (1 test, 1 assertions) ``` @@ -70,7 +70,7 @@ Since we have our app up and running locally, it's time to push the codebase to Let's create [a new project](../../../gitlab-basics/create-project.md) in GitLab named `laravel-sample`. After that, follow the command line instructions displayed on the project's homepage to initiate the repository on our machine and push the first commit. -```bash +```shell cd laravel-sample git init git remote add origin git@gitlab.example.com:/laravel-sample.git @@ -89,7 +89,7 @@ We have installed LEMP stack which stands for Linux, NGINX, MySQL and PHP on our Let's now create a new user that will be used to deploy our website and give it the needed permissions using [Linux ACL](https://serversforhackers.com/c/linux-acls): -```bash +```shell # Create user deployer sudo adduser deployer # Give the read-write-execute permissions to deployer user for directory /var/www @@ -98,7 +98,7 @@ sudo setfacl -R -m u:deployer:rwx /var/www If you don't have ACL installed on your Ubuntu server, use this command to install it: -```bash +```shell sudo apt install acl ``` @@ -108,7 +108,7 @@ Let's suppose we want to deploy our app to the production server from a private After that, we need to copy the private key, which will be used to connect to our server as the deployer user with SSH, to be able to automate our deployment process: -```bash +```shell # As the deployer user on server # # Copy the content of public key to authorized_keys @@ -128,7 +128,7 @@ We'll use this variable in the `.gitlab-ci.yml` later, to easily connect to our We also need to add the public key to **Project** > **Settings** > **Repository** as a [Deploy Key](../../../ssh/README.md#deploy-keys), which gives us the ability to access our repository from the server through [SSH protocol](../../../gitlab-basics/command-line-commands.md#start-working-on-your-project). -```bash +```shell # As the deployer user on the server # # Copy the public key @@ -141,7 +141,7 @@ To the field **Title**, add any name you want, and paste the public key into the Now, let's clone our repository on the server just to make sure the `deployer` user has access to the repository. -```bash +```shell # As the deployer user on server # git clone git@gitlab.example.com:/laravel-sample.git @@ -157,7 +157,7 @@ Now, let's make sure our web server configuration points to the `current/public` Open the default NGINX server block configuration file by typing: -```bash +```shell sudo nano /etc/nginx/sites-available/default ``` @@ -199,7 +199,7 @@ Then within our `@task` directive we define the bash commands that should be run On the local machine use the `run` command to run Envoy tasks. -```bash +```shell envoy run list ``` @@ -382,7 +382,7 @@ Now it's time to commit [Envoy.blade.php](https://gitlab.com/mehranrasulian/lara To keep things simple, we commit directly to `master`, without using [feature-branches](../../../topics/gitlab_flow.md#github-flow-as-a-simpler-alternative) since collaboration is beyond the scope of this tutorial. In a real world project, teams may use [Issue Tracker](../../../user/project/issues/index.md) and [Merge Requests](../../../user/project/merge_requests/index.md) to move their code across branches: -```bash +```shell git add Envoy.blade.php git commit -m 'Add Envoy' git push origin master @@ -407,7 +407,7 @@ With Docker images our builds run incredibly faster! Let's create a [Dockerfile](https://gitlab.com/mehranrasulian/laravel-sample/blob/master/Dockerfile) in the root directory of our app with the following content: -```bash +```shell # Set the base image for subsequent instructions FROM php:7.1 @@ -449,13 +449,13 @@ You may need to [enable Container Registry](../../../user/packages/container_reg To start using Container Registry on our machine, we first need to login to the GitLab registry using our GitLab username and password: -```bash +```shell docker login registry.gitlab.com ``` Then we can build and push our image to GitLab: -```bash +```shell docker build -t registry.gitlab.com//laravel-sample . docker push registry.gitlab.com//laravel-sample @@ -475,7 +475,7 @@ We'll use this image further down in the `.gitlab-ci.yml` configuration file to Let's commit the `Dockerfile` file. -```bash +```shell git add Dockerfile git commit -m 'Add Dockerfile' git push origin master diff --git a/doc/ci/examples/php.md b/doc/ci/examples/php.md index 1dd3049d53d..db039b746e3 100644 --- a/doc/ci/examples/php.md +++ b/doc/ci/examples/php.md @@ -40,7 +40,7 @@ done. Let's create a `ci/docker_install.sh` file in the root directory of our repository with the following content: -```bash +```shell #!/bin/bash # We need to install dependencies only for Docker @@ -153,7 +153,7 @@ dependencies are installed. For example, in a VM running Debian 8 we first update the cache, then we install `phpunit` and `php5-mysql`: -```bash +```shell sudo apt-get update -y sudo apt-get install -y phpunit php5-mysql ``` @@ -198,7 +198,7 @@ some extensions that are not currently present on the build machine. To install additional extensions simply execute: -```bash +```shell pecl install ``` @@ -269,7 +269,7 @@ documentation. With GitLab Runner 1.0 you can also test any changes locally. From your terminal execute: -```bash +```shell # Check using docker executor gitlab-runner exec docker test:app diff --git a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md index 03381dc16ff..6d05c37390a 100644 --- a/doc/ci/examples/test-and-deploy-python-application-to-heroku.md +++ b/doc/ci/examples/test-and-deploy-python-application-to-heroku.md @@ -75,7 +75,7 @@ First install [Docker Engine](https://docs.docker.com/installation/). To build this project you also need to have [GitLab Runner](https://docs.gitlab.com/runner/index.html). You can use public runners available on `gitlab.com` or you can register your own: -```sh +```shell gitlab-runner register \ --non-interactive \ --url "https://gitlab.com/" \ diff --git a/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md b/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md index 66246a0fda2..3de8f3c675c 100644 --- a/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md +++ b/doc/ci/examples/test-and-deploy-ruby-application-to-heroku.md @@ -66,7 +66,7 @@ First install [Docker Engine](https://docs.docker.com/installation/). To build this project you also need to have [GitLab Runner](https://docs.gitlab.com/runner/). You can use public runners available on `gitlab.com` or register your own: -```sh +```shell gitlab-runner register \ --non-interactive \ --url "https://gitlab.com/" \ diff --git a/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md b/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md index f91e89d3c4c..557ebad72ba 100644 --- a/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md +++ b/doc/ci/examples/test_phoenix_app_with_gitlab_ci_cd/index.md @@ -79,7 +79,7 @@ When we call `mix` command, we'll pass two arguments: - And the parameter `phoenix.new` requires, which is the name of the new project. In this case, we're calling it `hello_gitlab_ci`, but you're free to set your own name: -```bash +```shell mix phoenix.new hello_gitlab_ci ``` @@ -108,14 +108,14 @@ changes. Run the commands below to create our empty database: -```bash +```shell cd hello_gitlab_ci mix ecto.create ``` We expect to see this output at the end of the command: -```bash +```shell Generated hello_gitlab_ci app The database for HelloGitlabCi.Repo has been created ``` @@ -130,13 +130,13 @@ permissions and a password of `postgres`. If it's not your case, check Now, it's time to see if everything we did until now went well. We'll call `mix` again, this time with `phoenix.server` parameter, which will start Phoenix's HTTP Server. -```bash +```shell mix phoenix.server ``` This will be the output to this command: -```bash +```shell [info] Running HelloGitlabCi.Endpoint with Cowboy using http://localhost:4000 23 May 11:44:35 - info: compiling 23 May 11:44:37 - info: compiled 6 files into 2 files, copied 3 in 9.8 sec @@ -223,13 +223,13 @@ Let's run a new task with `mix` to run those tests for us. This time, the parame In your terminal, navigate to the directory `hello_gitlab_ci` and run: -```bash +```shell mix test ``` Our expected result is this: -```bash +```shell .... Finished in 0.7 seconds diff --git a/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md b/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md index fca6916bee4..744713b0678 100644 --- a/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md +++ b/doc/ci/merge_request_pipelines/pipelines_for_merged_results/merge_trains/index.md @@ -30,6 +30,7 @@ Pipelines invalidated through failures are immediately canceled and requeued. Merge trains have the following requirements and limitations: +- GitLab 12.0 and later requires [Redis](https://redis.io/) 3.2 or higher to run Merge Trains. - This feature requires that [pipelines for merged results](../index.md#pipelines-for-merged-results-premium) are **configured properly**. diff --git a/doc/ci/quick_start/README.md b/doc/ci/quick_start/README.md index 43cc7eeab8c..90efae30925 100644 --- a/doc/ci/quick_start/README.md +++ b/doc/ci/quick_start/README.md @@ -128,7 +128,7 @@ For more information and a complete `.gitlab-ci.yml` syntax, please read Once you've created `.gitlab-ci.yml`, you should add it to your Git repository and push it to GitLab. -```bash +```shell git add .gitlab-ci.yml git commit -m "Add .gitlab-ci.yml" git push origin master diff --git a/doc/ci/services/mysql.md b/doc/ci/services/mysql.md index ce69a7df885..e21b62e93cf 100644 --- a/doc/ci/services/mysql.md +++ b/doc/ci/services/mysql.md @@ -56,7 +56,7 @@ GitLab Runner with the Shell executor. First install the MySQL server: -```bash +```shell sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev ``` @@ -68,7 +68,7 @@ the root user.* The next step is to create a user, so login to MySQL as root: -```bash +```shell mysql -u root -p ``` @@ -77,38 +77,38 @@ application. Change `$password` in the command below to a real strong password. *Note: Do not type `mysql>`, this is part of the MySQL prompt.* -```bash +```shell mysql> CREATE USER 'runner'@'localhost' IDENTIFIED BY '$password'; ``` Create the database: -```bash +```shell mysql> CREATE DATABASE IF NOT EXISTS `` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; ``` Grant the necessary permissions on the database: -```bash +```shell mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON ``.* TO 'runner'@'localhost'; ``` If all went well you can now quit the database session: -```bash +```shell mysql> \q ``` Now, try to connect to the newly created database to check that everything is in place: -```bash +```shell mysql -u runner -p -D ``` As a final step, configure your application to use the database, for example: -```bash +```shell Host: localhost User: runner Password: $password diff --git a/doc/ci/services/postgres.md b/doc/ci/services/postgres.md index 142f4f262e5..a137f10949f 100644 --- a/doc/ci/services/postgres.md +++ b/doc/ci/services/postgres.md @@ -57,13 +57,13 @@ GitLab Runner with the Shell executor. First install the PostgreSQL server: -```bash +```shell sudo apt-get install -y postgresql postgresql-client libpq-dev ``` The next step is to create a user, so login to PostgreSQL: -```bash +```shell sudo -u postgres psql -d template1 ``` @@ -72,7 +72,7 @@ application. Change `$password` in the command below to a real strong password. *__Note:__ Do not type `template1=#`, this is part of the PostgreSQL prompt.* -```bash +```shell template1=# CREATE USER runner WITH PASSWORD '$password' CREATEDB; ``` @@ -83,20 +83,20 @@ testing framework you have tools that drop and create databases.* Create the database and grant all privileges on it for the user `runner`: -```bash +```shell template1=# CREATE DATABASE nice_marmot OWNER runner; ``` If all went well you can now quit the database session: -```bash +```shell template1=# \q ``` Now, try to connect to the newly created database with the user `runner` to check that everything is in place. -```bash +```shell psql -U runner -h localhost -d nice_marmot -W ``` diff --git a/doc/ci/services/redis.md b/doc/ci/services/redis.md index ccb92fa94d7..b04b36f7a04 100644 --- a/doc/ci/services/redis.md +++ b/doc/ci/services/redis.md @@ -40,13 +40,13 @@ Runner with the Shell executor. In your build machine install the Redis server: -```bash +```shell sudo apt-get install redis-server ``` Verify that you can connect to the server with the `gitlab-runner` user: -```bash +```shell # Try connecting the Redis server sudo -u gitlab-runner -H redis-cli diff --git a/doc/ci/ssh_keys/README.md b/doc/ci/ssh_keys/README.md index bee1501aed8..62a8bb23e08 100644 --- a/doc/ci/ssh_keys/README.md +++ b/doc/ci/ssh_keys/README.md @@ -134,7 +134,7 @@ on, and use that key for all projects that are run on this machine. Once done, try to login to the remote server in order to accept the fingerprint: -```bash +```shell ssh example.com ``` @@ -150,7 +150,7 @@ connection would fail if the public keys would not match). To find out the host keys of your server, run the `ssh-keyscan` command from a trusted network (ideally, from the private server itself): -```sh +```shell ## Use the domain name ssh-keyscan example.com diff --git a/doc/ci/triggers/README.md b/doc/ci/triggers/README.md index 1a58e3eb7a2..08b2171f23b 100644 --- a/doc/ci/triggers/README.md +++ b/doc/ci/triggers/README.md @@ -137,7 +137,7 @@ below. By using cURL you can trigger a pipeline rerun with minimal effort, for example: -```bash +```shell curl --request POST \ --form token=TOKEN \ --form ref=master \ @@ -148,7 +148,7 @@ In this case, the project with ID `9` will get rebuilt on `master` branch. Alternatively, you can pass the `token` and `ref` arguments in the query string: -```bash +```shell curl --request POST \ "https://gitlab.example.com/api/v4/projects/9/trigger/pipeline?token=TOKEN&ref=master" ``` @@ -241,7 +241,7 @@ upload_package: You can then trigger a rebuild while you pass the `UPLOAD_TO_S3` variable and the script of the `upload_package` job will run: -```bash +```shell curl --request POST \ --form token=TOKEN \ --form ref=master \ @@ -259,7 +259,7 @@ Whether you craft a script or just run cURL directly, you can trigger jobs in conjunction with cron. The example below triggers a job on the `master` branch of project with ID `9` every night at `00:30`: -```bash +```shell 30 0 * * * curl --request POST --form token=TOKEN --form ref=master https://gitlab.example.com/api/v4/projects/9/trigger/pipeline ``` diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md index ff602de6754..1fdf8009fcd 100644 --- a/doc/ci/variables/README.md +++ b/doc/ci/variables/README.md @@ -74,7 +74,7 @@ file path as a command line argument or an environment variable. In the past, th common pattern was to read the value of a CI variable, save it in a file, and then use the newly created file in your script: -```bash +```shell # Read certificate stored in $KUBE_CA_PEM variable and save it in a new file echo "$KUBE_CA_PEM" > "$(pwd)/kube.ca.pem" # Pass the newly created file to kubectl @@ -90,7 +90,7 @@ it directly. For example, let's say we have the following variables: We can then call them from `.gitlab-ci.yml` like this: -```bash +```shell kubectl config set-cluster e2e --server="$KUBE_URL" --certificate-authority="$KUBE_CA_PEM" ``` @@ -259,7 +259,7 @@ job_name: Example values: -```bash +```shell export CI_JOB_ID="50" export CI_COMMIT_SHA="1ecfd275763eff1d6b4844ea3168962458c9f27a" export CI_COMMIT_SHORT_SHA="1ecfd275" @@ -623,7 +623,7 @@ job_name: Example truncated output with `CI_DEBUG_TRACE` set to `true`: -```bash +```shell ... export CI_SERVER_TLS_CA_FILE="/builds/gitlab-examples/ci-debug-trace.tmp/CI_SERVER_TLS_CA_FILE" diff --git a/doc/development/README.md b/doc/development/README.md index 84d4fb5519f..f94da66085b 100644 --- a/doc/development/README.md +++ b/doc/development/README.md @@ -134,7 +134,6 @@ Complementary reads: - [Verifying database capabilities](verifying_database_capabilities.md) - [Database Debugging and Troubleshooting](database_debugging.md) - [Query Count Limits](query_count_limits.md) -- [Database helper modules](database_helpers.md) - [Code comments](code_comments.md) - [Creating enums](creating_enums.md) - [Renaming features](renaming_features.md) @@ -191,6 +190,10 @@ Complementary reads: - [Shell scripting standards and style guidelines](shell_scripting_guide/index.md) +## Domain-specific guides + +- [CI/CD development documentation](cicd/index.md) + ## Other Development guides - [Defining relations between files using projections](projections.md) diff --git a/doc/development/architecture.md b/doc/development/architecture.md index 778cc1aa1d7..cd41eb28e4d 100644 --- a/doc/development/architecture.md +++ b/doc/development/architecture.md @@ -504,7 +504,7 @@ To summarize here's the [directory structure of the `git` user home directory](. ### Processes -```sh +```shell ps aux | grep '^git' ``` diff --git a/doc/development/chaos_endpoints.md b/doc/development/chaos_endpoints.md index 961520db7d8..2e55f19cd91 100644 --- a/doc/development/chaos_endpoints.md +++ b/doc/development/chaos_endpoints.md @@ -26,7 +26,7 @@ A secret token can be set through the `GITLAB_CHAOS_SECRET` environment variable For example, when using the [GDK](https://gitlab.com/gitlab-org/gitlab-development-kit) this can be done with the following command: -```bash +```shell GITLAB_CHAOS_SECRET=secret gdk run ``` @@ -60,7 +60,7 @@ GET /-/chaos/leakmem?memory_mb=1024&duration_s=50&async=true | `duration_s` | integer | no | Minimum duration_s, in seconds, that the memory should be retained. Defaults to 30s. | | `async` | boolean | no | Set to true to leak memory in a Sidekiq background worker process | -```bash +```shell curl http://localhost:3000/-/chaos/leakmem?memory_mb=1024&duration_s=10 --header 'X-Chaos-Secret: secret' curl http://localhost:3000/-/chaos/leakmem?memory_mb=1024&duration_s=10&token=secret ``` @@ -83,7 +83,7 @@ GET /-/chaos/cpu_spin?duration_s=50&async=true | `duration_s` | integer | no | Duration, in seconds, that the core will be utilized. Defaults to 30s | | `async` | boolean | no | Set to true to consume CPU in a Sidekiq background worker process | -```bash +```shell curl http://localhost:3000/-/chaos/cpu_spin?duration_s=60 --header 'X-Chaos-Secret: secret' curl http://localhost:3000/-/chaos/cpu_spin?duration_s=60&token=secret ``` @@ -108,7 +108,7 @@ GET /-/chaos/db_spin?duration_s=50&async=true | `duration_s` | integer | no | Duration, in seconds, that the core will be utilized. Defaults to 30s | | `async` | boolean | no | Set to true to perform the operation in a Sidekiq background worker process | -```bash +```shell curl http://localhost:3000/-/chaos/db_spin?interval_s=1&duration_s=60 --header 'X-Chaos-Secret: secret' curl http://localhost:3000/-/chaos/db_spin?interval_s=1&duration_s=60&token=secret ``` @@ -130,7 +130,7 @@ GET /-/chaos/sleep?duration_s=50&async=true | `duration_s` | integer | no | Duration, in seconds, that the request will sleep for. Defaults to 30s | | `async` | boolean | no | Set to true to sleep in a Sidekiq background worker process | -```bash +```shell curl http://localhost:3000/-/chaos/sleep?duration_s=60 --header 'X-Chaos-Secret: secret' curl http://localhost:3000/-/chaos/sleep?duration_s=60&token=secret ``` @@ -151,7 +151,7 @@ GET /-/chaos/kill?async=true | ------------ | ------- | -------- | ---------------------------------------------------------------------- | | `async` | boolean | no | Set to true to kill a Sidekiq background worker process | -```bash +```shell curl http://localhost:3000/-/chaos/kill --header 'X-Chaos-Secret: secret' curl http://localhost:3000/-/chaos/kill?token=secret ``` diff --git a/doc/development/cicd/index.md b/doc/development/cicd/index.md new file mode 100644 index 00000000000..ed33eb01308 --- /dev/null +++ b/doc/development/cicd/index.md @@ -0,0 +1,59 @@ +# CI/CD development documentation + +Development guides that are specific to CI/CD are listed here. + +## Job scheduling + +When a Pipeline is created all its jobs are created at once for all stages, with an initial state of `created`. This makes it possible to visualize the full content of a pipeline. + +A job with the `created` state won't be seen by the Runner yet. To make it possible to assign a job to a Runner, the job must transition first into the `pending` state, which can happen if: + +1. The job is created in the very first stage of the pipeline. +1. The job required a manual start and it has been triggered. +1. All jobs from the previous stage have completed successfully. In this case we transition all jobs from the next stage to `pending`. +1. The job specifies DAG dependencies using `needs:` and all the dependent jobs are completed. + +When the Runner is connected, it requests the next `pending` job to run by polling the server continuously. + +NOTE: **Note:** API endpoints used by the Runner to interact with GitLab are defined in [`lib/api/runner.rb`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/api/runner.rb) + +After the server receives the request it selects a `pending` job based on the [`Ci::RegisterJobService` algorithm](#ciregisterjobservice), then assigns and sends the job to the Runner. + +Once all jobs are completed for the current stage, the server "unlocks" all the jobs from the next stage by changing their state to `pending`. These can now be picked by the scheduling algorithm when the Runner requests new jobs, and continues like this until all stages are completed. + +### Communication between Runner and GitLab server + +Once the Runner is [registered](../../ci/runners/README.md#registering-a-shared-runner) using the registration token, the server knows what type of jobs it can execute. This depends on: + +- The type of runner it is registered as: + - a shared runner + - a group runner + - a project specific runner +- Any associated tags. + +The Runner initiates the communication by requesting jobs to execute with `POST /api/v4/jobs/request`. Although this polling generally happens every few seconds we leverage caching via HTTP headers to reduce the server-side work load if the job queue doesn't change. + +This API endpoint runs [`Ci::RegisterJobService`](https://gitlab.com/gitlab-org/gitlab/blob/master/app/services/ci/register_job_service.rb), which: + +1. Picks the next job to run from the pool of `pending` jobs +1. Assigns it to the Runner +1. Presents it to the Runner via the API response + +### `Ci::RegisterJobService` + +There are 3 top level queries that this service uses to gather the majority of the jobs and they are selected based on the level where the Runner is registered to: + +- Select jobs for shared Runner (instance level) +- Select jobs for group level Runner +- Select jobs for project Runner + +This list of jobs is then filtered further by matching tags between job and Runner tags. + +NOTE: **Note:** If a job contains tags, the Runner will not pick the job if it does not match **all** the tags. +The Runner may have more tags than defined for the job, but not vice-versa. + +Finally if the Runner can only pick jobs that are tagged, all untagged jobs are filtered out. + +At this point we loop through remaining `pending` jobs and we try to assign the first job that the Runner "can pick" based on additional policies. For example, Runners marked as `protected` can only pick jobs that run against protected branches (such as production deployments). + +As we increase the number of Runners in the pool we also increase the chances of conflicts which would arise if assigning the same job to different Runners. To prevent that we gracefully rescue conflict errors and assign the next job in the list. diff --git a/doc/development/database_debugging.md b/doc/development/database_debugging.md index 65a3e518585..234d6b2518d 100644 --- a/doc/development/database_debugging.md +++ b/doc/development/database_debugging.md @@ -60,7 +60,7 @@ When running specs with the [Spring preloader](rake_tasks.md#speed-up-tests-rake the test database can get into a corrupted state. Trying to run the migration or dropping/resetting the test database has no effect. -```sh +```shell $ bundle exec spring rspec some_spec.rb ... Failure/Error: ActiveRecord::Migration.maintain_test_schema! @@ -78,7 +78,7 @@ ActiveRecord::PendingMigrationError: To resolve, you can kill the spring server and app that lives between spec runs. -```sh +```shell $ ps aux | grep spring eric 87304 1.3 2.9 3080836 482596 ?? Ss 10:12AM 4:08.36 spring app | gitlab | started 6 hours ago | test mode eric 37709 0.0 0.0 2518640 7524 s006 S Wed11AM 0:00.79 spring server | gitlab | started 29 hours ago @@ -100,6 +100,6 @@ of GitLab schema later than the `MIN_SCHEMA_VERSION`, and then rolled back the to an older migration, from before. In this case, in order to migrate forward again, you should set the `SKIP_SCHEMA_VERSION_CHECK` environment variable. -```sh +```shell bundle exec rake db:migrate SKIP_SCHEMA_VERSION_CHECK=true ``` diff --git a/doc/development/database_helpers.md b/doc/development/database_helpers.md deleted file mode 100644 index 21e4e725de6..00000000000 --- a/doc/development/database_helpers.md +++ /dev/null @@ -1,63 +0,0 @@ -# Database helpers - -There are a number of useful helper modules defined in `/lib/gitlab/database/`. - -## Subquery - -In some cases it is not possible to perform an operation on a query. -For example: - -```ruby -Geo::EventLog.where('id < 100').limit(10).delete_all -``` - -Will give this error: - -> ActiveRecord::ActiveRecordError: delete_all doesn't support limit - -One solution would be to wrap it in another `where`: - -```ruby -Geo::EventLog.where(id: Geo::EventLog.where('id < 100').limit(10)).delete_all -``` - -This works with PostgreSQL, but with MySQL it gives this error: - -> ActiveRecord::StatementInvalid: Mysql2::Error: This version of MySQL -> doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' - -Also, that query doesn't have very good performance. Using a -`INNER JOIN` with itself is better. - -So instead of this query: - -```sql -SELECT geo_event_log.* -FROM geo_event_log -WHERE geo_event_log.id IN - (SELECT geo_event_log.id - FROM geo_event_log - WHERE (id < 100) - LIMIT 10) -``` - -It's better to write: - -```sql -SELECT geo_event_log.* -FROM geo_event_log -INNER JOIN - (SELECT geo_event_log.* - FROM geo_event_log - WHERE (id < 100) - LIMIT 10) t2 ON geo_event_log.id = t2.id -``` - -And this is where `Gitlab::Database::Subquery.self_join` can help -you. So you can rewrite the above statement as: - -```ruby -Gitlab::Database::Subquery.self_join(Geo::EventLog.where('id < 100').limit(10)).delete_all -``` - -And this also works with MySQL, so you don't need to worry about that. diff --git a/doc/development/distributed_tracing.md b/doc/development/distributed_tracing.md index d2810fe89f0..948139f4aea 100644 --- a/doc/development/distributed_tracing.md +++ b/doc/development/distributed_tracing.md @@ -27,7 +27,7 @@ no overhead at all. To enable `GITLAB_TRACING`, a valid _"configuration-string"_ value should be set, with a URL-like form: -```sh +```shell GITLAB_TRACING=opentracing://?=&= ``` @@ -90,7 +90,7 @@ documentation](https://www.jaegertracing.io/docs/1.9/getting-started/). If you have Docker available, the easier approach to running the Jaeger all-in-one is through Docker, using the following command: -```sh +```shell $ docker run \ --rm \ -e COLLECTOR_ZIPKIN_HTTP_PORT=9411 \ @@ -121,7 +121,7 @@ appropriate configuration string. **TL;DR:** If you are running everything on the same host, use the following value: -```sh +```shell export GITLAB_TRACING="opentracing://jaeger?http_endpoint=http%3A%2F%2Flocalhost%3A14268%2Fapi%2Ftraces&sampler=const&sampler_param=1" ``` @@ -152,7 +152,7 @@ application. When `GITLAB_TRACING` is configured properly, the application will log this on startup: -```sh +```shell 13:41:53 gitlab-workhorse.1 | 2019/02/12 13:41:53 Tracing enabled ... 13:41:54 gitaly.1 | 2019/02/12 13:41:54 Tracing enabled @@ -161,7 +161,7 @@ When `GITLAB_TRACING` is configured properly, the application will log this on s If `GITLAB_TRACING` is not configured correctly, this will also be logged: -```sh +```shell 13:43:45 gitaly.1 | 2019/02/12 13:43:45 skipping tracing configuration step: tracer: unable to load driver mytracer ``` diff --git a/doc/development/documentation/index.md b/doc/development/documentation/index.md index 34cf50f61d9..ffb8178326b 100644 --- a/doc/development/documentation/index.md +++ b/doc/development/documentation/index.md @@ -98,7 +98,7 @@ For example, if you move `doc/workflow/lfs/lfs_administration.md` to A quick way to find them is to use `git grep`. First go to the root directory where you cloned the `gitlab` repository and then do: - ```sh + ```shell git grep -n "workflow/lfs/lfs_administration" git grep -n "lfs/lfs_administration" ``` @@ -435,7 +435,7 @@ This list does not limit what other linters you can add to your local documentat documentation in the [`gitlab` project](https://gitlab.com/gitlab-org/gitlab), run the following commands from within the `gitlab` project: -```sh +```shell cd doc proselint **/*.md ``` @@ -480,13 +480,13 @@ run the following commands from within your `gitlab` project root directory, whi automatically detect the [`.markdownlint.json`](#markdownlint-configuration) config file in the root of the project, and test all files in `/doc` and its subdirectories: -```sh +```shell markdownlint 'doc/**/*.md' ``` If you wish to use a different config file, use the `-c` flag: -```sh +```shell markdownlint -c 'doc/**/*.md' ``` diff --git a/doc/development/documentation/site_architecture/release_process.md b/doc/development/documentation/site_architecture/release_process.md index 51a02528758..de014c121a9 100644 --- a/doc/development/documentation/site_architecture/release_process.md +++ b/doc/development/documentation/site_architecture/release_process.md @@ -23,7 +23,7 @@ and tag all tooling images locally: 1. Make sure you're on the `dockerfiles/` directory of the `gitlab-docs` repo. 1. Build the images: - ```sh + ```shell docker build -t registry.gitlab.com/gitlab-org/gitlab-docs:bootstrap -f Dockerfile.bootstrap ../ docker build -t registry.gitlab.com/gitlab-org/gitlab-docs:builder-onbuild -f Dockerfile.builder.onbuild ../ docker build -t registry.gitlab.com/gitlab-org/gitlab-docs:nginx-onbuild -f Dockerfile.nginx.onbuild ../ @@ -64,13 +64,13 @@ this needs to happen when the stable branches for all products have been created 1. Make sure you're on the root path of the `gitlab-docs` repo. 1. Make sure your `master` is updated: - ```sh + ```shell git pull origin master ``` 1. Run the raketask to create the single version: - ```sh + ```shell ./bin/rake "release:single[12.0]" ``` @@ -96,7 +96,7 @@ this needs to happen when the stable branches for all products have been created Optionally, you can test locally by building the image and running it: -```sh +```shell docker build -t docs:12.0 -f Dockerfile.12.0 . docker run -it --rm -p 4000:4000 docs:12.0 ``` @@ -111,7 +111,7 @@ version and rotates the old one: 1. Make sure you're on the root path of the `gitlab-docs` repo. 1. Create a branch `release-X-Y`: - ```sh + ```shell git checkout master git checkout -b release-12-0 ``` @@ -150,7 +150,7 @@ version and rotates the old one: 1. In the end, there should be four files in total that have changed. Commit and push to create the merge request using the "Release" template: - ```sh + ```shell git add content/ Dockerfile.master dockerfiles/Dockerfile.archives git commit -m "Release 12.0" git push origin release-12-0 @@ -172,7 +172,7 @@ versions: pipelines succeed. The `release-X-Y` branch needs to be present locally, otherwise the raketask will fail: - ```sh + ```shell ./bin/rake release:dropdowns ``` @@ -218,7 +218,7 @@ from time to time. If this is not possible or there are many changes, merge master into them: -```sh +```shell git branch 12.0 git fetch origin master git merge origin/master diff --git a/doc/development/documentation/styleguide.md b/doc/development/documentation/styleguide.md index b361648b2f0..225e3a65eab 100644 --- a/doc/development/documentation/styleguide.md +++ b/doc/development/documentation/styleguide.md @@ -329,7 +329,7 @@ where a reader must replace text with their own value. For example: -```sh +```shell cp ``` @@ -1277,7 +1277,7 @@ METHOD /endpoint Example request: -```sh +```shell curl --header "PRIVATE-TOKEN: " 'https://gitlab.example.com/api/v4/endpoint?parameters' ``` @@ -1355,7 +1355,7 @@ Below is a set of [cURL](https://curl.haxx.se) examples that you can use in the Get the details of a group: -```bash +```shell curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/groups/gitlab-org ``` @@ -1363,7 +1363,7 @@ curl --header "PRIVATE-TOKEN: " https://gitlab.example.com/ap Create a new project under the authenticated user's namespace: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects?name=foo" ``` @@ -1373,7 +1373,7 @@ Instead of using `--request POST` and appending the parameters to the URI, you c cURL's `--data` option. The example below will create a new project `foo` under the authenticated user's namespace. -```bash +```shell curl --data "name=foo" --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects" ``` @@ -1382,7 +1382,7 @@ curl --data "name=foo" --header "PRIVATE-TOKEN: " "https://gi > **Note:** In this example we create a new group. Watch carefully the single and double quotes. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --header "Content-Type: application/json" --data '{"path": "my-group", "name": "My group"}' https://gitlab.example.com/api/v4/groups ``` @@ -1391,7 +1391,7 @@ curl --request POST --header "PRIVATE-TOKEN: " --header "Cont Instead of using JSON or urlencode you can use multipart/form-data which properly handles data encoding: -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " --form "title=ssh-key" --form "key=ssh-rsa AAAAB3NzaC1yc2EA..." https://gitlab.example.com/api/v4/users/25/keys ``` @@ -1405,7 +1405,7 @@ to escape them when possible. In the example below we create a new issue which contains spaces in its title. Observe how spaces are escaped using the `%20` ASCII code. -```bash +```shell curl --request POST --header "PRIVATE-TOKEN: " "https://gitlab.example.com/api/v4/projects/42/issues?title=Hello%20Dude" ``` @@ -1417,7 +1417,7 @@ The GitLab API sometimes accepts arrays of strings or integers. For example, to restrict the sign-up e-mail domains of a GitLab instance to `*.example.com` and `example.net`, you would do something like this: -```bash +```shell curl --request PUT --header "PRIVATE-TOKEN: " --data "domain_whitelist[]=*.example.com" --data "domain_whitelist[]=example.net" https://gitlab.example.com/api/v4/application/settings ``` diff --git a/doc/development/emails.md b/doc/development/emails.md index 2c5f3be45d8..5617d9d43f2 100644 --- a/doc/development/emails.md +++ b/doc/development/emails.md @@ -65,13 +65,13 @@ See the [Rails guides](https://guides.rubyonrails.org/action_mailer_basics.html# 1. Run this command in the GitLab root directory to launch `mail_room`: - ```sh + ```shell bundle exec mail_room -q -c config/mail_room.yml ``` 1. Verify that everything is configured correctly: - ```sh + ```shell bundle exec rake gitlab:incoming_email:check RAILS_ENV=development ``` diff --git a/doc/development/fe_guide/frontend_faq.md b/doc/development/fe_guide/frontend_faq.md index 01ed07f8736..ad52919a9af 100644 --- a/doc/development/fe_guide/frontend_faq.md +++ b/doc/development/fe_guide/frontend_faq.md @@ -33,7 +33,7 @@ Find here the [source code setting the attribute](https://gitlab.com/gitlab-org/ The `rake routes` command can be used to list all the routes available in the application, piping the output into `grep`, we can perform a search through the list of available routes. The output includes the request types available, route parameters and the relevant controller. -```sh +```shell bundle exec rake routes | grep "issues" ``` diff --git a/doc/development/fe_guide/graphql.md b/doc/development/fe_guide/graphql.md index 8c284ae955d..336a808b793 100644 --- a/doc/development/fe_guide/graphql.md +++ b/doc/development/fe_guide/graphql.md @@ -208,6 +208,21 @@ Now every single time on attempt to fetch a version, our client will fetch `id` Read more about local state management with Apollo in the [Vue Apollo documentation](https://vue-apollo.netlify.com/guide/local-state.html#local-state). +### Using with Vuex + +When Apollo Client is used within Vuex and fetched data is stored in the Vuex store, there is no need in keeping Apollo Client cache enabled. Otherwise we would have data from the API stored in two places - Vuex store and Apollo Client cache. More to say, with Apollo default settings, a subsequent fetch from the GraphQL API could result in fetching data from Apollo cache (in the case where we have the same query and variables). To prevent this behavior, we need to disable Apollo Client cache passing a valid `fetchPolicy` option to its constructor: + +```js +import fetchPolicies from '~/graphql_shared/fetch_policy_constants'; + +export const gqClient = createGqClient( + {}, + { + fetchPolicy: fetchPolicies.NO_CACHE, + }, +); +``` + ### Feature flags in queries Sometimes it may be useful to have an entity in the GraphQL query behind a feature flag. diff --git a/doc/development/feature_flags/controls.md b/doc/development/feature_flags/controls.md index 731fd7171f0..d711e49ee8b 100644 --- a/doc/development/feature_flags/controls.md +++ b/doc/development/feature_flags/controls.md @@ -153,13 +153,13 @@ When a feature gate has been removed from the code base, the feature record still exists in the database that the flag was deployed too. The record can be deleted once the MR is deployed to each environment: -```sh +```shell /chatops run feature delete some_feature --dev /chatops run feature delete some_feature --staging ``` Then, you can delete it from production after the MR is deployed to prod: -```sh +```shell /chatops run feature delete some_feature ``` diff --git a/doc/development/geo.md b/doc/development/geo.md index 5010e44e826..38a64cbadca 100644 --- a/doc/development/geo.md +++ b/doc/development/geo.md @@ -244,7 +244,7 @@ Whenever a new Geo node is configured or the database schema changes on the **primary** node, you must refresh the foreign tables on the **secondary** node by running the following: -```sh +```shell bundle exec rake geo:db:refresh_foreign_tables ``` diff --git a/doc/development/gitaly.md b/doc/development/gitaly.md index 3c18b3587c6..10da59ee9e0 100644 --- a/doc/development/gitaly.md +++ b/doc/development/gitaly.md @@ -98,13 +98,13 @@ most commonly-used RPCs can be enabled via feature flags: A convenience Rake task can be used to enable or disable these flags all together. To enable: -```sh +```shell bundle exec rake gitlab:features:enable_rugged ``` To disable: -```sh +```shell bundle exec rake gitlab:features:disable_rugged ``` @@ -343,7 +343,7 @@ the integration by using GDK: submitting commit, observing history, etc.). 1. Check that the list of current metrics has the new counter for the feature flag: - ```sh + ```shell curl --silent http://localhost:9236/metrics | grep go_find_all_tags ``` @@ -352,7 +352,7 @@ the integration by using GDK: 1. Navigate to GDK's root directory. 1. Start a Rails console: - ```sh + ```shell bundle install && bundle exec rails console ``` @@ -373,6 +373,6 @@ the integration by using GDK: your changes (project creation, submitting commit, observing history, etc.). 1. Verify the feature is on by observing the metrics for it: - ```sh + ```shell curl --silent http://localhost:9236/metrics | grep go_find_all_tags ``` diff --git a/doc/development/gotchas.md b/doc/development/gotchas.md index 09d0d71b3d7..5e9722d9586 100644 --- a/doc/development/gotchas.md +++ b/doc/development/gotchas.md @@ -43,7 +43,7 @@ end When run, this spec doesn't do what we might expect: -```sh +```shell 1) API::API reproduce sequence issue creates a second label Failure/Error: expect(json_response.first['name']).to eq('label1') diff --git a/doc/development/i18n/externalization.md b/doc/development/i18n/externalization.md index b9ab5f4e8ff..09908ed2fed 100644 --- a/doc/development/i18n/externalization.md +++ b/doc/development/i18n/externalization.md @@ -452,7 +452,7 @@ For more information, see the [`gl-sprintf`](https://gitlab-org.gitlab.io/gitlab Now that the new content is marked for translation, we need to update `locale/gitlab.pot` files with the following command: -```sh +```shell bin/rake gettext:regenerate ``` @@ -526,14 +526,14 @@ Let's suppose you want to add translations for a new language, let's say French. 1. Next, you need to add the language: - ```sh + ```shell bin/rake gettext:add_language[fr] ``` If you want to add a new language for a specific region, the command is similar, you just need to separate the region with an underscore (`_`). For example: - ```sh + ```shell bin/rake gettext:add_language[en_GB] ``` @@ -547,7 +547,7 @@ Let's suppose you want to add translations for a new language, let's say French. in order to generate the binary MO files and finally update the JSON files containing the translations: - ```sh + ```shell bin/rake gettext:compile ``` @@ -557,7 +557,7 @@ Let's suppose you want to add translations for a new language, let's say French. 1. After checking that the changes are ok, you can proceed to commit the new files. For example: - ```sh + ```shell git add locale/fr/ app/assets/javascripts/locale/fr/ git commit -m "Add French translations for Cycle Analytics page" ``` diff --git a/doc/development/import_export.md b/doc/development/import_export.md index 3ee723bc897..323ed48aaf9 100644 --- a/doc/development/import_export.md +++ b/doc/development/import_export.md @@ -14,7 +14,7 @@ Project.find_by_full_path('group/project').import_state.slice(:jid, :status, :la > {"jid"=>"414dec93f941a593ea1a6894", "status"=>"finished", "last_error"=>nil} ``` -```bash +```shell # Logs grep JID /var/log/gitlab/sidekiq/current grep "Import/Export error" /var/log/gitlab/sidekiq/current @@ -30,7 +30,7 @@ Read through the current performance problems using the Import/Export below. Out of memory (OOM) errors are normally caused by the [Sidekiq Memory Killer](../administration/operations/sidekiq_memory_killer.md): -```bash +```shell SIDEKIQ_MEMORY_KILLER_MAX_RSS = 2000000 SIDEKIQ_MEMORY_KILLER_HARD_LIMIT_RSS = 3000000 SIDEKIQ_MEMORY_KILLER_GRACE_TIME = 900 @@ -38,7 +38,7 @@ SIDEKIQ_MEMORY_KILLER_GRACE_TIME = 900 An import status `started`, and the following Sidekiq logs will signal a memory issue: -```bash +```shell WARN: Work still in progress ``` @@ -59,7 +59,7 @@ class StuckImportJobsWorker ... ``` -```bash +```shell Marked stuck import jobs as failed. JIDs: xyz ``` @@ -219,7 +219,7 @@ We do not need to bump the version up in any of the following cases: Every time we bump the version, the integration specs will fail and can be fixed with: -```bash +```shell bundle exec rake gitlab:import_export:bump_version ``` diff --git a/doc/development/import_project.md b/doc/development/import_project.md index 06c0bd02262..37cf07ff702 100644 --- a/doc/development/import_project.md +++ b/doc/development/import_project.md @@ -30,7 +30,7 @@ Note that to use the script, it will require some preparation if you haven't don For details how to use `bin/import-project`, run: -```sh +```shell bin/import-project --help ``` @@ -53,7 +53,7 @@ As part of this script we also disable direct and background upload to avoid sit We can simply run this script from the terminal: -```sh +```shell bundle exec rake "gitlab:import_export:import[root, root, testingprojectimport, /path/to/file.tar.gz]" ``` @@ -63,7 +63,7 @@ The last option is to import a project using a Rails console: 1. Start a Ruby on Rails console: - ```sh + ```shell # Omnibus GitLab gitlab-rails console @@ -126,7 +126,7 @@ You can use this [snippet](https://gitlab.com/gitlab-org/gitlab/snippets/1924954 You can execute the script from the `gdk/gitlab` directory like this: -```sh +```shell bundle exec rails r /path_to_sript/script.rb project_name /path_to_extracted_project request_store_enabled ``` diff --git a/doc/development/internal_api.md b/doc/development/internal_api.md index dbb721b6018..0bdc1d07591 100644 --- a/doc/development/internal_api.md +++ b/doc/development/internal_api.md @@ -51,7 +51,7 @@ POST /internal/allowed Example request: -```sh +```shell curl --request POST --header "Gitlab-Shared-Secret: " --data "key_id=11&project=gnuwget/wget2&action=git-upload-pack&protocol=ssh" http://localhost:3001/api/v4/internal/allowed ``` @@ -99,7 +99,7 @@ information for LFS clients when the repository is accessed over SSH. Example request: -```sh +```shell curl --request POST --header "Gitlab-Shared-Secret: " --data "key_id=11&project=gnuwget/wget2" http://localhost:3001/api/v4/internal/lfs_authenticate ``` @@ -132,7 +132,7 @@ GET /internal/authorized_keys Example request: -```sh +```shell curl --request GET --header "Gitlab-Shared-Secret: ""http://localhost:3001/api/v4/internal/authorized_keys?key=" ``` @@ -167,7 +167,7 @@ GET /internal/discover Example request: -```sh +```shell curl --request GET --header "Gitlab-Shared-Secret: " "http://localhost:3001/api/v4/internal/discover?key_id=7" ``` @@ -196,7 +196,7 @@ GET /internal/check Example request: -```sh +```shell curl --request GET --header "Gitlab-Shared-Secret: " "http://localhost:3001/api/v4/internal/check" ``` @@ -232,7 +232,7 @@ GET /internal/two_factor_recovery_codes Example request: -```sh +```shell curl --request POST --header "Gitlab-Shared-Secret: " --data "key_id=7" http://localhost:3001/api/v4/internal/two_factor_recovery_codes ``` @@ -275,7 +275,7 @@ POST /internal/pre_receive Example request: -```sh +```shell curl --request POST --header "Gitlab-Shared-Secret: " --data "gl_repository=project-7" http://localhost:3001/api/v4/internal/pre_receive ``` @@ -307,7 +307,7 @@ POST /internal/post_receive Example Request: -```sh +```shell curl --request POST --header "Gitlab-Shared-Secret: " --data "gl_repository=project-7" --data "identifier=user-1" --data "changes=0000000000000000000000000000000000000000 fd9e76b9136bdd9fe217061b497745792fe5a5ee gh-pages\n" http://localhost:3001/api/v4/internal/post_receive ``` diff --git a/doc/development/kubernetes.md b/doc/development/kubernetes.md index db06ddf352f..1a8aa7647af 100644 --- a/doc/development/kubernetes.md +++ b/doc/development/kubernetes.md @@ -164,7 +164,7 @@ installation. Once the installation/upgrade is underway, wait for the pod to be created. Then run the following to obtain the pods logs as they are written: -```bash +```shell kubectl logs --follow -n gitlab-managed-apps ``` diff --git a/doc/development/new_fe_guide/dependencies.md b/doc/development/new_fe_guide/dependencies.md index 161ffb1fb57..afdf6e27b37 100644 --- a/doc/development/new_fe_guide/dependencies.md +++ b/doc/development/new_fe_guide/dependencies.md @@ -17,13 +17,13 @@ production assets post-compile. To add or upgrade a dependency, run: -```sh +```shell yarn add ``` This may introduce duplicate dependencies. To de-duplicate `yarn.lock`, run: -```sh +```shell node_modules/.bin/yarn-deduplicate --list --strategy fewer yarn.lock && yarn install ``` diff --git a/doc/development/performance.md b/doc/development/performance.md index 94285efdf1e..a211fddc141 100644 --- a/doc/development/performance.md +++ b/doc/development/performance.md @@ -123,7 +123,7 @@ Keeping that in mind, to create a profile, identify (or create) a spec that exercises the troublesome code path, then run it using the `bin/rspec-stackprof` helper, e.g.: -```sh +```shell $ LIMIT=10 bin/rspec-stackprof spec/policies/project_policy_spec.rb 8/8 |====== 100 ======>| Time: 00:00:18 @@ -157,14 +157,14 @@ it calls, were being executed. To create a graphical view of the call stack: -```sh +```shell stackprof tmp/project_policy_spec.rb.dump --graphviz > project_policy_spec.dot dot -Tsvg project_policy_spec.dot > project_policy_spec.svg ``` To load the profile in [kcachegrind](https://kcachegrind.github.io/): -```sh +```shell stackprof tmp/project_policy_spec.dump --callgrind > project_policy_spec.callgrind kcachegrind project_policy_spec.callgrind # Linux qcachegrind project_policy_spec.callgrind # Mac @@ -172,7 +172,7 @@ qcachegrind project_policy_spec.callgrind # Mac It may be useful to zoom in on a specific method, e.g.: -```sh +```shell $ stackprof tmp/project_policy_spec.rb.dump --method warm_asset_cache TestEnv#warm_asset_cache (/Users/lupine/dev/gitlab.com/gitlab-org/gitlab-development-kit/gitlab/spec/support/test_env.rb:164) samples: 0 self (0.0%) / 6288 total (36.9%) @@ -225,7 +225,7 @@ may have changed over time. To activate profiling in your local environment, run the following: -```sh +```shell export RSPEC_PROFILING=yes rake rspec_profiling:install ``` @@ -237,7 +237,7 @@ variable set. Ad-hoc investigation of the collected results can be performed in an interactive shell: -```sh +```shell $ rake rspec_profiling:console irb(main):001:0> results.count => 231 @@ -271,7 +271,7 @@ bundle exec rbtrace -p -e 'File.open("heap.json", "wb") { |t| ObjectSpace. Having the JSON, you finally could render a picture using the script [provided by Aaron](https://gist.github.com/tenderlove/f28373d56fdd03d8b514af7191611b88) or similar: -```sh +```shell ruby heapviz.rb heap.json ``` diff --git a/doc/development/post_deployment_migrations.md b/doc/development/post_deployment_migrations.md index a41096aa3eb..4d523178a21 100644 --- a/doc/development/post_deployment_migrations.md +++ b/doc/development/post_deployment_migrations.md @@ -9,13 +9,13 @@ when running `rake db:migrate`. For example, this would run all migrations including any post deployment migrations: -```bash +```shell bundle exec rake db:migrate ``` This however will skip post deployment migrations: -```bash +```shell SKIP_POST_DEPLOYMENT_MIGRATIONS=true bundle exec rake db:migrate ``` @@ -26,7 +26,7 @@ post deployment migrations after deploying a new version. Let's assume you normally use the command `chef-client` to do so. To make use of this feature you'd have to run this command as follows: -```bash +```shell SKIP_POST_DEPLOYMENT_MIGRATIONS=true sudo chef-client ``` @@ -41,7 +41,7 @@ server but with the variable _unset_. To create a post deployment migration you can use the following Rails generator: -```bash +```shell bundle exec rails g post_deployment_migration migration_name_here ``` diff --git a/doc/development/profiling.md b/doc/development/profiling.md index 18683fa10f8..316273f37b8 100644 --- a/doc/development/profiling.md +++ b/doc/development/profiling.md @@ -99,7 +99,7 @@ Sherlock is a custom profiling tool built into GitLab. Sherlock is _only_ available when running GitLab in development mode _and_ when setting the environment variable `ENABLE_SHERLOCK` to a non empty value. For example: -```sh +```shell ENABLE_SHERLOCK=1 bundle exec rails s ``` @@ -112,7 +112,7 @@ Bullet adds quite a bit of logging noise it's disabled by default. To enable Bullet, set the environment variable `ENABLE_BULLET` to a non-empty value before starting GitLab. For example: -```sh +```shell ENABLE_BULLET=true bundle exec rails s ``` diff --git a/doc/development/python_guide/index.md b/doc/development/python_guide/index.md index d898351345d..af1ec44bf3d 100644 --- a/doc/development/python_guide/index.md +++ b/doc/development/python_guide/index.md @@ -15,7 +15,7 @@ Ruby world: [rbenv](https://github.com/rbenv/rbenv). To install `pyenv` on macOS, you can use [Homebrew](https://brew.sh/) with: -```bash +```shell brew install pyenv ``` @@ -23,7 +23,7 @@ brew install pyenv To install `pyenv` on Linux, you can run the command below: -```bash +```shell curl https://pyenv.run | bash ``` @@ -38,13 +38,13 @@ check for any additional steps required for it. For Fish, you can install a plugin for [Fisher](https://github.com/jorgebucaran/fisher): -```bash +```shell fisher add fisherman/pyenv ``` Or for [Oh My Fish](https://github.com/oh-my-fish/oh-my-fish): -```bash +```shell omf install pyenv ``` @@ -59,7 +59,7 @@ Recently, an equivalent to the `Gemfile` and the [Bundler](https://bundler.io/) You will now find a `Pipfile` with the dependencies in the root folder. To install them, run: -```bash +```shell pipenv install ``` @@ -70,7 +70,7 @@ Running this command will install both the required Python version as well as re To run any Python code under the Pipenv environment, you need to first start a `virtualenv` based on the dependencies of the application. With Pipenv, this is a simple as running: -```bash +```shell pipenv shell ``` diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md index aa326cbdd34..1f97d433223 100644 --- a/doc/development/shell_commands.md +++ b/doc/development/shell_commands.md @@ -211,7 +211,7 @@ Since there are no anchors in the used regular expression, the `git:/tmp/lol` in When importing, GitLab would execute the following command, passing the `import_url` as an argument: -```sh +```shell git clone file://git:/tmp/lol ``` diff --git a/doc/development/shell_scripting_guide/index.md b/doc/development/shell_scripting_guide/index.md index a501e3def10..387ef01bdcf 100644 --- a/doc/development/shell_scripting_guide/index.md +++ b/doc/development/shell_scripting_guide/index.md @@ -79,7 +79,7 @@ It's recommended to use the [shfmt](https://github.com/mvdan/sh#shfmt) tool to m We format shell scripts according to the [Google Shell Style Guide](https://google.github.io/styleguide/shell.xml), so the following `shfmt` invocation should be applied to the project's script files: -```bash +```shell shfmt -i 2 -ci scripts/**/*.sh ``` diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md index 4fc9c35b2d2..f4844cb14d1 100644 --- a/doc/development/testing_guide/best_practices.md +++ b/doc/development/testing_guide/best_practices.md @@ -36,7 +36,7 @@ Here are some things to keep in mind regarding test performance: To run rspec tests: -```sh +```shell # run all tests bundle exec rspec @@ -46,7 +46,7 @@ bundle exec rspec spec/[path]/[to]/[spec].rb Use [guard](https://github.com/guard/guard) to continuously monitor for changes and only run matching tests: -```sh +```shell bundle exec guard ``` diff --git a/doc/development/testing_guide/frontend_testing.md b/doc/development/testing_guide/frontend_testing.md index e2b29136524..626d4147e6a 100644 --- a/doc/development/testing_guide/frontend_testing.md +++ b/doc/development/testing_guide/frontend_testing.md @@ -571,7 +571,7 @@ As long as the fixtures don't change, `yarn test` is sufficient (and saves you s While you work on a testsuite, you may want to run these specs in watch mode, so they rerun automatically on every save. -```bash +```shell # Watch and rerun all specs matching the name icon yarn jest --watch icon @@ -581,7 +581,7 @@ yarn jest --watch path/to/spec/file.spec.js You can also run some focused tests without the `--watch` flag -```bash +```shell # Run specific jest file yarn jest ./path/to/local_spec.js # Run specific jest folder @@ -609,7 +609,7 @@ remove these directives when you commit your code. It is also possible to only run Karma on specific folders or files by filtering the run tests via the argument `--filter-spec` or short `-f`: -```bash +```shell # Run all files yarn karma-start # Run specific spec files @@ -623,7 +623,7 @@ yarn karma-start -f vue_shared -f vue_mr_widget You can also use glob syntax to match files. Remember to put quotes around the glob otherwise your shell may split it into multiple arguments: -```bash +```shell # Run all specs named `file_spec` within the IDE subdirectory yarn karma -f 'spec/javascripts/ide/**/file_spec.js' ``` diff --git a/doc/development/utilities.md b/doc/development/utilities.md index 68851f4d550..561d5efc696 100644 --- a/doc/development/utilities.md +++ b/doc/development/utilities.md @@ -196,12 +196,14 @@ end ## `ReactiveCaching` -The `ReactiveCaching` concern is used to fetch some data in the background and -store it in the Rails cache, keeping it up-to-date for as long as it is being -requested. If the data hasn't been requested for `reactive_cache_lifetime`, -it will stop being refreshed, and then be removed. +> This doc refers to . -Example of use: +The `ReactiveCaching` concern is used for fetching some data in the background and store it +in the Rails cache, keeping it up-to-date for as long as it is being requested. If the +data hasn't been requested for `reactive_cache_lifetime`, it will stop being refreshed, +and then be removed. + +### Examples ```ruby class Foo < ApplicationRecord @@ -209,67 +211,262 @@ class Foo < ApplicationRecord after_save :clear_reactive_cache! - def calculate_reactive_cache + def calculate_reactive_cache(param1, param2) # Expensive operation here. The return value of this method is cached end def result - with_reactive_cache do |data| + # Any arguments can be passed to `with_reactive_cache`. `calculate_reactive_cache` + # will be called with the same arguments. + with_reactive_cache(param1, param2) do |data| # ... end end end ``` -In this example, the first time `#result` is called, it will return `nil`. -However, it will enqueue a background worker to call `#calculate_reactive_cache` -and set an initial cache lifetime of ten minutes. +In this example, the first time `#result` is called, it will return `nil`. However, +it will enqueue a background worker to call `#calculate_reactive_cache` and set an +initial cache lifetime of 10 min. -The background worker needs to find or generate the object on which -`with_reactive_cache` was called. -The default behaviour can be overridden by defining a custom -`reactive_cache_worker_finder`. -Otherwise, the background worker will use the class name and primary key to get -the object using the ActiveRecord `find_by` method. +### How it works -```ruby -class Bar - include ReactiveCaching +The first time `#with_reactive_cache` is called, a background job is enqueued and +`with_reactive_cache` returns `nil`. The background job calls `#calculate_reactive_cache` +and stores its return value. It also re-enqueues the background job to run again after +`reactive_cache_refresh_interval`. Therefore, it will keep the stored value up to date. +Calculations never run concurrently. - self.reactive_cache_key = ->() { ["bar", "thing"] } - self.reactive_cache_worker_finder = ->(_id, *args) { from_cache(*args) } +Calling `#with_reactive_cache` while a value is cached will call the block given to +`#with_reactive_cache`, yielding the cached value. It will also extend the lifetime +of the cache by the `reactive_cache_lifetime` value. - def self.from_cache(var1, var2) - # This method will be called by the background worker with "bar1" and - # "bar2" as arguments. - new(var1, var2) - end +Once the lifetime has expired, no more background jobs will be enqueued and calling +`#with_reactive_cache` will again return `nil` - starting the process all over again. - def initialize(var1, var2) - # ... +### When to use + +- If we need to make a request to an external API (for example, requests to the k8s API). +It is not advisable to keep the application server worker blocked for the duration of +the external request. +- If a model needs to perform a lot of database calls or other time consuming +calculations. + +### How to use + +#### In models and services + +The ReactiveCaching concern can be used in models as well as `project_services` +(`app/models/project_services`). + +1. Include the concern in your model or service. + + When including in a model: + + ```ruby + include ReactiveCaching + ``` + + or when including in a `project_service`: + + ```ruby + include ReactiveService + ``` + +1. Implement the `calculate_reactive_cache` method in your model/service. +1. Call `with_reactive_cache` in your model/service where the cached value is needed. + +#### In controllers + +Controller endpoints that call a model or service method that uses `ReactiveCaching` should +not wait until the background worker completes. + +- An API that calls a model or service method that uses `ReactiveCaching` should return +`202 accepted` when the cache is being calculated (when `#with_reactive_cache` returns `nil`). +- It should also +[set the polling interval header](fe_guide/performance.md#realtime-components) with +`Gitlab::PollingInterval.set_header`. +- The consumer of the API is expected to poll the API. +- You can also consider implementing [ETag caching](polling.md) to reduce the server +load caused by polling. + +#### Methods to implement in a model or service + +These are methods that should be implemented in the model/service that includes `ReactiveCaching`. + +##### `#calculate_reactive_cache` (required) + +- This method must be implemented. Its return value will be cached. +- It will be called by `ReactiveCaching` when it needs to populate the cache. +- Any arguments passed to `with_reactive_cache` will also be passed to `calculate_reactive_cache`. + +##### `#reactive_cache_updated` (optional) + +- This method can be implemented if needed. +- It is called by the `ReactiveCaching` concern whenever the cache is updated. +If the cache is being refreshed and the new cache value is the same as the old cache +value, this method will not be called. It is only called if a new value is stored in +the cache. +- It can be used to perform an action whenever the cache is updated. + +#### Methods called by a model or service + +These are methods provided by `ReactiveCaching` and should be called in +the model/service. + +##### `#with_reactive_cache` (required) + +- `with_reactive_cache` must be called where the result of `calculate_reactive_cache` +is required. +- A block can be given to `with_reactive_cache`. `with_reactive_cache` can also take +any number of arguments. Any arguments passed to `with_reactive_cache` will be +passed to `calculate_reactive_cache`. The arguments passed to `with_reactive_cache` +will be appended to the cache key name. +- If `with_reactive_cache` is called when the result has already been cached, the +block will be called, yielding the cached value and the return value of the block +will be returned by `with_reactive_cache`. It will also reset the timeout of the +cache to the `reactive_cache_lifetime` value. +- If the result has not been cached as yet, `with_reactive_cache` will return nil. +It will also enqueue a background job, which will call `calculate_reactive_cache` +and cache the result. +- Once the background job has completed and the result is cached, the next call +to `with_reactive_cache` will pick up the cached value. +- In the example below, `data` is the cached value which is yielded to the block +given to `with_reactive_cache`. + + ```ruby + class Foo < ApplicationRecord + include ReactiveCaching + + def calculate_reactive_cache(param1, param2) + # Expensive operation here. The return value of this method is cached + end + + def result + with_reactive_cache(param1, param2) do |data| + # ... + end + end end + ``` - def calculate_reactive_cache - # Expensive operation here. The return value of this method is cached +##### `#clear_reactive_cache!` (optional) + +- This method can be called when the cache needs to be expired/cleared. For example, +it can be called in an `after_save` callback in a model so that the cache is +cleared after the model is modified. +- This method should be called with the same parameters that are passed to +`with_reactive_cache` because the parameters are part of the cache key. + +##### `#without_reactive_cache` (optional) + +- This is a convenience method that can be used for debugging purposes. +- This method calls `calculate_reactive_cache` in the current process instead of +in a background worker. + +#### Configurable options + +There are some `class_attribute` options which can be tweaked. + +##### `self.reactive_cache_key` + +- The value of this attribute is the prefix to the `data` and `alive` cache key names. +The parameters passed to `with_reactive_cache` form the rest of the cache key names. +- By default, this key uses the model's name and the ID of the record. + + ```ruby + self.reactive_cache_key = -> (record) { [model_name.singular, record.id] } + ``` + +- The `data` and `alive` cache keys in this case will be `"ExampleModel:1:arg1:arg2"` +and `"ExampleModel:1:arg1:arg2:alive"` respectively, where `ExampleModel` is the +name of the model, `1` is the ID of the record, `arg1` and `arg2` are parameters +passed to `with_reactive_cache`. +- If you're including this concern in a service instead, you will need to override +the default by adding the following to your service: + + ```ruby + self.reactive_cache_key = ->(service) { [service.class.model_name.singular, service.project_id] } + ``` + + If your reactive_cache_key is exactly like the above, you can use the existing + `ReactiveService` concern instead. + +##### `self.reactive_cache_lease_timeout` + +- `ReactiveCaching` uses `Gitlab::ExclusiveLease` to ensure that the cache calculation +is never run concurrently by multiple workers. +- This attribute is the timeout for the `Gitlab::ExclusiveLease`. +- It defaults to 2 minutes, but can be overriden if a different timeout is required. + +```ruby +self.reactive_cache_lease_timeout = 2.minutes +``` + +##### `self.reactive_cache_refresh_interval` + +- This is the interval at which the cache is refreshed. +- It defaults to 1 minute. + +```ruby +self.reactive_cache_lease_timeout = 1.minute +``` + +##### `self.reactive_cache_lifetime` + +- This is the duration after which the cache will be cleared if there are no requests. +- The default is 10 minutes. If there are no requests for this cache value for 10 minutes, +the cache will expire. +- If the cache value is requested before it expires, the timeout of the cache will +be reset to `reactive_cache_lifetime`. + +```ruby +self.reactive_cache_lifetime = 10.minutes +``` + +##### `self.reactive_cache_worker_finder` + +- This is the method used by the background worker to find or generate the object on +which `calculate_reactive_cache` can be called. +- By default it uses the model primary key to find the object: + + ```ruby + self.reactive_cache_worker_finder = ->(id, *_args) do + find_by(primary_key => id) end + ``` - def result - with_reactive_cache("bar1", "bar2") do |data| +- The default behaviour can be overridden by defining a custom `reactive_cache_worker_finder`. + + ```ruby + class Foo < ApplicationRecord + include ReactiveCaching + + self.reactive_cache_worker_finder = ->(_id, *args) { from_cache(*args) } + + def self.from_cache(var1, var2) + # This method will be called by the background worker with "bar1" and + # "bar2" as arguments. + new(var1, var2) + end + + def initialize(var1, var2) # ... end - end -end -``` -Each time the background job completes, it stores the return value of -`#calculate_reactive_cache`. It is also re-enqueued to run again after -`reactive_cache_refresh_interval`, therefore, it will keep the stored value up to date. -Calculations are never run concurrently. + def calculate_reactive_cache(var1, var2) + # Expensive operation here. The return value of this method is cached + end -Calling `#result` while a value is cached will call the block given to -`#with_reactive_cache`, yielding the cached value. It will also extend the -lifetime by the `reactive_cache_lifetime` value. + def result + with_reactive_cache("bar1", "bar2") do |data| + # ... + end + end + end + ``` -Once the lifetime has expired, no more background jobs will be enqueued and -calling `#result` will again return `nil` - starting the process all over -again. + - In this example, the primary key ID will be passed to `reactive_cache_worker_finder` + along with the parameters passed to `with_reactive_cache`. + - The custom `reactive_cache_worker_finder` calls `.from_cache` with the parameters + passed to `with_reactive_cache`. diff --git a/doc/downgrade_ee_to_ce/README.md b/doc/downgrade_ee_to_ce/README.md index db4bbe8ae39..bdbd17c2a23 100644 --- a/doc/downgrade_ee_to_ce/README.md +++ b/doc/downgrade_ee_to_ce/README.md @@ -47,13 +47,13 @@ to avoid getting this error, you need to remove all instances of the **Omnibus Installation** -```sh +```shell sudo gitlab-rails runner "Service.where(type: ['JenkinsService', 'JenkinsDeprecatedService', 'GithubService']).delete_all" ``` **Source Installation** -```sh +```shell bundle exec rails runner "Service.where(type: ['JenkinsService', 'JenkinsDeprecatedService', 'GithubService']).delete_all" production ``` @@ -89,7 +89,7 @@ To downgrade a source installation, you need to replace the current remote of your GitLab installation with the Community Edition's remote, fetch the latest changes, and checkout the latest stable branch: -```sh +```shell git remote set-url origin git@gitlab.com:gitlab-org/gitlab-foss.git git fetch --all git checkout 8-x-stable diff --git a/doc/gitlab-basics/add-file.md b/doc/gitlab-basics/add-file.md index d547584bf80..13a1591fb76 100644 --- a/doc/gitlab-basics/add-file.md +++ b/doc/gitlab-basics/add-file.md @@ -22,7 +22,7 @@ Open a [terminal/shell](command-line-commands.md), and change into the folder of GitLab project. This usually means running the following command until you get to the desired destination: -```sh +```shell cd ``` @@ -38,7 +38,7 @@ in Windows), put the file into a directory within the GitLab project. Check if your file is actually present in the directory (if you are in Windows, use `dir` instead): -```sh +```shell ls ``` @@ -46,33 +46,33 @@ You should see the name of the file in the list shown. Check the status: -```sh +```shell git status ``` Your file's name should appear in red, so `git` took notice of it! Now add it to the repository: -```sh +```shell git add ``` Check the status again, your file's name should have turned green: -```sh +```shell git status ``` Commit (save) your file to the repository: -```sh +```shell git commit -m "DESCRIBE COMMIT IN A FEW WORDS" ``` Now you can push (send) your changes (in the branch ``) to GitLab (the Git remote named 'origin'): -```sh +```shell git push origin ``` diff --git a/doc/gitlab-basics/create-project.md b/doc/gitlab-basics/create-project.md index 74b3afbcd98..f42a58a67b0 100644 --- a/doc/gitlab-basics/create-project.md +++ b/doc/gitlab-basics/create-project.md @@ -119,7 +119,7 @@ set to Private by default (you can later change it in the [project's settings](. This can be done by using either SSH or HTTPS: -```sh +```shell ## Git push using SSH git push --set-upstream git@gitlab.example.com:namespace/nonexistent-project.git master diff --git a/doc/gitlab-basics/feature_branch_workflow.md b/doc/gitlab-basics/feature_branch_workflow.md index 2b641126d0d..dd7eed89ea1 100644 --- a/doc/gitlab-basics/feature_branch_workflow.md +++ b/doc/gitlab-basics/feature_branch_workflow.md @@ -6,25 +6,25 @@ disqus_identifier: 'https://docs.gitlab.com/ee/workflow/workflow.html' 1. Clone project: - ```bash + ```shell git clone git@example.com:project-name.git ``` 1. Create branch with your feature: - ```bash + ```shell git checkout -b $feature_name ``` 1. Write code. Commit changes: - ```bash + ```shell git commit -am "My feature is ready" ``` 1. Push your branch to GitLab: - ```bash + ```shell git push origin $feature_name ``` diff --git a/doc/gitlab-basics/start-using-git.md b/doc/gitlab-basics/start-using-git.md index 38376f4334f..9a05c7fff14 100644 --- a/doc/gitlab-basics/start-using-git.md +++ b/doc/gitlab-basics/start-using-git.md @@ -21,7 +21,7 @@ Here are some suggestions: Git is usually preinstalled on Mac and Linux, so run the following command: -```bash +```shell git --version ``` @@ -39,25 +39,25 @@ commit will use this information to identify you as the author. In your shell, type the following command to add your username: -```bash +```shell git config --global user.name "YOUR_USERNAME" ``` Then verify that you have the correct username: -```bash +```shell git config --global user.name ``` To set your email address, type the following command: -```bash +```shell git config --global user.email "your_email_address@example.com" ``` To verify that you entered your email correctly, type: -```bash +```shell git config --global user.email ``` @@ -72,7 +72,7 @@ on how Git manages configurations in the [Git Config](https://git-scm.com/book/e To view the information that you entered, along with other global options, type: -```bash +```shell git config --global --list ``` @@ -85,7 +85,7 @@ Start using Git via the command line with the most basic commands as described b If you have an existing local directory that you want to *initialize* for version control, use the `init` command to instruct Git to begin tracking the directory: -```bash +```shell git init ``` @@ -123,13 +123,13 @@ repository files into, and run one of the following commands. Clone via HTTPS: -```bash +```shell git clone https://gitlab.com/gitlab-org/gitlab.git ``` Clone via SSH: -```bash +```shell git clone git@gitlab.com:gitlab-org/gitlab.git ``` @@ -143,7 +143,7 @@ You are always in a branch when working with Git. The main branch is the master branch, but you can use the same command to switch to a different branch by changing `master` to the branch name. -```bash +```shell git checkout master ``` @@ -155,7 +155,7 @@ since the last time you cloned or pulled the project. Use `master` for the `` to get the main branch code, or the branch name of the branch you are currently working in. -```bash +```shell git pull ``` @@ -171,7 +171,7 @@ You can learn more on how Git manages remote repositories in the To view your remote repositories, type: -```bash +```shell git remote -v ``` @@ -181,7 +181,7 @@ The `-v` flag stands for verbose. To add a link to a remote repository: -```bash +```shell git remote add ``` @@ -194,7 +194,7 @@ To create a new branch, to work from without affecting the `master` branch, type the following (spaces won't be recognized in the branch name, so you will need to use a hyphen or underscore): -```bash +```shell git checkout -b ``` @@ -202,7 +202,7 @@ git checkout -b To switch to an existing branch, so you can work on it: -```bash +```shell git checkout ``` @@ -212,7 +212,7 @@ It's important to be aware of what's happening and the status of your changes. W you add, change, or delete files/folders, Git knows about it. To check the status of your changes: -```bash +```shell git status ``` @@ -221,7 +221,7 @@ git status To view the differences between your local, unstaged changes and the repository versions that you cloned or pulled, type: -```bash +```shell git diff ``` @@ -232,7 +232,7 @@ be new, modified, or deleted files/folders. Use `git add` to first stage (prepar a local file/folder for committing. Then use `git commit` to commit (save) the staged files: -```bash +```shell git add git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT" ``` @@ -241,7 +241,7 @@ git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT" To add and commit (save) all local changes quickly: -```bash +```shell git add . git commit -m "COMMENT TO DESCRIBE THE INTENTION OF THE COMMIT" ``` @@ -257,13 +257,13 @@ To create a merge request from a fork to an upstream repository, see the To push all local commits (saved changes) to the remote repository: -```bash +```shell git push ``` For example, to push your local commits to the _`master`_ branch of the _`origin`_ remote: -```bash +```shell git push origin master ``` @@ -272,7 +272,7 @@ git push origin master To delete all local changes in the branch that have not been added to the staging area, and leave unstaged files/folders, type: -```bash +```shell git checkout . ``` @@ -282,7 +282,7 @@ Note that this removes *changes* to files, not the files themselves. To undo the most recently added, but not committed, changes to files/folders: -```bash +```shell git reset . ``` @@ -290,7 +290,7 @@ git reset . To undo the most recent commit, type: -```bash +```shell git reset HEAD~1 ``` @@ -306,7 +306,7 @@ the situation altogether by working carefully. When you are ready to make all the changes in a branch a permanent addition to the master branch, you `merge` the two together: -```bash +```shell git checkout git merge master ``` diff --git a/doc/install/aws/index.md b/doc/install/aws/index.md index 6a261091031..5b74d74bbb0 100644 --- a/doc/install/aws/index.md +++ b/doc/install/aws/index.md @@ -418,13 +418,13 @@ To find the host or endpoint, naviagate to **Amazon RDS > Databases** and click Do not to include the colon and port number: -```sh +```shell sudo /opt/gitlab/embedded/bin/psql -U gitlab -h -d gitlabhq_production ``` At the psql prompt create the extension and then quit the session: -```sh +```shell psql (10.9) Type "help" for help. @@ -474,14 +474,14 @@ gitlab_rails['redis_port'] = 6379 Finally, reconfigure GitLab for the change to take effect: -```sh +```shell sudo gitlab-ctl reconfigure ``` You might also find it useful to run a check and a service status to make sure everything has been setup correctly: -```sh +```shell sudo gitlab-rake gitlab:check sudo gitlab-ctl status ``` @@ -507,7 +507,7 @@ The EBS volume will host the Git repositories data: 1. Save the file and reconfigure GitLab: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -548,7 +548,7 @@ After you SSH into the instance, configure the domain name: 1. Reconfigure GitLab: - ```sh + ```shell sudo gitlab-ctl reconfigure ``` @@ -601,7 +601,7 @@ To back up GitLab: 1. SSH into your instance. 1. Take a backup: - ```sh + ```shell sudo gitlab-backup create ``` @@ -622,7 +622,7 @@ released, you can update your GitLab instance: 1. SSH into your instance 1. Take a backup: - ```sh + ```shell sudo gitlab-backup create ``` @@ -631,7 +631,7 @@ For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`. 1. Update the repositories and install GitLab: - ```sh + ```shell sudo apt update sudo apt install gitlab-ee ``` diff --git a/doc/install/azure/index.md b/doc/install/azure/index.md index 764b95299cf..bd96db91a2c 100644 --- a/doc/install/azure/index.md +++ b/doc/install/azure/index.md @@ -348,7 +348,7 @@ Again, remember that your Azure VM domain name will be the one you [set up previously in the tutorial](#set-up-a-domain-name). If you didn't set up a domain name for your VM, you can use the IP address in its place in the following command: -```bash +```shell ssh username@your-azure-domain-name.com ``` @@ -364,7 +364,7 @@ read on [using PuTTY in Windows][Using-SSH-In-Putty]. Once you've logged in via SSH, enter the following command to update GitLab to the latest version: -```bash +```shell sudo apt-get update && sudo apt-get install gitlab-ce ``` diff --git a/doc/install/digitaloceandocker.md b/doc/install/digitaloceandocker.md index bff7d97830f..ccfb97afe28 100644 --- a/doc/install/digitaloceandocker.md +++ b/doc/install/digitaloceandocker.md @@ -47,13 +47,13 @@ The rest of the steps are identical for macOS and Linux. 1. Set the DO token: - ```sh + ```shell export DOTOKEN= ``` 1. Create the machine: - ```sh + ```shell docker-machine create \ --driver digitalocean \ --digitalocean-access-token=$DOTOKEN \ @@ -71,7 +71,7 @@ In this example we'll create a GitLab EE 8.10.8 instance. First connect the docker client to the docker host you created previously. -```sh +```shell eval "$(docker-machine env gitlab-test-env-do)" ``` @@ -88,7 +88,7 @@ You can add this to your `~/.bash_profile` file to ensure the `docker` client us #### Set up container settings -```sh +```shell export SSH_PORT=2222 export HTTP_PORT=8888 export VERSION=8.10.8-ee.0 @@ -97,7 +97,7 @@ export NAME=gitlab-test-8.10 #### Create container -```sh +```shell docker run --detach \ --env GITLAB_OMNIBUS_CONFIG="external_url 'http://$(docker-machine ip gitlab-test-env-do):$HTTP_PORT'; gitlab_rails['gitlab_shell_ssh_port'] = $SSH_PORT;" \ --hostname $(docker-machine ip gitlab-test-env-do) \ @@ -110,7 +110,7 @@ gitlab/gitlab-ee:$VERSION #### Retrieve the docker host IP -```sh +```shell docker-machine ip gitlab-test-env-do # example output: 192.168.151.134 ``` @@ -119,11 +119,11 @@ Browse to: `http://192.168.151.134:8888/`. #### Execute interactive shell/edit configuration -```sh +```shell docker exec -it $NAME /bin/bash ``` -```sh +```shell # example commands root@192:/# vi /etc/gitlab/gitlab.rb root@192:/# gitlab-ctl reconfigure diff --git a/doc/install/installation.md b/doc/install/installation.md index 5cd8f98b2f3..7f8d808628f 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -91,7 +91,7 @@ The GitLab installation consists of setting up the following components: `sudo` is not installed on Debian by default. Make sure your system is up-to-date and install it. -```sh +```shell # run as root! apt-get update -y apt-get upgrade -y @@ -101,7 +101,7 @@ apt-get install sudo -y NOTE: **Note:** During this installation, some files will need to be edited manually. If you are familiar with vim, set it as default editor with the commands below. If you are not familiar with vim, skip this and keep using the default editor. -```sh +```shell # Install vim and set as default editor sudo apt-get install -y vim sudo update-alternatives --set editor /usr/bin/vim.basic @@ -109,7 +109,7 @@ sudo update-alternatives --set editor /usr/bin/vim.basic Install the required packages (needed to compile Ruby and native extensions to Ruby gems): -```sh +```shell sudo apt-get install -y build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libre2-dev \ libreadline-dev libncurses5-dev libffi-dev curl openssh-server checkinstall libxml2-dev \ libxslt-dev libcurl4-openssl-dev libicu-dev logrotate rsync python-docutils pkg-config cmake \ @@ -121,7 +121,7 @@ you can [install re2 manually](https://github.com/google/re2/wiki/Install). If you want to use Kerberos for user authentication, install `libkrb5-dev`: -```sh +```shell sudo apt-get install libkrb5-dev ``` @@ -130,7 +130,7 @@ If you don't know what Kerberos is, you can assume you don't need it. Make sure you have the right version of Git installed: -```sh +```shell # Install Git sudo apt-get install -y git-core @@ -141,7 +141,7 @@ git --version Starting with GitLab 12.0, Git is required to be compiled with `libpcre2`. Find out if that's the case: -```sh +```shell ldd /usr/local/bin/git | grep pcre2 ``` @@ -153,7 +153,7 @@ libpcre2-8.so.0 => /usr/lib/libpcre2-8.so.0 (0x00007f08461c3000) Is the system packaged Git too old, or not compiled with pcre2? Remove it and compile from source: -```sh +```shell # Remove packaged Git sudo apt-get remove git-core @@ -186,13 +186,13 @@ sudo make prefix=/usr/local install For the [Custom Favicon](../user/admin_area/appearance.md#favicon) to work, GraphicsMagick needs to be installed. -```sh +```shell sudo apt-get install -y graphicsmagick ``` **Note:** In order to receive mail notifications, make sure to install a mail server. By default, Debian is shipped with exim4 but this [has problems](https://gitlab.com/gitlab-org/gitlab-foss/issues/12754) while Ubuntu does not ship with one. The recommended mail server is postfix and you can install it with: -```sh +```shell sudo apt-get install -y postfix ``` @@ -216,13 +216,13 @@ instructions are designed to install Ruby from the official source code. Remove the old Ruby 1.8 if present: -```sh +```shell sudo apt-get remove ruby1.8 ``` Download Ruby and compile it: -```sh +```shell mkdir /tmp/ruby && cd /tmp/ruby curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz echo '1416ce288fb8bfeae07a12b608540318c9cace71 ruby-2.6.5.tar.gz' | shasum -c - && tar xzf ruby-2.6.5.tar.gz @@ -235,7 +235,7 @@ sudo make install Then install the Bundler gem (a version below 2.x): -```sh +```shell sudo gem install bundler --no-document --version '< 2' ``` @@ -246,7 +246,7 @@ GitLab we need a Go compiler. The instructions below assume you use 64-bit Linux. You can find downloads for other platforms at the [Go download page](https://golang.org/dl). -```sh +```shell # Remove former Go installation folder sudo rm -rf /usr/local/go @@ -270,7 +270,7 @@ In many distros, the versions provided by the official package repositories are out of date, so we'll need to install through the following commands: -```sh +```shell # install node v12.x curl --location https://deb.nodesource.com/setup_12.x | sudo bash - sudo apt-get install -y nodejs @@ -287,7 +287,7 @@ Visit the official websites for [node](https://nodejs.org/en/download/package-ma Create a `git` user for GitLab: -```sh +```shell sudo adduser --disabled-login --gecos 'GitLab' git ``` @@ -299,37 +299,37 @@ use of extensions and concurrent index removal, you need at least PostgreSQL 9.2 1. Install the database packages: - ```sh + ```shell sudo apt-get install -y postgresql postgresql-client libpq-dev postgresql-contrib ``` 1. Create a database user for GitLab: - ```sh + ```shell sudo -u postgres psql -d template1 -c "CREATE USER git CREATEDB;" ``` 1. Create the `pg_trgm` extension (required for GitLab 8.6+): - ```sh + ```shell sudo -u postgres psql -d template1 -c "CREATE EXTENSION IF NOT EXISTS pg_trgm;" ``` 1. Create the GitLab production database and grant all privileges on the database: - ```sh + ```shell sudo -u postgres psql -d template1 -c "CREATE DATABASE gitlabhq_production OWNER git;" ``` 1. Try connecting to the new database with the new user: - ```sh + ```shell sudo -u git -H psql -d gitlabhq_production ``` 1. Check if the `pg_trgm` extension is enabled: - ```sh + ```shell SELECT true AS enabled FROM pg_available_extensions WHERE name = 'pg_trgm' @@ -347,7 +347,7 @@ use of extensions and concurrent index removal, you need at least PostgreSQL 9.2 1. Quit the database session: - ```sh + ```shell gitlabhq_production> \q ``` @@ -358,13 +358,13 @@ GitLab requires at least Redis 2.8. If you are using Debian 8 or Ubuntu 14.04 and up, you can simply install Redis 2.8 with: -```sh +```shell sudo apt-get install redis-server ``` Once done, you can configure Redis: -```sh +```shell # Configure redis to use sockets sudo cp /etc/redis/redis.conf /etc/redis/redis.conf.orig @@ -396,14 +396,14 @@ sudo usermod -aG redis git ## 8. GitLab -```sh +```shell # We'll install GitLab into the home directory of the user "git" cd /home/git ``` ### Clone the Source -```sh +```shell # Clone GitLab repository sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-foss.git -b X-Y-stable gitlab ``` @@ -417,7 +417,7 @@ You can change `X-Y-stable` to `master` if you want the *bleeding edge* version, ### Configure It -```sh +```shell # Go to GitLab installation folder cd /home/git/gitlab @@ -503,7 +503,7 @@ If you want to use HTTPS, see [Using HTTPS](#using-https) for the additional ste ### Configure GitLab DB Settings -```sh +```shell sudo -u git cp config/database.yml.postgresql config/database.yml # Remove host, username, and password lines from config/database.yml. @@ -539,7 +539,7 @@ Make sure you have `bundle` (run `bundle -v`): - `>= 1.5.2`, because some [issues](https://devcenter.heroku.com/changelog-items/411) were [fixed](https://github.com/bundler/bundler/pull/2817) in 1.5.2. - `< 2.x`. -```sh +```shell sudo -u git -H bundle install --deployment --without development test mysql aws kerberos ``` @@ -550,7 +550,7 @@ If you want to use Kerberos for user authentication, omit `kerberos` in the `--w GitLab Shell is an SSH access and repository management software developed specially for GitLab. -```sh +```shell # Run the installation task for gitlab-shell (replace `REDIS_URL` if needed): sudo -u git -H bundle exec rake gitlab:shell:install REDIS_URL=unix:/var/run/redis/redis.sock RAILS_ENV=production SKIP_STORAGE_VALIDATION=true @@ -578,13 +578,13 @@ GitLab-Workhorse uses [GNU Make](https://www.gnu.org/software/make/). The following command-line will install GitLab-Workhorse in `/home/git/gitlab-workhorse` which is the recommended location. -```sh +```shell sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production ``` You can specify a different Git repository by providing it as an extra parameter: -```sh +```shell sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse,https://example.com/gitlab-workhorse.git]" RAILS_ENV=production ``` @@ -594,13 +594,13 @@ GitLab-Elasticsearch-Indexer uses [GNU Make](https://www.gnu.org/software/make/) following command-line will install GitLab-Elasticsearch-Indexer in `/home/git/gitlab-elasticsearch-indexer` which is the recommended location. -```sh +```shell sudo -u git -H bundle exec rake "gitlab:indexer:install[/home/git/gitlab-elasticsearch-indexer]" RAILS_ENV=production ``` You can specify a different Git repository by providing it as an extra parameter: -```sh +```shell sudo -u git -H bundle exec rake "gitlab:indexer:install[/home/git/gitlab-elasticsearch-indexer,https://example.com/gitlab-elasticsearch-indexer.git]" RAILS_ENV=production ``` @@ -611,7 +611,7 @@ You will then need to update `gitlab.yml`'s `production -> elasticsearch -> inde GitLab Pages uses [GNU Make](https://www.gnu.org/software/make/). This step is optional and only needed if you wish to host static sites from within GitLab. The following commands will install GitLab Pages in `/home/git/gitlab-pages`. For additional setup steps, consult the [administration guide](https://gitlab.com/gitlab-org/gitlab/blob/master/doc/administration/pages/source.md) for your version of GitLab as the GitLab Pages daemon can be run several different ways. -```sh +```shell cd /home/git sudo -u git -H git clone https://gitlab.com/gitlab-org/gitlab-pages.git cd gitlab-pages @@ -621,7 +621,7 @@ sudo -u git -H make ### Install Gitaly -```sh +```shell # Fetch Gitaly source with Git and compile with Go cd /home/git/gitlab sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories]" RAILS_ENV=production @@ -629,13 +629,13 @@ sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/gi You can specify a different Git repository by providing it as an extra parameter: -```sh +```shell sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories,https://example.com/gitaly.git]" RAILS_ENV=production ``` Next, make sure that Gitaly is configured: -```sh +```shell # Restrict Gitaly socket access sudo chmod 0700 /home/git/gitlab/tmp/sockets/private sudo chown git /home/git/gitlab/tmp/sockets/private @@ -652,7 +652,7 @@ For more information about configuring Gitaly see Gitaly must be running for the next section. -```sh +```shell gitlab_path=/home/git/gitlab gitaly_path=/home/git/gitaly @@ -662,7 +662,7 @@ sudo -u git -H sh -c "$gitlab_path/bin/daemon_with_pidfile $gitlab_path/tmp/pids ### Initialize Database and Activate Advanced Features -```sh +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production # Type 'yes' to create the database tables. @@ -676,7 +676,7 @@ sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production force=yes NOTE: **Note:** You can set the Administrator/root password and e-mail by supplying them in environmental variables, `GITLAB_ROOT_PASSWORD` and `GITLAB_ROOT_EMAIL` respectively, as seen below. If you don't set the password (and it is set to the default one), wait to expose GitLab to the public internet until the installation is done and you've logged into the server the first time. During the first login, you'll be forced to change the default password. An Enterprise Edition license may also be installed at this time by supplying a full path in the `GITLAB_LICENSE_FILE` environment variable. -```sh +```shell sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production GITLAB_ROOT_PASSWORD=yourpassword GITLAB_ROOT_EMAIL=youremail GITLAB_LICENSE_FILE="/path/to/license" ``` @@ -690,13 +690,13 @@ Otherwise, your secrets are exposed if one of your backups is compromised. Download the init script (will be `/etc/init.d/gitlab`): -```sh +```shell sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab ``` And if you are installing with a non-default folder or user copy and edit the defaults file: -```sh +```shell sudo cp lib/support/init.d/gitlab.default.example /etc/default/gitlab ``` @@ -704,13 +704,13 @@ If you installed GitLab in another directory or as a user other than the default Make GitLab start on boot: -```sh +```shell sudo update-rc.d gitlab defaults 21 ``` ### Set up Logrotate -```sh +```shell sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab ``` @@ -718,32 +718,32 @@ sudo cp lib/support/logrotate/gitlab /etc/logrotate.d/gitlab Check if GitLab and its environment are configured correctly: -```sh +```shell sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production ``` ### Compile GetText PO files -```sh +```shell sudo -u git -H bundle exec rake gettext:compile RAILS_ENV=production ``` ### Compile Assets -```sh +```shell sudo -u git -H yarn install --production --pure-lockfile sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production ``` If `rake` fails with `JavaScript heap out of memory` error, try to run it with `NODE_OPTIONS` set as follows. -```sh +```shell sudo -u git -H bundle exec rake gitlab:assets:compile RAILS_ENV=production NODE_ENV=production NODE_OPTIONS="--max_old_space_size=4096" ``` ### Start Your GitLab Instance -```sh +```shell sudo service gitlab start # or sudo /etc/init.d/gitlab restart @@ -756,7 +756,7 @@ NGINX is the officially supported web server for GitLab. If you cannot or do not ### Installation -```sh +```shell sudo apt-get install -y nginx ``` @@ -764,14 +764,14 @@ sudo apt-get install -y nginx Copy the example site config: -```sh +```shell sudo cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab sudo ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab ``` Make sure to edit the config file to match your setup. Also, ensure that you match your paths to GitLab, especially if installing for a user other than the `git` user: -```sh +```shell # Change YOUR_SERVER_FQDN to the fully-qualified # domain name of your host serving GitLab. # @@ -794,7 +794,7 @@ to use. Read all about the needed configuration at the Validate your `gitlab` or `gitlab-ssl` NGINX config file with the following command: -```sh +```shell sudo nginx -t ``` @@ -807,7 +807,7 @@ nginx: configuration file /etc/nginx/nginx.conf test failed` ### Restart -```sh +```shell sudo service nginx restart ``` @@ -817,7 +817,7 @@ sudo service nginx restart To make sure you didn't miss anything run a more thorough check with: -```sh +```shell sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` @@ -867,7 +867,7 @@ Using a self-signed certificate is discouraged but if you must use it, follow th 1. Generate a self-signed SSL certificate: - ```sh + ```shell mkdir -p /etc/nginx/ssl/ cd /etc/nginx/ssl/ sudo openssl req -newkey rsa:2048 -x509 -nodes -days 3560 -out gitlab.crt -keyout gitlab.key @@ -956,7 +956,7 @@ To use GitLab with Puma: 1. Finish GitLab setup so you have it up and running. 1. Copy the supplied example Puma config file into place: - ```sh + ```shell cd /home/git/gitlab # Copy config file for the web server @@ -985,7 +985,7 @@ version of this gem. First, you must find the exact version of `google-protobuf` that your GitLab installation requires: -```sh +```shell cd /home/git/gitlab # Only one of the following two commands will print something. It @@ -997,7 +997,7 @@ bundle check | grep google-protobuf Below, `3.2.0` is used as an example. Replace it with the version number you found above: -```sh +```shell cd /home/git/gitlab sudo -u git -H gem install google-protobuf --version 3.2.0 --platform ruby ``` @@ -1005,7 +1005,7 @@ sudo -u git -H gem install google-protobuf --version 3.2.0 --platform ruby Finally, you can test whether `google-protobuf` loads correctly. The following should print 'OK'. -```sh +```shell sudo -u git -H bundle exec ruby -rgoogle/protobuf -e 'puts :OK' ``` @@ -1014,13 +1014,13 @@ tools of your OS. On Debian/Ubuntu: -```sh +```shell sudo apt-get install build-essential libgmp-dev ``` On RedHat/CentOS: -```sh +```shell sudo yum groupinstall 'Development Tools' ``` diff --git a/doc/install/openshift_and_gitlab/index.md b/doc/install/openshift_and_gitlab/index.md index 181d4414a9b..232ad2f1509 100644 --- a/doc/install/openshift_and_gitlab/index.md +++ b/doc/install/openshift_and_gitlab/index.md @@ -68,7 +68,7 @@ In short: 1. Open a terminal and in a new directory run: - ```sh + ```shell vagrant init openshift/origin-all-in-one ``` @@ -76,7 +76,7 @@ In short: 1. In the same directory where you generated the Vagrantfile enter: - ```sh + ```shell vagrant up ``` @@ -120,7 +120,7 @@ functionalities. Let's first see the version of `oc`: -```sh +```shell $ oc version oc v1.3.0 @@ -136,7 +136,7 @@ when we visited the web console earlier. The username/password for the administrator user is `admin/admin`. There is also a test user with username/ password `user/user`, with limited access. Let's login as admin for the moment: -```sh +```shell $ oc login https://10.2.2.2:8443 Authentication required for https://10.2.2.2:8443 (openshift) @@ -158,13 +158,13 @@ Using project "default". Switch to the `openshift-infra` project with: -```sh +```shell oc project openshift-infra ``` And finally, see its status: -```sh +```shell oc status ``` @@ -193,20 +193,20 @@ In that case, the OpenShift service might not be running, so in order to fix it: 1. SSH into the VM by going to the directory where the Vagrantfile is and then run: - ```sh + ```shell vagrant ssh ``` 1. Run `systemctl` and verify by the output that the `openshift` service is not running (it will be in red color). If that's the case start the service with: - ```sh + ```shell sudo systemctl start openshift ``` 1. Verify the service is up with: - ```sh + ```shell systemctl status openshift -l ``` @@ -222,7 +222,7 @@ Now that you got a taste of what OpenShift looks like, let's deploy GitLab! First, we will create a new project to host our application. You can do this either by running the CLI client: -```bash +```shell oc new-project gitlab ``` @@ -233,7 +233,7 @@ or by using the web interface: If you used the command line, `oc` automatically uses the new project and you can see its status with: -```sh +```shell $ oc status In project gitlab on server https://10.2.2.2:8443 @@ -255,13 +255,13 @@ parameters for those objects. The template for GitLab resides in the Omnibus GitLab repository under the docker directory. Let's download it locally with `wget`: -```bash +```shell wget https://gitlab.com/gitlab-org/omnibus-gitlab/raw/master/docker/openshift-template.json ``` And then let's import it in OpenShift: -```bash +```shell oc create -f openshift-template.json -n openshift ``` @@ -391,13 +391,13 @@ Let's see how to do that using the following steps. 1. Make sure you are in the `gitlab` project: - ```sh + ```shell oc project gitlab ``` 1. See what services are used for this project: - ```sh + ```shell oc get svc ``` @@ -413,7 +413,7 @@ Let's see how to do that using the following steps. 1. We need to see the replication controllers of the `gitlab-ce` service. Get a detailed view of the current ones: - ```sh + ```shell oc describe rc gitlab-ce ``` @@ -424,13 +424,13 @@ Let's see how to do that using the following steps. 1. Scale GitLab using the previous information: - ```sh + ```shell oc scale --replicas=2 replicationcontrollers gitlab-ce-2 ``` 1. Get the new replicas number to make sure scaling worked: - ```sh + ```shell oc get rc gitlab-ce-2 ``` @@ -476,7 +476,7 @@ For OpenShift v3.0, you will need to do this manually: 1. Edit the Security Context: - ```sh + ```shell oc edit scc anyuid ``` @@ -488,7 +488,7 @@ For OpenShift v3.0, you will need to do this manually: For OpenShift v3.1 and above, you can do: -```sh +```shell oc adm policy add-scc-to-user anyuid system:serviceaccount:gitlab:gitlab-ce-user ``` diff --git a/doc/integration/auth0.md b/doc/integration/auth0.md index 2dd6fa3d5a2..521223e626b 100644 --- a/doc/integration/auth0.md +++ b/doc/integration/auth0.md @@ -32,13 +32,13 @@ application. For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/integration/azure.md b/doc/integration/azure.md index c30d79e3dab..60885f7d9ba 100644 --- a/doc/integration/azure.md +++ b/doc/integration/azure.md @@ -34,13 +34,13 @@ To enable the Microsoft Azure OAuth2 OmniAuth provider you must register your ap For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/integration/cas.md b/doc/integration/cas.md index 83b64773c9f..8aadfaad4e9 100644 --- a/doc/integration/cas.md +++ b/doc/integration/cas.md @@ -6,13 +6,13 @@ To enable the CAS OmniAuth provider you must register your application with your For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/integration/elasticsearch.md b/doc/integration/elasticsearch.md index 9cba1465fa1..c3e85002db8 100644 --- a/doc/integration/elasticsearch.md +++ b/doc/integration/elasticsearch.md @@ -68,7 +68,7 @@ installed before running `make`. To install on Debian or Ubuntu, run: -```sh +```shell sudo apt install libicu-dev ``` @@ -76,7 +76,7 @@ sudo apt install libicu-dev To install on CentOS or RHEL, run: -```sh +```shell sudo yum install libicu-devel ``` @@ -84,7 +84,7 @@ sudo yum install libicu-devel To install on macOS, run: -```sh +```shell brew install icu4c export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH" ``` @@ -93,7 +93,7 @@ export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH" To build and install the indexer, run: -```sh +```shell indexer_path=/home/git/gitlab-elasticsearch-indexer # Run the installation task for gitlab-elasticsearch-indexer: @@ -108,7 +108,7 @@ Please remember to pass the `-E` flag to `sudo` if you do so. Example: -```sh +```shell PREFIX=/usr sudo -E make install ``` @@ -184,7 +184,7 @@ To disable the Elasticsearch integration: 1. Click **Save changes** for the changes to take effect. 1. (Optional) Delete the existing index by running one of these commands: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:delete_index @@ -206,7 +206,7 @@ To index via the Admin Area: 1. [Configure your Elasticsearch host and port](#enabling-elasticsearch). 1. Create empty indexes using one of the following commands: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:create_empty_index @@ -219,7 +219,7 @@ To index via the Admin Area: 1. Click **Check progress** in the confirmation message to see the status of the background jobs. 1. Personal snippets need to be indexed manually by running one of these commands: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index_snippets @@ -241,7 +241,7 @@ If the database size is less than 500 MiB, and the size of all hosted repos is l 1. [Enable **Elasticsearch indexing** and configure your host and port](#enabling-elasticsearch). 1. Index your data using one of the following commands: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index @@ -261,7 +261,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq 1. [Configure your Elasticsearch host and port](#enabling-elasticsearch). 1. Create empty indexes using one of the following commands: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:create_empty_index @@ -274,7 +274,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq can temporarily disable auto-refreshing and replicating. In our experience, you can expect a 20% decrease in indexing time. We'll enable them when indexing is done. This step is optional! - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings --header 'Content-Type: application/json' --data '{ "index" : { "refresh_interval" : "-1", @@ -284,7 +284,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq 1. Index projects and their associated data: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index_projects @@ -296,7 +296,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq You can view the jobs in **Admin Area > Monitoring > Background Jobs > Queues Tab** and click `elastic_indexer`, or you can query indexing status using a rake task: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index_projects_status @@ -309,7 +309,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq If you want to limit the index to a range of projects you can provide the `ID_FROM` and `ID_TO` parameters: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index_projects ID_FROM=1001 ID_TO=2000 @@ -331,7 +331,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq it will check every project repository again to make sure that every commit in a repository is indexed, which can be useful in case if your index is outdated: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index_projects UPDATE_INDEX=true ID_TO=1000 @@ -346,7 +346,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq 1. Personal snippets are not associated with a project and need to be indexed separately by running one of these commands: - ```sh + ```shell # Omnibus installations sudo gitlab-rake gitlab:elastic:index_snippets @@ -356,7 +356,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq 1. Enable replication and refreshing again after indexing (only if you previously disabled it): - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings --header 'Content-Type: application/json' ---data '{ "index" : { "number_of_replicas" : 1, @@ -368,7 +368,7 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq For Elasticsearch 6.x, the index should be in read-only mode before proceeding with the force merge: - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings ---header 'Content-Type: application/json' --data '{ "settings": { "index.blocks.write": true @@ -377,13 +377,13 @@ or creating [extra Sidekiq processes](../administration/operations/extra_sidekiq Then, initiate the force merge: - ```bash + ```shell curl --request POST 'localhost:9200/gitlab-production/_forcemerge?max_num_segments=5' ``` After this, if your index is in read-only mode, switch back to read-write: - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings ---header 'Content-Type: application/json' --data '{ "settings": { "index.blocks.write": false @@ -437,7 +437,7 @@ In addition to the rake tasks, there are some environment variables that can be Because the `ID_TO` and `ID_FROM` environment variables use the `or equal to` comparison, you can index only one project by using both these variables with the same project ID number: -```sh +```shell root@git:~# sudo gitlab-rake gitlab:elastic:index_projects ID_TO=5 ID_FROM=5 Indexing project repositories...I, [2019-03-04T21:27:03.083410 #3384] INFO -- : Indexing GitLab User / test (ID=33)... I, [2019-03-04T21:27:05.215266 #3384] INFO -- : Indexing GitLab User / test (ID=33) is done! @@ -471,7 +471,7 @@ However, some larger installations may wish to tune the merge policy settings: - Consider reducing the `index.merge.policy.max_merged_segment` size from the default 5 GB to maybe 2 GB or 3 GB. Merging only happens when a segment has at least 50% deletions. Smaller segment sizes will allow merging to happen more frequently. - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings ---header 'Content-Type: application/json' --data '{ "index" : { "merge.policy.max_merged_segment": "2gb" @@ -481,7 +481,7 @@ However, some larger installations may wish to tune the merge policy settings: - You can also adjust `index.merge.policy.reclaim_deletes_weight`, which controls how aggressively deletions are targeted. But this can lead to costly merge decisions, so we recommend not changing this unless you understand the tradeoffs. - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings ---header 'Content-Type: application/json' --data '{ "index" : { "merge.policy.reclaim_deletes_weight": "3.0" @@ -604,7 +604,7 @@ Here are some common pitfalls and how to overcome them: If you have a **hard requirement to have a green status for your single node Elasticsearch cluster**, please make sure you understand the risks outlined in the previous paragraph and then simply run the following query to set the number of replicas to `0`(the cluster will no longer try to create any shard replicas): - ```bash + ```shell curl --request PUT localhost:9200/gitlab-production/_settings --header 'Content-Type: application/json' --data '{ "index" : { "number_of_replicas" : 0 diff --git a/doc/integration/facebook.md b/doc/integration/facebook.md index d46486ad888..878d6c38230 100644 --- a/doc/integration/facebook.md +++ b/doc/integration/facebook.md @@ -51,13 +51,13 @@ To enable the Facebook OmniAuth provider you must register your application with For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/integration/gitlab.md b/doc/integration/gitlab.md index 74f2d5cb403..e8c104bbe6f 100644 --- a/doc/integration/gitlab.md +++ b/doc/integration/gitlab.md @@ -32,13 +32,13 @@ GitLab.com will generate an application ID and secret key for you to use. For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/integration/google.md b/doc/integration/google.md index 97323557878..38cc33e3971 100644 --- a/doc/integration/google.md +++ b/doc/integration/google.md @@ -54,13 +54,13 @@ On your GitLab server: For Omnibus GitLab: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/integration/kerberos.md b/doc/integration/kerberos.md index 1cdbdb1c40e..3998089a0e4 100644 --- a/doc/integration/kerberos.md +++ b/doc/integration/kerberos.md @@ -275,7 +275,7 @@ authenticate to other Kerberos services. ### HTTP Basic: Access denied when cloning -```sh +```shell remote: HTTP Basic: Access denied fatal: Authentication failed for '' ``` diff --git a/doc/integration/oauth2_generic.md b/doc/integration/oauth2_generic.md index ad59592c45f..c53c5751f1f 100644 --- a/doc/integration/oauth2_generic.md +++ b/doc/integration/oauth2_generic.md @@ -38,13 +38,13 @@ This strategy is designed to allow configuration of the simple OmniAuth SSO proc For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/integration/omniauth.md b/doc/integration/omniauth.md index 6ac2e3e13d6..2e89093321a 100644 --- a/doc/integration/omniauth.md +++ b/doc/integration/omniauth.md @@ -73,7 +73,7 @@ To change these settings: Open the configuration file: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` @@ -96,7 +96,7 @@ To change these settings: Open the configuration file: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml @@ -188,19 +188,19 @@ from the OmniAuth provider's documentation. - Stop GitLab: - ```sh + ```shell sudo service gitlab stop ``` - Add the gem to your [Gemfile](https://gitlab.com/gitlab-org/gitlab/blob/master/Gemfile): - ```sh + ```shell gem "omniauth-your-auth-provider" ``` - Install the new OmniAuth provider gem by running the following command: - ```sh + ```shell sudo -u git -H bundle install --without development test mysql --path vendor/bundle --no-deployment ``` @@ -208,7 +208,7 @@ from the OmniAuth provider's documentation. - Start GitLab: - ```sh + ```shell sudo service gitlab start ``` diff --git a/doc/integration/salesforce.md b/doc/integration/salesforce.md index 958f05cf030..d0e25ae2d44 100644 --- a/doc/integration/salesforce.md +++ b/doc/integration/salesforce.md @@ -31,13 +31,13 @@ To get the credentials (a pair of Client ID and Client Secret), you must [create For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/integration/saml.md b/doc/integration/saml.md index 261fe6e8c18..a4e96adca47 100644 --- a/doc/integration/saml.md +++ b/doc/integration/saml.md @@ -19,13 +19,13 @@ in your SAML IdP: For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/integration/sourcegraph.md b/doc/integration/sourcegraph.md index 25d1ef457c0..c400d5a9a63 100644 --- a/doc/integration/sourcegraph.md +++ b/doc/integration/sourcegraph.md @@ -35,7 +35,7 @@ by instance administrators. Use these commands to start the Rails console: -```sh +```shell # Omnibus GitLab gitlab-rails console diff --git a/doc/integration/twitter.md b/doc/integration/twitter.md index b2bd1b57d0f..cf6492d7372 100644 --- a/doc/integration/twitter.md +++ b/doc/integration/twitter.md @@ -34,13 +34,13 @@ To enable the Twitter OmniAuth provider you must register your application with For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml diff --git a/doc/integration/ultra_auth.md b/doc/integration/ultra_auth.md index 83b2d7fe096..091887d8eb8 100644 --- a/doc/integration/ultra_auth.md +++ b/doc/integration/ultra_auth.md @@ -27,13 +27,13 @@ To get the credentials (a pair of Client ID and Client Secret), you must registe For Omnibus package: - ```sh + ```shell sudo editor /etc/gitlab/gitlab.rb ``` For installations from source: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H editor config/gitlab.yml ``` diff --git a/doc/integration/vault.md b/doc/integration/vault.md index 8bd0897548a..ea3aeeb0f64 100644 --- a/doc/integration/vault.md +++ b/doc/integration/vault.md @@ -30,13 +30,13 @@ The following assumes you already have Vault installed and running. Open a terminal session and run the following command to enable the OpenID Connect authentication provider in Vault: - ```bash + ```shell vault auth enable oidc ``` You should see the following output in the terminal: - ```bash + ```shell Success! Enabled oidc auth method at: oidc/ ``` @@ -48,7 +48,7 @@ The following assumes you already have Vault installed and running. Replace `your_application_id` and `your_secret` in the example below with the application ID and secret generated for your app: - ```bash + ```shell $ vault write auth/oidc/config \ oidc_discovery_url="https://gitlab.com" \ oidc_client_id="your_application_id" \ @@ -59,7 +59,7 @@ The following assumes you already have Vault installed and running. You should see the following output in the terminal: - ```bash + ```shell Success! Data written to: auth/oidc/config ``` @@ -69,7 +69,7 @@ The following assumes you already have Vault installed and running. This configuration is saved under the name of the role you are creating. In this case, we are creating a `demo` role. Later, we'll show how you can access this role through the Vault CLI. - ```bash + ```shell vault write auth/oidc/role/demo \ user_claim="sub" \ allowed_redirect_uris="http://localhost:8250/oidc/callback,http://127.0.0.1:8200/ui/vault/auth/oidc/oidc/callback" \ @@ -96,7 +96,7 @@ The following assumes you already have Vault installed and running. After writing the same configurations from above, you can run the command below in your terminal to sign in with the role configuration created in step 4 above: - ```bash + ```shell vault login -method=oidc port=8250 role=demo ``` diff --git a/doc/migrate_ci_to_ce/README.md b/doc/migrate_ci_to_ce/README.md index 85e69be6516..9cb14272544 100644 --- a/doc/migrate_ci_to_ce/README.md +++ b/doc/migrate_ci_to_ce/README.md @@ -34,7 +34,7 @@ upgrade to 8.0 until you finish the migration procedure. If you have GitLab CI installed using Omnibus GitLab packages but **you don't want to migrate your existing data**: -```bash +```shell mv /var/opt/gitlab/gitlab-ci/builds /var/opt/gitlab/gitlab-ci/builds.$(date +%s) ``` @@ -326,13 +326,13 @@ You should also make sure that you can: ### 2. Check NGINX configuration -```sh +```shell sudo nginx -t ``` ### 3. Restart NGINX -```sh +```shell sudo /etc/init.d/nginx restart ``` diff --git a/doc/raketasks/backup_restore.md b/doc/raketasks/backup_restore.md index 2d2f5409c15..78d634b7795 100644 --- a/doc/raketasks/backup_restore.md +++ b/doc/raketasks/backup_restore.md @@ -21,7 +21,7 @@ If you installed GitLab: - Using the Omnibus package, you're all set. - From source, make sure `rsync` is installed: - ```sh + ```shell # Debian/Ubuntu sudo apt-get install rsync @@ -35,7 +35,7 @@ Backup and restore tasks use `tar` under the hood to create and extract archives. Ensure you have version 1.30 or above of `tar` available in your system. To check the version, run: -```sh +```shell tar --version ``` @@ -76,7 +76,7 @@ You are highly advised to [read about storing configuration files](#storing-conf Use this command if you've installed GitLab with the Omnibus package: -```sh +```shell sudo gitlab-backup create ``` @@ -85,13 +85,13 @@ For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`. Use this if you've installed GitLab from source: -```sh +```shell sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` If you are running GitLab within a Docker container, you can run the backup from the host: -```sh +```shell docker exec -t gitlab-backup create ``` @@ -102,7 +102,7 @@ If you are using the [GitLab Helm chart](https://gitlab.com/gitlab-org/charts/gi Kubernetes cluster, you can run the backup task using `backup-utility` script on the GitLab task runner pod via `kubectl`. Refer to [backing up a GitLab installation](https://gitlab.com/gitlab-org/charts/gitlab/blob/master/doc/backup-restore/backup.md#backing-up-a-gitlab-installation) for more details: -```sh +```shell kubectl exec -it backup-utility ``` @@ -204,7 +204,7 @@ installations. This is why the `copy` strategy is not the default in 8.17. To use the `copy` strategy instead of the default streaming strategy, specify `STRATEGY=copy` in the Rake task command. For example: -```sh +```shell sudo gitlab-backup create STRATEGY=copy ``` @@ -215,7 +215,7 @@ For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`. By default a backup file is created according to the specification in [the Backup timestamp](#backup-timestamp) section above. You can however override the `[TIMESTAMP]` part of the filename by setting the `BACKUP` environment variable. For example: -```sh +```shell sudo gitlab-backup create BACKUP=dump ``` @@ -230,7 +230,7 @@ To make sure the generated archive is intelligently transferable by rsync, the ` Note that the `--rsyncable` option in `gzip` is not guaranteed to be available on all distributions. To verify that it is available in your distribution you can run `gzip --help` or consult the man pages. -```sh +```shell sudo gitlab-backup create BACKUP=dump GZIP_RSYNCABLE=yes ``` @@ -258,7 +258,7 @@ will be skipped during a backup. For Omnibus GitLab packages: -```sh +```shell sudo gitlab-backup create SKIP=db,uploads ``` @@ -267,7 +267,7 @@ For GitLab 12.1 and earlier, use `gitlab-rake gitlab:backup:create`. For installations from source: -```sh +```shell sudo -u git -H bundle exec rake gitlab:backup:create SKIP=db,uploads RAILS_ENV=production ``` @@ -579,7 +579,7 @@ policy as described here](https://stackoverflow.com/questions/37553070/gitlab-om To schedule a cron job that backs up your repositories and GitLab metadata, use the root user: -```sh +```shell sudo su - crontab -e ``` @@ -608,7 +608,7 @@ For installations from source: 1. [Restart GitLab] for the changes to take effect. -```sh +```shell sudo -u git crontab -e # Edit the crontab for the git user ``` @@ -796,7 +796,7 @@ backup location (default location is `/var/opt/gitlab/backups`). For docker installations, the restore task can be run from host: -```sh +```shell docker exec -it gitlab-backup restore ``` @@ -906,13 +906,13 @@ backup beforehand. For Omnibus GitLab packages: - ```sh + ```shell sudo gitlab-rails dbconsole ``` For installations from source: - ```sh + ```shell sudo -u git -H bundle exec rails dbconsole RAILS_ENV=production ``` @@ -941,13 +941,13 @@ backup beforehand. For Omnibus GitLab packages: - ```sh + ```shell sudo gitlab-rails dbconsole ``` For installations from source: - ```sh + ```shell sudo -u git -H bundle exec rails dbconsole RAILS_ENV=production ``` @@ -974,13 +974,13 @@ backup beforehand. For Omnibus GitLab packages: - ```sh + ```shell sudo gitlab-rails dbconsole ``` For installations from source: - ```sh + ```shell sudo -u git -H bundle exec rails dbconsole RAILS_ENV=production ``` @@ -1017,7 +1017,7 @@ unable to assign the correct ownership to the registry files during the restore To get your registry working again: -```bash +```shell sudo chown -R registry:registry /var/opt/gitlab/gitlab-rails/shared/registry/docker ``` @@ -1033,7 +1033,7 @@ want to run the `chown` against your custom location instead of While running the backup, you may receive a gzip error: -```sh +```shell sudo /opt/gitlab/bin/gitlab-backup create ... Dumping ... diff --git a/doc/raketasks/import.md b/doc/raketasks/import.md index 5f11af0213d..d50272174ab 100644 --- a/doc/raketasks/import.md +++ b/doc/raketasks/import.md @@ -42,7 +42,7 @@ If you are using an installation from source, replace `/var/opt/gitlab/` with `/ #### Omnibus Installation -```sh +```shell sudo gitlab-rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-'] ``` @@ -50,7 +50,7 @@ sudo gitlab-rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import Before running this command you need to change the directory to where your GitLab installation is located: -```sh +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:import:repos['/var/opt/gitlab/git-data/repository-import-'] RAILS_ENV=production ``` diff --git a/doc/raketasks/user_management.md b/doc/raketasks/user_management.md index 571e784e530..04f8ad59153 100644 --- a/doc/raketasks/user_management.md +++ b/doc/raketasks/user_management.md @@ -2,7 +2,7 @@ ## Add user as a developer to all projects -```bash +```shell # omnibus-gitlab sudo gitlab-rake gitlab:import:user_to_projects[username@domain.tld] @@ -16,7 +16,7 @@ Notes: - admin users are added as maintainers -```bash +```shell # omnibus-gitlab sudo gitlab-rake gitlab:import:all_users_to_all_projects @@ -26,7 +26,7 @@ bundle exec rake gitlab:import:all_users_to_all_projects RAILS_ENV=production ## Add user as a developer to all groups -```bash +```shell # omnibus-gitlab sudo gitlab-rake gitlab:import:user_to_groups[username@domain.tld] @@ -40,7 +40,7 @@ Notes: - admin users are added as owners so they can add additional users to the group -```bash +```shell # omnibus-gitlab sudo gitlab-rake gitlab:import:all_users_to_all_groups @@ -62,7 +62,7 @@ This task will disable 2FA for all users that have it enabled. This can be useful if GitLab's `config/secrets.yml` file has been lost and users are unable to login, for example. -```bash +```shell # omnibus-gitlab sudo gitlab-rake gitlab:two_factor:disable_for_all_users diff --git a/doc/raketasks/web_hooks.md b/doc/raketasks/web_hooks.md index d9a042ec8fe..22084c862ba 100644 --- a/doc/raketasks/web_hooks.md +++ b/doc/raketasks/web_hooks.md @@ -2,7 +2,7 @@ ## Add a webhook for **ALL** projects -```sh +```shell # omnibus-gitlab sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook" # source installations @@ -11,7 +11,7 @@ bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" RAILS_ENV=pro ## Add a webhook for projects in a given **NAMESPACE** -```sh +```shell # omnibus-gitlab sudo gitlab-rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acme # source installations @@ -20,7 +20,7 @@ bundle exec rake gitlab:web_hook:add URL="http://example.com/hook" NAMESPACE=acm ## Remove a webhook from **ALL** projects using -```sh +```shell # omnibus-gitlab sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook" # source installations @@ -29,7 +29,7 @@ bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" RAILS_ENV=prod ## Remove a webhook from projects in a given **NAMESPACE** -```sh +```shell # omnibus-gitlab sudo gitlab-rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme # source installations @@ -38,7 +38,7 @@ bundle exec rake gitlab:web_hook:rm URL="http://example.com/hook" NAMESPACE=acme ## List **ALL** webhooks -```sh +```shell # omnibus-gitlab sudo gitlab-rake gitlab:web_hook:list # source installations @@ -47,7 +47,7 @@ bundle exec rake gitlab:web_hook:list RAILS_ENV=production ## List the webhooks from projects in a given **NAMESPACE** -```sh +```shell # omnibus-gitlab sudo gitlab-rake gitlab:web_hook:list NAMESPACE=acme # source installations diff --git a/doc/security/asset_proxy.md b/doc/security/asset_proxy.md index 5522a41ff01..d042fb3efe7 100644 --- a/doc/security/asset_proxy.md +++ b/doc/security/asset_proxy.md @@ -30,7 +30,7 @@ To install a Camo server as an asset proxy: 1. Make sure your instance of GitLab is running, and that you have created a private API token. Using the API, configure the asset proxy settings on your GitLab instance. For example: - ```sh + ```shell curl --request "PUT" "https://gitlab.example.com/api/v4/application/settings?\ asset_proxy_enabled=true&\ asset_proxy_url=https://proxy.gitlab.example.com&\ diff --git a/doc/security/password_length_limits.md b/doc/security/password_length_limits.md index c00fd78c4d3..8fc799faff0 100644 --- a/doc/security/password_length_limits.md +++ b/doc/security/password_length_limits.md @@ -21,7 +21,7 @@ To change that for installations from source: 1. Edit `devise_password_length.rb`: - ```sh + ```shell cd /home/git/gitlab sudo -u git -H cp config/initializers/devise_password_length.rb.example config/initializers/devise_password_length.rb sudo -u git -H editor config/initializers/devise_password_length.rb diff --git a/doc/security/rack_attack.md b/doc/security/rack_attack.md index 9cbb296338a..bb51fc38e61 100644 --- a/doc/security/rack_attack.md +++ b/doc/security/rack_attack.md @@ -146,7 +146,7 @@ taken in order to enable protection for your GitLab instance: `paths_to_be_protected`, and add any other path you need protecting 1. Restart GitLab: - ```sh + ```shell sudo service gitlab restart ``` @@ -164,13 +164,13 @@ In case you want to remove a blocked IP, follow these steps: 1. Find the IPs that have been blocked in the production log: - ```sh + ```shell grep "Rack_Attack" /var/log/gitlab/gitlab-rails/auth.log ``` 1. Since the blacklist is stored in Redis, you need to open up `redis-cli`: - ```sh + ```shell /opt/gitlab/embedded/bin/redis-cli -s /var/opt/gitlab/redis/redis.socket ``` diff --git a/doc/security/reset_root_password.md b/doc/security/reset_root_password.md index 00c9dc1407d..cd2144698f6 100644 --- a/doc/security/reset_root_password.md +++ b/doc/security/reset_root_password.md @@ -8,7 +8,7 @@ To reset your root password, first log into your server with root privileges. Start a Ruby on Rails console with this command: -```bash +```shell gitlab-rails console -e production ``` @@ -16,19 +16,19 @@ Wait until the console has loaded. There are multiple ways to find your user. You can search for email or username. -```bash +```shell user = User.where(id: 1).first ``` or -```bash +```shell user = User.find_by(email: 'admin@example.com') ``` Now you can change your password: -```bash +```shell user.password = 'secret_pass' user.password_confirmation = 'secret_pass' ``` @@ -37,7 +37,7 @@ It's important that you change both password and password_confirmation to make i Don't forget to save the changes. -```bash +```shell user.save! ``` diff --git a/doc/security/two_factor_authentication.md b/doc/security/two_factor_authentication.md index 39f92f95ba1..e51ef00a1fa 100644 --- a/doc/security/two_factor_authentication.md +++ b/doc/security/two_factor_authentication.md @@ -66,7 +66,7 @@ The following are important notes about 2FA: There may be some special situations where you want to disable 2FA for everyone even when forced 2FA is disabled. There is a rake task for that: -```sh +```shell # Omnibus installations sudo gitlab-rake gitlab:two_factor:disable_for_all_users diff --git a/doc/security/unlock_user.md b/doc/security/unlock_user.md index d34826c853c..fdf7ba90a3b 100644 --- a/doc/security/unlock_user.md +++ b/doc/security/unlock_user.md @@ -11,7 +11,7 @@ To unlock a locked user: 1. SSH into your GitLab server. 1. Start a Ruby on Rails console: - ```sh + ```shell ## For Omnibus GitLab sudo gitlab-rails console production diff --git a/doc/ssh/README.md b/doc/ssh/README.md index 5a3f97de77d..bc34df4086d 100644 --- a/doc/ssh/README.md +++ b/doc/ssh/README.md @@ -93,13 +93,13 @@ To create a new SSH key pair: 1. Open a terminal on Linux or macOS, or Git Bash / WSL on Windows. 1. Generate a new ED25519 SSH key pair: - ```bash + ```shell ssh-keygen -t ed25519 -C "email@example.com" ``` Or, if you want to use RSA: - ```bash + ```shell ssh-keygen -t rsa -b 4096 -C "email@example.com" ``` @@ -140,13 +140,13 @@ If you already have an RSA SSH key pair to use with GitLab, consider upgrading i to use the more secure password encryption format by using the following command on the private key: -```bash +```shell ssh-keygen -o -f ~/.ssh/id_rsa ``` Or generate a new RSA key: -```bash +```shell ssh-keygen -o -t rsa -b 4096 -C "email@example.com" ``` @@ -159,19 +159,19 @@ Now, it's time to add the newly created public key to your GitLab account. **macOS:** - ```bash + ```shell pbcopy < ~/.ssh/id_ed25519.pub ``` **WSL / GNU/Linux (requires the xclip package):** - ```bash + ```shell xclip -sel clip < ~/.ssh/id_ed25519.pub ``` **Git Bash on Windows:** - ```bash + ```shell cat ~/.ssh/id_ed25519.pub | clip ``` @@ -197,7 +197,7 @@ Now, it's time to add the newly created public key to your GitLab account. To test whether your SSH key was added correctly, run the following command in your terminal (replacing `gitlab.com` with your GitLab's instance domain): -```bash +```shell ssh -T git@gitlab.com ``` @@ -234,7 +234,7 @@ for connections to GitLab. Open a terminal and use the following commands (replacing `other_id_rsa` with your private SSH key): -```bash +```shell eval $(ssh-agent -s) ssh-add ~/.ssh/other_id_rsa ``` @@ -267,7 +267,7 @@ that's why it needs to uniquely map to a single user. If you want to use different keys depending on the repository you are working on, you can issue the following command while inside your repository: -```sh +```shell git config core.sshCommand "ssh -o IdentitiesOnly=yes -i ~/.ssh/private-key-filename-for-this-repository -F /dev/null" ``` @@ -314,13 +314,13 @@ despite giving very little context as to where they point, would also work. Cloning the `gitlab` repository normally looks like this: -```sh +```shell git clone git@gitlab.com:gitlab-org/gitlab.git ``` To clone it for `user_1`, replace `gitlab.com` with the SSH alias `user_1.gitlab.com`: -```sh +```shell git clone git@:gitlab-org/gitlab.git ``` @@ -328,7 +328,7 @@ Fix a previously cloned repository using the `git remote` command. The example below assumes the remote repository is aliased as `origin`. -```sh +```shell git remote set-url origin git@:gitlab-org/gitlab.git ``` diff --git a/doc/topics/autodevops/index.md b/doc/topics/autodevops/index.md index f4dbed25274..1c8162a49e7 100644 --- a/doc/topics/autodevops/index.md +++ b/doc/topics/autodevops/index.md @@ -769,7 +769,7 @@ This might be neccessary, for example, when: For example, to start a Rails console from the application root directory, run: -```sh +```shell /bin/herokuish procfile exec bin/rails c ``` @@ -1137,7 +1137,7 @@ variables in the container running the application. Following the example above, you can see the secret below containing the `RAILS_MASTER_KEY` variable. -```sh +```shell $ kubectl get secret production-secret -n minimal-ruby-app-54 -o yaml apiVersion: v1 data: @@ -1351,7 +1351,7 @@ The banner can be disabled for: - Through the REST API with an admin access token: - ```sh + ```shell curl --data "value=true" --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/features/auto_devops_banner_disabled ``` diff --git a/doc/topics/git/how_to_install_git/index.md b/doc/topics/git/how_to_install_git/index.md index db474559627..2c3cd61f050 100644 --- a/doc/topics/git/how_to_install_git/index.md +++ b/doc/topics/git/how_to_install_git/index.md @@ -46,7 +46,7 @@ for the official Homebrew installation instructions. With Homebrew installed you are now ready to install Git. Open a Terminal and enter in the following command: -```sh +```shell brew install git ``` @@ -62,7 +62,7 @@ it is recommended to use the built in package manager to install Git. Open a Terminal and enter in the following commands to install the latest Git from the official Git maintained package archives: -```sh +```shell sudo apt-add-repository ppa:git-core/ppa sudo apt-get update sudo apt-get install git diff --git a/doc/topics/git/migrate_to_git_lfs/index.md b/doc/topics/git/migrate_to_git_lfs/index.md index eec1c3c10c1..9c73b4dfde7 100644 --- a/doc/topics/git/migrate_to_git_lfs/index.md +++ b/doc/topics/git/migrate_to_git_lfs/index.md @@ -49,13 +49,13 @@ To follow this tutorial, you'll need: (Java 7 or above) installed locally. - BFG installed locally: - ```bash + ```shell brew install bfg ``` - Git LFS installed locally: - ```bash + ```shell brew install git-lfs ``` @@ -80,13 +80,13 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs- (in our example, `test-git-lfs-repo-migration.git`), mirroring the upstream project: - ```bash + ```shell git clone --mirror git@gitlab.com:gitlab-tests/test-git-lfs-repo-migration.git ``` 1. Convert the Git history with BFG: - ```bash + ```shell bfg --convert-to-git-lfs "*.{png,mp4,jpg,gif}" --no-blob-protection test-git-lfs-repo-migration.git ``` @@ -95,7 +95,7 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs- 1. Clean up the repository: - ```bash + ```shell # cd path/to/mirror/repo: cd test-git-lfs-repo-migration.git # clean up the repo: @@ -107,7 +107,7 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs- 1. Install Git LFS in the mirror repository: - ```bash + ```shell git lfs install ``` @@ -121,13 +121,13 @@ Consider an example upstream project, `git@gitlab.com:gitlab-tests/test-git-lfs- 1. Force-push to GitLab: - ```bash + ```shell git push --force ``` 1. Track the files you want with LFS: - ```bash + ```shell # cd path/to/upstream/repo: cd test-git-lfs-repo-migration # You may need to reset your local copy with upstream's `master` after force-pushing from the mirror: diff --git a/doc/topics/git/numerous_undo_possibilities_in_git/index.md b/doc/topics/git/numerous_undo_possibilities_in_git/index.md index 33da01d35b8..cea052f3a90 100644 --- a/doc/topics/git/numerous_undo_possibilities_in_git/index.md +++ b/doc/topics/git/numerous_undo_possibilities_in_git/index.md @@ -161,7 +161,7 @@ of the staging tree. You also have an option to discard all changes with Lets start the example by editing a file, with your favorite editor, to change the content and add it to staging -```sh +```shell vim git add ``` diff --git a/doc/topics/git/partial_clone.md b/doc/topics/git/partial_clone.md index e6f84ee8251..83f1d0f0de5 100644 --- a/doc/topics/git/partial_clone.md +++ b/doc/topics/git/partial_clone.md @@ -44,7 +44,7 @@ Follow [Git for enormous repositories](https://gitlab.com/groups/gitlab-org/-/ep To enable partial clone, use the [feature flags API](../../api/features.md). For example: -```sh +```shell curl --data "value=true" --header "PRIVATE-TOKEN: " https://gitlab.example.com/api/v4/features/gitaly_upload_pack_filter ``` @@ -64,7 +64,7 @@ partial clone, all files – large or small – may be treated the same. With the `uploadpack.allowFilter` and `uploadpack.allowAnySHA1InWant` options enabled on the Git server: -```bash +```shell # clone the repo, excluding blobs larger than 1 megabyte git clone --filter=blob:limit=1m @@ -109,7 +109,7 @@ enabled on the Git server: [issue tracking support for `--filter=sparse:oid`](https://gitlab.com/gitlab-org/git/issues/4) for updates. - ```bash + ```shell # Create a new directory for the Git repository mkdir jumbo-repo && cd jumbo-repo @@ -140,7 +140,7 @@ enabled on the Git server: other paths being downloaded automatically when checking out branches. Follow [issue proposing automating sparse checkouts](https://gitlab.com/gitlab-org/git/issues/5) for updates. - ```bash + ```shell # Enable sparse checkout git config --local core.sparsecheckout true diff --git a/doc/topics/git/troubleshooting_git.md b/doc/topics/git/troubleshooting_git.md index d4d559c9483..446c2c0db4c 100644 --- a/doc/topics/git/troubleshooting_git.md +++ b/doc/topics/git/troubleshooting_git.md @@ -30,7 +30,7 @@ Example of an error during a clone: Open a terminal and enter: -```sh +```shell git config http.postBuffer 52428800 ``` @@ -78,7 +78,7 @@ ClientAliveCountMax 5 **If 'pack-objects' type errors are also being displayed**, you can try to run a `git repack` before attempting to push to the remote repository again: -```sh +```shell git repack git push ``` @@ -146,7 +146,7 @@ This can be fixed by increasing the existing `http.postBuffer` value to one grea NOTE: **Note:** The default value of `http.postBuffer`, 1 MiB, is applied if the setting is not configured. -```sh +```shell git config http.postBuffer 524288000 ``` diff --git a/doc/topics/git/useful_git_commands.md b/doc/topics/git/useful_git_commands.md index 68b4c772b8b..2cec0cd04f7 100644 --- a/doc/topics/git/useful_git_commands.md +++ b/doc/topics/git/useful_git_commands.md @@ -11,7 +11,7 @@ need to use often, but they can can come in handy when needed. ### Add another URL to a remote, so both remotes get updated on each push -```sh +```shell git remote set-url --add ``` @@ -19,7 +19,7 @@ git remote set-url --add ### Remove last commit and leave the changes in unstaged -```sh +```shell git reset --soft HEAD^ ``` @@ -27,13 +27,13 @@ git reset --soft HEAD^ To unstage 3 commits, for example, run: -```sh +```shell git reset HEAD^3 ``` ### Unstage changes to a certain file from HEAD -```sh +```shell git reset ``` @@ -46,19 +46,19 @@ There are two options to revert changes to a file: ### Undo a previous commit by creating a new replacement commit -```sh +```shell git revert ``` ### Create a new message for last commit -```sh +```shell git commit --amend ``` ### Add a file to the last commit -```sh +```shell git add git commit --amend ``` @@ -70,31 +70,31 @@ message. ### Stash changes -```sh +```shell git stash save ``` The default behavior of `stash` is to save, so you can also use just: -```sh +```shell git stash ``` ### Unstash your changes -```sh +```shell git stash apply ``` ### Discard your stashed changes -```sh +```shell git stash drop ``` ### Apply and drop your stashed changes -```sh +```shell git stash pop ``` @@ -102,7 +102,7 @@ git stash pop ### Use reflog to show the log of reference changes to HEAD -```sh +```shell git reflog ``` @@ -110,7 +110,7 @@ git reflog The basic command to check the Git history of a file: -```sh +```shell git log ``` @@ -123,25 +123,25 @@ Use '--' to separate paths from revisions, like this: Use this to check the Git history of the file: -```sh +```shell git log -- ``` ### Find the tags that contain a particular SHA -```sh +```shell git tag --contains ``` ### Check the content of each change to a file -```sh +```shell gitk ``` ### Check the content of each change to a file, follows it past file renames -```sh +```shell gitk --follow ``` @@ -149,7 +149,7 @@ gitk --follow ### Use a custom SSH key for a Git command -```sh +```shell GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlabadmin" git ``` @@ -157,13 +157,13 @@ GIT_SSH_COMMAND="ssh -i ~/.ssh/gitlabadmin" git With SSH: -```sh +```shell GIT_SSH_COMMAND="ssh -vvv" git clone ``` With HTTPS: -```sh +```shell GIT_TRACE_PACKET=1 GIT_TRACE=2 GIT_CURL_VERBOSE=1 git clone ``` @@ -181,13 +181,13 @@ Git includes a complete set of [traces for debugging Git commands](https://git-s The -i flag stands for 'interactive': -```sh +```shell git rebase -i master ``` ### Continue the rebase if paused -```sh +```shell git rebase --continue ``` @@ -195,13 +195,13 @@ git rebase --continue To _reuse_ recorded solutions to the same problems when repeated: -```sh +```shell git rerere ``` To enable `rerere` functionality: -```sh +```shell git config --global rerere.enabled true ``` diff --git a/doc/university/training/end-user/README.md b/doc/university/training/end-user/README.md index be9db9229cd..7832d89aaf5 100644 --- a/doc/university/training/end-user/README.md +++ b/doc/university/training/end-user/README.md @@ -59,7 +59,7 @@ Workshop Time! - One-time configuration of the Git client: -```bash +```shell git config --global user.name "Your Name" git config --global user.email you@example.com ``` @@ -68,7 +68,7 @@ git config --global user.email you@example.com each project - Check settings with: -```bash +```shell git config --global --list ``` @@ -81,7 +81,7 @@ git config --global --list - Create a workspace or development directory - This is where we'll be working and adding content -```bash +```shell mkdir ~/development cd ~/development @@ -210,7 +210,7 @@ git push origin squash_some_bugs ### Example 1/2 -```sh +```shell git checkout -b conflicts_branch # vi conflicts.rb @@ -231,7 +231,7 @@ git push origin master Create a merge request on the GitLab web UI. You'll see a conflict warning. -```sh +```shell git checkout conflicts_branch git fetch git rebase master @@ -261,26 +261,26 @@ git push origin conflicts_branch -f To remove files from stage use reset HEAD. Where HEAD is the last commit of the current branch: -```sh +```shell git reset HEAD ``` This will unstage the file but maintain the modifications. To revert the file back to the state it was in before the changes we can use: -```sh +```shell git checkout -- ``` To remove a file from disk and repo use `git rm` and to remove a directory use the `-r` flag: -```sh +```shell git rm '*.txt' git rm -r ``` If we want to remove a file from the repository but keep it on disk, say we forgot to add it to our .gitignore file then use `--cache`: -```sh +```shell git rm --cache ``` @@ -288,25 +288,25 @@ git rm --cache Undo last commit putting everything back into the staging area: -```sh +```shell git reset --soft HEAD^ ``` Add files and change message with: -```sh +```shell git commit --amend -m "New Message" ``` Undo last and remove changes -```sh +```shell git reset --hard HEAD^ ``` Same as last one but for two commits back: -```sh +```shell git reset --hard HEAD^^ ``` @@ -325,7 +325,7 @@ Don't reset after pushing 1. Pull for updates 1. Push changes -```sh +```shell # Change file edit_this_file.rb git status git commit -am "kjkfjkg" @@ -343,7 +343,7 @@ git push origin master Reset removes the commit while revert removes the changes but leaves the commit Revert is safer considering we can revert a revert -```sh +```shell # Changed file git commit -am "bug introduced" git revert HEAD diff --git a/doc/university/training/topics/bisect.md b/doc/university/training/topics/bisect.md index 24dc670d9d5..cb6d6e683a8 100644 --- a/doc/university/training/topics/bisect.md +++ b/doc/university/training/topics/bisect.md @@ -19,7 +19,7 @@ comments: false ## Setup -```sh +```shell mkdir bisect-ex cd bisect-ex touch index.html @@ -36,7 +36,7 @@ comments: false vi index.html ``` -```sh +```shell # Add all good 3 git add -A git commit -m "fourth commit" @@ -56,7 +56,7 @@ comments: false ## Commands -```sh +```shell git bisect start # Test your code git bisect bad diff --git a/doc/university/training/topics/cherry_picking.md b/doc/university/training/topics/cherry_picking.md index f5bcdfcbf12..47734834801 100644 --- a/doc/university/training/topics/cherry_picking.md +++ b/doc/university/training/topics/cherry_picking.md @@ -17,7 +17,7 @@ comments: false 1. Check out the 'stable' branch 1. Cherry pick the commit using the SHA obtained earlier -```bash +```shell git checkout master git checkout -b stable git checkout master diff --git a/doc/university/training/topics/env_setup.md b/doc/university/training/topics/env_setup.md index f65b4f68868..be517032a1b 100644 --- a/doc/university/training/topics/env_setup.md +++ b/doc/university/training/topics/env_setup.md @@ -15,11 +15,11 @@ comments: false - **Linux** - ```bash + ```shell sudo yum install git-all ``` - ```bash + ```shell sudo apt-get install git-all ``` @@ -27,18 +27,18 @@ comments: false One-time configuration of the Git client -```bash +```shell git config --global user.name "Your Name" git config --global user.email you@example.com ``` ## Configure SSH Key -```bash +```shell ssh-keygen -t rsa -b 4096 -C "you@computer-name" ``` -```bash +```shell # You will be prompted for the following information. Press enter to accept the defaults. Defaults appear in parentheses. Generating public/private rsa key pair. Enter file in which to save the key (/Users/you/.ssh/id_rsa): @@ -52,10 +52,10 @@ The key fingerprint is: Copy your public key and add it to your GitLab profile -```bash +```shell cat ~/.ssh/id_rsa.pub ``` -```bash +```shell ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com ``` diff --git a/doc/university/training/topics/feature_branching.md b/doc/university/training/topics/feature_branching.md index f530389d4da..e7454dbba75 100644 --- a/doc/university/training/topics/feature_branching.md +++ b/doc/university/training/topics/feature_branching.md @@ -18,7 +18,7 @@ comments: false 1. Commit 1. Push -```sh +```shell git checkout -b squash_some_bugs # Edit `bugs.rb` git status diff --git a/doc/university/training/topics/getting_started.md b/doc/university/training/topics/getting_started.md index bb197f3f1ed..fd50c5492f1 100644 --- a/doc/university/training/topics/getting_started.md +++ b/doc/university/training/topics/getting_started.md @@ -8,13 +8,13 @@ comments: false - Create a new repository by instantiating it through: - ```bash + ```shell git init ``` - Copy an existing project by cloning the repository through: - ```bash + ```shell git clone ``` @@ -24,7 +24,7 @@ comments: false - Bare repositories don't allow file editing or committing changes. - Create a bare repo with: - ```bash + ```shell git init --bare project-name.git ``` @@ -35,7 +35,7 @@ comments: false 1. Create a '`Workspace`' directory in your home directory. 1. Clone the '`training-examples`' project. -```sh +```shell mkdir ~/workspace cd ~/workspace @@ -67,7 +67,7 @@ Modified files that have been marked to go in the next commit. 1. Push the commit to the remote 1. View the Git log -```sh +```shell # Edit `edit_this_file.rb` git status git diff diff --git a/doc/university/training/topics/git_add.md b/doc/university/training/topics/git_add.md index 0c9a50bb5e1..a3389af526d 100644 --- a/doc/university/training/topics/git_add.md +++ b/doc/university/training/topics/git_add.md @@ -8,30 +8,30 @@ Adds content to the index or staging area. - Adds a list of file: - ```bash + ```shell git add ``` - Adds all files including deleted ones: - ```bash + ```shell git add -A ``` - Add all text files in current dir: - ```bash + ```shell git add *.txt ``` - Add all text file in the project: - ```bash + ```shell git add "*.txt*" ``` - Adds all files in directory: - ```bash + ```shell git add views/layouts/ ``` diff --git a/doc/university/training/topics/git_log.md b/doc/university/training/topics/git_log.md index bae734554f5..26b389beea9 100644 --- a/doc/university/training/topics/git_log.md +++ b/doc/university/training/topics/git_log.md @@ -8,31 +8,31 @@ Git log lists commit history. It allows searching and filtering. - Initiate log: - ```sh + ```shell git log ``` - Retrieve set number of records: - ```sh + ```shell git log -n 2 ``` - Search commits by author. Allows user name or a regular expression. - ```sh + ```shell git log --author="user_name" ``` - Search by comment message: - ```sh + ```shell git log --grep="" ``` - Search by date: - ```sh + ```shell git log --since=1.month.ago --until=3.weeks.ago ``` @@ -47,7 +47,7 @@ Git log lists commit history. It allows searching and filtering. ## Commands -```sh +```shell cd ~/workspace git clone git@gitlab.com:gitlab-org/gitlab-runner.git cd gitlab-runner diff --git a/doc/university/training/topics/merge_conflicts.md b/doc/university/training/topics/merge_conflicts.md index a01b3dbf3e0..e59f9e2bae8 100644 --- a/doc/university/training/topics/merge_conflicts.md +++ b/doc/university/training/topics/merge_conflicts.md @@ -22,7 +22,7 @@ comments: false 1. Force push the changes. 1. Finally continue with the Merge Request. -```sh +```shell git checkout -b conflicts_branch # vi conflicts.rb @@ -41,7 +41,7 @@ git push origin master Create a merge request on the GitLab web UI. You'll see a conflict warning. -```sh +```shell git checkout conflicts_branch git fetch git rebase master diff --git a/doc/university/training/topics/rollback_commits.md b/doc/university/training/topics/rollback_commits.md index 333b2f23a1b..616ed972ab0 100644 --- a/doc/university/training/topics/rollback_commits.md +++ b/doc/university/training/topics/rollback_commits.md @@ -8,25 +8,25 @@ comments: false - Undo last commit putting everything back into the staging area: - ```sh + ```shell git reset --soft HEAD^ ``` - Add files and change message with: - ```sh + ```shell git commit --amend -m "New Message" ``` - Undo last and remove changes: - ```sh + ```shell git reset --hard HEAD^ ``` - Same as last one but for two commits back: - ```sh + ```shell git reset --hard HEAD^^ ``` @@ -47,7 +47,7 @@ comments: false ## Commands -```sh +```shell # Change file edit_this_file.rb git status git commit -am "kjkfjkg" @@ -66,7 +66,7 @@ git push origin master - Reset removes the commit while revert removes the changes but leaves the commit - Revert is safer considering we can revert a revert -```sh +```shell # Changed file git commit -am "bug introduced" git revert HEAD diff --git a/doc/university/training/topics/stash.md b/doc/university/training/topics/stash.md index c582240d0f7..28d28382d62 100644 --- a/doc/university/training/topics/stash.md +++ b/doc/university/training/topics/stash.md @@ -9,7 +9,7 @@ and we need to change to a different branch. - Stash: - ```sh + ```shell git stash save # or git stash @@ -19,7 +19,7 @@ and we need to change to a different branch. - Apply stash to keep working on it: - ```sh + ```shell git stash apply # or apply a specific one from out stack git stash apply stash@{3} @@ -28,7 +28,7 @@ and we need to change to a different branch. - Every time we save a stash it gets stacked so by using `list` we can see all our stashes. - ```sh + ```shell git stash list # or for more information (log methods) git stash list --stat @@ -36,7 +36,7 @@ and we need to change to a different branch. - To clean our stack we need to manually remove them: - ```sh + ```shell # drop top stash git stash drop # or @@ -47,7 +47,7 @@ and we need to change to a different branch. - Apply and drop on one command: - ```sh + ```shell git stash pop ``` @@ -64,7 +64,7 @@ and we need to change to a different branch. 1. Apply with pop 1. View list to confirm changes -```sh +```shell # Modify edit_this_file.rb file git add . diff --git a/doc/university/training/topics/subtree.md b/doc/university/training/topics/subtree.md index 981918d4758..e1ee7b6a836 100644 --- a/doc/university/training/topics/subtree.md +++ b/doc/university/training/topics/subtree.md @@ -17,7 +17,7 @@ comments: false - Ex: `git config alias.sbp 'subtree pull --prefix st / git@gitlab.com:balameb/subtree-nested-example.git master --squash'`. -```sh +```shell # Add an alias # Add git config alias.sba 'subtree add --prefix st / @@ -37,7 +37,7 @@ comments: false ``` -```sh +```shell # Adding, or committing won't change the sub repo at remote # even if we push git add -A diff --git a/doc/university/training/topics/tags.md b/doc/university/training/topics/tags.md index 631b93cc384..01eb1dd9b4c 100644 --- a/doc/university/training/topics/tags.md +++ b/doc/university/training/topics/tags.md @@ -17,7 +17,7 @@ type: reference - Create an annotated tag - Push the tags to the remote repository -```sh +```shell git checkout master # Lightweight tag diff --git a/doc/university/training/topics/unstage.md b/doc/university/training/topics/unstage.md index 9a9d42221a4..b74cc9b2f0a 100644 --- a/doc/university/training/topics/unstage.md +++ b/doc/university/training/topics/unstage.md @@ -6,25 +6,25 @@ comments: false - To remove files from stage use reset HEAD where HEAD is the last commit of the current branch. This will unstage the file but maintain the modifications. - ```bash + ```shell git reset HEAD ``` - To revert the file back to the state it was in before the changes we can use: - ```bash + ```shell git checkout -- ``` - To remove a file from disk and repo use `git rm` and to remove a directory use the `-r` flag: - ```sh + ```shell git rm '*.txt' git rm -r ``` - If we want to remove a file from the repository but keep it on disk, say we forgot to add it to our `.gitignore` file then use `--cache`: - ```sh + ```shell git rm --cache ``` diff --git a/doc/university/training/user_training.md b/doc/university/training/user_training.md index 08b7635f9ce..267a8e8913b 100644 --- a/doc/university/training/user_training.md +++ b/doc/university/training/user_training.md @@ -63,18 +63,18 @@ Use the tools at your disposal when you get stuck. One-time configuration of the Git client: -```sh +```shell git config --global user.name "Your Name" git config --global user.email you@example.com ``` ## Configure SSH Key -```sh +```shell ssh-keygen -t rsa -b 4096 -C "you@computer-name" ``` -```sh +```shell # You will be prompted for the following information. Press enter to accept the defaults. Defaults appear in parentheses. Generating public/private rsa key pair. Enter file in which to save the key (/Users/you/.ssh/id_rsa): @@ -88,11 +88,11 @@ The key fingerprint is: Copy your public key and add it to your GitLab profile: -```sh +```shell cat ~/.ssh/id_rsa.pub ``` -```sh +```shell ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example.com ``` @@ -105,7 +105,7 @@ ssh-rsa AAAAB3NzaC1yc2EAAAADAQEL17Ufacg8cDhlQMS5NhV8z3GHZdhCrZbl4gz you@example. ## Commands (project) -```sh +```shell mkdir ~/development cd ~/development @@ -144,7 +144,7 @@ Modified files that have been marked to go in the next commit. ## Commands (committing) -```sh +```shell # Edit `edit_this_file.rb` git status git diff @@ -172,7 +172,7 @@ git log ## Commands (feature branching) -```sh +```shell git checkout -b squash_some_bugs # Edit `bugs.rb` git status @@ -246,7 +246,7 @@ Additional resources: . ## Commands (tags) -```sh +```shell git checkout master # Lightweight tag @@ -279,7 +279,7 @@ git push origin --tags After creating a merge request you should notice that conflicts exist. Resolve the conflicts locally by rebasing. -```sh +```shell git rebase master # Fix conflicts by editing the files. @@ -310,7 +310,7 @@ Squash these in to meaningful commits using an interactive rebase. Squash the commits on the same branch we used for the merge conflicts step. -```sh +```shell git rebase -i master ``` diff --git a/doc/update/README.md b/doc/update/README.md index 255abc7b523..9762ecffc6d 100644 --- a/doc/update/README.md +++ b/doc/update/README.md @@ -115,7 +115,7 @@ following command: **For Omnibus installations** -```bash +```shell sudo gitlab-rails runner -e production 'puts Sidekiq::Queue.new("background_migration").size' ``` diff --git a/doc/update/mysql_to_postgresql.md b/doc/update/mysql_to_postgresql.md index 7f6162cca88..08794b8a101 100644 --- a/doc/update/mysql_to_postgresql.md +++ b/doc/update/mysql_to_postgresql.md @@ -20,19 +20,19 @@ Debian/Ubuntu: 1. Search for the version: - ```bash + ```shell apt-cache madison pgloader ``` 1. If the version is 3.4.1+, install it with: - ```bash + ```shell sudo apt-get install pgloader ``` If your distribution's version is too old, use PostgreSQL's repository: - ```bash + ```shell # Add repository sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' @@ -72,7 +72,7 @@ need to enable the bundled PostgreSQL: 1. Stop GitLab: - ```bash + ```shell sudo gitlab-ctl stop ``` @@ -91,20 +91,20 @@ need to enable the bundled PostgreSQL: for the changes to take effect. 1. Start Unicorn and PostgreSQL so that we can prepare the schema: - ```bash + ```shell sudo gitlab-ctl start unicorn sudo gitlab-ctl start postgresql ``` 1. Run the following commands to prepare the schema: - ```bash + ```shell sudo gitlab-rake db:create db:migrate ``` 1. Stop Unicorn to prevent other database access from interfering with the loading of data: - ```bash + ```shell sudo gitlab-ctl stop unicorn ``` @@ -136,7 +136,7 @@ new PostgreSQL one: 1. Start the migration: - ```bash + ```shell sudo -u gitlab-psql pgloader commands.load ``` @@ -168,7 +168,7 @@ new PostgreSQL one: 1. Start GitLab: - ```bash + ```shell sudo gitlab-ctl start ``` @@ -183,13 +183,13 @@ After the database is created, go on with the following steps: 1. Stop GitLab: - ```bash + ```shell sudo service gitlab stop ``` 1. Switch database from MySQL to PostgreSQL - ```bash + ```shell cd /home/git/gitlab sudo -u git mv config/database.yml config/database.yml.bak sudo -u git cp config/database.yml.postgresql config/database.yml @@ -198,14 +198,14 @@ After the database is created, go on with the following steps: 1. Install Gems related to PostgreSQL - ```bash + ```shell sudo -u git -H rm .bundle/config sudo -u git -H bundle install --deployment --without development test mysql aws kerberos ``` 1. Run the following commands to prepare the schema: - ```bash + ```shell sudo -u git -H bundle exec rake db:create db:migrate RAILS_ENV=production ``` @@ -237,7 +237,7 @@ new PostgreSQL one: 1. Start the migration: - ```bash + ```shell sudo -u postgres pgloader commands.load ``` @@ -269,7 +269,7 @@ new PostgreSQL one: 1. Start GitLab: - ```bash + ```shell sudo service gitlab start ``` @@ -297,7 +297,7 @@ debugger invoked on a CL-POSTGRES-ERROR:INSUFFICIENT-PRIVILEGE in thread If you experience 500 errors after the migration, try to clear the cache: -```bash +```shell # Omnibus GitLab sudo gitlab-rake cache:clear diff --git a/doc/update/patch_versions.md b/doc/update/patch_versions.md index 5aa97d82fd1..ac7aee779c0 100644 --- a/doc/update/patch_versions.md +++ b/doc/update/patch_versions.md @@ -16,7 +16,7 @@ It's useful to make a backup just in case things go south. Depending on the inst ### 1. Stop server -```bash +```shell sudo service gitlab stop ``` @@ -27,7 +27,7 @@ to update to, for example `v8.0.3`. Use `git tag -l 'v*.[0-9]' --sort='v:refname to see a list of all tags. Make sure to update patch versions only (check your current version with `cat VERSION`). -```bash +```shell cd /home/git/gitlab sudo -u git -H git fetch --all @@ -37,7 +37,7 @@ sudo -u git -H git checkout LATEST_TAG -b LATEST_TAG ### 3. Install libs, migrations, etc -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle install --without development test mysql --deployment @@ -60,7 +60,7 @@ sudo -u git -H bundle exec rake yarn:install gitlab:assets:clean gitlab:assets:c ### 4. Update GitLab Workhorse to the corresponding version -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workhorse]" RAILS_ENV=production @@ -68,7 +68,7 @@ sudo -u git -H bundle exec rake "gitlab:workhorse:install[/home/git/gitlab-workh ### 5. Update Gitaly to the corresponding version -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/git/repositories]" RAILS_ENV=production @@ -76,7 +76,7 @@ sudo -u git -H bundle exec rake "gitlab:gitaly:install[/home/git/gitaly,/home/gi ### 6. Update GitLab Shell to the corresponding version -```bash +```shell cd /home/git/gitlab-shell sudo -u git -H git fetch --all --tags @@ -86,7 +86,7 @@ sudo -u git -H make build ### 7. Update GitLab Pages to the corresponding version (skip if not using pages) -```bash +```shell cd /home/git/gitlab-pages sudo -u git -H git fetch --all --tags @@ -100,7 +100,7 @@ Please follow the [install instruction](../integration/elasticsearch.md#installa ### 9. Start application -```bash +```shell sudo service gitlab start sudo service nginx restart ``` @@ -109,7 +109,7 @@ sudo service nginx restart Check if GitLab and its environment are configured correctly: -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production @@ -117,7 +117,7 @@ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production To make sure you didn't miss anything run a more thorough check with: -```bash +```shell sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` diff --git a/doc/update/upgrading_from_ce_to_ee.md b/doc/update/upgrading_from_ce_to_ee.md index d1853466e30..5c395ddba70 100644 --- a/doc/update/upgrading_from_ce_to_ee.md +++ b/doc/update/upgrading_from_ce_to_ee.md @@ -32,7 +32,7 @@ use the following branches: Make a backup just in case something goes wrong: -```sh +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ``` @@ -42,13 +42,13 @@ privileges to the GitLab user on the database version. ### 1. Stop server -```sh +```shell sudo service gitlab stop ``` ### 2. Get the EE code -```sh +```shell cd /home/git/gitlab sudo -u git -H git remote add -f ee https://gitlab.com/gitlab-org/gitlab.git sudo -u git -H git checkout EE_BRANCH @@ -56,7 +56,7 @@ sudo -u git -H git checkout EE_BRANCH ### 3. Install libs, migrations, etc -```sh +```shell cd /home/git/gitlab sudo -u git -H bundle install --deployment --without development test mysql aws kerberos @@ -83,7 +83,7 @@ Please follow the [install instruction](../integration/elasticsearch.md#installa ### 5. Start application -```sh +```shell sudo service gitlab start sudo service nginx restart ``` @@ -92,13 +92,13 @@ sudo service nginx restart Check if GitLab and its environment are configured correctly: -```sh +```shell sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production ``` To make sure you didn't miss anything run a more thorough check with: -```sh +```shell sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production ``` @@ -108,14 +108,14 @@ If all items are green, then congratulations upgrade complete! ### 1. Revert the code to the previous version -```sh +```shell cd /home/git/gitlab sudo -u git -H git checkout CE_BRANCH ``` ### 2. Restore from the backup -```sh +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production ``` diff --git a/doc/update/upgrading_from_source.md b/doc/update/upgrading_from_source.md index 48f8052cbb8..661f3eef832 100644 --- a/doc/update/upgrading_from_source.md +++ b/doc/update/upgrading_from_source.md @@ -44,7 +44,7 @@ specific guidelines (should there be any) are covered separately. NOTE: If you installed GitLab from source, make sure `rsync` is installed. -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production @@ -52,7 +52,7 @@ sudo -u git -H bundle exec rake gitlab:backup:create RAILS_ENV=production ### 2. Stop server -```bash +```shell sudo service gitlab stop ``` @@ -65,7 +65,7 @@ You can check which version you are running with `ruby -v`. Download Ruby and compile it: -```bash +```shell mkdir /tmp/ruby && cd /tmp/ruby curl --remote-name --progress https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.gz echo '1416ce288fb8bfeae07a12b608540318c9cace71 ruby-2.6.5.tar.gz' | shasum -c - && tar xzf ruby-2.6.5.tar.gz @@ -78,7 +78,7 @@ sudo make install Install Bundler: -```bash +```shell sudo gem install bundler --no-document --version '< 2' ``` @@ -91,7 +91,7 @@ dependencies. In Debian or Ubuntu: -```bash +```shell curl --silent --show-error https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list sudo apt-get update @@ -108,7 +108,7 @@ You can check which version you are running with `go version`. Download and install Go (for Linux, 64-bit): -```bash +```shell # Remove former Go installation folder sudo rm -rf /usr/local/go @@ -126,7 +126,7 @@ NOTE: To check the minimum required Git version, see [Git versions](../install/r In Debian or Ubuntu: -```bash +```shell # Make sure Git is version 2.21.0 or higher git --version @@ -161,7 +161,7 @@ sudo make prefix=/usr/local install ### 7. Get latest code -```bash +```shell cd /home/git/gitlab sudo -u git -H git fetch --all --prune @@ -171,7 +171,7 @@ sudo -u git -H git checkout -- locale For GitLab Community Edition: -```bash +```shell cd /home/git/gitlab sudo -u git -H git checkout BRANCH @@ -181,7 +181,7 @@ OR For GitLab Enterprise Edition: -```bash +```shell cd /home/git/gitlab sudo -u git -H git checkout BRANCH-ee @@ -189,7 +189,7 @@ sudo -u git -H git checkout BRANCH-ee ### 8. Update GitLab Shell -```bash +```shell cd /home/git/gitlab-shell sudo -u git -H git fetch --all --tags --prune @@ -204,7 +204,7 @@ Install and compile GitLab Workhorse. GitLab Workhorse uses If you are not using Linux you may have to run `gmake` instead of `make` below. -```bash +```shell cd /home/git/gitlab-workhorse sudo -u git -H git fetch --all --tags --prune @@ -232,7 +232,7 @@ Install and compile GitLab Pages. GitLab Pages uses If you are not using Linux you may have to run `gmake` instead of `make` below. -```bash +```shell cd /home/git/gitlab-pages sudo -u git -H git fetch --all --tags --prune @@ -247,7 +247,7 @@ sudo -u git -H make There might be configuration options available for [`gitlab.yml`](https://gitlab.com/gitlab-org/gitlab/blob/master/config/gitlab.yml.example)). View them with the command below and apply them manually to your current `gitlab.yml`: -```sh +```shell cd /home/git/gitlab git diff origin/PREVIOUS_BRANCH:config/gitlab.yml.example origin/BRANCH:config/gitlab.yml.example @@ -257,7 +257,7 @@ git diff origin/PREVIOUS_BRANCH:config/gitlab.yml.example origin/BRANCH:config/g Ensure you're still up-to-date with the latest NGINX configuration changes: -```sh +```shell cd /home/git/gitlab # For HTTPS configurations @@ -293,7 +293,7 @@ There might be new configuration options available for [`gitlab.default.example`](https://gitlab.com/gitlab-org/gitlab/blob/master/lib/support/init.d/gitlab.default.example). View them with the command below and apply them manually to your current `/etc/default/gitlab`: -```sh +```shell cd /home/git/gitlab git diff origin/PREVIOUS_BRANCH:lib/support/init.d/gitlab.default.example origin/BRANCH:lib/support/init.d/gitlab.default.example @@ -301,7 +301,7 @@ git diff origin/PREVIOUS_BRANCH:lib/support/init.d/gitlab.default.example origin Ensure you're still up-to-date with the latest init script changes: -```bash +```shell cd /home/git/gitlab sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab @@ -309,13 +309,13 @@ sudo cp lib/support/init.d/gitlab /etc/init.d/gitlab For Ubuntu 16.04.1 LTS: -```bash +```shell sudo systemctl daemon-reload ``` ### 13. Install libs, migrations, etc -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle install --deployment --without development test mysql aws kerberos @@ -339,7 +339,7 @@ sudo -u git -H bundle exec rake cache:clear RAILS_ENV=production ### 14. Start application -```bash +```shell sudo service gitlab start sudo service nginx restart ``` @@ -348,7 +348,7 @@ sudo service nginx restart Check if GitLab and its environment are configured correctly: -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production @@ -356,7 +356,7 @@ sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production To make sure you didn't miss anything run a more thorough check: -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production @@ -394,7 +394,7 @@ backup has already been migrated to the previous version. ### 2. Restore from the backup -```bash +```shell cd /home/git/gitlab sudo -u git -H bundle exec rake gitlab:backup:restore RAILS_ENV=production diff --git a/doc/user/admin_area/license.md b/doc/user/admin_area/license.md index c9d8a457a51..fd74b2f311f 100644 --- a/doc/user/admin_area/license.md +++ b/doc/user/admin_area/license.md @@ -57,7 +57,7 @@ It is also possible to specify a custom location and filename for the license. Source installations should set the `GITLAB_LICENSE_FILE` environment variable with the path to a valid GitLab Enterprise Edition license. -```sh +```shell export GITLAB_LICENSE_FILE="/path/to/license/file" ``` diff --git a/doc/user/admin_area/monitoring/health_check.md b/doc/user/admin_area/monitoring/health_check.md index fe38c350f19..b0ad08e3b37 100644 --- a/doc/user/admin_area/monitoring/health_check.md +++ b/doc/user/admin_area/monitoring/health_check.md @@ -51,7 +51,7 @@ GET /-/health Example request: -```sh +```shell curl 'https://gitlab.example.com/-/health' ``` @@ -78,7 +78,7 @@ GET /-/readiness?all=1 Example request: -```sh +```shell curl 'https://gitlab.example.com/-/readiness' ``` @@ -117,7 +117,7 @@ GET /-/liveness Example request: -```sh +```shell curl 'https://gitlab.example.com/-/liveness' ``` diff --git a/doc/user/clusters/applications.md b/doc/user/clusters/applications.md index c502cd607d7..e8ef3c59b22 100644 --- a/doc/user/clusters/applications.md +++ b/doc/user/clusters/applications.md @@ -196,25 +196,25 @@ rules that allow external access to your deployed applications. If you installed Ingress via the **Applications**, run the following command: -```bash +```shell kubectl get service --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].ip}' ``` Some Kubernetes clusters return a hostname instead, like [Amazon EKS](https://aws.amazon.com/eks/). For these platforms, run: -```bash +```shell kubectl get service --namespace=gitlab-managed-apps ingress-nginx-ingress-controller -o jsonpath='{.status.loadBalancer.ingress[0].hostname}' ``` For Istio/Knative, the command will be different: -```bash +```shell kubectl get svc --namespace=istio-system knative-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip} ' ``` Otherwise, you can list the IP addresses of all load balancers: -```bash +```shell kubectl get svc --all-namespaces -o jsonpath='{range.items[?(@.status.loadBalancer.ingress)]}{.status.loadBalancer.ingress[*].ip} ' ``` @@ -264,7 +264,7 @@ This feature: - Is viewable by checking your Ingress controller's `modsec` log for rule violations. For example: - ```sh + ```shell kubectl logs -n gitlab-managed-apps $(kubectl get pod -n gitlab-managed-apps -l app=nginx-ingress,component=controller --no-headers=true -o custom-columns=:metadata.name) modsecurity-log -f ``` @@ -698,7 +698,7 @@ information. By default, the drop log for traffic is logged out by the `cilium-monitor` sidecar container. You can check these logs via: -```bash +```shell kubectl -n gitlab-managed-apps logs cilium-XXXX cilium-monitor ``` @@ -784,7 +784,7 @@ To avoid installation errors: You can confirm that the certificates match via `kubectl`: - ```sh + ```shell kubectl get configmaps/values-content-configuration-ingress -n gitlab-managed-apps -o \ "jsonpath={.data['cert\.pem']}" | base64 -d > a.pem kubectl get secrets/tiller-secret -n gitlab-managed-apps -o "jsonpath={.data['ca\.crt']}" | base64 -d > b.pem diff --git a/doc/user/group/saml_sso/scim_setup.md b/doc/user/group/saml_sso/scim_setup.md index fe64afd23f6..c47b9bd25ef 100644 --- a/doc/user/group/saml_sso/scim_setup.md +++ b/doc/user/group/saml_sso/scim_setup.md @@ -189,7 +189,7 @@ Alternatively, the [SCIM API](../../../api/scim.md#get-a-list-of-saml-users) can For example: -```sh +```shell curl 'https://example.gitlab.com/api/scim/v2/groups/GROUP_NAME/Users?startIndex=1"' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` @@ -207,7 +207,7 @@ The [SCIM API](../../../api/scim.md#update-a-single-saml-user) can be used to ma It is then possible to issue a manual SCIM#update request, for example: -```sh +```shell curl --verbose --request PATCH 'https://gitlab.com/api/scim/v2/groups/YOUR_GROUP/Users/OLD_EXTERNAL_UID' --data '{ "Operations": [{"op":"Replace","path":"externalId","value":"NEW_EXTERNAL_UID"}] }' --header "Authorization: Bearer " --header "Content-Type: application/scim+json" ``` diff --git a/doc/user/packages/conan_repository/index.md b/doc/user/packages/conan_repository/index.md index e9f86ebf4b2..2abfd08a5dd 100644 --- a/doc/user/packages/conan_repository/index.md +++ b/doc/user/packages/conan_repository/index.md @@ -33,7 +33,7 @@ Follow the instructions at [conan.io](https://conan.io/downloads.html) to downlo Once installation is complete, verify you can use Conan in your terminal by running -```sh +```shell conan --version ``` @@ -48,7 +48,7 @@ Conan version 1.20.5 When developing with C++ and Conan, you have a wide range of options for compilers. This tutorial walks through using the cmake compiler. In your terminal, run the command -```sh +```shell cmake --version ``` @@ -69,13 +69,13 @@ Clone the repo and it can be used for the rest of the tutorial if you don't have In your terminal, navigate to the root folder of your project. Generate a new recipe by running `conan new` and providing it with a package name and version: -```sh +```shell conan new Hello/0.1 -t ``` Next, you will create a package for that recipe by running `conan create` providing the Conan user and channel: -```sh +```shell conan create . my-org+my-group+my-project/beta ``` @@ -94,7 +94,7 @@ You are now ready to upload your package to the GitLab registry. To get started, Add a new remote to your Conan configuration: -```sh +```shell conan remote add gitlab https://gitlab.example.com/api/v4/packages/conan ``` @@ -102,7 +102,7 @@ Once the remote is set, you can use the remote when running Conan commands by ad For example: -```sh +```shell conan search Hello* --all --remote=gitlab ``` @@ -114,7 +114,7 @@ You will need to generate a [personal access token](../../../user/profile/person Once you have a personal access token and have [set your Conan remote](#adding-the-gitlab-package-registry-as-a-conan-remote), you can associate the token with the remote so you do not have to explicitly add them to each Conan command you run: -```sh +```shell conan user -r gitlab -p ``` @@ -129,7 +129,7 @@ The personal access token is not stored locally at any moment. Conan uses JWT, s Alternatively, you could explicitly include your credentials in any given command. For example: -```sh +```shell CONAN_LOGIN_USERNAME= CONAN_PASSWORD= conan upload Hello/0.1@my-group+my-project/beta --all --remote=gitlab ``` @@ -137,7 +137,7 @@ CONAN_LOGIN_USERNAME= CONAN_PASSWORD= co If you'd like Conan to always use GitLab as the registry for your package, you can tell Conan to always reference the GitLab remote for a given package recipe: -```sh +```shell conan remote add_ref Hello/0.1@my-group+my-project/beta gitlab ``` @@ -147,7 +147,7 @@ This functionality is best suited for when you want to consume or install packag The rest of the example commands in this documentation assume that you have added a Conan user with your credentials to the `gitlab` remote and will not include the explicit credentials or remote option, but be aware that any of the commands could be run without having added a user or default remote: -```sh +```shell `CONAN_LOGIN_USERNAME= CONAN_PASSWORD= --remote=gitlab ``` @@ -159,7 +159,7 @@ Ensure you have a project created on GitLab and that the personal access token y You can upload your package to the GitLab Package Registry using the `conan upload` command: -```sh +```shell conan upload Hello/0.1@my-group+my-project/beta --all ``` @@ -200,13 +200,13 @@ Add the Conan recipe to the `[requires]` section of the file: Next, from the root of your project, create a build directory and navigate to it: -```sh +```shell mkdir build && cd build ``` Now you can install the dependencies listed in `conanfile.txt`: -```sh +```shell conan install .. ``` @@ -220,7 +220,7 @@ There are two ways to remove a Conan package from the GitLab Package Registry. - **Using the Conan client in the command line:** - ```sh + ```shell conan remove Hello/0.2@user/channel --remote=gitlab ``` @@ -238,7 +238,7 @@ The `conan search` command can be run searching by full or partial package name, To search using a partial name, use the wildcard symbol `*`, which should be placed at the end of your search (e.g., `my-packa*`): -```sh +```shell conan search Hello --all --remote=gitlab conan search He* --all --remote=gitlab conan search Hello/0.1@my-group+my-project/beta --all --remote=gitlab @@ -250,7 +250,7 @@ The scope of your search will include all projects you have permission to access The `conan info` command will return info about a given package: -```sh +```shell conan info Hello/0.1@my-group+my-project/beta ``` diff --git a/doc/user/packages/container_registry/index.md b/doc/user/packages/container_registry/index.md index b10430633ff..c9e60d1497f 100644 --- a/doc/user/packages/container_registry/index.md +++ b/doc/user/packages/container_registry/index.md @@ -60,7 +60,7 @@ using your GitLab credentials. For example if the Registry's URL is `registry.example.com`, then you should be able to login with: -```sh +```shell docker login registry.example.com ``` @@ -68,7 +68,7 @@ Building and publishing images should be a straightforward process. Just make sure that you are using the Registry URL with the namespace and project name that is hosted on GitLab: -```sh +```shell docker build -t registry.example.com/group/project/image . docker push registry.example.com/group/project/image ``` @@ -94,7 +94,7 @@ registry.example.com/group/project/my/image:rc1 To download and run a container from images hosted in GitLab Container Registry, use `docker run`: -```sh +```shell docker run [options] registry.example.com/group/project/image [arguments] ``` @@ -134,7 +134,7 @@ The minimal scope needed for both of them is `read_registry`. Example of using a token: -```sh +```shell docker login registry.example.com -u -p ``` @@ -153,13 +153,13 @@ Examples: - Select all tags, keep at least 1 tag per image, expire any tag older than 14 days, run once a month, and the policy is enabled: - ```bash + ```shell curl --request PUT --header 'Content-Type: application/json;charset=UTF-8' --header "PRIVATE-TOKEN: " --data-binary '{"container_expiration_policy_attributes":{"cadence":"1month","enabled":true,"keep_n":1,"older_than":"14d","name_regex":".*"}' 'https://gitlab.example.com/api/v4/projects/2' ``` - Select only tags with a name that contains `stable`, keep at least 50 tag per image, expire any tag older than 7 days, run every day, and the policy is enabled: - ```bash + ```shell curl --request PUT --header 'Content-Type: application/json;charset=UTF-8' --header "PRIVATE-TOKEN: " --data-binary '{"container_expiration_policy_attributes":{"cadence":"1day","enabled":true,"keep_n":50"older_than":"7d","name_regex":"*stable"}' 'https://gitlab.example.com/api/v4/projects/2' ``` diff --git a/doc/user/packages/dependency_proxy/index.md b/doc/user/packages/dependency_proxy/index.md index 1cebd734a99..7e15df7b433 100644 --- a/doc/user/packages/dependency_proxy/index.md +++ b/doc/user/packages/dependency_proxy/index.md @@ -41,19 +41,19 @@ To get a Docker image into the dependency proxy: - Manually pulling the Docker image: - ```bash + ```shell docker pull gitlab.com/groupname/dependency_proxy/containers/alpine:latest ``` - From a `Dockerfile`: - ```bash + ```shell FROM gitlab.com/groupname/dependency_proxy/containers/alpine:latest ``` - In [`.gitlab-ci.yml`](../../../ci/yaml/README.md#image): - ```bash + ```shell image: gitlab.com/groupname/dependency_proxy/containers/alpine:latest ``` diff --git a/doc/user/packages/maven_repository/index.md b/doc/user/packages/maven_repository/index.md index ea052703416..f65042d2684 100644 --- a/doc/user/packages/maven_repository/index.md +++ b/doc/user/packages/maven_repository/index.md @@ -261,7 +261,7 @@ Once you have set up the [authentication](#authenticating-to-the-gitlab-maven-re and [configuration](#configuring-your-project-to-use-the-gitlab-maven-repository-url), test to upload a Maven artifact from a project of yours: -```sh +```shell mvn deploy ``` diff --git a/doc/user/packages/npm_registry/index.md b/doc/user/packages/npm_registry/index.md index a0c82fd3e3c..58b4bf6a710 100644 --- a/doc/user/packages/npm_registry/index.md +++ b/doc/user/packages/npm_registry/index.md @@ -43,7 +43,7 @@ NPM to your local development environment. Once installation is complete, verify you can use NPM in your terminal by running: -```sh +```shell npm --version ``` @@ -61,7 +61,7 @@ your development environment. Once installed, you can verify that Yarn is available with the following command: -```sh +```shell yarn --version ``` @@ -77,13 +77,13 @@ Understanding how to create a full JavaScript project is outside the scope of this guide but you can initialize a new empty package by creating and navigating to an empty directory and using the following command: -```sh +```shell npm init ``` Or if you're using Yarn: -```sh +```shell yarn init ``` @@ -110,7 +110,7 @@ If you have 2FA enabled, you need to use a [personal access token](../../profile To authenticate with a [personal access token](../../profile/personal_access_tokens.md), set your NPM configuration: -```bash +```shell # Set URL for your scoped packages. # For example package with name `@foo/bar` will use this URL for download npm config set @foo:registry https://gitlab.com/api/v4/packages/npm/ @@ -140,7 +140,7 @@ If you encounter an error message with [Yarn](https://yarnpkg.com/en/), see the To avoid hard-coding the `authToken` value, you may use a variables in its place: -```bash +```shell npm config set '//gitlab.com/api/v4/projects//packages/npm/:_authToken' "${NPM_TOKEN}" npm config set '//gitlab.com/api/v4/packages/npm/:_authToken' "${NPM_TOKEN}" ``` @@ -149,7 +149,7 @@ Then, you could run `npm publish` either locally or via GitLab CI/CD: - **Locally:** Export `NPM_TOKEN` before publishing: - ```sh + ```shell NPM_TOKEN= npm publish ``` @@ -191,7 +191,7 @@ domain name. Once you have enabled it and set up [authentication](#authenticating-to-the-gitlab-npm-registry), you can upload an NPM package to your project: -```sh +```shell npm publish ``` @@ -248,7 +248,7 @@ NPM packages are commonly installed using the the `npm` or `yarn` commands inside a JavaScript project. If you haven't already, you will need to set the URL for scoped packages. You can do this with the following command: -```sh +```shell npm config set @foo:registry https://gitlab.com/api/v4/packages/npm/ ``` @@ -259,13 +259,13 @@ is setup so you can successfully install the package. Once this has been completed, you can run the following command inside your project to install a package: -```sh +```shell npm install @my-project-scope/my-package ``` Or if you're using Yarn: -```sh +```shell yarn add @my-project-scope/my-package ``` @@ -302,7 +302,7 @@ deploy: If you are using [yarn](https://yarnpkg.com/en/) with the NPM registry, you may get an error message like: -```sh +```shell yarn install v1.15.2 warning package.json: No license field info No lockfile found. @@ -351,7 +351,7 @@ And the `.npmrc` file should look like: You do not need a token to run `npm install` unless your project is private (the token is only required to publish). If the `.npmrc` file was checked in with a reference to `$NPM_TOKEN`, you can remove it. If you prefer to leave the reference in, you'll need to set a value prior to running `npm install` or set the value using [GitLab environment variables](./../../../ci/variables/README.md): -```bash +```shell NPM_TOKEN= npm install ``` @@ -384,7 +384,7 @@ a package without specifying the tag or version. Examples of the supported `dist-tag` commands and using tags in general: -```sh +```shell npm publish @scope/package --tag # Publish new package with new tag npm dist-tag add @scope/package@version my-tag # Add a tag to an existing package npm dist-tag ls @scope/package # List all tags under the package diff --git a/doc/user/packages/nuget_repository/index.md b/doc/user/packages/nuget_repository/index.md index 212641222f8..d32683e1d40 100644 --- a/doc/user/packages/nuget_repository/index.md +++ b/doc/user/packages/nuget_repository/index.md @@ -17,7 +17,7 @@ If you have [Visual Studio](https://visualstudio.microsoft.com/vs/), [nuget CLI] You can confirm that [nuget CLI](https://www.nuget.org/) is properly installed with: -```sh +```shell nuget help ``` @@ -63,7 +63,7 @@ You can now add a new source to nuget either using [nuget CLI](https://www.nuget To add the GitLab NuGet Repository as a source with `nuget`: -```sh +```shell nuget source Add -Name -Source "https://example.gitlab.com/api/v4/projects//packages/nuget/index.json" -UserName -Password ``` @@ -77,7 +77,7 @@ Replace: For example: -```sh +```shell nuget source Add -Name "GitLab" -Source "https//gitlab.example/api/v4/projects/10/packages/nuget/index.json" -UserName carol -Password 12345678asdf ``` diff --git a/doc/user/packages/workflows/monorepo.md b/doc/user/packages/workflows/monorepo.md index 9f281d2b31c..0c7fb4a1a20 100644 --- a/doc/user/packages/workflows/monorepo.md +++ b/doc/user/packages/workflows/monorepo.md @@ -76,7 +76,7 @@ Using the example project above, this `gitlab-ci.yml` file will publish and publish `MyPackage` anytime changes are made to anywhere _except_ the `Foo` directory on the `master` branch. -```sh +```shell stages: - build diff --git a/doc/user/packages/workflows/project_registry.md b/doc/user/packages/workflows/project_registry.md index d8c1c7c2861..df330931ac5 100644 --- a/doc/user/packages/workflows/project_registry.md +++ b/doc/user/packages/workflows/project_registry.md @@ -80,6 +80,6 @@ if your project is located at `https://gitlab.com/foo/bar/my-proj`, then you can using `conan create . foo+bar+my-proj/channel`, where `channel` is your package channel (`stable`, `beta`, etc.). Once your package is created, you are ready to [upload your package](../conan_repository/index.md#uploading-a-package) depending on your final package recipe. For example: -```sh +```shell CONAN_LOGIN_USERNAME= CONAN_PASSWORD= conan upload MyPackage/1.0.0@foo+bar+my-proj/channel --all --remote=gitlab ``` diff --git a/doc/user/profile/account/two_factor_authentication.md b/doc/user/profile/account/two_factor_authentication.md index 108d4f0b387..ab701337c2a 100644 --- a/doc/user/profile/account/two_factor_authentication.md +++ b/doc/user/profile/account/two_factor_authentication.md @@ -181,14 +181,14 @@ a new set of recovery codes with SSH: 1. Run: - ```sh + ```shell ssh git@gitlab.example.com 2fa_recovery_codes ``` 1. You will then be prompted to confirm that you want to generate new codes. Continuing this process invalidates previously saved codes: - ```sh + ```shell Are you sure you want to generate new two-factor recovery codes? Any existing recovery codes you saved will be invalidated. (yes/no) diff --git a/doc/user/profile/index.md b/doc/user/profile/index.md index 06e4eac6623..dc6c744ff3c 100644 --- a/doc/user/profile/index.md +++ b/doc/user/profile/index.md @@ -209,7 +209,7 @@ Once this option is enabled, every Git-related action will be performed using th To stay fully anonymous, you can also copy this private commit email and configure it on your local machine using the following command: -```sh +```shell git config --global user.email ``` diff --git a/doc/user/project/clusters/add_remove_clusters.md b/doc/user/project/clusters/add_remove_clusters.md index 7aeb4c4cf91..ef491a1971d 100644 --- a/doc/user/project/clusters/add_remove_clusters.md +++ b/doc/user/project/clusters/add_remove_clusters.md @@ -393,7 +393,7 @@ To add a Kubernetes cluster to your project, group, or instance: Get the API URL by running this command: - ```sh + ```shell kubectl cluster-info | grep 'Kubernetes master' | awk '/http/ {print $NF}' ``` @@ -402,7 +402,7 @@ To add a Kubernetes cluster to your project, group, or instance: `default-token-xxxxx`. Copy that token name for use below. - Get the certificate by running this command: - ```sh + ```shell kubectl get secret -o jsonpath="{['data']['ca\.crt']}" | base64 --decode @@ -444,7 +444,7 @@ To add a Kubernetes cluster to your project, group, or instance: 1. Apply the service account and cluster role binding to your cluster: - ```bash + ```shell kubectl apply -f gitlab-admin-service-account.yaml ``` @@ -453,7 +453,7 @@ To add a Kubernetes cluster to your project, group, or instance: you can alternatively enable Basic Authentication and then run the `kubectl apply` command as an admin: - ```bash + ```shell kubectl apply -f gitlab-admin-service-account.yaml --username=admin --password= ``` @@ -463,14 +463,14 @@ To add a Kubernetes cluster to your project, group, or instance: Output: - ```bash + ```shell serviceaccount "gitlab-admin" created clusterrolebinding "gitlab-admin" created ``` 1. Retrieve the token for the `gitlab-admin` service account: - ```bash + ```shell kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep gitlab-admin | awk '{print $1}') ``` @@ -530,7 +530,7 @@ To add an existing EKS cluster to your project, group, or instance: `default-token-xxxxx`. Copy that token name for use below. 1. Get the certificate with: - ```sh + ```shell kubectl get secret -o jsonpath="{['data']['ca\.crt']}" | base64 --decode ``` @@ -582,7 +582,7 @@ To add an existing EKS cluster to your project, group, or instance: 1. Retrieve the token for the `eks-admin` service account: - ```bash + ```shell kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep eks-admin | awk '{print $1}') ``` @@ -643,7 +643,7 @@ or user who can authenticate to the cluster, has full API access. This is a To effectively disable RBAC, global permissions can be applied granting full access: -```bash +```shell kubectl create clusterrolebinding permissive-binding \ --clusterrole=cluster-admin \ --user=admin \ diff --git a/doc/user/project/clusters/serverless/aws.md b/doc/user/project/clusters/serverless/aws.md index 94b07af0985..afe48f8c7f4 100644 --- a/doc/user/project/clusters/serverless/aws.md +++ b/doc/user/project/clusters/serverless/aws.md @@ -149,7 +149,7 @@ Running the following `curl` command should trigger your function. NOTE: **Note:** Your url should be the one retrieved from the GitLab deploy stage log. -```sh +```shell curl https://u768nzby1j.execute-api.us-east-1.amazonaws.com/production/hello ``` @@ -192,7 +192,7 @@ The `serverless-offline` plugin allows to run your code locally. To run your cod Running the following `curl` command should trigger your function. -```sh +```shell curl http://localhost:3000/hello ``` diff --git a/doc/user/project/clusters/serverless/index.md b/doc/user/project/clusters/serverless/index.md index 9b56970db53..7935a88f3ad 100644 --- a/doc/user/project/clusters/serverless/index.md +++ b/doc/user/project/clusters/serverless/index.md @@ -159,7 +159,7 @@ You must do the following: Then run the following command: - ```bash + ```shell kubectl apply -f knative-serving-only-role.yaml ``` @@ -362,7 +362,7 @@ Kubernetes cluster. Click on each function to obtain detailed scale and invocati The function details can be retrieved directly from Knative on the cluster: -```bash +```shell kubectl -n "$KUBE_NAMESPACE" get services.serving.knative.dev ``` @@ -370,7 +370,7 @@ The sample function can now be triggered from any HTTP client using a simple `PO 1. Using curl (replace the URL on the last line with the URL of your application): - ```bash + ```shell curl \ --header "Content-Type: application/json" \ --request POST \ @@ -388,7 +388,7 @@ To access your Kubernetes secrets from within your function, the secrets should #### CLI example -```bash +```shell kubectl create secret generic my-secrets -n "$KUBE_NAMESPACE" --from-literal MY_SECRET=imverysecure ``` @@ -491,7 +491,7 @@ Go to the **CI/CD > Pipelines** and click on the pipeline that deployed your app The output will look like this: -```bash +```shell Running with gitlab-runner 12.1.0-rc1 (6da35412) on prm-com-gitlab-org ae3bfce3 Using Docker executor with image registry.gitlab.com/gitlab-org/gitlabktl:latest ... @@ -594,7 +594,7 @@ The instructions below relate to installing and running Certbot on a Linux serve [`certbot-auto` wrapper script](https://certbot.eff.org/docs/install.html#certbot-auto). On the command line of your server, run the following commands: - ```sh + ```shell wget https://dl.eff.org/certbot-auto sudo mv certbot-auto /usr/local/bin/certbot-auto sudo chown root /usr/local/bin/certbot-auto @@ -604,7 +604,7 @@ The instructions below relate to installing and running Certbot on a Linux serve To check the integrity of the `certbot-auto` script, run: - ```sh + ```shell wget -N https://dl.eff.org/certbot-auto.asc gpg2 --keyserver ipv4.pool.sks-keyservers.net --recv-key A2CFB51FA275A7286234E7B24D17C995CD9775F2 gpg2 --trusted-key 4D17C995CD9775F2 --verify certbot-auto.asc /usr/local/bin/certbot-auto @@ -612,7 +612,7 @@ The instructions below relate to installing and running Certbot on a Linux serve The output of the last command should look something like: - ```sh + ```shell gpg: Signature made Mon 10 Jun 2019 06:24:40 PM EDT gpg: using RSA key A2CFB51FA275A7286234E7B24D17C995CD9775F2 gpg: key 4D17C995CD9775F2 marked as ultimately trusted @@ -626,7 +626,7 @@ The instructions below relate to installing and running Certbot on a Linux serve 1. Run the following command to use Certbot to request a certificate using DNS challenge during authorization: - ```sh + ```shell ./certbot-auto certonly --manual --preferred-challenges dns -d '*..example.com' ``` @@ -640,14 +640,14 @@ The instructions below relate to installing and running Certbot on a Linux serve In the above image, the namespace for the project is `node-function-11909507` and the domain is `knative.info`, thus certificate request line would look like this: - ```sh + ```shell ./certbot-auto certonly --manual --preferred-challenges dns -d '*.node-function-11909507.knative.info' ``` The Certbot tool walks you through the steps of validating that you own each domain that you specify by creating TXT records in those domains. After this process is complete, the output should look something like this: - ```sh + ```shell IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/namespace.example.com/fullchain.pem @@ -671,13 +671,13 @@ The instructions below relate to installing and running Certbot on a Linux serve Run the following command to see the contents of `fullchain.pem`: - ```sh + ```shell sudo cat /etc/letsencrypt/live/node-function-11909507.knative.info/fullchain.pem ``` Output should look like this: - ```sh + ```shell -----BEGIN CERTIFICATE----- 2fcb195768c39e9a94cec2c2e32c59c0aad7a3365c10892e8116b5d83d4096b6 04f294d1eaca42b8692017b426d53bbc8fe75f827734f0260710b83a556082df @@ -743,13 +743,13 @@ The instructions below relate to installing and running Certbot on a Linux serve Once `cert.pem` is created, run the following command to see the contents of `privkey.pem`: - ```sh + ```shell sudo cat /etc/letsencrypt/live/namespace.example/privkey.pem ``` Output should look like this: - ```sh + ```shell -----BEGIN PRIVATE KEY----- 2fcb195768c39e9a94cec2c2e32c59c0aad7a3365c10892e8116b5d83d4096b6 04f294d1eaca42b8692017b426d53bbc8fe75f827734f0260710b83a556082df @@ -792,7 +792,7 @@ The instructions below relate to installing and running Certbot on a Linux serve [GKE Cluster Access](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl). For other platforms, [install `kubectl`](https://kubernetes.io/docs/tasks/tools/install-kubectl/). - ```sh + ```shell kubectl create --namespace istio-system secret tls istio-ingressgateway-certs \ --key cert.pk \ --cert cert.pem @@ -804,13 +804,13 @@ The instructions below relate to installing and running Certbot on a Linux serve connections. Run the following command to open the Knative shared `gateway` in edit mode: - ```sh + ```shell kubectl edit gateway knative-ingress-gateway --namespace knative-serving ``` Update the gateway to include the following tls: section and configuration: - ```sh + ```shell tls: mode: SIMPLE privateKey: /etc/istio/ingressgateway-certs/tls.key @@ -819,7 +819,7 @@ The instructions below relate to installing and running Certbot on a Linux serve Example: - ```sh + ```shell apiVersion: networking.istio.io/v1alpha3 kind: Gateway metadata: diff --git a/doc/user/project/deploy_tokens/index.md b/doc/user/project/deploy_tokens/index.md index 5c3c2188629..ef09c299036 100644 --- a/doc/user/project/deploy_tokens/index.md +++ b/doc/user/project/deploy_tokens/index.md @@ -56,7 +56,7 @@ To download a repository using a Deploy Token, you just need to: 1. Take note of your `username` and `token`. 1. `git clone` the project using the Deploy Token: - ```sh + ```shell git clone http://:@gitlab.example.com/tanuki/awesome_project.git ``` @@ -70,7 +70,7 @@ To read the container registry images, you'll need to: 1. Take note of your `username` and `token`. 1. Log in to GitLab’s Container Registry using the deploy token: -```sh +```shell docker login -u -p registry.example.com ``` @@ -90,7 +90,7 @@ automatically exposed to the CI/CD jobs as environment variables: `CI_DEPLOY_USE After you create the token, you can login to the Container Registry using those variables: -```sh +```shell docker login -u $CI_DEPLOY_USER -p $CI_DEPLOY_PASSWORD $CI_REGISTRY ``` diff --git a/doc/user/project/file_lock.md b/doc/user/project/file_lock.md index 045f2c8049b..e3590147dd7 100644 --- a/doc/user/project/file_lock.md +++ b/doc/user/project/file_lock.md @@ -81,7 +81,7 @@ pre-receive hook will reject your changes when you try to push. In the following example, a user who has no permissions on the locked `.gitignore` file will see the message below: -```bash +```shell Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. diff --git a/doc/user/project/import/svn.md b/doc/user/project/import/svn.md index 6b22c5f2fd0..87ea02b5b46 100644 --- a/doc/user/project/import/svn.md +++ b/doc/user/project/import/svn.md @@ -119,13 +119,13 @@ process should be run on a local workstation. Install `svn2git`. On all systems you can install as a Ruby gem if you already have Ruby and Git installed. -```bash +```shell sudo gem install svn2git ``` On Debian-based Linux distributions you can install the native packages: -```bash +```shell sudo apt-get install git-core git-svn ruby ``` @@ -138,7 +138,7 @@ repository. If you don't, the conversion will fail and you will have to update the author file accordingly. The following command will search through the repository and output a list of authors. -```bash +```shell svn log --quiet | grep -E "r[0-9]+ \| .+ \|" | cut -d'|' -f2 | sed 's/ //g' | sort | uniq ``` @@ -157,7 +157,7 @@ command will checkout the repository and do the conversion in the current working directory. Be sure to create a new directory for each repository before running the `svn2git` command. The conversion process will take some time. -```bash +```shell svn2git https://svn.example.com/path/to/repo --authors /path/to/authors.txt ``` @@ -172,7 +172,7 @@ Copy the SSH or HTTP(S) repository URL from the project page. Add the GitLab repository as a Git remote and push all the changes. This will push all commits, branches and tags. -```bash +```shell git remote add origin git@gitlab.com:/.git git push --all origin git push --tags origin diff --git a/doc/user/project/integrations/generic_alerts.md b/doc/user/project/integrations/generic_alerts.md index 8c509f30c4f..bb07b97e456 100644 --- a/doc/user/project/integrations/generic_alerts.md +++ b/doc/user/project/integrations/generic_alerts.md @@ -34,7 +34,7 @@ You can customize the payload by sending the following parameters. All fields ar Example request: -```sh +```shell curl --request POST \ --data '{"title": "Incident title"}' \ --header "Authorization: Bearer " \ diff --git a/doc/user/project/integrations/jira.md b/doc/user/project/integrations/jira.md index d08c8699eba..0bfb13ba54f 100644 --- a/doc/user/project/integrations/jira.md +++ b/doc/user/project/integrations/jira.md @@ -134,7 +134,7 @@ ENTITY_TITLE For example, the following commit will reference the Jira issue with `PROJECT-1` as its ID: -```bash +```shell git commit -m "PROJECT-1 Fix spelling and grammar" ``` diff --git a/doc/user/project/integrations/slack.md b/doc/user/project/integrations/slack.md index 508e72b5753..1dda3a60430 100644 --- a/doc/user/project/integrations/slack.md +++ b/doc/user/project/integrations/slack.md @@ -50,7 +50,7 @@ communicating with itself. The former is less likely since Slack's security cert should _hopefully_ always be trusted. We can establish which we're dealing with by using the below rails console script. -```sh +```shell # start a rails console: sudo gitlab-rails console production diff --git a/doc/user/project/issues/associate_zoom_meeting.md b/doc/user/project/issues/associate_zoom_meeting.md index 24775204c9f..a11fb4a7438 100644 --- a/doc/user/project/issues/associate_zoom_meeting.md +++ b/doc/user/project/issues/associate_zoom_meeting.md @@ -15,7 +15,7 @@ To associate a zoom meeting with an issue, you can use GitLab's In an issue, leave a comment using the `/zoom` quick action followed by a valid Zoom link: -```sh +```shell /zoom https://zoom.us/j/123456789 ``` @@ -34,7 +34,7 @@ need to [remove it](#removing-an-existing-zoom-meeting-from-an-issue) first. Similarly to adding a zoom meeting, you can remove it with a quick action: -```sh +```shell /remove_zoom ``` diff --git a/doc/user/project/issues/design_management.md b/doc/user/project/issues/design_management.md index b8983a06180..80075efe4ac 100644 --- a/doc/user/project/issues/design_management.md +++ b/doc/user/project/issues/design_management.md @@ -75,6 +75,12 @@ of the design, and will replace the previous version. Designs cannot be added if the issue has been moved, or its [discussion is locked](../../discussions/#lock-discussions). +### Skipped designs + +Designs with the same filename as an existing uploaded design _and_ whose content has not changed will be skipped. +This means that no new version of the design will be created. When designs are skipped, you will be made aware via a warning +message on the Issue. + ## Viewing designs Images on the Design Management page can be enlarged by clicking on them. diff --git a/doc/user/project/issues/managing_issues.md b/doc/user/project/issues/managing_issues.md index ff360e973aa..c6444259f25 100644 --- a/doc/user/project/issues/managing_issues.md +++ b/doc/user/project/issues/managing_issues.md @@ -178,7 +178,7 @@ Closes #4, #6, and https://gitlab.com///issues/ When not specified, the default issue closing pattern as shown below will be used: -```bash +```shell ((?:[Cc]los(?:e[sd]?|ing)|[Ff]ix(?:e[sd]|ing)?|[Rr]esolv(?:e[sd]?|ing)|[Ii]mplement(?:s|ed|ing)?)(:?) +(?:(?:issues? +)?%{issue_ref}(?:(?:, *| +and +)?)|([A-Z][A-Z0-9_]+-\d+))+) ``` diff --git a/doc/user/project/merge_requests/allow_collaboration.md b/doc/user/project/merge_requests/allow_collaboration.md index 083a117600b..721d866415c 100644 --- a/doc/user/project/merge_requests/allow_collaboration.md +++ b/doc/user/project/merge_requests/allow_collaboration.md @@ -55,7 +55,7 @@ Here's how the process would look like: 1. Use the copy button to copy the first command and paste them in your terminal: - ```sh + ```shell git fetch git@gitlab.com:thedude/awesome-project.git update-docs git checkout -b thedude-awesome-project-update-docs FETCH_HEAD ``` @@ -66,7 +66,7 @@ Here's how the process would look like: 1. Make any changes you want and commit. 1. Push to the forked project: - ```sh + ```shell git push git@gitlab.com:thedude/awesome-project.git thedude-awesome-project-update-docs:update-docs ``` diff --git a/doc/user/project/merge_requests/cherry_pick_changes.md b/doc/user/project/merge_requests/cherry_pick_changes.md index a5c191c150f..1ba5ece89d5 100644 --- a/doc/user/project/merge_requests/cherry_pick_changes.md +++ b/doc/user/project/merge_requests/cherry_pick_changes.md @@ -38,7 +38,7 @@ from the command line. Here is a quick example to cherry-pick a merge commit using the second parent as the mainline: -```bash +```shell git cherry-pick -m 2 7a39eb0 ``` diff --git a/doc/user/project/merge_requests/creating_merge_requests.md b/doc/user/project/merge_requests/creating_merge_requests.md index 470cf2a8656..87ef29407e9 100644 --- a/doc/user/project/merge_requests/creating_merge_requests.md +++ b/doc/user/project/merge_requests/creating_merge_requests.md @@ -106,27 +106,27 @@ Assuming you have your repository cloned into your computer and you'd like to start working on changes to files, start by creating and checking out a new branch: -```bash +```shell git checkout -b my-new-branch ``` Work on your file changes, stage, and commit them: -```bash +```shell git add . git commit -m "My commit message" ``` Once you're done, [push your branch to GitLab](../../../gitlab-basics/start-using-git.md#send-changes-to-gitlabcom): -```bash +```shell git push origin my-new-branch ``` In the output, GitLab will prompt you with a direct link for creating a merge request: -```bash +```shell ... remote: To create a merge request for docs-new-merge-request, visit: remote: https://gitlab-instance.com/my-group/my-project/merge_requests/new?merge_request%5Bsource_branch%5D=my-new-branch diff --git a/doc/user/project/merge_requests/revert_changes.md b/doc/user/project/merge_requests/revert_changes.md index 1cbbcf45400..75d9702ceb9 100644 --- a/doc/user/project/merge_requests/revert_changes.md +++ b/doc/user/project/merge_requests/revert_changes.md @@ -52,7 +52,7 @@ from the command line. Here is a quick example to revert a merge commit using the second parent as the mainline: -```bash +```shell git revert -m 2 7a39eb0 ``` diff --git a/doc/user/project/pages/getting_started_part_four.md b/doc/user/project/pages/getting_started_part_four.md index 263b20ea224..d6b34f4319e 100644 --- a/doc/user/project/pages/getting_started_part_four.md +++ b/doc/user/project/pages/getting_started_part_four.md @@ -53,7 +53,7 @@ write in the `.gitlab-ci.yml` the script you want to run so GitLab Runner will do it for you. It looks more complicated than it is. What you need to tell the Runner: -```sh +```shell gem install jekyll jekyll build ``` diff --git a/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md b/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md index c9bd3e35a5f..33181828fb2 100644 --- a/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md +++ b/doc/user/project/pages/lets_encrypt_for_gitlab_pages.md @@ -43,27 +43,27 @@ operating systems the steps might be slightly different. Follow the 1. On your computer, open a terminal and navigate to your repository's root directory: - ```bash + ```shell cd path/to/dir ``` 1. Install CertBot (the tool Let's Encrypt uses to issue certificates): - ```bash + ```shell brew install certbot ``` 1. Request a certificate for your domain (`example.com`) and provide an email account (`your@email.com`) to receive notifications: - ```bash + ```shell sudo certbot certonly -a manual -d example.com --email your@email.com ``` Alternatively, you can register without adding an e-mail account, but you won't be notified about the certificate expiration's date: - ```bash + ```shell sudo certbot certonly -a manual -d example.com --register-unsafely-without-email ``` @@ -76,7 +76,7 @@ operating systems the steps might be slightly different. Follow the CertBot will then prompt you with the following message: - ```bash + ```shell Create a file containing just this data: Rxnv6WKo95hsuLVX3osmT6LgmzsJKSaK9htlPToohOP.HUGNKk82jlsmOOfphlt8Jy69iuglsn095nxOMH9j3Yb @@ -95,7 +95,7 @@ operating systems the steps might be slightly different. Follow the and add to the last folder an `index.html` file containing the content referred on the previous prompt message: - ```bash + ```shell Rxnv6WKo95hsuLVX3osmT6LgmzsJKSaK9htlPToohOP.HUGNKk82jlsmOOfphlt8Jy69iuglsn095nxOMH9j3Yb ``` @@ -109,7 +109,7 @@ operating systems the steps might be slightly different. Follow the passes, press **Enter** on your terminal to continue issuing your certificate. CertBot will then prompt you with the following message: - ```bash + ```shell Waiting for verification... Cleaning up challenges @@ -137,13 +137,13 @@ Now that your certificate has been issued, let's add it to your Pages site: 1. From your terminal, copy and paste the certificate into the first field **Certificate (PEM)**: - ```bash + ```shell sudo cat /etc/letsencrypt/live/example.com/fullchain.pem | pbcopy ``` 1. Copy and paste the private key into the second field **Key (PEM)**: - ```bash + ```shell sudo cat /etc/letsencrypt/live/example.com/privkey.pem | pbcopy ``` @@ -160,6 +160,6 @@ valid certificates)**. Let's Encrypt certificates expire every 90 days and you'll have to renew them periodically. To renew all your certificates at once, run: -```bash +```shell sudo certbot renew ``` diff --git a/doc/user/project/pipelines/settings.md b/doc/user/project/pipelines/settings.md index 3998dc69ad5..a89304acd8a 100644 --- a/doc/user/project/pipelines/settings.md +++ b/doc/user/project/pipelines/settings.md @@ -141,7 +141,7 @@ small one line script that will strip the color codes off. For example: -```bash +```shell lein cloverage | perl -pe 's/\e\[?.*?[\@-~]//g' ``` diff --git a/doc/user/project/repository/git_blame.md b/doc/user/project/repository/git_blame.md index 1c63d73acdb..2deb53b313c 100644 --- a/doc/user/project/repository/git_blame.md +++ b/doc/user/project/repository/git_blame.md @@ -38,14 +38,14 @@ If you're running `git` from the command line, the equivalent command is `git blame `. For example, if you want to find `blame` information about a `README.md` file in the local directory, run the following command: -```bash +```shell git blame README.md ``` You'll see output similar to the following, which includes the commit time in UTC format: -```bash +```shell 62e2353a (Achilleas Pipinellis 2019-07-11 14:52:18 +0300 1) [![build status](https://gitlab.com/gitlab-org/gitlab-docs/badges/master/build.svg)](https://gitlab.com/gitlab-com/gitlab-docs/commits/master) fb0fc7d6 (Achilleas Pipinellis 2016-11-07 22:21:22 +0100 2) ^764ca75 (Connor Shea 2016-10-05 23:40:24 -0600 3) # GitLab Documentation diff --git a/doc/user/project/repository/git_history.md b/doc/user/project/repository/git_history.md index 9cd3d0d4ed0..b7375602a78 100644 --- a/doc/user/project/repository/git_history.md +++ b/doc/user/project/repository/git_history.md @@ -29,14 +29,14 @@ is `git log `. For example, if you want to find `history` information about a `README.md` file in the local directory, run the following command: -```bash +```shell git log README.md ``` You'll see output similar to the following, which includes the commit time in UTC format: -```bash +```shell commit 0e62ed6d9f39fa9bedf7efc6edd628b137fa781a Author: Mike Jang Date: Tue Nov 26 21:44:53 2019 +0000 diff --git a/doc/user/project/repository/repository_mirroring.md b/doc/user/project/repository/repository_mirroring.md index 09506da6e90..aa54c727fbe 100644 --- a/doc/user/project/repository/repository_mirroring.md +++ b/doc/user/project/repository/repository_mirroring.md @@ -214,7 +214,7 @@ Other providers will vary. If you're running self-managed GitLab, or otherwise have access to the server for the other repository, you can securely gather the key fingerprints: -```sh +```shell $ cat /etc/ssh/ssh_host*pub | ssh-keygen -E md5 -l -f - 256 MD5:f4:28:9f:23:99:15:21:1b:bf:ed:1f:8e:a0:76:b2:9d root@example.com (ECDSA) 256 MD5:e6:eb:45:8a:3c:59:35:5f:e9:5b:80:12:be:7e:22:73 root@example.com (ED25519) @@ -345,7 +345,7 @@ Read about [configuring Server hooks](../../../administration/server_hooks.md) o A sample `pre-receive` hook is provided below. -```bash +```shell #!/usr/bin/env bash # --- Assume only one push mirror target diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 32a5f3ce33d..07ed6bd7e0b 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -2,86 +2,6 @@ module API module Entities - class RemoteMirror < Grape::Entity - expose :id - expose :enabled - expose :safe_url, as: :url - expose :update_status - expose :last_update_at - expose :last_update_started_at - expose :last_successful_update_at - expose :last_error - expose :only_protected_branches - end - - class ContainerExpirationPolicy < Grape::Entity - expose :cadence - expose :enabled - expose :keep_n - expose :older_than - expose :name_regex - expose :next_run_at - end - - class ProjectImportStatus < ProjectIdentity - expose :import_status - - # TODO: Use `expose_nil` once we upgrade the grape-entity gem - expose :import_error, if: lambda { |project, _ops| project.import_state&.last_error } do |project| - project.import_state.last_error - end - end - - class BasicProjectDetails < ProjectIdentity - include ::API::ProjectsRelationBuilder - - expose :default_branch, if: -> (project, options) { Ability.allowed?(options[:current_user], :download_code, project) } - # Avoids an N+1 query: https://github.com/mbleigh/acts-as-taggable-on/issues/91#issuecomment-168273770 - expose :tag_list do |project| - # project.tags.order(:name).pluck(:name) is the most suitable option - # to avoid loading all the ActiveRecord objects but, if we use it here - # it override the preloaded associations and makes a query - # (fixed in https://github.com/rails/rails/pull/25976). - project.tags.map(&:name).sort - end - - expose :ssh_url_to_repo, :http_url_to_repo, :web_url, :readme_url - - expose :license_url, if: :license do |project| - license = project.repository.license_blob - - if license - Gitlab::Routing.url_helpers.project_blob_url(project, File.join(project.default_branch, license.path)) - end - end - - expose :license, with: 'API::Entities::LicenseBasic', if: :license do |project| - project.repository.license - end - - expose :avatar_url do |project, options| - project.avatar_url(only_path: false) - end - - expose :star_count, :forks_count - expose :last_activity_at - expose :namespace, using: 'API::Entities::NamespaceBasic' - expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes - - # rubocop: disable CodeReuse/ActiveRecord - def self.preload_relation(projects_relation, options = {}) - # Preloading tags, should be done with using only `:tags`, - # as `:tags` are defined as: `has_many :tags, through: :taggings` - # N+1 is solved then by using `subject.tags.map(&:name)` - # MR describing the solution: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20555 - projects_relation.preload(:project_feature, :route) - .preload(:import_state, :tags) - .preload(:auto_devops) - .preload(namespace: [:route, :owner]) - end - # rubocop: enable CodeReuse/ActiveRecord - end - class Project < BasicProjectDetails include ::API::Helpers::RelatedResourcesHelpers @@ -208,15 +128,6 @@ module API end end - class ProjectStatistics < Grape::Entity - expose :commit_count - expose :storage_size - expose :repository_size - expose :wiki_size - expose :lfs_objects_size - expose :build_artifacts_size, as: :job_artifacts_size - end - class ProjectDailyFetches < Grape::Entity expose :fetch_count, as: :count expose :date @@ -759,12 +670,6 @@ module API end end - class MergeRequestContextCommit < Grape::Entity - expose :sha, :relative_order, :new_file, :renamed_file, - :deleted_file, :too_large, :a_mode, :b_mode, :new_path, :old_path, - :diff, :binary - end - class SSHKey < Grape::Entity expose :id, :title, :key, :created_at end diff --git a/lib/api/entities/basic_project_details.rb b/lib/api/entities/basic_project_details.rb new file mode 100644 index 00000000000..9ea3aeb9903 --- /dev/null +++ b/lib/api/entities/basic_project_details.rb @@ -0,0 +1,55 @@ +# frozen_string_literal: true + +module API + module Entities + class BasicProjectDetails < ProjectIdentity + include ::API::ProjectsRelationBuilder + + expose :default_branch, if: -> (project, options) { Ability.allowed?(options[:current_user], :download_code, project) } + # Avoids an N+1 query: https://github.com/mbleigh/acts-as-taggable-on/issues/91#issuecomment-168273770 + expose :tag_list do |project| + # project.tags.order(:name).pluck(:name) is the most suitable option + # to avoid loading all the ActiveRecord objects but, if we use it here + # it override the preloaded associations and makes a query + # (fixed in https://github.com/rails/rails/pull/25976). + project.tags.map(&:name).sort + end + + expose :ssh_url_to_repo, :http_url_to_repo, :web_url, :readme_url + + expose :license_url, if: :license do |project| + license = project.repository.license_blob + + if license + Gitlab::Routing.url_helpers.project_blob_url(project, File.join(project.default_branch, license.path)) + end + end + + expose :license, with: 'API::Entities::LicenseBasic', if: :license do |project| + project.repository.license + end + + expose :avatar_url do |project, options| + project.avatar_url(only_path: false) + end + + expose :star_count, :forks_count + expose :last_activity_at + expose :namespace, using: 'API::Entities::NamespaceBasic' + expose :custom_attributes, using: 'API::Entities::CustomAttribute', if: :with_custom_attributes + + # rubocop: disable CodeReuse/ActiveRecord + def self.preload_relation(projects_relation, options = {}) + # Preloading tags, should be done with using only `:tags`, + # as `:tags` are defined as: `has_many :tags, through: :taggings` + # N+1 is solved then by using `subject.tags.map(&:name)` + # MR describing the solution: https://gitlab.com/gitlab-org/gitlab-foss/merge_requests/20555 + projects_relation.preload(:project_feature, :route) + .preload(:import_state, :tags) + .preload(:auto_devops) + .preload(namespace: [:route, :owner]) + end + # rubocop: enable CodeReuse/ActiveRecord + end + end +end diff --git a/lib/api/entities/container_expiration_policy.rb b/lib/api/entities/container_expiration_policy.rb new file mode 100644 index 00000000000..853bbb9b76b --- /dev/null +++ b/lib/api/entities/container_expiration_policy.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module API + module Entities + class ContainerExpirationPolicy < Grape::Entity + expose :cadence + expose :enabled + expose :keep_n + expose :older_than + expose :name_regex + expose :next_run_at + end + end +end diff --git a/lib/api/entities/project_import_status.rb b/lib/api/entities/project_import_status.rb new file mode 100644 index 00000000000..0b884b43e9e --- /dev/null +++ b/lib/api/entities/project_import_status.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module API + module Entities + class ProjectImportStatus < ProjectIdentity + expose :import_status + + # TODO: Use `expose_nil` once we upgrade the grape-entity gem + expose :import_error, if: lambda { |project, _ops| project.import_state&.last_error } do |project| + project.import_state.last_error + end + end + end +end diff --git a/lib/api/entities/project_statistics.rb b/lib/api/entities/project_statistics.rb new file mode 100644 index 00000000000..e5f6165da31 --- /dev/null +++ b/lib/api/entities/project_statistics.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +module API + module Entities + class ProjectStatistics < Grape::Entity + expose :commit_count + expose :storage_size + expose :repository_size + expose :wiki_size + expose :lfs_objects_size + expose :build_artifacts_size, as: :job_artifacts_size + end + end +end diff --git a/lib/api/entities/remote_mirror.rb b/lib/api/entities/remote_mirror.rb new file mode 100644 index 00000000000..dde3e9dea99 --- /dev/null +++ b/lib/api/entities/remote_mirror.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module API + module Entities + class RemoteMirror < Grape::Entity + expose :id + expose :enabled + expose :safe_url, as: :url + expose :update_status + expose :last_update_at + expose :last_update_started_at + expose :last_successful_update_at + expose :last_error + expose :only_protected_branches + end + end +end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 6397a376af7..c4ab84c5200 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -293,7 +293,7 @@ module API end desc 'Get the context commits of a merge request' do - success Entities::CommitEntity + success Entities::Commit end get ':id/merge_requests/:merge_request_iid/context_commits' do merge_request = find_merge_request_with_access(params[:merge_request_iid]) @@ -301,8 +301,10 @@ module API not_found! unless project.context_commits_enabled? - context_commits = merge_request.context_commits - CommitEntity.represent(context_commits, type: :full, request: merge_request) + context_commits = + paginate(merge_request.merge_request_context_commits).map(&:to_commit) + + present context_commits, with: Entities::Commit end params do diff --git a/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb b/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb index e951b44b036..7d40dfbcdc4 100644 --- a/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb +++ b/lib/gitlab/background_migration/user_mentions/create_resource_user_mention.rb @@ -24,14 +24,11 @@ module Gitlab mentions << record.build_mention_values end - no_quote_columns = [:note_id] - no_quote_columns << resource_user_mention_model.resource_foreign_key - Gitlab::Database.bulk_insert( resource_user_mention_model.table_name, mentions, return_ids: true, - disable_quote: no_quote_columns, + disable_quote: resource_model.no_quote_columns, on_conflict: :do_nothing ) end diff --git a/lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb b/lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb new file mode 100644 index 00000000000..40aab896212 --- /dev/null +++ b/lib/gitlab/background_migration/user_mentions/models/concerns/isolated_mentionable.rb @@ -0,0 +1,95 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + module UserMentions + module Models + # == IsolatedMentionable concern + # + # Shortcutted for isolation version of Mentionable to be used in mentions migrations + # + module IsolatedMentionable + extend ::ActiveSupport::Concern + + class_methods do + # Indicate which attributes of the Mentionable to search for GFM references. + def attr_mentionable(attr, options = {}) + attr = attr.to_s + mentionable_attrs << [attr, options] + end + end + + included do + # Accessor for attributes marked mentionable. + cattr_accessor :mentionable_attrs, instance_accessor: false do + [] + end + + if self < Participable + participant -> (user, ext) { all_references(user, extractor: ext) } + end + end + + def all_references(current_user = nil, extractor: nil) + # Use custom extractor if it's passed in the function parameters. + if extractor + extractors[current_user] = extractor + else + extractor = extractors[current_user] ||= ::Gitlab::ReferenceExtractor.new(project, current_user) + + extractor.reset_memoized_values + end + + self.class.mentionable_attrs.each do |attr, options| + text = __send__(attr) # rubocop:disable GitlabSecurity/PublicSend + options = options.merge( + cache_key: [self, attr], + author: author, + skip_project_check: skip_project_check? + ).merge(mentionable_params) + + cached_html = self.try(:updated_cached_html_for, attr.to_sym) + options[:rendered] = cached_html if cached_html + + extractor.analyze(text, options) + end + + extractor + end + + def extractors + @extractors ||= {} + end + + def skip_project_check? + false + end + + def build_mention_values + refs = all_references(author) + + { + "#{self.user_mention_model.resource_foreign_key}": user_mention_resource_id, + note_id: user_mention_note_id, + mentioned_users_ids: array_to_sql(refs.mentioned_users.pluck(:id)), + mentioned_projects_ids: array_to_sql(refs.mentioned_projects.pluck(:id)), + mentioned_groups_ids: array_to_sql(refs.mentioned_groups.pluck(:id)) + } + end + + def array_to_sql(ids_array) + return unless ids_array.present? + + '{' + ids_array.join(", ") + '}' + end + + private + + def mentionable_params + {} + end + end + end + end + end +end diff --git a/lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb b/lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb new file mode 100644 index 00000000000..fa479cb0ed3 --- /dev/null +++ b/lib/gitlab/background_migration/user_mentions/models/concerns/mentionable_migration_methods.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module Gitlab + module BackgroundMigration + module UserMentions + module Models + # Extract common no_quote_columns method used in determining the columns that do not need + # to be quoted for corresponding models + module MentionableMigrationMethods + extend ::ActiveSupport::Concern + + class_methods do + def no_quote_columns + [ + :note_id, + user_mention_model.resource_foreign_key + ] + end + end + end + end + end + end +end diff --git a/lib/gitlab/background_migration/user_mentions/models/epic.rb b/lib/gitlab/background_migration/user_mentions/models/epic.rb index 019d8f0ea8b..9797c86478e 100644 --- a/lib/gitlab/background_migration/user_mentions/models/epic.rb +++ b/lib/gitlab/background_migration/user_mentions/models/epic.rb @@ -8,6 +8,7 @@ module Gitlab class Epic < ActiveRecord::Base include IsolatedMentionable include CacheMarkdownField + include MentionableMigrationMethods attr_mentionable :title, pipeline: :single_line attr_mentionable :description diff --git a/lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb b/lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb deleted file mode 100644 index 40aab896212..00000000000 --- a/lib/gitlab/background_migration/user_mentions/models/isolated_mentionable.rb +++ /dev/null @@ -1,95 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module BackgroundMigration - module UserMentions - module Models - # == IsolatedMentionable concern - # - # Shortcutted for isolation version of Mentionable to be used in mentions migrations - # - module IsolatedMentionable - extend ::ActiveSupport::Concern - - class_methods do - # Indicate which attributes of the Mentionable to search for GFM references. - def attr_mentionable(attr, options = {}) - attr = attr.to_s - mentionable_attrs << [attr, options] - end - end - - included do - # Accessor for attributes marked mentionable. - cattr_accessor :mentionable_attrs, instance_accessor: false do - [] - end - - if self < Participable - participant -> (user, ext) { all_references(user, extractor: ext) } - end - end - - def all_references(current_user = nil, extractor: nil) - # Use custom extractor if it's passed in the function parameters. - if extractor - extractors[current_user] = extractor - else - extractor = extractors[current_user] ||= ::Gitlab::ReferenceExtractor.new(project, current_user) - - extractor.reset_memoized_values - end - - self.class.mentionable_attrs.each do |attr, options| - text = __send__(attr) # rubocop:disable GitlabSecurity/PublicSend - options = options.merge( - cache_key: [self, attr], - author: author, - skip_project_check: skip_project_check? - ).merge(mentionable_params) - - cached_html = self.try(:updated_cached_html_for, attr.to_sym) - options[:rendered] = cached_html if cached_html - - extractor.analyze(text, options) - end - - extractor - end - - def extractors - @extractors ||= {} - end - - def skip_project_check? - false - end - - def build_mention_values - refs = all_references(author) - - { - "#{self.user_mention_model.resource_foreign_key}": user_mention_resource_id, - note_id: user_mention_note_id, - mentioned_users_ids: array_to_sql(refs.mentioned_users.pluck(:id)), - mentioned_projects_ids: array_to_sql(refs.mentioned_projects.pluck(:id)), - mentioned_groups_ids: array_to_sql(refs.mentioned_groups.pluck(:id)) - } - end - - def array_to_sql(ids_array) - return unless ids_array.present? - - '{' + ids_array.join(", ") + '}' - end - - private - - def mentionable_params - {} - end - end - end - end - end -end diff --git a/lib/gitlab/database/subquery.rb b/lib/gitlab/database/subquery.rb deleted file mode 100644 index 2a6f39c6a27..00000000000 --- a/lib/gitlab/database/subquery.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module Database - module Subquery - class << self - def self_join(relation) - t = relation.arel_table - t2 = relation.arel.as('t2') - - relation.unscoped.joins(t.join(t2).on(t[:id].eq(t2[:id])).join_sources.first) - end - end - end - end -end diff --git a/lib/gitlab/jira/http_client.rb b/lib/gitlab/jira/http_client.rb index 0c8b509740c..c09d8170d17 100644 --- a/lib/gitlab/jira/http_client.rb +++ b/lib/gitlab/jira/http_client.rb @@ -12,7 +12,7 @@ module Gitlab def request(*args) result = make_request(*args) - raise JIRA::HTTPError.new(result) unless result.response.is_a?(Net::HTTPSuccess) + raise JIRA::HTTPError.new(result.response) unless result.response.is_a?(Net::HTTPSuccess) result end diff --git a/locale/gitlab.pot b/locale/gitlab.pot index adc979efd1d..40b4d286a97 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -5963,6 +5963,9 @@ msgstr "" msgid "Date picker" msgstr "" +msgid "Date range cannot exceed %{maxDateRange} days." +msgstr "" + msgid "DayTitle|F" msgstr "" @@ -6450,6 +6453,9 @@ msgstr "" msgid "DesignManagement|%{current_design} of %{designs_count}" msgstr "" +msgid "DesignManagement|%{filename} did not change." +msgstr "" + msgid "DesignManagement|Add designs" msgstr "" @@ -6516,6 +6522,12 @@ msgstr "" msgid "DesignManagement|Upload and view the latest designs for this issue. Consistent and easy to find, so everyone is up to date." msgstr "" +msgid "DesignManagement|Upload skipped." +msgstr "" + +msgid "DesignManagement|and %{moreCount} more." +msgstr "" + msgid "Designs" msgstr "" @@ -17464,6 +17476,9 @@ msgstr "" msgid "Some email servers do not support overriding the email sender name. Enable this option to include the name of the author of the issue, merge request or comment in the email body instead." msgstr "" +msgid "Some of the designs you tried uploading did not change:" +msgstr "" + msgid "Some of your epics may not be visible. A roadmap is limited to the first 1,000 epics, in your selected sort order." msgstr "" @@ -18687,6 +18702,9 @@ msgstr "" msgid "The deployment of this job to %{environmentLink} did not succeed." msgstr "" +msgid "The designs you tried uploading did not change." +msgstr "" + msgid "The directory has been successfully created." msgstr "" diff --git a/spec/controllers/admin/spam_logs_controller_spec.rb b/spec/controllers/admin/spam_logs_controller_spec.rb index baf4216dcde..15fb57d5add 100644 --- a/spec/controllers/admin/spam_logs_controller_spec.rb +++ b/spec/controllers/admin/spam_logs_controller_spec.rb @@ -39,7 +39,7 @@ describe Admin::SpamLogsController do describe '#mark_as_ham' do before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:submit_ham).and_return(true) end end diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb index e2ffc595c44..e5ca2226111 100644 --- a/spec/controllers/projects/issues_controller_spec.rb +++ b/spec/controllers/projects/issues_controller_spec.rb @@ -422,7 +422,7 @@ describe Projects::IssuesController do context 'when Akismet is enabled and the issue is identified as spam' do before do stub_application_setting(recaptcha_enabled: true) - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end @@ -702,7 +702,7 @@ describe Projects::IssuesController do context 'when an issue is not identified as spam' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: false) end end @@ -715,7 +715,7 @@ describe Projects::IssuesController do context 'when an issue is identified as spam' do context 'when captcha is not verified' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end @@ -954,7 +954,7 @@ describe Projects::IssuesController do before do stub_feature_flags(allow_possible_spam: false) - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: false) end end @@ -971,7 +971,7 @@ describe Projects::IssuesController do end before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end @@ -1096,7 +1096,7 @@ describe Projects::IssuesController do describe 'POST #mark_as_spam' do context 'properly submits to Akismet' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(submit_spam: true) end expect_next_instance_of(ApplicationSetting) do |setting| diff --git a/spec/controllers/projects/snippets_controller_spec.rb b/spec/controllers/projects/snippets_controller_spec.rb index 8233c0a0adb..0a8aa60ee02 100644 --- a/spec/controllers/projects/snippets_controller_spec.rb +++ b/spec/controllers/projects/snippets_controller_spec.rb @@ -92,7 +92,7 @@ describe Projects::SnippetsController do context 'when the snippet is spam' do before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end @@ -172,7 +172,7 @@ describe Projects::SnippetsController do context 'when the snippet is spam' do before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end @@ -282,7 +282,7 @@ describe Projects::SnippetsController do let(:snippet) { create(:project_snippet, :private, project: project, author: user) } before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive_messages(submit_spam: true) end stub_application_setting(akismet_enabled: true) diff --git a/spec/controllers/snippets_controller_spec.rb b/spec/controllers/snippets_controller_spec.rb index f8fc9a72e00..daa560649f0 100644 --- a/spec/controllers/snippets_controller_spec.rb +++ b/spec/controllers/snippets_controller_spec.rb @@ -275,7 +275,7 @@ describe SnippetsController do context 'when the snippet is spam' do before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end @@ -349,7 +349,7 @@ describe SnippetsController do context 'when the snippet is spam' do before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end @@ -459,7 +459,7 @@ describe SnippetsController do let(:snippet) { create(:personal_snippet, :public, author: user) } before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive_messages(submit_spam: true) end stub_application_setting(akismet_enabled: true) diff --git a/spec/features/projects/serverless/functions_spec.rb b/spec/features/projects/serverless/functions_spec.rb index c661ceb8eda..e494a0e9626 100644 --- a/spec/features/projects/serverless/functions_spec.rb +++ b/spec/features/projects/serverless/functions_spec.rb @@ -16,7 +16,12 @@ describe 'Functions', :js do shared_examples "it's missing knative installation" do before do + functions_finder = Projects::Serverless::FunctionsFinder.new(project) visit project_serverless_functions_path(project) + allow(Projects::Serverless::FunctionsFinder) + .to receive(:new) + .and_return(functions_finder) + synchronous_reactive_cache(functions_finder) end it 'sees an empty state require Knative installation' do diff --git a/spec/finders/projects/serverless/functions_finder_spec.rb b/spec/finders/projects/serverless/functions_finder_spec.rb index d5644daebab..67eda297b91 100644 --- a/spec/finders/projects/serverless/functions_finder_spec.rb +++ b/spec/finders/projects/serverless/functions_finder_spec.rb @@ -26,9 +26,69 @@ describe Projects::Serverless::FunctionsFinder do project.add_maintainer(user) end - describe '#installed' do - it 'when reactive_caching is still fetching data' do - expect(described_class.new(project).knative_installed).to eq 'checking' + describe '#knative_installed' do + context 'when environment does not exist yet' do + shared_examples 'before first deployment' do + let(:service) { cluster.platform_kubernetes } + let(:deployment) { nil } + + it 'returns true if Knative is installed on cluster' do + stub_kubeclient_discover_knative_found(service.api_url) + function_finder = described_class.new(project) + synchronous_reactive_cache(function_finder) + + expect(function_finder.knative_installed).to be true + end + + it 'returns false if Knative is not installed on cluster' do + stub_kubeclient_discover_knative_not_found(service.api_url) + function_finder = described_class.new(project) + synchronous_reactive_cache(function_finder) + + expect(function_finder.knative_installed).to be false + end + end + context 'when project level cluster is present and enabled' do + it_behaves_like 'before first deployment' do + let(:cluster) { create(:cluster, :project, :provided_by_gcp, enabled: true) } + let(:project) { cluster.project } + end + end + + context 'when group level cluster is present and enabled' do + it_behaves_like 'before first deployment' do + let(:cluster) { create(:cluster, :group, :provided_by_gcp, enabled: true) } + let(:project) { create(:project, group: cluster.groups.first) } + end + end + + context 'when instance level cluster is present and enabled' do + it_behaves_like 'before first deployment' do + let(:project) { create(:project) } + let(:cluster) { create(:cluster, :instance, :provided_by_gcp, enabled: true) } + end + end + + context 'when project level cluster is present, but disabled' do + let(:cluster) { create(:cluster, :project, :provided_by_gcp, enabled: false) } + let(:project) { cluster.project } + let(:service) { cluster.platform_kubernetes } + let(:deployment) { nil } + + it 'returns false even if Knative is installed on cluster' do + stub_kubeclient_discover_knative_found(service.api_url) + function_finder = described_class.new(project) + synchronous_reactive_cache(function_finder) + + expect(function_finder.knative_installed).to be false + end + end + end + + context 'when reactive_caching is still fetching data' do + it 'returns "checking"' do + expect(described_class.new(project).knative_installed).to eq 'checking' + end end context 'when reactive_caching has finished' do diff --git a/spec/lib/gitlab/database/subquery_spec.rb b/spec/lib/gitlab/database/subquery_spec.rb deleted file mode 100644 index 70380e02f16..00000000000 --- a/spec/lib/gitlab/database/subquery_spec.rb +++ /dev/null @@ -1,17 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe Gitlab::Database::Subquery do - describe '.self_join' do - set(:project) { create(:project) } - - it 'allows you to delete_all rows with WHERE and LIMIT' do - events = create_list(:event, 8, project: project) - - expect do - described_class.self_join(Event.where('id < ?', events[5]).recent.limit(2)).delete_all - end.to change { Event.count }.by(-2) - end - end -end diff --git a/spec/requests/api/issues/post_projects_issues_spec.rb b/spec/requests/api/issues/post_projects_issues_spec.rb index 6597a3ab3ba..341d0e8ae6b 100644 --- a/spec/requests/api/issues/post_projects_issues_spec.rb +++ b/spec/requests/api/issues/post_projects_issues_spec.rb @@ -392,7 +392,7 @@ describe API::Issues do expect_next_instance_of(Spam::SpamCheckService) do |spam_service| expect(spam_service).to receive_messages(check_for_spam?: true) end - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end diff --git a/spec/requests/api/issues/put_projects_issues_spec.rb b/spec/requests/api/issues/put_projects_issues_spec.rb index e6fec2fa1fc..8e78aca59b2 100644 --- a/spec/requests/api/issues/put_projects_issues_spec.rb +++ b/spec/requests/api/issues/put_projects_issues_spec.rb @@ -197,7 +197,7 @@ describe API::Issues do expect_next_instance_of(Spam::SpamCheckService) do |spam_service| expect(spam_service).to receive_messages(check_for_spam?: true) end - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 58ae4565582..33ac175e945 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -1069,10 +1069,16 @@ describe API::MergeRequests do describe 'GET /projects/:id/merge_requests/:merge_request_iid/:context_commits' do it 'returns a 200 when merge request is valid' do + context_commit = merge_request.context_commits.first + get api("/projects/#{project.id}/merge_requests/#{merge_request.iid}/context_commits", user) + expect(response).to have_gitlab_http_status(200) + expect(response).to include_pagination_headers expect(json_response).to be_an Array expect(json_response.size).to eq(merge_request.context_commits.size) + expect(json_response.first['id']).to eq(context_commit.id) + expect(json_response.first['title']).to eq(context_commit.title) end it 'returns a 404 when merge_request_iid not found' do diff --git a/spec/requests/api/project_snippets_spec.rb b/spec/requests/api/project_snippets_spec.rb index bfb6f10efa3..ccbfe040fca 100644 --- a/spec/requests/api/project_snippets_spec.rb +++ b/spec/requests/api/project_snippets_spec.rb @@ -179,7 +179,7 @@ describe API::ProjectSnippets do end before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end @@ -271,7 +271,7 @@ describe API::ProjectSnippets do end before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end diff --git a/spec/requests/api/snippets_spec.rb b/spec/requests/api/snippets_spec.rb index f32be7a8765..1749ec89bc1 100644 --- a/spec/requests/api/snippets_spec.rb +++ b/spec/requests/api/snippets_spec.rb @@ -238,7 +238,7 @@ describe API::Snippets do end before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end @@ -327,7 +327,7 @@ describe API::Snippets do end before do - allow_next_instance_of(AkismetService) do |instance| + allow_next_instance_of(Spam::AkismetService) do |instance| allow(instance).to receive(:spam?).and_return(true) end end diff --git a/spec/services/akismet_service_spec.rb b/spec/services/akismet_service_spec.rb deleted file mode 100644 index 355ff1611a0..00000000000 --- a/spec/services/akismet_service_spec.rb +++ /dev/null @@ -1,136 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -describe AkismetService do - let(:fake_akismet_client) { double(:akismet_client) } - - let_it_be(:text) { "Would you like to buy some tinned meat product?" } - let_it_be(:spam_owner) { create(:user) } - - subject do - options = { ip_address: '1.2.3.4', user_agent: 'some user_agent', referrer: 'some referrer' } - described_class.new(spam_owner.name, spam_owner.email, text, options) - end - - before do - stub_application_setting(akismet_enabled: true) - allow(subject).to receive(:akismet_client).and_return(fake_akismet_client) - end - - shared_examples 'no activity if Akismet is not enabled' do |method_call| - before do - stub_application_setting(akismet_enabled: false) - end - - it 'is automatically false' do - expect(subject.send(method_call)).to be_falsey - end - - it 'performs no check' do - expect(fake_akismet_client).not_to receive(:public_send) - - subject.send(method_call) - end - end - - shared_examples 'false if Akismet is not available' do |method_call| - context 'if Akismet is not available' do - before do - allow(fake_akismet_client).to receive(:public_send).and_raise(StandardError.new("oh noes!")) - end - - specify do - expect(subject.send(method_call)).to be_falsey - end - - it 'logs an error' do - logger_spy = double(:logger) - expect(Rails).to receive(:logger).and_return(logger_spy) - expect(logger_spy).to receive(:error).with(/skipping/) - - subject.send(method_call) - end - end - end - - describe '#spam?' do - it_behaves_like 'no activity if Akismet is not enabled', :spam?, :check - - context 'if Akismet is enabled' do - context 'the text is spam' do - before do - allow(fake_akismet_client).to receive(:check).and_return([true, false]) - end - - specify do - expect(subject.spam?).to be_truthy - end - end - - context 'the text is blatant spam' do - before do - allow(fake_akismet_client).to receive(:check).and_return([false, true]) - end - - specify do - expect(subject.spam?).to be_truthy - end - end - - context 'the text is not spam' do - before do - allow(fake_akismet_client).to receive(:check).and_return([false, false]) - end - - specify do - expect(subject.spam?).to be_falsey - end - end - - context 'if Akismet is not available' do - before do - allow(fake_akismet_client).to receive(:check).and_raise(StandardError.new("oh noes!")) - end - - specify do - expect(subject.spam?).to be_falsey - end - - it 'logs an error' do - logger_spy = double(:logger) - expect(Rails).to receive(:logger).and_return(logger_spy) - expect(logger_spy).to receive(:error).with(/skipping check/) - - subject.spam? - end - end - end - end - - describe '#submit_ham' do - it_behaves_like 'no activity if Akismet is not enabled', :submit_ham - it_behaves_like 'false if Akismet is not available', :submit_ham - - context 'if Akismet is available' do - specify do - expect(fake_akismet_client).to receive(:public_send).with(:ham, any_args) - - expect(subject.submit_ham).to be_truthy - end - end - end - - describe '#submit_spam' do - it_behaves_like 'no activity if Akismet is not enabled', :submit_spam - it_behaves_like 'false if Akismet is not available', :submit_spam - - context 'if Akismet is available' do - specify do - expect(fake_akismet_client).to receive(:public_send).with(:spam, any_args) - - expect(subject.submit_spam).to be_truthy - end - end - end -end diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index 3246578c743..44d4cd70f9a 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -355,7 +355,7 @@ describe Issues::CreateService do opts[:recaptcha_verified] = true opts[:spam_log_id] = spam_logs.last.id - expect(AkismetService).not_to receive(:new) + expect(Spam::AkismetService).not_to receive(:new) end it 'does no mark an issue as a spam ' do @@ -392,7 +392,7 @@ describe Issues::CreateService do context 'when akismet detects spam' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end @@ -442,7 +442,7 @@ describe Issues::CreateService do context 'when akismet does not detect spam' do before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: false) end end diff --git a/spec/services/notes/update_service_spec.rb b/spec/services/notes/update_service_spec.rb index 73fcdd787aa..ab28e08ec83 100644 --- a/spec/services/notes/update_service_spec.rb +++ b/spec/services/notes/update_service_spec.rb @@ -30,6 +30,12 @@ describe Notes::UpdateService do @note.reload end + it 'does not update the note when params is blank' do + Timecop.freeze(1.day.from_now) do + expect { update_note({}) }.not_to change { note.reload.updated_at } + end + end + context 'suggestions' do it 'refreshes note suggestions' do markdown = <<-MARKDOWN.strip_heredoc diff --git a/spec/services/snippets/create_service_spec.rb b/spec/services/snippets/create_service_spec.rb index 3ada50e80aa..7aa8f0ebf8f 100644 --- a/spec/services/snippets/create_service_spec.rb +++ b/spec/services/snippets/create_service_spec.rb @@ -99,7 +99,7 @@ describe Snippets::CreateService do end before do - expect_next_instance_of(AkismetService) do |akismet_service| + expect_next_instance_of(Spam::AkismetService) do |akismet_service| expect(akismet_service).to receive_messages(spam?: true) end end diff --git a/spec/services/spam/akismet_service_spec.rb b/spec/services/spam/akismet_service_spec.rb new file mode 100644 index 00000000000..a496cd1890e --- /dev/null +++ b/spec/services/spam/akismet_service_spec.rb @@ -0,0 +1,136 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Spam::AkismetService do + let(:fake_akismet_client) { double(:akismet_client) } + + let_it_be(:text) { "Would you like to buy some tinned meat product?" } + let_it_be(:spam_owner) { create(:user) } + + subject do + options = { ip_address: '1.2.3.4', user_agent: 'some user_agent', referrer: 'some referrer' } + described_class.new(spam_owner.name, spam_owner.email, text, options) + end + + before do + stub_application_setting(akismet_enabled: true) + allow(subject).to receive(:akismet_client).and_return(fake_akismet_client) + end + + shared_examples 'no activity if Akismet is not enabled' do |method_call| + before do + stub_application_setting(akismet_enabled: false) + end + + it 'is automatically false' do + expect(subject.send(method_call)).to be_falsey + end + + it 'performs no check' do + expect(fake_akismet_client).not_to receive(:public_send) + + subject.send(method_call) + end + end + + shared_examples 'false if Akismet is not available' do |method_call| + context 'if Akismet is not available' do + before do + allow(fake_akismet_client).to receive(:public_send).and_raise(StandardError.new("oh noes!")) + end + + specify do + expect(subject.send(method_call)).to be_falsey + end + + it 'logs an error' do + logger_spy = double(:logger) + expect(Rails).to receive(:logger).and_return(logger_spy) + expect(logger_spy).to receive(:error).with(/skipping/) + + subject.send(method_call) + end + end + end + + describe '#spam?' do + it_behaves_like 'no activity if Akismet is not enabled', :spam?, :check + + context 'if Akismet is enabled' do + context 'the text is spam' do + before do + allow(fake_akismet_client).to receive(:check).and_return([true, false]) + end + + specify do + expect(subject.spam?).to be_truthy + end + end + + context 'the text is blatant spam' do + before do + allow(fake_akismet_client).to receive(:check).and_return([false, true]) + end + + specify do + expect(subject.spam?).to be_truthy + end + end + + context 'the text is not spam' do + before do + allow(fake_akismet_client).to receive(:check).and_return([false, false]) + end + + specify do + expect(subject.spam?).to be_falsey + end + end + + context 'if Akismet is not available' do + before do + allow(fake_akismet_client).to receive(:check).and_raise(StandardError.new("oh noes!")) + end + + specify do + expect(subject.spam?).to be_falsey + end + + it 'logs an error' do + logger_spy = double(:logger) + expect(Rails).to receive(:logger).and_return(logger_spy) + expect(logger_spy).to receive(:error).with(/skipping check/) + + subject.spam? + end + end + end + end + + describe '#submit_ham' do + it_behaves_like 'no activity if Akismet is not enabled', :submit_ham + it_behaves_like 'false if Akismet is not available', :submit_ham + + context 'if Akismet is available' do + specify do + expect(fake_akismet_client).to receive(:public_send).with(:ham, any_args) + + expect(subject.submit_ham).to be_truthy + end + end + end + + describe '#submit_spam' do + it_behaves_like 'no activity if Akismet is not enabled', :submit_spam + it_behaves_like 'false if Akismet is not available', :submit_spam + + context 'if Akismet is available' do + specify do + expect(fake_akismet_client).to receive(:public_send).with(:spam, any_args) + + expect(subject.submit_spam).to be_truthy + end + end + end +end diff --git a/spec/services/spam/spam_check_service_spec.rb b/spec/services/spam/spam_check_service_spec.rb index 5e06d14b8bc..732b64b52a0 100644 --- a/spec/services/spam/spam_check_service_spec.rb +++ b/spec/services/spam/spam_check_service_spec.rb @@ -85,7 +85,7 @@ describe Spam::SpamCheckService do before do issue.closed_at = Time.zone.now - allow(AkismetService).to receive(:new).and_return(double(spam?: true)) + allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: true)) end it 'returns false' do @@ -105,7 +105,7 @@ describe Spam::SpamCheckService do context 'when indicated as spam by akismet' do before do - allow(AkismetService).to receive(:new).and_return(double(spam?: true)) + allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: true)) end context 'when allow_possible_spam feature flag is false' do @@ -135,7 +135,7 @@ describe Spam::SpamCheckService do context 'when not indicated as spam by akismet' do before do - allow(AkismetService).to receive(:new).and_return(double(spam?: false)) + allow(Spam::AkismetService).to receive(:new).and_return(double(spam?: false)) end it 'returns false' do diff --git a/spec/support/helpers/kubernetes_helpers.rb b/spec/support/helpers/kubernetes_helpers.rb index 77acad31d62..8e5042e2ad3 100644 --- a/spec/support/helpers/kubernetes_helpers.rb +++ b/spec/support/helpers/kubernetes_helpers.rb @@ -60,6 +60,12 @@ module KubernetesHelpers .to_return(status: [404, "Resource Not Found"]) end + def stub_kubeclient_discover_knative_found(api_url) + WebMock + .stub_request(:get, api_url + '/apis/serving.knative.dev/v1alpha1') + .to_return(kube_response(kube_knative_discovery_body)) + end + def stub_kubeclient_service_pods(response = nil, options = {}) stub_kubeclient_discover(service.api_url) @@ -288,6 +294,13 @@ module KubernetesHelpers } end + def kube_knative_discovery_body + { + "kind" => "APIResourceList", + "resources" => [] + } + end + def kube_extensions_v1beta1_discovery_body { "kind" => "APIResourceList", -- cgit v1.2.3