Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2020-11-14 00:09:32 +00:00
parent c19dce027b
commit f1087d16f7
32 changed files with 204 additions and 95 deletions

View File

@ -1,7 +1,6 @@
<script> <script>
import { GlIcon } from '@gitlab/ui'; import { GlIcon, GlTooltipDirective } from '@gitlab/ui';
import { __, sprintf } from '~/locale'; import { __, sprintf } from '~/locale';
import tooltip from '~/vue_shared/directives/tooltip';
import '~/lib/utils/datetime_utility'; import '~/lib/utils/datetime_utility';
export default { export default {
@ -9,7 +8,7 @@ export default {
GlIcon, GlIcon,
}, },
directives: { directives: {
tooltip, GlTooltip: GlTooltipDirective,
}, },
props: { props: {
file: { file: {
@ -28,7 +27,7 @@ export default {
</script> </script>
<template> <template>
<span v-if="file.file_lock" v-tooltip :title="lockTooltip" data-container="body"> <span v-if="file.file_lock" v-gl-tooltip :title="lockTooltip" data-container="body">
<gl-icon name="lock" class="file-status-icon" /> <gl-icon name="lock" class="file-status-icon" />
</span> </span>
</template> </template>

View File

@ -96,7 +96,8 @@ class Namespace < ApplicationRecord
'COALESCE(SUM(ps.snippets_size), 0) AS snippets_size', 'COALESCE(SUM(ps.snippets_size), 0) AS snippets_size',
'COALESCE(SUM(ps.lfs_objects_size), 0) AS lfs_objects_size', 'COALESCE(SUM(ps.lfs_objects_size), 0) AS lfs_objects_size',
'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size', 'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size',
'COALESCE(SUM(ps.packages_size), 0) AS packages_size' 'COALESCE(SUM(ps.packages_size), 0) AS packages_size',
'COALESCE(SUM(ps.uploads_size), 0) AS uploads_size'
) )
end end

View File

@ -11,6 +11,7 @@ class Namespace::RootStorageStatistics < ApplicationRecord
packages_size packages_size
#{SNIPPETS_SIZE_STAT_NAME} #{SNIPPETS_SIZE_STAT_NAME}
pipeline_artifacts_size pipeline_artifacts_size
uploads_size
).freeze ).freeze
self.primary_key = :namespace_id self.primary_key = :namespace_id
@ -50,7 +51,8 @@ class Namespace::RootStorageStatistics < ApplicationRecord
'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size', 'COALESCE(SUM(ps.build_artifacts_size), 0) AS build_artifacts_size',
'COALESCE(SUM(ps.packages_size), 0) AS packages_size', 'COALESCE(SUM(ps.packages_size), 0) AS packages_size',
"COALESCE(SUM(ps.snippets_size), 0) AS #{SNIPPETS_SIZE_STAT_NAME}", "COALESCE(SUM(ps.snippets_size), 0) AS #{SNIPPETS_SIZE_STAT_NAME}",
'COALESCE(SUM(ps.pipeline_artifacts_size), 0) AS pipeline_artifacts_size' 'COALESCE(SUM(ps.pipeline_artifacts_size), 0) AS pipeline_artifacts_size',
'COALESCE(SUM(ps.uploads_size), 0) AS uploads_size'
) )
end end

View File

