From 298ff2e010adcc99b8614678d9e63e8e98fabfad Mon Sep 17 00:00:00 2001 From: qiaofeng1227 <76487013@qq.com> Date: Mon, 24 Jul 2023 17:55:37 +0800 Subject: [PATCH] changelog --- .github/workflows/upload_artifact.yml | 1 + CHANGELOG.md | 1 + appmanage/api/service/manage.py | 42 +++++---------------------- appmanage/api/v1/routers/apps.py | 7 +++-- install/install.sh | 1 + 5 files changed, 15 insertions(+), 37 deletions(-) diff --git a/.github/workflows/upload_artifact.yml b/.github/workflows/upload_artifact.yml index 84de05c1..2c8e02b8 100644 --- a/.github/workflows/upload_artifact.yml +++ b/.github/workflows/upload_artifact.yml @@ -30,6 +30,7 @@ jobs: cp version.json websoft9 zip -r websoft9-$version.zip websoft9 cp websoft9-$version.zip artifacts + cp version.json artifacts cp artifacts/websoft9-$version.zip artifacts/websoft9-latest.zip - name: Upload To Azure Blob diff --git a/CHANGELOG.md b/CHANGELOG.md index d446fd8b..7fae420d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.8.2 release on 2023-07-24 1. install from artifacts +2. add extre version.json into artifacts ## 0.7.2 release on 2023-06-25 diff --git a/appmanage/api/service/manage.py b/appmanage/api/service/manage.py index bdba6baa..df13d8c9 100644 --- a/appmanage/api/service/manage.py +++ b/appmanage/api/service/manage.py @@ -39,11 +39,8 @@ def auto_update(): myLogger.info_logger("auto update start...") local_path = '/usr/share/cockpit/appstore/appstore.json' local_version = "0" - try: - op = shell_execute.execute_command_output_all("cat " + local_path)['result'] - local_version = json.loads(op)['Version'] - except: - local_version = "0.0.0" + op = shell_execute.execute_command_output_all("cat " + local_path)['result'] + local_version = json.loads(op)['Version'] download_url = const.ARTIFACT_URL + "/plugin/appstore-latest.zip" cmd = "cd /opt && wget " + download_url + " && unzip appstore-latest.zip " @@ -68,8 +65,9 @@ def auto_update(): myLogger.info_logger("Appstore is latest, not need to update.") scheduler = BackgroundScheduler() -scheduler.add_job(auto_update, 'cron', hour=1) -scheduler.start() +# scheduler.add_job(auto_update, 'cron', day=1) +# scheduler.start() +# scheduler.stop() # 获取github文件内容 def get_github_content(repo, path): @@ -99,36 +97,12 @@ def AppAutoUpdate(auto_update): # 更新软件商店 def AppStoreUpdate(): - local_path = '/data/library/install/version.json' - local_version = "0" - try: - op = shell_execute.execute_command_output_all("cat " + local_path)['result'] - local_version = json.loads(op)['VERSION'] - except: - local_version = "0.0.1" - - repo = 'docker-library' - version_contents = get_github_content(repo, 'install/version.json') - version = json.loads(version_contents)['VERSION'] - - if compared_version(local_version, version) == -1: - content = [] - change_log_contents = get_github_content(repo, 'CHANGELOG.md') - change_log = change_log_contents.split('## ')[1].split('\n') - for change in change_log[1:]: - if change != '': - content.append(change) - shell_execute.execute_command_output_all("rm -rf /tmp/update_appstore.sh") - shell_execute.execute_command_output_all("cd /tmp && wget https://websoft9.github.io/websoft9/install/update_appstore.sh") - shell_execute.execute_command_output_all("bash /tmp/update_appstore.sh 1>/dev/null 2>&1") - - return content - else: - return None + + auto_update() # 获取 update info def get_update_list(): - local_path = '/data/apps/websoft9/install/version.json' + local_path = '/data/apps/websoft9/version.json' repo = 'websoft9' local_version = "0" try: diff --git a/appmanage/api/v1/routers/apps.py b/appmanage/api/v1/routers/apps.py index b9966c04..c38f1c6a 100644 --- a/appmanage/api/v1/routers/apps.py +++ b/appmanage/api/v1/routers/apps.py @@ -59,7 +59,7 @@ update = "  Compare_content: 新旧版本内容{\n\n" \ "      date: 更新日期\n\n" \ "      content: 更新内容\n\n    }\n\n  }\n\n}\n\n" -appstore_update = "  Update_content: [] 更新内容\n\n}\n\n" +appstore_update = "  Update_flag: 更新结果(成功或失败)\n\n}\n\n" auto = "  auto_update: 目前的自动更新状态\n\n}\n\n" user = "  user: 用户信息{\n\n" \ "      username: 用户名\n\n" \ @@ -359,7 +359,7 @@ def AppDomainList(request: Request, app_id: Optional[str] = Query(default=None, return response -@router.api_route("/AppStoreUpdateList", methods=["GET", "POST"], summary="查询Appstore更新內容", response_model=Response, response_description=rd_appstore) +@router.api_route("/AppStoreUpdateList", methods=["GET", "POST"], summary="查询Appstore更新內容", response_model=Response, response_description=rd_update_list) def AppStoreUpdateList(request: Request): try: @@ -413,9 +413,10 @@ def AppStoreUpdate(request: Request): try: myLogger.info_logger("Receive request: /AppStoreUpdate") get_headers(request) + manage.AppStoreUpdate() ret = {} ret['ResponseData'] = {} - ret['ResponseData']['Update_content'] = manage.AppStoreUpdate() + ret['ResponseData']['Update_flag'] = "success" myLogger.info_logger(ret) response = JSONResponse(content=ret) except CommandException as ce: diff --git a/install/install.sh b/install/install.sh index e0476aae..319525e5 100644 --- a/install/install.sh +++ b/install/install.sh @@ -339,6 +339,7 @@ mkdir -p /data/apps && cd /data/apps wget $urls/websoft9-latest.zip unzip websoft9-latest.zip cp -r /data/apps/websoft9/docker /data/apps/w9services +rm -f websoft9-latest.zip # install plugins cd /usr/share/cockpit