Commit 0a7dc675 authored by Corinna Wiesner's avatar Corinna Wiesner Committed by Tyler Amos

Pass excess storage info storage excess endpoint

Adds the necessary fields to the storage excess endpoint in order to
have the excess storage data in GraphQL. Also updates the docs and
schema for GraphQL.
parent cc864263
...@@ -7195,6 +7195,11 @@ type GrafanaIntegration { ...@@ -7195,6 +7195,11 @@ type GrafanaIntegration {
} }
type Group { type Group {
"""
Additional storage purchased for the root namespace in bytes
"""
additionalPurchasedStorageSize: Float
""" """
Indicates whether Auto DevOps is enabled for all projects within this group Indicates whether Auto DevOps is enabled for all projects within this group
""" """
...@@ -7245,6 +7250,11 @@ type Group { ...@@ -7245,6 +7250,11 @@ type Group {
last: Int last: Int
): BoardConnection ): BoardConnection
"""
Includes at least one project where the repository size exceeds the limit
"""
containsLockedProjects: Boolean!
""" """
Description of the namespace Description of the namespace
""" """
...@@ -7696,6 +7706,11 @@ type Group { ...@@ -7696,6 +7706,11 @@ type Group {
""" """
lfsEnabled: Boolean lfsEnabled: Boolean
"""
Number of projects in the root namespace where the repository size exceeds the limit
"""
lockedProjectCount: Int!
""" """
Indicates if a group is disabled from getting mentioned Indicates if a group is disabled from getting mentioned
""" """
...@@ -7983,6 +7998,16 @@ type Group { ...@@ -7983,6 +7998,16 @@ type Group {
startTime: Time startTime: Time
): TimelogConnection! ): TimelogConnection!
"""
Total repository size of all projects in the root namespace in bytes
"""
totalRepositorySize: Float
"""
Total excess repository size of all projects in the root namespace in bytes
"""
totalRepositorySizeExcess: Float
""" """
Time before two-factor authentication is enforced Time before two-factor authentication is enforced
""" """
...@@ -11888,6 +11913,16 @@ enum MutationOperationMode { ...@@ -11888,6 +11913,16 @@ enum MutationOperationMode {
} }
type Namespace { type Namespace {
"""
Additional storage purchased for the root namespace in bytes
"""
additionalPurchasedStorageSize: Float
"""
Includes at least one project where the repository size exceeds the limit
"""
containsLockedProjects: Boolean!
""" """
Description of the namespace Description of the namespace
""" """
...@@ -11923,6 +11958,11 @@ type Namespace { ...@@ -11923,6 +11958,11 @@ type Namespace {
""" """
lfsEnabled: Boolean lfsEnabled: Boolean
"""
Number of projects in the root namespace where the repository size exceeds the limit
"""
lockedProjectCount: Int!
""" """
Name of the namespace Name of the namespace
""" """
...@@ -11998,6 +12038,16 @@ type Namespace { ...@@ -11998,6 +12038,16 @@ type Namespace {
""" """
temporaryStorageIncreaseEndsOn: Time temporaryStorageIncreaseEndsOn: Time
"""
Total repository size of all projects in the root namespace in bytes
"""
totalRepositorySize: Float
"""
Total excess repository size of all projects in the root namespace in bytes
"""
totalRepositorySizeExcess: Float
""" """
Visibility of the namespace Visibility of the namespace
""" """
...@@ -14055,6 +14105,11 @@ type Project { ...@@ -14055,6 +14105,11 @@ type Project {
""" """
repository: Repository repository: Repository
"""
Size of repository that exceeds the limit in bytes
"""
repositorySizeExcess: Float
""" """
Indicates if users can request member access to the project Indicates if users can request member access to the project
""" """
......
...@@ -19906,6 +19906,20 @@ ...@@ -19906,6 +19906,20 @@
"name": "Group", "name": "Group",
"description": null, "description": null,
"fields": [ "fields": [
{
"name": "additionalPurchasedStorageSize",
"description": "Additional storage purchased for the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "autoDevopsEnabled", "name": "autoDevopsEnabled",
"description": "Indicates whether Auto DevOps is enabled for all projects within this group", "description": "Indicates whether Auto DevOps is enabled for all projects within this group",
...@@ -20024,6 +20038,24 @@ ...@@ -20024,6 +20038,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "containsLockedProjects",
"description": "Includes at least one project where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "description", "name": "description",
"description": "Description of the namespace", "description": "Description of the namespace",
...@@ -21063,6 +21095,24 @@ ...@@ -21063,6 +21095,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "lockedProjectCount",
"description": "Number of projects in the root namespace where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "mentionsDisabled", "name": "mentionsDisabled",
"description": "Indicates if a group is disabled from getting mentioned", "description": "Indicates if a group is disabled from getting mentioned",
...@@ -21749,6 +21799,34 @@ ...@@ -21749,6 +21799,34 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "totalRepositorySize",
"description": "Total repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalRepositorySizeExcess",
"description": "Total excess repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "twoFactorGracePeriod", "name": "twoFactorGracePeriod",
"description": "Time before two-factor authentication is enforced", "description": "Time before two-factor authentication is enforced",
...@@ -35022,6 +35100,38 @@ ...@@ -35022,6 +35100,38 @@
"name": "Namespace", "name": "Namespace",
"description": null, "description": null,
"fields": [ "fields": [
{
"name": "additionalPurchasedStorageSize",
"description": "Additional storage purchased for the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "containsLockedProjects",
"description": "Includes at least one project where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "description", "name": "description",
"description": "Description of the namespace", "description": "Description of the namespace",
...@@ -35136,6 +35246,24 @@ ...@@ -35136,6 +35246,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "lockedProjectCount",
"description": "Number of projects in the root namespace where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "name", "name": "name",
"description": "Name of the namespace", "description": "Name of the namespace",
...@@ -35325,6 +35453,34 @@ ...@@ -35325,6 +35453,34 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "totalRepositorySize",
"description": "Total repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalRepositorySizeExcess",
"description": "Total excess repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "visibility", "name": "visibility",
"description": "Visibility of the namespace", "description": "Visibility of the namespace",
...@@ -40799,6 +40955,20 @@ ...@@ -40799,6 +40955,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "repositorySizeExcess",
"description": "Size of repository that exceeds the limit in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "requestAccessEnabled", "name": "requestAccessEnabled",
"description": "Indicates if users can request member access to the project", "description": "Indicates if users can request member access to the project",
...@@ -1136,9 +1136,11 @@ Autogenerated return type of EpicTreeReorder. ...@@ -1136,9 +1136,11 @@ Autogenerated return type of EpicTreeReorder.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `additionalPurchasedStorageSize` | Float | Additional storage purchased for the root namespace in bytes |
| `autoDevopsEnabled` | Boolean | Indicates whether Auto DevOps is enabled for all projects within this group | | `autoDevopsEnabled` | Boolean | Indicates whether Auto DevOps is enabled for all projects within this group |
| `avatarUrl` | String | Avatar URL of the group | | `avatarUrl` | String | Avatar URL of the group |
| `board` | Board | A single board of the group | | `board` | Board | A single board of the group |
| `containsLockedProjects` | Boolean! | Includes at least one project where the repository size exceeds the limit |
| `description` | String | Description of the namespace | | `description` | String | Description of the namespace |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` | | `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
| `emailsDisabled` | Boolean | Indicates if a group has email notifications disabled | | `emailsDisabled` | Boolean | Indicates if a group has email notifications disabled |
...@@ -1151,6 +1153,7 @@ Autogenerated return type of EpicTreeReorder. ...@@ -1151,6 +1153,7 @@ Autogenerated return type of EpicTreeReorder.
| `isTemporaryStorageIncreaseEnabled` | Boolean! | Status of the temporary storage increase | | `isTemporaryStorageIncreaseEnabled` | Boolean! | Status of the temporary storage increase |
| `label` | Label | A label available on this group | | `label` | Label | A label available on this group |
| `lfsEnabled` | Boolean | Indicates if Large File Storage (LFS) is enabled for namespace | | `lfsEnabled` | Boolean | Indicates if Large File Storage (LFS) is enabled for namespace |
| `lockedProjectCount` | Int! | Number of projects in the root namespace where the repository size exceeds the limit |
| `mentionsDisabled` | Boolean | Indicates if a group is disabled from getting mentioned | | `mentionsDisabled` | Boolean | Indicates if a group is disabled from getting mentioned |
| `name` | String! | Name of the namespace | | `name` | String! | Name of the namespace |
| `parent` | Group | Parent group | | `parent` | Group | Parent group |
...@@ -1163,6 +1166,8 @@ Autogenerated return type of EpicTreeReorder. ...@@ -1163,6 +1166,8 @@ Autogenerated return type of EpicTreeReorder.
| `storageSizeLimit` | Float | Total storage limit of the root namespace in bytes | | `storageSizeLimit` | Float | Total storage limit of the root namespace in bytes |
| `subgroupCreationLevel` | String | The permission level required to create subgroups within the group | | `subgroupCreationLevel` | String | The permission level required to create subgroups within the group |
| `temporaryStorageIncreaseEndsOn` | Time | Date until the temporary storage increase is active | | `temporaryStorageIncreaseEndsOn` | Time | Date until the temporary storage increase is active |
| `totalRepositorySize` | Float | Total repository size of all projects in the root namespace in bytes |
| `totalRepositorySizeExcess` | Float | Total excess repository size of all projects in the root namespace in bytes |
| `twoFactorGracePeriod` | Int | Time before two-factor authentication is enforced | | `twoFactorGracePeriod` | Int | Time before two-factor authentication is enforced |
| `userPermissions` | GroupPermissions! | Permissions for the current user on the resource | | `userPermissions` | GroupPermissions! | Permissions for the current user on the resource |
| `visibility` | String | Visibility of the namespace | | `visibility` | String | Visibility of the namespace |
...@@ -1712,6 +1717,8 @@ Contains statistics about a milestone. ...@@ -1712,6 +1717,8 @@ Contains statistics about a milestone.
| Field | Type | Description | | Field | Type | Description |
| ----- | ---- | ----------- | | ----- | ---- | ----------- |
| `additionalPurchasedStorageSize` | Float | Additional storage purchased for the root namespace in bytes |
| `containsLockedProjects` | Boolean! | Includes at least one project where the repository size exceeds the limit |
| `description` | String | Description of the namespace | | `description` | String | Description of the namespace |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` | | `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
| `fullName` | String! | Full name of the namespace | | `fullName` | String! | Full name of the namespace |
...@@ -1719,12 +1726,15 @@ Contains statistics about a milestone. ...@@ -1719,12 +1726,15 @@ Contains statistics about a milestone.
| `id` | ID! | ID of the namespace | | `id` | ID! | ID of the namespace |
| `isTemporaryStorageIncreaseEnabled` | Boolean! | Status of the temporary storage increase | | `isTemporaryStorageIncreaseEnabled` | Boolean! | Status of the temporary storage increase |
| `lfsEnabled` | Boolean | Indicates if Large File Storage (LFS) is enabled for namespace | | `lfsEnabled` | Boolean | Indicates if Large File Storage (LFS) is enabled for namespace |
| `lockedProjectCount` | Int! | Number of projects in the root namespace where the repository size exceeds the limit |
| `name` | String! | Name of the namespace | | `name` | String! | Name of the namespace |
| `path` | String! | Path of the namespace | | `path` | String! | Path of the namespace |
| `requestAccessEnabled` | Boolean | Indicates if users can request access to namespace | | `requestAccessEnabled` | Boolean | Indicates if users can request access to namespace |
| `rootStorageStatistics` | RootStorageStatistics | Aggregated storage statistics of the namespace. Only available for root namespaces | | `rootStorageStatistics` | RootStorageStatistics | Aggregated storage statistics of the namespace. Only available for root namespaces |
| `storageSizeLimit` | Float | Total storage limit of the root namespace in bytes | | `storageSizeLimit` | Float | Total storage limit of the root namespace in bytes |
| `temporaryStorageIncreaseEndsOn` | Time | Date until the temporary storage increase is active | | `temporaryStorageIncreaseEndsOn` | Time | Date until the temporary storage increase is active |
| `totalRepositorySize` | Float | Total repository size of all projects in the root namespace in bytes |
| `totalRepositorySizeExcess` | Float | Total excess repository size of all projects in the root namespace in bytes |
| `visibility` | String | Visibility of the namespace | | `visibility` | String | Visibility of the namespace |
### NamespaceIncreaseStorageTemporarilyPayload ### NamespaceIncreaseStorageTemporarilyPayload
...@@ -1918,6 +1928,7 @@ Autogenerated return type of PipelineRetry. ...@@ -1918,6 +1928,7 @@ Autogenerated return type of PipelineRetry.
| `release` | Release | A single release of the project | | `release` | Release | A single release of the project |
| `removeSourceBranchAfterMerge` | Boolean | Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project | | `removeSourceBranchAfterMerge` | Boolean | Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project |
| `repository` | Repository | Git repository of the project | | `repository` | Repository | Git repository of the project |
| `repositorySizeExcess` | Float | Size of repository that exceeds the limit in bytes |
| `requestAccessEnabled` | Boolean | Indicates if users can request member access to the project | | `requestAccessEnabled` | Boolean | Indicates if users can request member access to the project |
| `requirement` | Requirement | Find a single requirement | | `requirement` | Requirement | Find a single requirement |
| `requirementStatesCount` | RequirementStatesCount | Number of requirements for the project by their state | | `requirementStatesCount` | RequirementStatesCount | Number of requirements for the project by their state |
......
...@@ -2,6 +2,11 @@ query getStorageCounter($fullPath: ID!) { ...@@ -2,6 +2,11 @@ query getStorageCounter($fullPath: ID!) {
namespace(fullPath: $fullPath) { namespace(fullPath: $fullPath) {
id id
storageSizeLimit storageSizeLimit
additionalPurchasedStorageSize
totalRepositorySizeExcess
totalRepositorySize
containsLockedProjects
lockedProjectCount
rootStorageStatistics { rootStorageStatistics {
storageSize storageSize
repositorySize repositorySize
...@@ -20,6 +25,7 @@ query getStorageCounter($fullPath: ID!) { ...@@ -20,6 +25,7 @@ query getStorageCounter($fullPath: ID!) {
avatarUrl avatarUrl
webUrl webUrl
name name
repositorySizeExcess
statistics { statistics {
commitCount commitCount
storageSize storageSize
......
...@@ -6,6 +6,32 @@ module EE ...@@ -6,6 +6,32 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
prepended do prepended do
field :additional_purchased_storage_size,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Additional storage purchased for the root namespace in bytes'
field :total_repository_size_excess,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Total excess repository size of all projects in the root namespace in bytes'
field :total_repository_size,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Total repository size of all projects in the root namespace in bytes'
field :contains_locked_projects,
GraphQL::BOOLEAN_TYPE,
null: false,
description: 'Includes at least one project where the repository size exceeds the limit',
resolve: -> (obj, _args, _ctx) { obj.contains_locked_projects? }
field :locked_project_count,
GraphQL::INT_TYPE,
null: false,
description: 'Number of projects in the root namespace where the repository size exceeds the limit'
field :storage_size_limit, field :storage_size_limit,
GraphQL::FLOAT_TYPE, GraphQL::FLOAT_TYPE,
null: true, null: true,
......
...@@ -115,6 +115,15 @@ module EE ...@@ -115,6 +115,15 @@ module EE
description: 'Cluster agents associated with the project', description: 'Cluster agents associated with the project',
resolver: ::Resolvers::Clusters::AgentsResolver resolver: ::Resolvers::Clusters::AgentsResolver
field :repository_size_excess,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Size of repository that exceeds the limit in bytes'
def self.requirements_available?(project, user)
::Feature.enabled?(:requirements_management, project, default_enabled: true) && Ability.allowed?(user, :read_requirement, project)
end
def self.sast_ci_configuration(project) def self.sast_ci_configuration(project)
::Security::CiConfiguration::SastParserService.new(project).configuration ::Security::CiConfiguration::SastParserService.new(project).configuration
end end
......
...@@ -4,7 +4,16 @@ require 'spec_helper' ...@@ -4,7 +4,16 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Namespace'] do RSpec.describe GitlabSchema.types['Namespace'] do
it 'has specific fields' do it 'has specific fields' do
expected_fields = %w[storage_size_limit is_temporary_storage_increase_enabled temporary_storage_increase_ends_on] expected_fields = %w[
additional_purchased_storage_size
total_repository_size_excess
total_repository_size
contains_locked_projects
locked_project_count
storage_size_limit
is_temporary_storage_increase_enabled
temporary_storage_increase_ends_on
]
expect(described_class).to include_graphql_fields(*expected_fields) expect(described_class).to include_graphql_fields(*expected_fields)
end end
......
...@@ -17,7 +17,7 @@ RSpec.describe GitlabSchema.types['Project'] do ...@@ -17,7 +17,7 @@ RSpec.describe GitlabSchema.types['Project'] do
expected_fields = %w[ expected_fields = %w[
vulnerabilities sast_ci_configuration vulnerability_scanners requirement_states_count vulnerabilities sast_ci_configuration vulnerability_scanners requirement_states_count
vulnerability_severities_count packages compliance_frameworks vulnerabilities_count_by_day vulnerability_severities_count packages compliance_frameworks vulnerabilities_count_by_day
security_dashboard_path iterations cluster_agents security_dashboard_path iterations cluster_agents repository_size_excess
] ]
expect(described_class).to include_graphql_fields(*expected_fields) expect(described_class).to include_graphql_fields(*expected_fields)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment