feat(configs): deprecared old hooks protocol and ssh wrapper.

New defaults are now set on v2 keys, so previous installation are automatically set to new keys.
Fallback mode is still available.
This commit is contained in:
RhodeCode Admin 2024-08-07 13:35:47 +02:00
parent 55281cb2b0
commit efb6d1e422
12 changed files with 14 additions and 12 deletions

View file

@ -624,7 +624,8 @@ vcs.scm_app_implementation = http
; Push/Pull operations hooks protocol, available options are:
; `http` - use http-rpc backend (default)
; `celery` - use celery based hooks
vcs.hooks.protocol = http
#DEPRECATED:vcs.hooks.protocol = http
vcs.hooks.protocol.v2 = celery
; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be
; accessible via network.

View file

@ -592,7 +592,8 @@ vcs.scm_app_implementation = http
; Push/Pull operations hooks protocol, available options are:
; `http` - use http-rpc backend (default)
; `celery` - use celery based hooks
vcs.hooks.protocol = http
#DEPRECATED:vcs.hooks.protocol = http
vcs.hooks.protocol.v2 = celery
; Host on which this instance is listening for hooks. vcsserver will call this host to pull/push hooks so it should be
; accessible via network.

View file

@ -157,7 +157,7 @@ class SshVcsServer(object):
return exit_code, action == "push"
def run(self, tunnel_extras=None):
self.hooks_protocol = self.settings['vcs.hooks.protocol']
self.hooks_protocol = self.settings['vcs.hooks.protocol.v2']
tunnel_extras = tunnel_extras or {}
extras = {}
extras.update(tunnel_extras)

View file

@ -32,7 +32,7 @@ class GitServerCreator(object):
config_data = {
'app:main': {
'ssh.executable.git': git_path,
'vcs.hooks.protocol': 'http',
'vcs.hooks.protocol.v2': 'celery',
}
}
repo_name = 'test_git'

View file

@ -31,7 +31,7 @@ class MercurialServerCreator(object):
config_data = {
'app:main': {
'ssh.executable.hg': hg_path,
'vcs.hooks.protocol': 'http',
'vcs.hooks.protocol.v2': 'celery',
}
}
repo_name = 'test_hg'

View file

@ -29,7 +29,7 @@ class SubversionServerCreator(object):
config_data = {
'app:main': {
'ssh.executable.svn': svn_path,
'vcs.hooks.protocol': 'http',
'vcs.hooks.protocol.v2': 'celery',
}
}
repo_name = 'test-svn'

View file

@ -106,7 +106,7 @@ def sanitize_settings_and_apply_defaults(global_config, settings):
settings_maker.make_setting('vcs.svn.redis_conn', 'redis://redis:6379/0')
settings_maker.make_setting('vcs.svn.proxy.enabled', True, parser='bool')
settings_maker.make_setting('vcs.svn.proxy.host', 'http://svn:8090', parser='string')
settings_maker.make_setting('vcs.hooks.protocol', 'http')
settings_maker.make_setting('vcs.hooks.protocol.v2', 'celery')
settings_maker.make_setting('vcs.hooks.host', '*')
settings_maker.make_setting('vcs.scm_app_implementation', 'http')
settings_maker.make_setting('vcs.server', '')

View file

@ -35,7 +35,7 @@ def configure_vcs(config):
'svn': 'rhodecode.lib.vcs.backends.svn.SubversionRepository',
}
conf.settings.HOOKS_PROTOCOL = config['vcs.hooks.protocol']
conf.settings.HOOKS_PROTOCOL = config['vcs.hooks.protocol.v2']
conf.settings.HOOKS_HOST = config['vcs.hooks.host']
conf.settings.DEFAULT_ENCODINGS = config['default_encoding']
conf.settings.ALIASES[:] = config['vcs.backends']

View file

@ -117,7 +117,7 @@ class TestSanitizeVcsSettings(object):
_string_funcs = [
('vcs.svn.compatible_version', ''),
('vcs.hooks.protocol', 'http'),
('vcs.hooks.protocol.v2', 'celery'),
('vcs.hooks.host', '*'),
('vcs.scm_app_implementation', 'http'),
('vcs.server', ''),

View file

@ -110,7 +110,7 @@ def ini_config(request, tmpdir_factory, rcserver_port, vcsserver_port):
'vcs.server.protocol': 'http',
'vcs.scm_app_implementation': 'http',
'vcs.svn.proxy.enabled': 'true',
'vcs.hooks.protocol': 'http',
'vcs.hooks.protocol.v2': 'celery',
'vcs.hooks.host': '*',
'repo_store.path': TESTS_TMP_PATH,
'app.service_api.token': 'service_secret_token',

View file

@ -399,7 +399,7 @@ class TestGenerateVcsResponse(object):
def call_controller_with_response_body(self, response_body):
settings = {
'base_path': 'fake_base_path',
'vcs.hooks.protocol': 'http',
'vcs.hooks.protocol.v2': 'celery',
'vcs.hooks.direct_calls': False,
}
registry = AttributeDict()

View file

@ -449,7 +449,7 @@ class TestPullRequestModel(object):
@pytest.mark.usefixtures('config_stub')
class TestIntegrationMerge(object):
@pytest.mark.parametrize('extra_config', (
{'vcs.hooks.protocol': 'http', 'vcs.hooks.direct_calls': False},
{'vcs.hooks.protocol.v2': 'celery', 'vcs.hooks.direct_calls': False},
))
def test_merge_triggers_push_hooks(
self, pr_util, user_admin, capture_rcextensions, merge_extras,