@ -19,14 +19,14 @@ class ProjectStatistics < ApplicationRecord
before_save :update_storage_size before_save :update_storage_size
COLUMNS_TO_REFRESH = [:repository_size, :wiki_size, :lfs_objects_size, :commit_count, :snippets_size].freeze COLUMNS_TO_REFRESH = [:repository_size, :wiki_size, :lfs_objects_size, :commit_count, :snippets_size, :uploads_size].freeze
INCREMENTABLE_COLUMNS = { INCREMENTABLE_COLUMNS = {
build_artifacts_size: %i[storage_size], build_artifacts_size: %i[storage_size],
packages_size: %i[storage_size], packages_size: %i[storage_size],
pipeline_artifacts_size: %i[storage_size], pipeline_artifacts_size: %i[storage_size],
snippets_size: %i[storage_size] snippets_size: %i[storage_size]
}.freeze }.freeze
NAMESPACE_RELATABLE_COLUMNS = [:repository_size, :wiki_size, :lfs_objects_size].freeze NAMESPACE_RELATABLE_COLUMNS = [:repository_size, :wiki_size, :lfs_objects_size, :uploads_size].freeze
scope :for_project_ids, ->(project_ids) { where(project_id: project_ids) } scope :for_project_ids, ->(project_ids) { where(project_id: project_ids) }
@ -72,6 +72,12 @@ class ProjectStatistics < ApplicationRecord
self.lfs_objects_size = project.lfs_objects.sum(:size) self.lfs_objects_size = project.lfs_objects.sum(:size)
end end
def update_uploads_size
return uploads_size unless Feature.enabled?(:count_uploads_size_in_storage_stats, project)
self.uploads_size = project.uploads.sum(:size)
end
# `wiki_size` and `snippets_size` have no default value in the database # `wiki_size` and `snippets_size` have no default value in the database
# and the column can be nil. # and the column can be nil.
# This means that, when the columns were added, all rows had nil # This means that, when the columns were added, all rows had nil
@ -98,6 +104,10 @@ class ProjectStatistics < ApplicationRecord
# might try to update project statistics before the `pipeline_artifacts_size` column has been created. # might try to update project statistics before the `pipeline_artifacts_size` column has been created.
storage_size += pipeline_artifacts_size if self.class.column_names.include?('pipeline_artifacts_size') storage_size += pipeline_artifacts_size if self.class.column_names.include?('pipeline_artifacts_size')
# The `uploads_size` column was added on 20201105021637 but db/post_migrate/20190527194900_schedule_calculate_wiki_sizes.rb
# might try to update project statistics before the `uploads_size` column has been created.
storage_size += uploads_size if self.class.column_names.include?('uploads_size')
self.storage_size = storage_size self.storage_size = storage_size
end end

View File

@ -0,0 +1,5 @@
---
title: Account for uploads as part of used repository storage
merge_request: 46941
author:
type: added

View File

@ -0,0 +1,8 @@
---
name: count_uploads_size_in_storage_stats
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/46941
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/281950
milestone: '13.6'
type: development
group: group::project management
default_enabled: false

View File

@ -1,8 +0,0 @@
---
name: sse_image_uploads
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/35126
rollout_issue_url:
milestone: '13.2'
type: development
group: group::static site editor
default_enabled: false

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class AddUploadsSizeToProjectStatistics < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
add_column :project_statistics, :uploads_size, :bigint, default: 0, null: false
end
def down
remove_column :project_statistics, :uploads_size
end
end

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class AddUploadsSizeToNamespaceRootStorageStatistics < ActiveRecord::Migration[6.0]
DOWNTIME = false
def up
add_column :namespace_root_storage_statistics, :uploads_size, :bigint, default: 0, null: false
end
def down
remove_column :namespace_root_storage_statistics, :uploads_size
end
end

View File

@ -0,0 +1 @@
b04e37c8713a333afbff4c7034d9f3ffca4a4490d0b563b73d9e6bffd45f3f6a

View File

@ -0,0 +1 @@
afeff8d6bf5ca14f955f5d387e8d219e852e9617b80fe07ed2e1b57af19fd4fa

View File

