diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-29 18:11:47 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-29 18:11:47 +0300 |
commit | cee701c9641a4dfa508f9a1d913863a52ae67167 (patch) | |
tree | 64ae2ab0eebdd56b8656ddc577c1bdee367bcbfe | |
parent | 5f8d4d631d241c993c2cac54db3494f474b21dc1 (diff) |
Add latest changes from gitlab-org/gitlab@master
48 files changed, 141 insertions, 675 deletions
diff --git a/app/assets/javascripts/packages/details/constants.js b/app/assets/javascripts/packages/details/constants.js index cd34b1ad45a..a1981797c0c 100644 --- a/app/assets/javascripts/packages/details/constants.js +++ b/app/assets/javascripts/packages/details/constants.js @@ -1,53 +1,5 @@ import { s__ } from '~/locale'; -export const TrackingLabels = { - CODE_INSTRUCTION: 'code_instruction', - CONAN_INSTALLATION: 'conan_installation', - MAVEN_INSTALLATION: 'maven_installation', - NPM_INSTALLATION: 'npm_installation', - NUGET_INSTALLATION: 'nuget_installation', - PYPI_INSTALLATION: 'pypi_installation', - COMPOSER_INSTALLATION: 'composer_installation', -}; - -export const TrackingActions = { - INSTALLATION: 'installation', - REGISTRY_SETUP: 'registry_setup', - - COPY_CONAN_COMMAND: 'copy_conan_command', - COPY_CONAN_SETUP_COMMAND: 'copy_conan_setup_command', - - COPY_MAVEN_XML: 'copy_maven_xml', - COPY_MAVEN_COMMAND: 'copy_maven_command', - COPY_MAVEN_SETUP: 'copy_maven_setup_xml', - - COPY_NPM_INSTALL_COMMAND: 'copy_npm_install_command', - COPY_NPM_SETUP_COMMAND: 'copy_npm_setup_command', - - COPY_YARN_INSTALL_COMMAND: 'copy_yarn_install_command', - COPY_YARN_SETUP_COMMAND: 'copy_yarn_setup_command', - - COPY_NUGET_INSTALL_COMMAND: 'copy_nuget_install_command', - COPY_NUGET_SETUP_COMMAND: 'copy_nuget_setup_command', - - COPY_PIP_INSTALL_COMMAND: 'copy_pip_install_command', - COPY_PYPI_SETUP_COMMAND: 'copy_pypi_setup_command', - - COPY_COMPOSER_REGISTRY_INCLUDE_COMMAND: 'copy_composer_registry_include_command', - COPY_COMPOSER_PACKAGE_INCLUDE_COMMAND: 'copy_composer_package_include_command', - - COPY_GRADLE_INSTALL_COMMAND: 'copy_gradle_install_command', - COPY_GRADLE_ADD_TO_SOURCE_COMMAND: 'copy_gradle_add_to_source_command', - - COPY_KOTLIN_INSTALL_COMMAND: 'copy_kotlin_install_command', - COPY_KOTLIN_ADD_TO_SOURCE_COMMAND: 'copy_kotlin_add_to_source_command', -}; - -export const NpmManager = { - NPM: 'npm', - YARN: 'yarn', -}; - export const FETCH_PACKAGE_VERSIONS_ERROR = s__( 'PackageRegistry|Unable to fetch package version information.', ); diff --git a/app/assets/javascripts/packages/details/store/getters.js b/app/assets/javascripts/packages/details/store/getters.js index ae273e26d6a..6a17e7aa6d6 100644 --- a/app/assets/javascripts/packages/details/store/getters.js +++ b/app/assets/javascripts/packages/details/store/getters.js @@ -1,140 +1,3 @@ -import { PackageType } from '../../shared/constants'; -import { getPackageTypeLabel } from '../../shared/utils'; -import { NpmManager } from '../constants'; - export const packagePipeline = ({ packageEntity }) => { return packageEntity?.pipeline || null; }; - -export const packageTypeDisplay = ({ packageEntity }) => { - return getPackageTypeLabel(packageEntity.package_type); -}; - -export const packageIcon = ({ packageEntity }) => { - if (packageEntity.package_type === PackageType.NUGET) { - return packageEntity.nuget_metadatum?.icon_url || null; - } - - return null; -}; - -export const conanInstallationCommand = ({ packageEntity }) => { - // eslint-disable-next-line @gitlab/require-i18n-strings - return `conan install ${packageEntity.name} --remote=gitlab`; -}; - -export const conanSetupCommand = ({ conanPath }) => - // eslint-disable-next-line @gitlab/require-i18n-strings - `conan remote add gitlab ${conanPath}`; - -export const mavenInstallationXml = ({ packageEntity = {} }) => { - const { - app_group: appGroup = '', - app_name: appName = '', - app_version: appVersion = '', - } = packageEntity.maven_metadatum; - - return `<dependency> - <groupId>${appGroup}</groupId> - <artifactId>${appName}</artifactId> - <version>${appVersion}</version> -</dependency>`; -}; - -export const mavenInstallationCommand = ({ packageEntity = {} }) => { - const { - app_group: group = '', - app_name: name = '', - app_version: version = '', - } = packageEntity.maven_metadatum; - - return `mvn dependency:get -Dartifact=${group}:${name}:${version}`; -}; - -export const mavenSetupXml = ({ mavenPath }) => `<repositories> - <repository> - <id>gitlab-maven</id> - <url>${mavenPath}</url> - </repository> -</repositories> - -<distributionManagement> - <repository> - <id>gitlab-maven</id> - <url>${mavenPath}</url> - </repository> - - <snapshotRepository> - <id>gitlab-maven</id> - <url>${mavenPath}</url> - </snapshotRepository> -</distributionManagement>`; - -export const npmInstallationCommand = ({ packageEntity }) => (type = NpmManager.NPM) => { - // eslint-disable-next-line @gitlab/require-i18n-strings - const instruction = type === NpmManager.NPM ? 'npm i' : 'yarn add'; - - return `${instruction} ${packageEntity.name}`; -}; - -export const npmSetupCommand = ({ packageEntity, npmPath }) => (type = NpmManager.NPM) => { - const scope = packageEntity.name.substring(0, packageEntity.name.indexOf('/')); - - if (type === NpmManager.NPM) { - return `echo ${scope}:registry=${npmPath}/ >> .npmrc`; - } - - return `echo \\"${scope}:registry\\" \\"${npmPath}/\\" >> .yarnrc`; -}; - -export const nugetInstallationCommand = ({ packageEntity }) => - `nuget install ${packageEntity.name} -Source "GitLab"`; - -export const nugetSetupCommand = ({ nugetPath }) => - `nuget source Add -Name "GitLab" -Source "${nugetPath}" -UserName <your_username> -Password <your_token>`; - -export const pypiPipCommand = ({ pypiPath, packageEntity }) => - // eslint-disable-next-line @gitlab/require-i18n-strings - `pip install ${packageEntity.name} --extra-index-url ${pypiPath}`; - -export const pypiSetupCommand = ({ pypiSetupPath }) => `[gitlab] -repository = ${pypiSetupPath} -username = __token__ -password = <your personal access token>`; - -export const composerRegistryInclude = ({ composerPath, composerConfigRepositoryName }) => - // eslint-disable-next-line @gitlab/require-i18n-strings - `composer config repositories.${composerConfigRepositoryName} '{"type": "composer", "url": "${composerPath}"}'`; - -export const composerPackageInclude = ({ packageEntity }) => - // eslint-disable-next-line @gitlab/require-i18n-strings - `composer req ${[packageEntity.name]}:${packageEntity.version}`; - -export const gradleGroovyInstalCommand = ({ packageEntity }) => { - const { - app_group: group = '', - app_name: name = '', - app_version: version = '', - } = packageEntity.maven_metadatum; - // eslint-disable-next-line @gitlab/require-i18n-strings - return `implementation '${group}:${name}:${version}'`; -}; - -export const gradleGroovyAddSourceCommand = ({ mavenPath }) => - // eslint-disable-next-line @gitlab/require-i18n-strings - `maven { - url '${mavenPath}' -}`; - -export const gradleKotlinInstalCommand = ({ packageEntity }) => { - const { - app_group: group = '', - app_name: name = '', - app_version: version = '', - } = packageEntity.maven_metadatum; - return `implementation("${group}:${name}:${version}")`; -}; - -export const gradleKotlinAddSourceCommand = ({ mavenPath }) => `maven("${mavenPath}")`; - -export const groupExists = ({ groupListUrl }) => groupListUrl.length > 0; diff --git a/app/assets/javascripts/packages/details/utils.js b/app/assets/javascripts/packages/details/utils.js deleted file mode 100644 index 27cc95566d3..00000000000 --- a/app/assets/javascripts/packages/details/utils.js +++ /dev/null @@ -1,10 +0,0 @@ -import { TrackingActions } from './constants'; - -export const trackInstallationTabChange = { - methods: { - trackInstallationTabChange(tabIndex) { - const action = tabIndex === 0 ? TrackingActions.INSTALLATION : TrackingActions.REGISTRY_SETUP; - this.track(action, { label: this.trackingLabel }); - }, - }, -}; diff --git a/app/assets/javascripts/repository/components/blob_viewers/index.js b/app/assets/javascripts/repository/components/blob_viewers/index.js index f6c34fbb58b..c5209d97abb 100644 --- a/app/assets/javascripts/repository/components/blob_viewers/index.js +++ b/app/assets/javascripts/repository/components/blob_viewers/index.js @@ -10,6 +10,8 @@ export const loadViewer = (type) => { return () => import(/* webpackChunkName: 'blob_download_viewer' */ './download_viewer.vue'); case 'image': return () => import(/* webpackChunkName: 'blob_image_viewer' */ './image_viewer.vue'); + case 'video': + return () => import(/* webpackChunkName: 'blob_video_viewer' */ './video_viewer.vue'); default: return null; } @@ -31,5 +33,8 @@ export const viewerProps = (type, blob) => { url: blob.rawPath, alt: blob.name, }, + video: { + url: blob.rawPath, + }, }[type]; }; diff --git a/app/assets/javascripts/repository/components/blob_viewers/video_viewer.vue b/app/assets/javascripts/repository/components/blob_viewers/video_viewer.vue new file mode 100644 index 00000000000..dec0c4802ca --- /dev/null +++ b/app/assets/javascripts/repository/components/blob_viewers/video_viewer.vue @@ -0,0 +1,15 @@ +<script> +export default { + props: { + url: { + type: String, + required: true, + }, + }, +}; +</script> +<template> + <div class="gl-text-center gl-p-7 gl-bg-gray-50"> + <video :src="url" controls data-testid="video" class="gl-max-w-full"></video> + </div> +</template> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue index 08f4837a5cf..bd531f0cc84 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/base.vue @@ -46,6 +46,8 @@ export default { return true; }, statusIconName() { + if (this.isLoadingSummary) return null; + return this.statusIcon(this.collapsedData); }, }, diff --git a/app/assets/javascripts/vue_merge_request_widget/components/extensions/status_icon.vue b/app/assets/javascripts/vue_merge_request_widget/components/extensions/status_icon.vue index ed6aa8be1d5..5b41decc190 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/extensions/status_icon.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/extensions/status_icon.vue @@ -19,7 +19,8 @@ export default { }, iconName: { type: String, - required: true, + required: false, + default: null, }, }, computed: { diff --git a/app/finders/issuable_finder.rb b/app/finders/issuable_finder.rb index cf706a8f98e..7b0cd17a761 100644 --- a/app/finders/issuable_finder.rb +++ b/app/finders/issuable_finder.rb @@ -194,8 +194,7 @@ class IssuableFinder def use_cte_for_search? strong_memoize(:use_cte_for_search) do next false unless search - # Only simple unsorted & simple sorts can use CTE - next false if params[:sort].present? && !params[:sort].in?(klass.simple_sorts.keys) + next false unless default_or_simple_sort? attempt_group_search_optimizations? || attempt_project_search_optimizations? end @@ -244,6 +243,10 @@ class IssuableFinder klass.all end + def default_or_simple_sort? + params[:sort].blank? || params[:sort].to_s.in?(klass.simple_sorts.keys) + end + def attempt_group_search_optimizations? params[:attempt_group_search_optimizations] end diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index f3c3625e6b0..f137df5575c 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -1427,7 +1427,7 @@ :urgency: :high :resource_boundary: :unknown :weight: 3 - :idempotent: + :idempotent: true :tags: [] - :name: pipeline_cache:expire_pipeline_cache :worker_name: ExpirePipelineCacheWorker diff --git a/app/workers/expire_job_cache_worker.rb b/app/workers/expire_job_cache_worker.rb index 401fe1dc1e5..7374f650546 100644 --- a/app/workers/expire_job_cache_worker.rb +++ b/app/workers/expire_job_cache_worker.rb @@ -10,11 +10,9 @@ class ExpireJobCacheWorker # rubocop:disable Scalability/IdempotentWorker queue_namespace :pipeline_cache urgency :high - # This worker should be idempotent, but we're switching to data_consistency - # :sticky and there is an ongoing incompatibility, so it needs to be disabled for - # now. The following line can be uncommented and this comment removed once - # https://gitlab.com/gitlab-org/gitlab/-/issues/325291 is resolved. - # idempotent! + + deduplicate :until_executing, including_scheduled: true + idempotent! # rubocop: disable CodeReuse/ActiveRecord def perform(job_id) diff --git a/doc/README.md b/doc/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/administration/auth/README.md b/doc/administration/auth/README.md deleted file mode 100644 index 5ab8653dc35..00000000000 --- a/doc/administration/auth/README.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -redirect_to: 'index.md' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/administration/get_started.md b/doc/administration/get_started.md index 18e9264d6d7..2455aecafea 100644 --- a/doc/administration/get_started.md +++ b/doc/administration/get_started.md @@ -214,7 +214,7 @@ If you use GitLab SaaS, you have several channels with which to get support and To get assistance for GitLab SaaS: -- Access [GitLab Docs](../README.md) for self-service support. +- Access [GitLab Docs](../index.md) for self-service support. - Join the [GitLab Forum](https://forum.gitlab.com/) for community support. - Gather [your subscription information](https://about.gitlab.com/support/#for-self-managed-users) before submitting a ticket. - Submit a support ticket for: diff --git a/doc/api/README.md b/doc/api/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/api/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/README.md b/doc/ci/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/chatops/index.md b/doc/ci/chatops/index.md index 19133e355cb..698b467a813 100644 --- a/doc/ci/chatops/index.md +++ b/doc/ci/chatops/index.md @@ -18,7 +18,7 @@ posted back to the channel can significantly augment your team's workflow. ## How GitLab ChatOps works -GitLab ChatOps is built upon [GitLab CI/CD](../README.md) and +GitLab ChatOps is built upon [GitLab CI/CD](../index.md) and [Slack Slash Commands](../../user/project/integrations/slack_slash_commands.md). ChatOps provides a `run` action for [slash commands](../../integration/slash_commands.md) with the following arguments: diff --git a/doc/ci/examples/README.md b/doc/ci/examples/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/examples/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/examples/deployment/README.md b/doc/ci/examples/deployment/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/examples/deployment/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/examples/deployment/composer-npm-deploy.md b/doc/ci/examples/deployment/composer-npm-deploy.md index 6817c7cac8e..aa4055c00ea 100644 --- a/doc/ci/examples/deployment/composer-npm-deploy.md +++ b/doc/ci/examples/deployment/composer-npm-deploy.md @@ -7,7 +7,7 @@ type: tutorial # Running Composer and npm scripts with deployment via SCP in GitLab CI/CD **(FREE)** -This guide covers the building of dependencies of a PHP project while compiling assets via an npm script using [GitLab CI/CD](../../README.md). +This guide covers the building of dependencies of a PHP project while compiling assets via an npm script using [GitLab CI/CD](../../index.md). While it is possible to create your own image with custom PHP and Node.js versions, for brevity we use an existing [Docker image](https://hub.docker.com/r/tetraweb/php/) that contains both PHP and Node.js installed. diff --git a/doc/ci/examples/end_to_end_testing_webdriverio/index.md b/doc/ci/examples/end_to_end_testing_webdriverio/index.md index 06074d6edc2..1fecd6b1b78 100644 --- a/doc/ci/examples/end_to_end_testing_webdriverio/index.md +++ b/doc/ci/examples/end_to_end_testing_webdriverio/index.md @@ -33,7 +33,7 @@ to write such end-to-end tests, and how to set up GitLab CI/CD to automatically against your new code, on a branch-by-branch basis. For the scope of this article, we will walk you through the process of setting up GitLab CI/CD for end-to-end testing JavaScript-based applications with WebdriverIO, but the general strategy should carry over to other languages. -We assume you are familiar with GitLab, [GitLab CI/CD](../../README.md), [Review Apps](../../review_apps/index.md), and running your app locally, e.g., on `localhost:8000`. +We assume you are familiar with GitLab, [GitLab CI/CD](../../index.md), [Review Apps](../../review_apps/index.md), and running your app locally, e.g., on `localhost:8000`. ## What to test diff --git a/doc/ci/examples/index.md b/doc/ci/examples/index.md index 2c2c6ecd30f..0fc7b06a584 100644 --- a/doc/ci/examples/index.md +++ b/doc/ci/examples/index.md @@ -9,7 +9,7 @@ type: index # GitLab CI/CD Examples **(FREE)** This page contains links to a variety of examples that can help you understand how to -implement [GitLab CI/CD](../README.md) for your specific use case. +implement [GitLab CI/CD](../index.md) for your specific use case. Examples are available in several forms. As a collection of: 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 c511839b3e4..e2e12235eba 100644 --- a/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md +++ b/doc/ci/examples/laravel_with_gitlab_and_envoy/index.md @@ -17,7 +17,7 @@ date: 2017-08-31 GitLab features our applications with Continuous Integration, and it is possible to easily deploy the new code changes to the production server whenever we want. -In this tutorial, we'll show you how to initialize a [Laravel](https://laravel.com) application and set up our [Envoy](https://laravel.com/docs/master/envoy) tasks, then we'll jump into see how to test and deploy it with [GitLab CI/CD](../README.md) via [Continuous Delivery](https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/). +In this tutorial, we'll show you how to initialize a [Laravel](https://laravel.com) application and set up our [Envoy](https://laravel.com/docs/master/envoy) tasks, then we'll jump into see how to test and deploy it with [GitLab CI/CD](../index.md) via [Continuous Delivery](https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/). We assume you have a basic experience with Laravel, Linux servers, and you know how to use GitLab. @@ -394,7 +394,7 @@ We have our app ready on GitLab, and we also can deploy it manually. But let's take a step forward to do it automatically with [Continuous Delivery](https://about.gitlab.com/blog/2016/08/05/continuous-integration-delivery-and-deployment-with-gitlab/#continuous-delivery) method. We need to check every commit with a set of automated tests to become aware of issues at the earliest, and then, we can deploy to the target environment if we are happy with the result of the tests. -[GitLab CI/CD](../../README.md) allows us to use [Docker](https://www.docker.com) engine to handle the process of testing and deploying our app. +[GitLab CI/CD](../../index.md) allows us to use [Docker](https://www.docker.com) engine to handle the process of testing and deploying our app. In case you're not familiar with Docker, refer to [Set up automated builds](https://docs.docker.com/get-started/). To be able to build, test, and deploy our app with GitLab CI/CD, we need to prepare our work environment. diff --git a/doc/ci/index.md b/doc/ci/index.md index cc778858e8f..6abc1cdbcea 100644 --- a/doc/ci/index.md +++ b/doc/ci/index.md @@ -111,7 +111,7 @@ GitLab CI/CD features, grouped by DevOps stage, include: ## GitLab CI/CD examples -See the [CI/CD examples](examples/README.md) page for example project code and tutorials for +See the [CI/CD examples](examples/index.md) page for example project code and tutorials for using GitLab CI/CD with various: - App frameworks diff --git a/doc/ci/pipelines/pipeline_efficiency.md b/doc/ci/pipelines/pipeline_efficiency.md index 5c3cdd0633e..94cfeff3acc 100644 --- a/doc/ci/pipelines/pipeline_efficiency.md +++ b/doc/ci/pipelines/pipeline_efficiency.md @@ -7,7 +7,7 @@ type: reference # Pipeline efficiency **(FREE)** -[CI/CD Pipelines](index.md) are the fundamental building blocks for [GitLab CI/CD](../README.md). +[CI/CD Pipelines](index.md) are the fundamental building blocks for [GitLab CI/CD](../index.md). Making pipelines more efficient helps you save developer time, which: - Speeds up your DevOps processes diff --git a/doc/ci/runners/README.md b/doc/ci/runners/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/runners/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/triggers/README.md b/doc/ci/triggers/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/triggers/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/variables/README.md b/doc/ci/variables/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/variables/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/yaml/README.md b/doc/ci/yaml/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ci/yaml/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ci/yaml/index.md b/doc/ci/yaml/index.md index b9b4e1faafb..3fae004a443 100644 --- a/doc/ci/yaml/index.md +++ b/doc/ci/yaml/index.md @@ -10,7 +10,7 @@ type: reference This document lists the configuration options for your GitLab `.gitlab-ci.yml` file. - For a quick introduction to GitLab CI/CD, follow the [quick start guide](../quick_start/index.md). -- For a collection of examples, see [GitLab CI/CD Examples](../examples/README.md). +- For a collection of examples, see [GitLab CI/CD Examples](../examples/index.md). - To view a large `.gitlab-ci.yml` file used in an enterprise, see the [`.gitlab-ci.yml` file for `gitlab`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab-ci.yml). When you are editing your `.gitlab-ci.yml` file, you can validate it with the diff --git a/doc/development/README.md b/doc/development/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/development/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/development/documentation/workflow.md b/doc/development/documentation/workflow.md index 31c38bc1446..0edc1139a9b 100644 --- a/doc/development/documentation/workflow.md +++ b/doc/development/documentation/workflow.md @@ -99,7 +99,7 @@ The process involves the following: - Primary Reviewer. Review by a [code reviewer](https://about.gitlab.com/handbook/engineering/projects/) or other appropriate colleague to confirm accuracy, clarity, and completeness. This can be skipped for minor fixes without substantive content changes. -- Technical Writer (Optional). If not completed for a merge request prior to merging, must be scheduled +- Technical Writer (Optional). If not completed for a merge request before merging, must be scheduled post-merge. Schedule post-merge reviews only if an urgent merge is required. To request a: - Pre-merge review, assign the Technical Writer listed for the applicable [DevOps stage group](https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments). @@ -111,7 +111,7 @@ The process involves the following: - Ensure the appropriate labels are applied, including any required to pick a merge request into a release. - Ensure that, if there has not been a Technical Writer review completed or scheduled, they - [create the required issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Doc%20Review), assign to the Technical Writer of the given stage group, + [create the required issue](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Doc%20Review), assign it to the Technical Writer of the given stage group, and link it from the merge request. The process is reflected in the **Documentation** @@ -130,10 +130,10 @@ immediately after merge by the developer or maintainer. For this, create an issue using the [Doc Review description template](https://gitlab.com/gitlab-org/gitlab/-/issues/new?issuable_template=Doc%20Review) and link to it from the merged merge request that introduced the documentation change. -Circumstances where a regular pre-merge Technical Writer review might be skipped include: +Circumstances, where a regular pre-merge Technical Writer review might be skipped, include: -- There is a short amount of time left before the milestone release. If there are less than three days - remaining, seek a post-merge review and ping the writer via Slack to ensure the review is +- There is a short amount of time left before the milestone release. If less than three + days are remaining, seek a post-merge review and ping the writer via Slack to ensure the review is completed as soon as possible. - The size of the change is small and you have a high degree of confidence that early users of the feature (for example, GitLab.com users) can easily @@ -156,15 +156,15 @@ Remember: Ensure the following if skipping an initial Technical Writer review: -- That [product badges](styleguide/index.md#product-tier-badges) are applied. -- That the GitLab [version](styleguide/index.md#gitlab-versions) that - introduced the feature has been included. -- That changes to headings don't affect in-app hyperlinks. +- [Product badges](styleguide/index.md#product-tier-badges) are applied. +- The GitLab [version](styleguide/index.md#gitlab-versions) that + introduced the feature is included. +- Changes to headings don't affect in-app hyperlinks. - Specific [user permissions](../../user/permissions.md) are documented. -- That new documents are linked from higher-level indexes, for discoverability. -- Style guide is followed: +- New documents are linked from higher-level indexes, for discoverability. +- The style guide is followed: - For [directories and files](styleguide/index.md#work-with-directories-and-files). - For [images](styleguide/index.md#images). Merge requests that change the location of documentation must always be reviewed by a Technical -Writer prior to merging. +Writer before merging. diff --git a/doc/development/index.md b/doc/development/index.md index d9666577859..a2ede5ab770 100644 --- a/doc/development/index.md +++ b/doc/development/index.md @@ -18,7 +18,7 @@ the [Handbook](https://about.gitlab.com/handbook/). For information on using GitLab to work on your own software projects, see the [GitLab user documentation](../user/index.md). -For information on working with the GitLab APIs, see the [API documentation](../api/README.md). +For information on working with the GitLab APIs, see the [API documentation](../api/index.md). For information about how to install, configure, update, and upgrade your own GitLab instance, see the [administration documentation](../administration/index.md). diff --git a/doc/index.md b/doc/index.md index cb8b0e67f7d..9c96c966aee 100644 --- a/doc/index.md +++ b/doc/index.md @@ -108,7 +108,7 @@ There are many ways to integrate with GitLab, including: | Topic | Description | |:-------------------------------------------|:------------| -| [GitLab REST API](api/README.md) | Integrate with GitLab using our REST API. | +| [GitLab REST API](api/index.md) | Integrate with GitLab using our REST API. | | [GitLab GraphQL API](api/graphql/index.md) | Integrate with GitLab using our GraphQL API. | | [Integrations](integration/index.md) | Integrations with third-party products. | diff --git a/doc/security/README.md b/doc/security/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/security/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/ssh/README.md b/doc/ssh/README.md deleted file mode 100644 index 0e6c2f63f9e..00000000000 --- a/doc/ssh/README.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -redirect_to: 'index.md' -remove_date: '2021-09-28' ---- - -This document was moved to [another location](index.md). - -<!-- This redirect file can be deleted after 2021-09-28. --> -<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page --> diff --git a/doc/user/permissions.md b/doc/user/permissions.md index 116982641c9..7ad6ffd2980 100644 --- a/doc/user/permissions.md +++ b/doc/user/permissions.md @@ -59,21 +59,21 @@ The following table lists project permissions available for each role: | [Application security](application_security/index.md):<br>View [threats list](application_security/threat_monitoring/index.md#threat-monitoring) **(ULTIMATE)** | | | ✓ | ✓ | ✓ | | [Application security](application_security/index.md):<br>Create a [CVE ID Request](application_security/cve_id_request.md) **(FREE SAAS)** | | | | ✓ | ✓ | | [Application security](application_security/index.md):<br>Create or assign [security policy project](application_security/policies/index.md) **(ULTIMATE)** | | | | | ✓ | -| [CI/CD](../ci/README.md):<br>Download and browse job artifacts | ✓ (*3*) | ✓ | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>View a job log | ✓ (*3*) | ✓ | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>View list of jobs | ✓ (*3*) | ✓ | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>View [environments](../ci/environments/index.md) | | ✓ | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Cancel and retry jobs | | | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Create new [environments](../ci/environments/index.md) | | | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Run CI/CD pipeline against a protected branch | | | ✓ (*5*) | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Stop [environments](../ci/environments/index.md) | | | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>View a job with [debug logging](../ci/variables/index.md#debug-logging) | | | ✓ | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Manage CI/CD variables | | | | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Manage job triggers | | | | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Manage runners | | | | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Run Web IDE's Interactive Web Terminals **(ULTIMATE ONLY)** | | | | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Use [environment terminals](../ci/environments/index.md#web-terminals) | | | | ✓ | ✓ | -| [CI/CD](../ci/README.md):<br>Delete pipelines | | | | | ✓ | +| [CI/CD](../ci/index.md):<br>Download and browse job artifacts | ✓ (*3*) | ✓ | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>View a job log | ✓ (*3*) | ✓ | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>View list of jobs | ✓ (*3*) | ✓ | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>View [environments](../ci/environments/index.md) | | ✓ | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Cancel and retry jobs | | | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Create new [environments](../ci/environments/index.md) | | | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Run CI/CD pipeline against a protected branch | | | ✓ (*5*) | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Stop [environments](../ci/environments/index.md) | | | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>View a job with [debug logging](../ci/variables/index.md#debug-logging) | | | ✓ | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Manage CI/CD variables | | | | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Manage job triggers | | | | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Manage runners | | | | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Run Web IDE's Interactive Web Terminals **(ULTIMATE ONLY)** | | | | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Use [environment terminals](../ci/environments/index.md#web-terminals) | | | | ✓ | ✓ | +| [CI/CD](../ci/index.md):<br>Delete pipelines | | | | | ✓ | | [Clusters](project/clusters/index.md):<br>View pod logs | | | ✓ | ✓ | ✓ | | [Clusters](project/clusters/index.md):<br>Manage clusters | | | | ✓ | ✓ | | [Container Registry](packages/container_registry/index.md):<br>Create, edit, delete cleanup policies | | | ✓ | ✓ | ✓ | diff --git a/doc/user/project/clusters/protect/container_network_security/quick_start_guide.md b/doc/user/project/clusters/protect/container_network_security/quick_start_guide.md index 1940cf229b8..283e6c0b81c 100644 --- a/doc/user/project/clusters/protect/container_network_security/quick_start_guide.md +++ b/doc/user/project/clusters/protect/container_network_security/quick_start_guide.md @@ -57,7 +57,7 @@ to install Cilium in your Kubernetes cluster. ``` 1. Merge or push these changes to the default branch of your cluster management project, -and [GitLab CI/CD](../../../../../ci/README.md) will automatically install Cilium. +and [GitLab CI/CD](../../../../../ci/index.md) will automatically install Cilium. WARNING: Installation and removal of the Cilium requires a **manual** diff --git a/doc/user/project/working_with_projects.md b/doc/user/project/working_with_projects.md index cd6f5ea04ac..11b570f19e5 100644 --- a/doc/user/project/working_with_projects.md +++ b/doc/user/project/working_with_projects.md @@ -165,7 +165,7 @@ To push a new project: As project creation permissions can have many factors, contact your GitLab administrator if you're unsure. -1. If you want to push using SSH, ensure you have [created a SSH key](../../ssh/README.md) and +1. If you want to push using SSH, ensure you have [created a SSH key](../../ssh/index.md) and [added it to your GitLab account](../../ssh/index.md#add-an-ssh-key-to-your-gitlab-account). 1. Push with one of the following methods. Replace `gitlab.example.com` with the domain name of the machine that hosts your Git repository, `namespace` with the name of diff --git a/lib/tasks/gitlab/packages/composer.rake b/lib/tasks/gitlab/packages/composer.rake deleted file mode 100644 index 97f1da0ff63..00000000000 --- a/lib/tasks/gitlab/packages/composer.rake +++ /dev/null @@ -1,20 +0,0 @@ -# frozen_string_literal: true - -require 'logger' - -desc "GitLab | Packages | Build composer cache" -namespace :gitlab do - namespace :packages do - task build_composer_cache: :environment do - logger = Logger.new($stdout) - logger.info('Starting to build composer cache files') - - ::Packages::Package.composer.find_in_batches do |packages| - packages.group_by { |pkg| [pkg.project_id, pkg.name] }.each do |(project_id, name), packages| - logger.info("Building cache for #{project_id} -> #{name}") - Gitlab::Composer::Cache.new(project: packages.first.project, name: name).execute - end - end - end - end -end diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index a014a1d622c..e99b8a47301 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -67,7 +67,7 @@ fi # Do not use 'README.md', instead use 'index.md' # Number of 'README.md's as of 2021-08-17 -NUMBER_READMES=13 +NUMBER_READMES=0 FIND_READMES=$(find doc/ -name "README.md" | wc -l) echo '=> Checking for new README.md files...' echo diff --git a/spec/features/projects/ci/lint_spec.rb b/spec/features/projects/ci/lint_spec.rb index 0d9ea6331a7..7f10c6afcd5 100644 --- a/spec/features/projects/ci/lint_spec.rb +++ b/spec/features/projects/ci/lint_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe 'CI Lint', :js, quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/297782' do +RSpec.describe 'CI Lint', :js do include Spec::Support::Helpers::Features::SourceEditorSpecHelpers let(:project) { create(:project, :repository) } diff --git a/spec/finders/issues_finder_spec.rb b/spec/finders/issues_finder_spec.rb index ed35d75720c..9f12308013e 100644 --- a/spec/finders/issues_finder_spec.rb +++ b/spec/finders/issues_finder_spec.rb @@ -1199,6 +1199,14 @@ RSpec.describe IssuesFinder do end end + context 'when a non-simple sort is given' do + let(:params) { { search: 'foo', attempt_project_search_optimizations: true, sort: 'popularity' } } + + it 'returns false' do + expect(finder.use_cte_for_search?).to be_falsey + end + end + context 'when all conditions are met' do context "uses group search optimization" do let(:params) { { search: 'foo', attempt_group_search_optimizations: true } } @@ -1217,6 +1225,24 @@ RSpec.describe IssuesFinder do expect(finder.execute.to_sql).to match(/^WITH "issues" AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported}/) end end + + context 'with simple sort' do + let(:params) { { search: 'foo', attempt_project_search_optimizations: true, sort: 'updated_desc' } } + + it 'returns true' do + expect(finder.use_cte_for_search?).to be_truthy + expect(finder.execute.to_sql).to match(/^WITH "issues" AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported}/) + end + end + + context 'with simple sort as a symbol' do + let(:params) { { search: 'foo', attempt_project_search_optimizations: true, sort: :updated_desc } } + + it 'returns true' do + expect(finder.use_cte_for_search?).to be_truthy + expect(finder.execute.to_sql).to match(/^WITH "issues" AS #{Gitlab::Database::AsWithMaterialized.materialized_if_supported}/) + end + end end end diff --git a/spec/frontend/packages/details/store/getters_spec.js b/spec/frontend/packages/details/store/getters_spec.js index 8210511bf8f..4eccb766a89 100644 --- a/spec/frontend/packages/details/store/getters_spec.js +++ b/spec/frontend/packages/details/store/getters_spec.js @@ -1,54 +1,15 @@ -import { NpmManager } from '~/packages/details/constants'; +import { packagePipeline } from '~/packages/details/store/getters'; import { - conanInstallationCommand, - conanSetupCommand, - packagePipeline, - packageTypeDisplay, - packageIcon, - mavenInstallationXml, - mavenInstallationCommand, - mavenSetupXml, - npmInstallationCommand, - npmSetupCommand, - nugetInstallationCommand, - nugetSetupCommand, - pypiPipCommand, - pypiSetupCommand, - composerRegistryInclude, - composerPackageInclude, - groupExists, - gradleGroovyInstalCommand, - gradleGroovyAddSourceCommand, - gradleKotlinInstalCommand, - gradleKotlinAddSourceCommand, -} from '~/packages/details/store/getters'; -import { - conanPackage, npmPackage, - nugetPackage, mockPipelineInfo, mavenPackage as packageWithoutBuildInfo, - pypiPackage, - rubygemsPackage, } from '../../mock_data'; -import { - generateMavenCommand, - generateXmlCodeBlock, - generateMavenSetupXml, - registryUrl, - pypiSetupCommandStr, -} from '../mock_data'; describe('Getters PackageDetails Store', () => { let state; const defaultState = { packageEntity: packageWithoutBuildInfo, - conanPath: registryUrl, - mavenPath: registryUrl, - npmPath: registryUrl, - nugetPath: registryUrl, - pypiPath: registryUrl, }; const setupState = (testState = {}) => { @@ -58,28 +19,6 @@ describe('Getters PackageDetails Store', () => { }; }; - const conanInstallationCommandStr = `conan install ${conanPackage.name} --remote=gitlab`; - const conanSetupCommandStr = `conan remote add gitlab ${registryUrl}`; - - const mavenCommandStr = generateMavenCommand(packageWithoutBuildInfo.maven_metadatum); - const mavenInstallationXmlBlock = generateXmlCodeBlock(packageWithoutBuildInfo.maven_metadatum); - const mavenSetupXmlBlock = generateMavenSetupXml(); - - const npmInstallStr = `npm i ${npmPackage.name}`; - const npmSetupStr = `echo @Test:registry=${registryUrl}/ >> .npmrc`; - const yarnInstallStr = `yarn add ${npmPackage.name}`; - const yarnSetupStr = `echo \\"@Test:registry\\" \\"${registryUrl}/\\" >> .yarnrc`; - - const nugetInstallationCommandStr = `nuget install ${nugetPackage.name} -Source "GitLab"`; - const nugetSetupCommandStr = `nuget source Add -Name "GitLab" -Source "${registryUrl}" -UserName <your_username> -Password <your_token>`; - - const pypiPipCommandStr = `pip install ${pypiPackage.name} --extra-index-url ${registryUrl}`; - const composerRegistryIncludeStr = - 'composer config repositories.gitlab.com/123 \'{"type": "composer", "url": "foo"}\''; - const composerPackageIncludeStr = `composer req ${[packageWithoutBuildInfo.name]}:${ - packageWithoutBuildInfo.version - }`; - describe('packagePipeline', () => { it('should return the pipeline info when pipeline exists', () => { setupState({ @@ -93,203 +32,9 @@ describe('Getters PackageDetails Store', () => { }); it('should return null when build_info does not exist', () => { - setupState(); + setupState({ pipeline: undefined }); expect(packagePipeline(state)).toBe(null); }); }); - - describe('packageTypeDisplay', () => { - describe.each` - packageEntity | expectedResult - ${conanPackage} | ${'Conan'} - ${packageWithoutBuildInfo} | ${'Maven'} - ${npmPackage} | ${'npm'} - ${nugetPackage} | ${'NuGet'} - ${pypiPackage} | ${'PyPI'} - ${rubygemsPackage} | ${'RubyGems'} - `(`package type`, ({ packageEntity, expectedResult }) => { - beforeEach(() => setupState({ packageEntity })); - - it(`${packageEntity.package_type} should show as ${expectedResult}`, () => { - expect(packageTypeDisplay(state)).toBe(expectedResult); - }); - }); - }); - - describe('packageIcon', () => { - describe('nuget packages', () => { - it('should return nuget package icon', () => { - setupState({ packageEntity: nugetPackage }); - - expect(packageIcon(state)).toBe(nugetPackage.nuget_metadatum.icon_url); - }); - - it('should return null when nuget package does not have an icon', () => { - setupState({ packageEntity: { ...nugetPackage, nuget_metadatum: {} } }); - - expect(packageIcon(state)).toBe(null); - }); - }); - - it('should not find icons for other package types', () => { - setupState({ packageEntity: npmPackage }); - - expect(packageIcon(state)).toBe(null); - }); - }); - - describe('conan string getters', () => { - it('gets the correct conanInstallationCommand', () => { - setupState({ packageEntity: conanPackage }); - - expect(conanInstallationCommand(state)).toBe(conanInstallationCommandStr); - }); - - it('gets the correct conanSetupCommand', () => { - setupState({ packageEntity: conanPackage }); - - expect(conanSetupCommand(state)).toBe(conanSetupCommandStr); - }); - }); - - describe('maven string getters', () => { - it('gets the correct mavenInstallationXml', () => { - setupState(); - - expect(mavenInstallationXml(state)).toBe(mavenInstallationXmlBlock); - }); - - it('gets the correct mavenInstallationCommand', () => { - setupState(); - - expect(mavenInstallationCommand(state)).toBe(mavenCommandStr); - }); - - it('gets the correct mavenSetupXml', () => { - setupState(); - - expect(mavenSetupXml(state)).toBe(mavenSetupXmlBlock); - }); - }); - - describe('npm string getters', () => { - it('gets the correct npmInstallationCommand for npm', () => { - setupState({ packageEntity: npmPackage }); - - expect(npmInstallationCommand(state)(NpmManager.NPM)).toBe(npmInstallStr); - }); - - it('gets the correct npmSetupCommand for npm', () => { - setupState({ packageEntity: npmPackage }); - - expect(npmSetupCommand(state)(NpmManager.NPM)).toBe(npmSetupStr); - }); - - it('gets the correct npmInstallationCommand for Yarn', () => { - setupState({ packageEntity: npmPackage }); - - expect(npmInstallationCommand(state)(NpmManager.YARN)).toBe(yarnInstallStr); - }); - - it('gets the correct npmSetupCommand for Yarn', () => { - setupState({ packageEntity: npmPackage }); - - expect(npmSetupCommand(state)(NpmManager.YARN)).toBe(yarnSetupStr); - }); - }); - - describe('nuget string getters', () => { - it('gets the correct nugetInstallationCommand', () => { - setupState({ packageEntity: nugetPackage }); - - expect(nugetInstallationCommand(state)).toBe(nugetInstallationCommandStr); - }); - - it('gets the correct nugetSetupCommand', () => { - setupState({ packageEntity: nugetPackage }); - - expect(nugetSetupCommand(state)).toBe(nugetSetupCommandStr); - }); - }); - - describe('pypi string getters', () => { - it('gets the correct pypiPipCommand', () => { - setupState({ packageEntity: pypiPackage }); - - expect(pypiPipCommand(state)).toBe(pypiPipCommandStr); - }); - - it('gets the correct pypiSetupCommand', () => { - setupState({ pypiSetupPath: 'foo' }); - - expect(pypiSetupCommand(state)).toBe(pypiSetupCommandStr); - }); - }); - - describe('composer string getters', () => { - it('gets the correct composerRegistryInclude command', () => { - setupState({ composerPath: 'foo', composerConfigRepositoryName: 'gitlab.com/123' }); - - expect(composerRegistryInclude(state)).toBe(composerRegistryIncludeStr); - }); - - it('gets the correct composerPackageInclude command', () => { - setupState(); - - expect(composerPackageInclude(state)).toBe(composerPackageIncludeStr); - }); - }); - - describe('gradle groovy string getters', () => { - it('gets the correct gradleGroovyInstalCommand', () => { - setupState(); - - expect(gradleGroovyInstalCommand(state)).toMatchInlineSnapshot( - `"implementation 'com.test.app:test-app:1.0-SNAPSHOT'"`, - ); - }); - - it('gets the correct gradleGroovyAddSourceCommand', () => { - setupState(); - - expect(gradleGroovyAddSourceCommand(state)).toMatchInlineSnapshot(` - "maven { - url 'foo/registry' - }" - `); - }); - }); - - describe('gradle kotlin string getters', () => { - it('gets the correct gradleKotlinInstalCommand', () => { - setupState(); - - expect(gradleKotlinInstalCommand(state)).toMatchInlineSnapshot( - `"implementation(\\"com.test.app:test-app:1.0-SNAPSHOT\\")"`, - ); - }); - - it('gets the correct gradleKotlinAddSourceCommand', () => { - setupState(); - - expect(gradleKotlinAddSourceCommand(state)).toMatchInlineSnapshot( - `"maven(\\"foo/registry\\")"`, - ); - }); - }); - - describe('check if group', () => { - it('is set', () => { - setupState({ groupListUrl: '/groups/composer/-/packages' }); - - expect(groupExists(state)).toBe(true); - }); - - it('is not set', () => { - setupState({ groupListUrl: '' }); - - expect(groupExists(state)).toBe(false); - }); - }); }); diff --git a/spec/frontend/repository/components/blob_viewers/video_viewer_spec.js b/spec/frontend/repository/components/blob_viewers/video_viewer_spec.js new file mode 100644 index 00000000000..34448c03b31 --- /dev/null +++ b/spec/frontend/repository/components/blob_viewers/video_viewer_spec.js @@ -0,0 +1,22 @@ +import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; +import VideoViewer from '~/repository/components/blob_viewers/video_viewer.vue'; + +describe('Video Viewer', () => { + let wrapper; + + const propsData = { url: 'some/video.mp4' }; + + const createComponent = () => { + wrapper = shallowMountExtended(VideoViewer, { propsData }); + }; + + const findVideo = () => wrapper.findByTestId('video'); + + it('renders a Video element', () => { + createComponent(); + + expect(findVideo().exists()).toBe(true); + expect(findVideo().attributes('src')).toBe(propsData.url); + expect(findVideo().attributes('controls')).not.toBeUndefined(); + }); +}); diff --git a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js index 24d2b39ce87..a474c34af41 100644 --- a/spec/frontend/vue_mr_widget/mr_widget_options_spec.js +++ b/spec/frontend/vue_mr_widget/mr_widget_options_spec.js @@ -10,7 +10,10 @@ import axios from '~/lib/utils/axios_utils'; import { setFaviconOverlay } from '~/lib/utils/favicon'; import notify from '~/lib/utils/notify'; import SmartInterval from '~/smart_interval'; -import { registerExtension } from '~/vue_merge_request_widget/components/extensions'; +import { + registerExtension, + registeredExtensions, +} from '~/vue_merge_request_widget/components/extensions'; import { SUCCESS } from '~/vue_merge_request_widget/components/deployment/constants'; import eventHub from '~/vue_merge_request_widget/event_hub'; import MrWidgetOptions from '~/vue_merge_request_widget/mr_widget_options.vue'; @@ -886,20 +889,22 @@ describe('MrWidgetOptions', () => { describe('mock extension', () => { beforeEach(() => { + registerExtension(testExtension); + createComponent(); }); - it('renders collapsed data', async () => { - registerExtension(testExtension); + afterEach(() => { + registeredExtensions.extensions = []; + }); + it('renders collapsed data', async () => { await waitForPromises(); expect(wrapper.text()).toContain('Test extension summary count: 1'); }); it('renders full data', async () => { - registerExtension(testExtension); - await waitForPromises(); wrapper diff --git a/spec/frontend/vue_mr_widget/test_extension.js b/spec/frontend/vue_mr_widget/test_extension.js index 7ea42e33103..ba354403f2d 100644 --- a/spec/frontend/vue_mr_widget/test_extension.js +++ b/spec/frontend/vue_mr_widget/test_extension.js @@ -1,3 +1,5 @@ +import { EXTENSION_ICONS } from '~/vue_merge_request_widget/constants'; + export default { name: 'WidgetTestExtension', props: ['targetProjectFullPath'], @@ -6,7 +8,7 @@ export default { return `Test extension summary count: ${count} & ${targetProjectFullPath}`; }, statusIcon({ count }) { - return count > 0 ? 'warning' : 'success'; + return count > 0 ? EXTENSION_ICONS.warning : EXTENSION_ICONS.success; }, }, methods: { diff --git a/spec/tasks/gitlab/packages/composer_rake_spec.rb b/spec/tasks/gitlab/packages/composer_rake_spec.rb deleted file mode 100644 index f4f43bf77d8..00000000000 --- a/spec/tasks/gitlab/packages/composer_rake_spec.rb +++ /dev/null @@ -1,29 +0,0 @@ -# frozen_string_literal: true - -require 'rake_helper' - -RSpec.describe 'gitlab:packages:build_composer_cache namespace rake task', :silence_stdout do - let_it_be(:package_name) { 'sample-project' } - let_it_be(:package_name2) { 'sample-project2' } - let_it_be(:json) { { 'name' => package_name } } - let_it_be(:json2) { { 'name' => package_name2 } } - let_it_be(:group) { create(:group) } - let_it_be(:project) { create(:project, :custom_repo, files: { 'composer.json' => json.to_json }, group: group) } - let_it_be(:project2) { create(:project, :custom_repo, files: { 'composer.json' => json2.to_json }, group: group) } - - let!(:package) { create(:composer_package, :with_metadatum, project: project, name: package_name, version: '1.0.0', json: json) } - let!(:package2) { create(:composer_package, :with_metadatum, project: project, name: package_name, version: '2.0.0', json: json) } - let!(:package3) { create(:composer_package, :with_metadatum, project: project2, name: package_name2, version: '3.0.0', json: json2) } - - before :all do - Rake.application.rake_require 'tasks/gitlab/packages/composer' - end - - subject do - run_rake_task("gitlab:packages:build_composer_cache") - end - - it 'generates the cache files' do - expect { subject }.to change { Packages::Composer::CacheFile.count }.by(2) - end -end diff --git a/spec/workers/expire_job_cache_worker_spec.rb b/spec/workers/expire_job_cache_worker_spec.rb index 6b14ccea105..e9af39ed2df 100644 --- a/spec/workers/expire_job_cache_worker_spec.rb +++ b/spec/workers/expire_job_cache_worker_spec.rb @@ -13,6 +13,8 @@ RSpec.describe ExpireJobCacheWorker do let(:job_args) { job.id } + it_behaves_like 'an idempotent worker' + it_behaves_like 'worker with data consistency', described_class, data_consistency: :delayed |