mirror of https://github.com/openspug/spug
fix issue
parent
adeccb08cd
commit
a2056edbbd
|
@ -67,7 +67,7 @@ class Command(BaseCommand):
|
||||||
f'cd {settings.BASE_DIR}',
|
f'cd {settings.BASE_DIR}',
|
||||||
f'python3 ./manage.py makemigrations ' + ' '.join(apps),
|
f'python3 ./manage.py makemigrations ' + ' '.join(apps),
|
||||||
f'python3 ./manage.py migrate',
|
f'python3 ./manage.py migrate',
|
||||||
f'python3 ./tools/migrate.py {version}'
|
f'python3 ./tools/migrate.py {settings.SPUG_VERSION}'
|
||||||
]
|
]
|
||||||
task = subprocess.Popen(' && '.join(commands), shell=True)
|
task = subprocess.Popen(' && '.join(commands), shell=True)
|
||||||
if task.wait() != 0:
|
if task.wait() != 0:
|
||||||
|
|
|
@ -14,6 +14,7 @@ import uuid
|
||||||
import os
|
import os
|
||||||
|
|
||||||
REPOS_DIR = settings.REPOS_DIR
|
REPOS_DIR = settings.REPOS_DIR
|
||||||
|
BUILD_DIR = settings.BUILD_DIR
|
||||||
|
|
||||||
|
|
||||||
def dispatch(rep: Repository, helper=None):
|
def dispatch(rep: Repository, helper=None):
|
||||||
|
@ -65,7 +66,7 @@ def _build(rep: Repository, helper, env):
|
||||||
extras = json.loads(rep.extra)
|
extras = json.loads(rep.extra)
|
||||||
git_dir = os.path.join(REPOS_DIR, str(rep.deploy_id))
|
git_dir = os.path.join(REPOS_DIR, str(rep.deploy_id))
|
||||||
build_dir = os.path.join(REPOS_DIR, rep.spug_version)
|
build_dir = os.path.join(REPOS_DIR, rep.spug_version)
|
||||||
tar_file = os.path.join(REPOS_DIR, 'build', f'{rep.spug_version}.tar.gz')
|
tar_file = os.path.join(BUILD_DIR, f'{rep.spug_version}.tar.gz')
|
||||||
env.update(SPUG_DST_DIR=extend.dst_dir)
|
env.update(SPUG_DST_DIR=extend.dst_dir)
|
||||||
if extras[0] == 'branch':
|
if extras[0] == 'branch':
|
||||||
tree_ish = extras[2]
|
tree_ish = extras[2]
|
||||||
|
|
|
@ -109,7 +109,7 @@ MONITOR_WORKER_KEY = 'spug:monitor:worker'
|
||||||
EXEC_WORKER_KEY = 'spug:exec:worker'
|
EXEC_WORKER_KEY = 'spug:exec:worker'
|
||||||
REQUEST_KEY = 'spug:request'
|
REQUEST_KEY = 'spug:request'
|
||||||
BUILD_KEY = 'spug:build'
|
BUILD_KEY = 'spug:build'
|
||||||
REPOS_DIR = os.path.join(BASE_DIR, 'repos')
|
REPOS_DIR = os.path.join(os.path.dirname(os.path.dirname(BASE_DIR)), 'repos')
|
||||||
BUILD_DIR = os.path.join(REPOS_DIR, 'build')
|
BUILD_DIR = os.path.join(REPOS_DIR, 'build')
|
||||||
|
|
||||||
# Internationalization
|
# Internationalization
|
||||||
|
|
|
@ -9,34 +9,15 @@ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "spug.settings")
|
||||||
django.setup()
|
django.setup()
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from apps.app.models import App
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
class Version:
|
|
||||||
def __init__(self, version):
|
|
||||||
self.version = version.lstrip('vV').split('.')
|
|
||||||
|
|
||||||
def __gt__(self, other):
|
|
||||||
if not isinstance(other, Version):
|
|
||||||
raise TypeError('required type Version')
|
|
||||||
for v1, v2 in zip(self.version, other.version):
|
|
||||||
if int(v1) == int(v2):
|
|
||||||
continue
|
|
||||||
elif int(v1) > int(v2):
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
return False
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
old_version = Version(sys.argv[1])
|
version = sys.argv[1]
|
||||||
now_version = Version(settings.SPUG_VERSION)
|
if version < 'v3.0.1-beta.8':
|
||||||
if old_version < Version('v2.3.14'):
|
print('执行 v3.0.1-beta.8 repos目录迁移')
|
||||||
app = App.objects.first()
|
old_path = os.path.join(settings.BASE_DIR, 'repos')
|
||||||
if app and hasattr(app, 'sort_id') and app.sort_id == 0:
|
new_path = os.path.join(settings.REPOS_DIR)
|
||||||
print('执行v2.3.14数据初始化')
|
shutil.move(old_path, new_path)
|
||||||
for app in App.objects.all():
|
|
||||||
app.sort_id = app.id
|
|
||||||
app.save()
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ export default observer(function () {
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item required label="监控主机" style={getStyle(['3', '4'])}>
|
<Form.Item required label="监控主机" style={getStyle(['3', '4'])}>
|
||||||
{store.record.targets?.length > 0 && `已选择 ${store.record.targets.length} 台`}
|
{store.record.targets?.length > 0 && `已选择 ${store.record.targets.length} 台`}
|
||||||
<Button type="link" onClick={() => setShowSelector(true)}>选择主机</Button>
|
<Button type="link" style={{padding: 0}} onClick={() => setShowSelector(true)}>选择主机</Button>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item label="响应时间" style={getStyle(['1'])}>
|
<Form.Item label="响应时间" style={getStyle(['1'])}>
|
||||||
<Input suffix="ms" value={extra} placeholder="最长响应时间(毫秒),不设置则默认10秒超时"
|
<Input suffix="ms" value={extra} placeholder="最长响应时间(毫秒),不设置则默认10秒超时"
|
||||||
|
|
Loading…
Reference in New Issue