@ -13876,7 +13876,8 @@ CREATE TABLE namespace_root_storage_statistics (
storage_size bigint DEFAULT 0 NOT NULL, storage_size bigint DEFAULT 0 NOT NULL,
packages_size bigint DEFAULT 0 NOT NULL, packages_size bigint DEFAULT 0 NOT NULL,
snippets_size bigint DEFAULT 0 NOT NULL, snippets_size bigint DEFAULT 0 NOT NULL,
pipeline_artifacts_size bigint DEFAULT 0 NOT NULL pipeline_artifacts_size bigint DEFAULT 0 NOT NULL,
uploads_size bigint DEFAULT 0 NOT NULL
); );
CREATE TABLE namespace_settings ( CREATE TABLE namespace_settings (
@ -15260,7 +15261,8 @@ CREATE TABLE project_statistics (
packages_size bigint DEFAULT 0 NOT NULL, packages_size bigint DEFAULT 0 NOT NULL,
wiki_size bigint, wiki_size bigint,
snippets_size bigint, snippets_size bigint,
pipeline_artifacts_size bigint DEFAULT 0 NOT NULL pipeline_artifacts_size bigint DEFAULT 0 NOT NULL,
uploads_size bigint DEFAULT 0 NOT NULL
); );
CREATE SEQUENCE project_statistics_id_seq CREATE SEQUENCE project_statistics_id_seq

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -345,9 +345,9 @@ location. You can then go back to running it from within GitLab CI.
## Managing state files ## Managing state files
NOTE: **Note:** NOTE: **Note:**
We are currently working on [providing a graphical for managing state files](https://gitlab.com/groups/gitlab-org/-/epics/4563). We are currently working on [providing a graphical interface for managing state files](https://gitlab.com/groups/gitlab-org/-/epics/4563).
![Terraform state list](img/terraform_list_view.png) ![Terraform state list](img/terraform_list_view_v13_5.png)
The state files attached to a project can be found under Operations / Terraform. The state files attached to a project can be found under Operations / Terraform.

View File

@ -12,23 +12,27 @@ info: To determine the technical writer assigned to the Stage/Group associated w
Publish Conan packages in your projects Package Registry. Then install the Publish Conan packages in your projects Package Registry. Then install the
packages whenever you need to use them as a dependency. packages whenever you need to use them as a dependency.
To publish Conan packages to the Package Registry, add the To publish Conan packages to the Package Registry, add the Package Registry as a
Package Registry as a remote and authenticate with it. remote and authenticate with it.
Then you can run `conan` commands and publish your package to the Package Registry. Then you can run `conan` commands and publish your package to the
Package Registry.
## Build a Conan package ## Build a Conan package
This section explains how to install Conan and build a package for your C/C++ project. This section explains how to install Conan and build a package for your C/C++
project.
If you already use Conan and know how to build your own packages, go to the [next section](#add-the-package-registry-as-a-conan-remote). If you already use Conan and know how to build your own packages, go to the
[next section](#add-the-package-registry-as-a-conan-remote).
### Install Conan ### Install Conan
Download the Conan package manager to your local development environment by following Download the Conan package manager to your local development environment by
the instructions at [conan.io](https://conan.io/downloads.html). following the instructions at [conan.io](https://conan.io/downloads.html).
When installation is complete, verify you can use Conan in your terminal by running: When installation is complete, verify you can use Conan in your terminal by
running:
```shell ```shell
conan --version conan --version
@ -42,15 +46,16 @@ Conan version 1.20.5
### Install CMake ### Install CMake
When you develop with C++ and Conan, you have a range of compilers to choose from. When you develop with C++ and Conan, you can select from many available
This example uses the CMake compiler. compilers. This example uses the CMake compiler.
To install CMake: To install CMake:
- For Mac, use [homebrew](https://brew.sh/) and run `brew install cmake`. - For Mac, use [homebrew](https://brew.sh/) and run `brew install cmake`.
- For other operating systems, follow the instructions at [cmake.org](https://cmake.org/install/). - For other operating systems, follow the instructions at [cmake.org](https://cmake.org/install/).
When installation is complete, verify you can use CMake in your terminal by running: When installation is complete, verify you can use CMake in your terminal by
running:
```shell ```shell
cmake --version cmake --version
@ -60,8 +65,8 @@ The CMake version is printed in the output.
### Create a project ### Create a project
To test the Package Registry, you need a C++ project. If you don't already have one, you can clone the To test the Package Registry, you need a C++ project. If you don't already have
Conan [hello world starter project](https://github.com/conan-io/hello). one, you can clone the Conan [hello world starter project](https://github.com/conan-io/hello).
### Build a package ### Build a package
@ -74,22 +79,26 @@ To build a package:
conan new Hello/0.1 -t conan new Hello/0.1 -t
``` ```
1. Create a package for the recipe by running `conan create` with the Conan user and channel: 1. Create a package for the recipe by running `conan create` with the Conan user
and channel:
```shell ```shell
conan create . mycompany/beta conan create . mycompany/beta
``` ```
NOTE: **Note:** NOTE: **Note:**
If you use an [instance remote](#add-a-remote-for-your-instance), you must follow a specific [naming convention](#package-recipe-naming-convention-for-instance-remotes). If you use an [instance remote](#add-a-remote-for-your-instance), you must
follow a specific [naming convention](#package-recipe-naming-convention-for-instance-remotes).
A package with the recipe `Hello/0.1@mycompany/beta` is created. A package with the recipe `Hello/0.1@mycompany/beta` is created.
For more details on creating and managing Conan packages, see the [Conan docs](https://docs.conan.io/en/latest/creating_packages.html). For more details about creating and managing Conan packages, see the
[Conan documentation](https://docs.conan.io/en/latest/creating_packages.html).
## Add the Package Registry as a Conan remote ## Add the Package Registry as a Conan remote
To run `conan` commands, you must add the Package Registry as a Conan remote for your project or instance. To run `conan` commands, you must add the Package Registry as a Conan remote for
your project or instance.
### Add a remote for your project ### Add a remote for your project
@ -143,9 +152,9 @@ To add the remote:
#### Package recipe naming convention for instance remotes #### Package recipe naming convention for instance remotes
The standard Conan recipe convention is `package_name/version@user/channel`, The standard Conan recipe convention is `package_name/version@user/channel`, but
but if you're using an [instance remote](#add-a-remote-for-your-instance), the recipe if you're using an [instance remote](#add-a-remote-for-your-instance), the
`user` must be the plus sign (`+`) separated project path. recipe `user` must be the plus sign (`+`) separated project path.
Example recipe names: Example recipe names:
@ -156,58 +165,68 @@ Example recipe names:
| `gitlab-org/gitlab-ce` | `my-package/1.0.0@gitlab-org+gitlab-ce/stable` | Yes | | `gitlab-org/gitlab-ce` | `my-package/1.0.0@gitlab-org+gitlab-ce/stable` | Yes |
| `gitlab-org/gitlab-ce` | `my-package/1.0.0@foo/stable` | No | | `gitlab-org/gitlab-ce` | `my-package/1.0.0@foo/stable` | No |
[Project remotes](#add-a-remote-for-your-project) have a more flexible naming convention. [Project remotes](#add-a-remote-for-your-project) have a more flexible naming
convention.
## Authenticate to the Package Registry ## Authenticate to the Package Registry
To authenticate to the Package Registry, you need either a personal access token or deploy token. To authenticate to the Package Registry, you need either a personal access token
or deploy token.
- If you use a [personal access token](../../../user/profile/personal_access_tokens.md), set the scope to `api`. - If you use a [personal access token](../../../user/profile/personal_access_tokens.md),
- If you use a [deploy token](../../project/deploy_tokens/index.md), set the scope to `read_package_registry`, `write_package_registry`, or both. set the scope to `api`.
- If you use a [deploy token](../../project/deploy_tokens/index.md), set the
scope to `read_package_registry`, `write_package_registry`, or both.
### Add your credentials to the GitLab remote ### Add your credentials to the GitLab remote
Associate your token with the GitLab remote, so that you don't have to explicitly Associate your token with the GitLab remote, so that you don't have to
add a token to every Conan command. explicitly add a token to every Conan command.
Prerequisites: Prerequisites:
- You must have an authentication token. - You must have an authentication token.
- The Conan remote [must be set](#add-the-package-registry-as-a-conan-remote). - The Conan remote [must be configured](#add-the-package-registry-as-a-conan-remote).
In a terminal, run this command. In this example, the remote name is `gitlab`. Use the name of your remote. In a terminal, run this command. In this example, the remote name is `gitlab`.
Use the name of your remote.
```shell ```shell
conan user <gitlab_username or deploy_token_username> -r gitlab -p <personal_access_token or deploy_token> conan user <gitlab_username or deploy_token_username> -r gitlab -p <personal_access_token or deploy_token>
``` ```
Now when you run commands with `--remote=gitlab`, your username and password are automatically included in the requests. Now when you run commands with `--remote=gitlab`, your username and password are
included in the requests.
Alternately, you can explicitly include your credentials in any given command. For example: Alternatively, you can explicitly include your credentials in any given command.
For example:
```shell ```shell
CONAN_LOGIN_USERNAME=<gitlab_username or deploy_token_username> CONAN_PASSWORD=<personal_access_token or deploy_token> conan upload Hello/0.1@mycompany/beta --all --remote=gitlab CONAN_LOGIN_USERNAME=<gitlab_username or deploy_token_username> CONAN_PASSWORD=<personal_access_token or deploy_token> conan upload Hello/0.1@mycompany/beta --all --remote=gitlab
``` ```
NOTE: **Note:** NOTE: **Note:**
Your authentication with GitLab expires on a regular basis, Because your authentication with GitLab expires on a regular basis, you may
so occasionally you may need to re-enter your personal access token. occasionally need to re-enter your personal access token.
### Set a default remote for your project (optional) ### Set a default remote for your project (optional)
If you want to interact with the GitLab Package Registry without having to specify a remote, If you want to interact with the GitLab Package Registry without having to
you can tell Conan to always use the Package Registry for your packages. specify a remote, you can tell Conan to always use the Package Registry for your
packages.
In a terminal, run this command. In a terminal, run this command:
```shell ```shell
conan remote add_ref Hello/0.1@mycompany/beta gitlab conan remote add_ref Hello/0.1@mycompany/beta gitlab
``` ```
NOTE: **Note:** NOTE: **Note:**
The package recipe includes the version, so the default remote for `Hello/0.1@user/channel` does not work for `Hello/0.2@user/channel`. The package recipe includes the version, so the default remote for
`Hello/0.1@user/channel` doesn't work for `Hello/0.2@user/channel`.
If you do not set a default user or remote, you can still include the user and remote in your commands: If you don't set a default user or remote, you can still include the user and
remote in your commands:
```shell ```shell
`CONAN_LOGIN_USERNAME=<gitlab_username or deploy_token_username> CONAN_PASSWORD=<personal_access_token or deploy_token> <conan command> --remote=gitlab `CONAN_LOGIN_USERNAME=<gitlab_username or deploy_token_username> CONAN_PASSWORD=<personal_access_token or deploy_token> <conan command> --remote=gitlab
@ -215,17 +234,18 @@ If you do not set a default user or remote, you can still include the user and r
## Publish a Conan package ## Publish a Conan package
Publish a Conan package to the Package Registry, so that anyone who can access the project can use the package as a dependency. Publish a Conan package to the Package Registry, so that anyone who can access
the project can use the package as a dependency.
Prerequisites: Prerequisites:
To publish a Conan package, you need: - The Conan remote [must be configured](#add-the-package-registry-as-a-conan-remote).
- [Authentication](#authenticate-to-the-package-registry) with the
- The Package Registry [set as a remote](#add-the-package-registry-as-a-conan-remote). Package Registry must be configured.
- [Authentication](#authenticate-to-the-package-registry) set up with the Package Registry. - A local [Conan package](https://docs.conan.io/en/latest/creating_packages/getting_started.html)
- A local [Conan package](https://docs.conan.io/en/latest/creating_packages/getting_started.html). must exist.
- For an instance remote, the package must meet the [naming convention](#package-recipe-naming-convention-for-instance-remotes). - For an instance remote, the package must meet the [naming convention](#package-recipe-naming-convention-for-instance-remotes).
- A project ID, which is on the project's homepage. - You must have the project ID, which is on the project's homepage.
To publish the package, use the `conan upload` command: To publish the package, use the `conan upload` command:
@ -237,11 +257,11 @@ conan upload Hello/0.1@mycompany/beta --all
> [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/11678) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.7. > [Introduced](https://gitlab.com/gitlab-org/gitlab/-/issues/11678) in [GitLab Premium](https://about.gitlab.com/pricing/) 12.7.
To work with Conan commands in [GitLab CI/CD](../../../ci/README.md), you can use To work with Conan commands in [GitLab CI/CD](../../../ci/README.md), you can
`CI_JOB_TOKEN` in place of the personal access token in your commands. use `CI_JOB_TOKEN` in place of the personal access token in your commands.
You can provide the `CONAN_LOGIN_USERNAME` and `CONAN_PASSWORD` with each You can provide the `CONAN_LOGIN_USERNAME` and `CONAN_PASSWORD` with each Conan
Conan command in your `.gitlab-ci.yml` file. For example: command in your `.gitlab-ci.yml` file. For example:
```yaml ```yaml
image: conanio/gcc7 image: conanio/gcc7
@ -255,24 +275,26 @@ create_package:
- CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload <package-name>/0.1@<group-name>+<project-name>/stable --all --remote=gitlab - CONAN_LOGIN_USERNAME=ci_user CONAN_PASSWORD=${CI_JOB_TOKEN} conan upload <package-name>/0.1@<group-name>+<project-name>/stable --all --remote=gitlab
``` ```
Additional Conan images to use as the basis of your CI file are available Additional Conan images to use as the basis of your CI file are available in the
in the [Conan docs](https://docs.conan.io/en/latest/howtos/run_conan_in_docker.html#available-docker-images). [Conan docs](https://docs.conan.io/en/latest/howtos/run_conan_in_docker.html#available-docker-images).
## Install a Conan package ## Install a Conan package
Install a Conan package from the Package Registry so you can use it as a dependency. Install a Conan package from the Package Registry so you can use it as a
dependency.
Conan packages are often installed as dependencies by using the `conanfile.txt` file. Conan packages are often installed as dependencies by using the `conanfile.txt`
file.
Prerequisites: Prerequisites:
To install a Conan package, you need: - The Conan remote [must be configured](#add-the-package-registry-as-a-conan-remote).
- [Authentication](#authenticate-to-the-package-registry) with the
Package Registry must be configured.
- The Package Registry [set as a remote](#add-the-package-registry-as-a-conan-remote). 1. In the project where you want to install the package as a dependency, open
- [Authentication](#authenticate-to-the-package-registry) set up with the Package Registry. `conanfile.txt`. Or, in the root of your project, create a file called
`conanfile.txt`.
1. In the project where you want to install the package as a dependency, open `conanfile.txt`.
Or, in the root of your project, create a file called `conanfile.txt`.
1. Add the Conan recipe to the `[requires]` section of the file: 1. Add the Conan recipe to the `[requires]` section of the file:
@ -284,7 +306,8 @@ To install a Conan package, you need:
cmake cmake
``` ```
1. At the root of your project, create a `build` directory and change to that directory: 1. At the root of your project, create a `build` directory and change to that
directory:
```shell ```shell
mkdir build && cd build mkdir build && cd build
@ -298,7 +321,7 @@ To install a Conan package, you need:
NOTE: **Note:** NOTE: **Note:**
If you try to install the package you just created in this tutorial, the package If you try to install the package you just created in this tutorial, the package
already exists on your local machine, so this command has no effect. already exists on your local computer, so this command has no effect.
## Remove a Conan package ## Remove a Conan package
@ -310,19 +333,22 @@ There are two ways to remove a Conan package from the GitLab Package Registry.
conan remove Hello/0.2@user/channel --remote=gitlab conan remove Hello/0.2@user/channel --remote=gitlab
``` ```
You must explicitly include the remote in this command, otherwise the package is only removed from your You must explicitly include the remote in this command, otherwise the package
local system cache. is removed only from your local system cache.
NOTE: **Note:** NOTE: **Note:**
This command removes all recipe and binary package files from the Package Registry. This command removes all recipe and binary package files from the
Package Registry.
- From the GitLab user interface: - From the GitLab user interface:
Go to your project's **Packages & Registries > Package Registry**. Remove the package by clicking the red trash icon. Go to your project's **Packages & Registries > Package Registry**. Remove the
package by clicking the red trash icon.
## Search for Conan packages in the Package Registry ## Search for Conan packages in the Package Registry
To search by full or partial package name, or by exact recipe, run the `conan search` command. To search by full or partial package name, or by exact recipe, run the
`conan search` command.
- To search for all packages with a specific package name: - To search for all packages with a specific package name:
@ -336,7 +362,8 @@ To search by full or partial package name, or by exact recipe, run the `conan se
conan search He* --remote=gitlab conan search He* --remote=gitlab
``` ```
The scope of your search includes all projects you have permission to access. This includes your private projects as well as all public projects. The scope of your search includes all projects you have permission to access.
This includes your private projects as well as all public projects.
## Fetch Conan package information from the Package Registry ## Fetch Conan package information from the Package Registry
@ -351,7 +378,9 @@ conan info Hello/0.1@mycompany/beta
The GitLab Conan repository supports the following Conan CLI commands: The GitLab Conan repository supports the following Conan CLI commands:
- `conan upload`: Upload your recipe and package files to the Package Registry. - `conan upload`: Upload your recipe and package files to the Package Registry.
- `conan install`: Install a Conan package from the Package Registry, this includes using the `conanfile.txt` file. - `conan install`: Install a Conan package from the Package Registry, which
- `conan search`: Search the Package Registry for public packages, and private packages you have permission to view. includes using the `conanfile.txt` file.
- `conan search`: Search the Package Registry for public packages, and private
packages you have permission to view.
- `conan info`: View the information on a given package from the Package Registry. - `conan info`: View the information on a given package from the Package Registry.
- `conan remove`: Delete the package from the Package Registry. - `conan remove`: Delete the package from the Package Registry.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 141 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 183 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 190 KiB

After

Width:  |  Height:  |  Size: 76 KiB

View File

@ -23,6 +23,7 @@ FactoryBot.define do
project_statistics.packages_size = evaluator.size_multiplier * 5 project_statistics.packages_size = evaluator.size_multiplier * 5
project_statistics.snippets_size = evaluator.size_multiplier * 6 project_statistics.snippets_size = evaluator.size_multiplier * 6
project_statistics.pipeline_artifacts_size = evaluator.size_multiplier * 7 project_statistics.pipeline_artifacts_size = evaluator.size_multiplier * 7
project_statistics.uploads_size = evaluator.size_multiplier * 8
end end
end end
end end

View File

@ -134,9 +134,7 @@ describe('RepoTab', () => {
}); });
it('renders a tooltip', () => { it('renders a tooltip', () => {
expect(wrapper.find('span:nth-child(2)').attributes('data-original-title')).toContain( expect(wrapper.find('span:nth-child(2)').attributes('title')).toBe('Locked by testuser');
'Locked by testuser',
);
}); });
}); });

View File

@ -45,6 +45,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
total_storage_size = stat1.storage_size + stat2.storage_size total_storage_size = stat1.storage_size + stat2.storage_size
total_snippets_size = stat1.snippets_size + stat2.snippets_size total_snippets_size = stat1.snippets_size + stat2.snippets_size
total_pipeline_artifacts_size = stat1.pipeline_artifacts_size + stat2.pipeline_artifacts_size total_pipeline_artifacts_size = stat1.pipeline_artifacts_size + stat2.pipeline_artifacts_size
total_uploads_size = stat1.uploads_size + stat2.uploads_size
expect(root_storage_statistics.repository_size).to eq(total_repository_size) expect(root_storage_statistics.repository_size).to eq(total_repository_size)
expect(root_storage_statistics.wiki_size).to eq(total_wiki_size) expect(root_storage_statistics.wiki_size).to eq(total_wiki_size)
@ -54,6 +55,7 @@ RSpec.describe Namespace::RootStorageStatistics, type: :model do
expect(root_storage_statistics.storage_size).to eq(total_storage_size) expect(root_storage_statistics.storage_size).to eq(total_storage_size)
expect(root_storage_statistics.snippets_size).to eq(total_snippets_size) expect(root_storage_statistics.snippets_size).to eq(total_snippets_size)
expect(root_storage_statistics.pipeline_artifacts_size).to eq(total_pipeline_artifacts_size) expect(root_storage_statistics.pipeline_artifacts_size).to eq(total_pipeline_artifacts_size)
expect(root_storage_statistics.uploads_size).to eq(total_uploads_size)
end end
it 'works when there are no projects' do it 'works when there are no projects' do

View File

@ -34,7 +34,8 @@ RSpec.describe ProjectStatistics do
lfs_objects_size: 2.exabytes, lfs_objects_size: 2.exabytes,
build_artifacts_size: 1.exabyte, build_artifacts_size: 1.exabyte,
snippets_size: 1.exabyte, snippets_size: 1.exabyte,
pipeline_artifacts_size: 1.exabyte - 1 pipeline_artifacts_size: 512.petabytes - 1,
uploads_size: 512.petabytes
) )
statistics.reload statistics.reload
@ -46,7 +47,8 @@ RSpec.describe ProjectStatistics do
expect(statistics.build_artifacts_size).to eq(1.exabyte) expect(statistics.build_artifacts_size).to eq(1.exabyte)
expect(statistics.storage_size).to eq(8.exabytes - 1) expect(statistics.storage_size).to eq(8.exabytes - 1)
expect(statistics.snippets_size).to eq(1.exabyte) expect(statistics.snippets_size).to eq(1.exabyte)
expect(statistics.pipeline_artifacts_size).to eq(1.exabyte - 1) expect(statistics.pipeline_artifacts_size).to eq(512.petabytes - 1)
expect(statistics.uploads_size).to eq(512.petabytes)
end end
end end
@ -57,6 +59,7 @@ RSpec.describe ProjectStatistics do
statistics.lfs_objects_size = 3 statistics.lfs_objects_size = 3
statistics.build_artifacts_size = 4 statistics.build_artifacts_size = 4
statistics.snippets_size = 5 statistics.snippets_size = 5
statistics.uploads_size = 3
expect(statistics.total_repository_size).to eq 5 expect(statistics.total_repository_size).to eq 5
end end
@ -98,6 +101,7 @@ RSpec.describe ProjectStatistics do
allow(statistics).to receive(:update_lfs_objects_size) allow(statistics).to receive(:update_lfs_objects_size)
allow(statistics).to receive(:update_snippets_size) allow(statistics).to receive(:update_snippets_size)
allow(statistics).to receive(:update_storage_size) allow(statistics).to receive(:update_storage_size)
allow(statistics).to receive(:update_uploads_size)
end end
context "without arguments" do context "without arguments" do
@ -111,6 +115,7 @@ RSpec.describe ProjectStatistics do
expect(statistics).to have_received(:update_wiki_size) expect(statistics).to have_received(:update_wiki_size)
expect(statistics).to have_received(:update_lfs_objects_size) expect(statistics).to have_received(:update_lfs_objects_size)
expect(statistics).to have_received(:update_snippets_size) expect(statistics).to have_received(:update_snippets_size)
expect(statistics).to have_received(:update_uploads_size)
end end
end end
@ -125,6 +130,7 @@ RSpec.describe ProjectStatistics do
expect(statistics).not_to have_received(:update_repository_size) expect(statistics).not_to have_received(:update_repository_size)
expect(statistics).not_to have_received(:update_wiki_size) expect(statistics).not_to have_received(:update_wiki_size)
expect(statistics).not_to have_received(:update_snippets_size) expect(statistics).not_to have_received(:update_snippets_size)
expect(statistics).not_to have_received(:update_uploads_size)
end end
end end
@ -139,10 +145,12 @@ RSpec.describe ProjectStatistics do
expect(statistics).to have_received(:update_repository_size) expect(statistics).to have_received(:update_repository_size)
expect(statistics).to have_received(:update_wiki_size) expect(statistics).to have_received(:update_wiki_size)
expect(statistics).to have_received(:update_snippets_size) expect(statistics).to have_received(:update_snippets_size)
expect(statistics).to have_received(:update_uploads_size)
expect(statistics.repository_size).to eq(0) expect(statistics.repository_size).to eq(0)
expect(statistics.commit_count).to eq(0) expect(statistics.commit_count).to eq(0)
expect(statistics.wiki_size).to eq(0) expect(statistics.wiki_size).to eq(0)
expect(statistics.snippets_size).to eq(0) expect(statistics.snippets_size).to eq(0)
expect(statistics.uploads_size).to eq(0)
end end
end end
@ -163,10 +171,12 @@ RSpec.describe ProjectStatistics do
expect(statistics).to have_received(:update_repository_size) expect(statistics).to have_received(:update_repository_size)
expect(statistics).to have_received(:update_wiki_size) expect(statistics).to have_received(:update_wiki_size)
expect(statistics).to have_received(:update_snippets_size) expect(statistics).to have_received(:update_snippets_size)
expect(statistics).to have_received(:update_uploads_size)
expect(statistics.repository_size).to eq(0) expect(statistics.repository_size).to eq(0)
expect(statistics.commit_count).to eq(0) expect(statistics.commit_count).to eq(0)
expect(statistics.wiki_size).to eq(0) expect(statistics.wiki_size).to eq(0)
expect(statistics.snippets_size).to eq(0) expect(statistics.snippets_size).to eq(0)
expect(statistics.uploads_size).to eq(0)
end end
end end
@ -211,6 +221,7 @@ RSpec.describe ProjectStatistics do
expect(statistics).not_to receive(:update_wiki_size) expect(statistics).not_to receive(:update_wiki_size)
expect(statistics).not_to receive(:update_lfs_objects_size) expect(statistics).not_to receive(:update_lfs_objects_size)
expect(statistics).not_to receive(:update_snippets_size) expect(statistics).not_to receive(:update_snippets_size)
expect(statistics).not_to receive(:update_uploads_size)
expect(statistics).not_to receive(:save!) expect(statistics).not_to receive(:save!)
expect(Namespaces::ScheduleAggregationWorker) expect(Namespaces::ScheduleAggregationWorker)
.not_to receive(:perform_async) .not_to receive(:perform_async)
@ -295,6 +306,26 @@ RSpec.describe ProjectStatistics do
end end
end end
describe '#update_uploads_size' do
let!(:upload1) { create(:upload, model: project, size: 1.megabyte) }
let!(:upload2) { create(:upload, model: project, size: 2.megabytes) }
it 'stores the size of related uploaded files' do
expect(statistics.update_uploads_size).to eq(3.megabytes)
end
context 'with feature flag disabled' do
before do
statistics.update_columns(uploads_size: 0)
stub_feature_flags(count_uploads_size_in_storage_stats: false)
end
it 'does not store the size of related uploaded files' do
expect(statistics.update_uploads_size).to eq(0)
end
end
end
describe '#update_storage_size' do describe '#update_storage_size' do
it "sums all storage counters" do it "sums all storage counters" do
statistics.update!( statistics.update!(
@ -302,12 +333,13 @@ RSpec.describe ProjectStatistics do
wiki_size: 4, wiki_size: 4,
lfs_objects_size: 3, lfs_objects_size: 3,
snippets_size: 2, snippets_size: 2,
pipeline_artifacts_size: 3 pipeline_artifacts_size: 3,
uploads_size: 5
) )
statistics.reload statistics.reload
expect(statistics.storage_size).to eq 14 expect(statistics.storage_size).to eq 19
end end
it 'works during wiki_size backfill' do it 'works during wiki_size backfill' do