forked from wangbo/easyai
fix(deploy): 固定配套服务版本并同步已核验网关镜像
This commit is contained in:
@@ -56,7 +56,7 @@ if args[:1] == ['inspect']:
|
||||
print('true|unhealthy' if unhealthy else 'true|healthy')
|
||||
sys.exit(0)
|
||||
sys.exit(1)
|
||||
if args[:3] == ['compose', 'config', '--services']: print('easyai-server\\neasyai-web\\nws-gateway\\nmodel-conversion-worker\\nmongo\\nredis')
|
||||
if args[:3] == ['compose', 'config', '--services']: print('easyai-server\\neasyai-web\\nws-gateway\\neasyai-updater\\nmodel-conversion-worker\\nmongo\\nredis')
|
||||
elif args[:3] == ['compose', 'ps', '-q']: print('container-' + args[-1])
|
||||
sys.exit(0)
|
||||
''')
|
||||
@@ -121,6 +121,29 @@ with tempfile.TemporaryDirectory(prefix='easyai-conversion-update-') as temporar
|
||||
result = run(command, root, {**env, 'UPDATE_TEST_UNHEALTHY': '1', 'UPDATE_HEALTH_TIMEOUT_SECONDS': '1'})
|
||||
assert result.returncode != 0
|
||||
assert '应用更新成功' not in result.stdout
|
||||
if name == 'bash':
|
||||
companion_env = {**env, 'UPDATE_SERVICES': 'ws-gateway easyai-updater',
|
||||
'UPDATE_GATEWAY_VERSION': '3.25.0.20261009',
|
||||
'UPDATE_UPDATER_VERSION': '3.25.0.20261009'}
|
||||
original = (root / '.env').read_bytes()
|
||||
for overrides in ({'UPDATE_GATEWAY_VERSION': 'latest;unsafe'},
|
||||
{'UPDATE_SERVICES': 'ws-gateway'}):
|
||||
log.write_text('')
|
||||
result = run(command, root, {**companion_env, **overrides})
|
||||
assert result.returncode != 0
|
||||
assert original == (root / '.env').read_bytes()
|
||||
assert not any(c[:2] in [['compose', 'pull'], ['compose', 'up']] for c in calls(log))
|
||||
log.write_text('')
|
||||
result = run(command, root, companion_env)
|
||||
assert result.returncode == 0, result.stdout + result.stderr
|
||||
assert ['compose', 'pull', 'ws-gateway', 'easyai-updater'] in calls(log)
|
||||
assert ['compose', 'up', '-d', '--no-deps', 'ws-gateway', 'easyai-updater'] in calls(log)
|
||||
new_values = dict(line.split('=', 1) for line in (root / '.env').read_text().splitlines() if '=' in line and not line.startswith('#'))
|
||||
assert new_values['WS_GATEWAY_VERSION'] == new_values['UPDATER_VERSION'] == '3.25.0.20261009'
|
||||
assert new_values['VERSION'] == values['VERSION']
|
||||
assert new_values['MODEL_CONVERSION_WORKER_VERSION'] == values['MODEL_CONVERSION_WORKER_VERSION']
|
||||
assert new_values['CONFIG_JWT_SECRET'] == values['CONFIG_JWT_SECRET']
|
||||
print('bash: independent companion pins preserve non-target versions and reject invalid scope passed')
|
||||
print(f'{name}: selected services, stable secret, invalid service and unhealthy Worker passed')
|
||||
|
||||
case = base / 'self-update'
|
||||
|
||||
Reference in New Issue
Block a user