remove versions for now
This commit is contained in:
Binary file not shown.
@@ -386,46 +386,10 @@ def init_routes(main_bp):
|
||||
gitea_repo = git_settings.get('repo') if git_settings else None
|
||||
|
||||
for instance in instances:
|
||||
# 1. Check status
|
||||
# Check status
|
||||
status_info = check_instance_status(instance)
|
||||
instance.status = status_info['status']
|
||||
instance.status_details = status_info['details']
|
||||
|
||||
# 2. Check deployed version
|
||||
deployed_version = None
|
||||
deployed_tag = None
|
||||
deployed_commit = None
|
||||
try:
|
||||
version_url = f"{instance.main_url.rstrip('/')}/api/version"
|
||||
resp = requests.get(version_url, timeout=30) # Increased timeout to 30 seconds
|
||||
if resp.status_code == 200:
|
||||
version_data = resp.json()
|
||||
deployed_version = version_data.get('version', 'unknown')
|
||||
deployed_tag = version_data.get('tag', 'unknown')
|
||||
deployed_commit = version_data.get('commit', 'unknown')
|
||||
except Exception as e:
|
||||
deployed_version = None
|
||||
deployed_tag = None
|
||||
deployed_commit = None
|
||||
|
||||
instance.deployed_version = deployed_tag or deployed_version or 'unknown'
|
||||
instance.deployed_branch = instance.deployed_branch or 'master'
|
||||
|
||||
# 3. Check latest version from Gitea (if settings available)
|
||||
latest_version = None
|
||||
deployed_branch = instance.deployed_branch or 'master'
|
||||
if gitea_url and gitea_token and gitea_repo:
|
||||
try:
|
||||
headers = {'Accept': 'application/json', 'Authorization': f'token {gitea_token}'}
|
||||
# Gitea API: /api/v1/repos/{owner}/{repo}/commits/{branch}
|
||||
commit_url = f"{gitea_url}/api/v1/repos/{gitea_repo}/commits/{deployed_branch}"
|
||||
commit_resp = requests.get(commit_url, headers=headers, timeout=30) # Increased timeout to 30 seconds
|
||||
if commit_resp.status_code == 200:
|
||||
latest_version = commit_resp.json().get('sha')
|
||||
except Exception as e:
|
||||
latest_version = None
|
||||
instance.latest_version = latest_version or 'unknown'
|
||||
instance.version_checked_at = datetime.utcnow()
|
||||
|
||||
db.session.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user