1
0
mirror of https://github.com/quay/quay.git synced 2025-07-30 07:43:13 +03:00

defaults: Update defaults in config and schema (PROJQUAY-2425) (#923)

- Update defaults in config.pu
This commit is contained in:
Jonathan King
2021-10-12 14:47:40 -07:00
committed by GitHub
parent f50f37a393
commit a29f3e0eea
5 changed files with 44 additions and 13 deletions

View File

@ -791,4 +791,7 @@ class DefaultConfig(ImmutableConfig):
FEATURE_USER_INITIALIZE = False
# Allows "/" in repository names
FEATURE_EXTENDED_REPOSITORY_NAMES = False
FEATURE_EXTENDED_REPOSITORY_NAMES = True
# Allow creation of push to public repo
CREATE_REPOSITORY_ON_PUSH_PUBLIC = False

View File

@ -25,8 +25,10 @@ def get_robot_password(username):
"repository:devtable/simple/foo/bar/baz:pull",
"devtable",
"password",
400,
[],
400 if not original_app.config["FEATURE_EXTENDED_REPOSITORY_NAMES"] else 200,
[]
if not original_app.config["FEATURE_EXTENDED_REPOSITORY_NAMES"]
else ["devtable/simple/foo/bar/baz:pull"],
True,
"private",
False,

View File

@ -17,7 +17,7 @@ from test.registry.protocol_fixtures import *
from test.registry.protocols import Failures, Image, layer_bytes_for_contents, ProtocolOptions
from app import instance_keys
from app import instance_keys, app as original_app
from data.registry_model import registry_model
from image.docker.schema1 import DOCKER_SCHEMA1_MANIFEST_CONTENT_TYPE
from image.docker.schema2 import DOCKER_SCHEMA2_MANIFEST_CONTENT_TYPE
@ -1988,7 +1988,21 @@ def test_login(
True,
),
# Basic pull with invalid endpoint.
("devtable", "password", ["repository:someinvalid/devtable/simple:pull"], [], False),
(
"devtable",
"password",
["repository:someinvalid/devtable/simple:pull"],
[]
if not original_app.config["FEATURE_EXTENDED_REPOSITORY_NAMES"]
else [
{
"type": "repository",
"name": "someinvalid/devtable/simple",
"actions": [],
},
],
False if not original_app.config["FEATURE_EXTENDED_REPOSITORY_NAMES"] else True,
),
# Pull with no access.
(
"public",

View File

@ -2015,12 +2015,18 @@ class TestCreateRepo(ApiTestCase):
def test_invalidreponame(self):
self.login(ADMIN_ACCESS_USER)
if app.config["FEATURE_EXTENDED_REPOSITORY_NAMES"]:
json = self.postJsonResponse(
RepositoryList,
data=dict(repository="some/repo", visibility="public", description=""),
expected_code=201,
)
else:
json = self.postJsonResponse(
RepositoryList,
data=dict(repository="some/repo", visibility="public", description=""),
expected_code=400,
)
self.assertEqual("Invalid repository name", json["detail"])
def test_duplicaterepo(self):

View File

@ -777,7 +777,7 @@ CONFIG_SCHEMA = {
"FEATURE_EXTENDED_REPOSITORY_NAMES": {
"type": "boolean",
"description": "Whether repository names can have nested paths (/)",
"x-example": False,
"x-example": True,
},
# Login
"FEATURE_GITHUB_LOGIN": {
@ -1196,5 +1196,11 @@ CONFIG_SCHEMA = {
],
},
},
# Create repo on public push
"CREATE_REPOSITORY_ON_PUSH_PUBLIC": {
"type": "boolean",
"description": "Whether to create a repository when pushing to an unexisting public repo",
"x-example": False,
},
},
}