mirror of
https://github.com/YunoHost/yunorunner.git
synced 2024-09-03 20:05:52 +02:00
[enh] store repo state
This commit is contained in:
parent
768507df8c
commit
480bda0e9a
2 changed files with 12 additions and 0 deletions
|
@ -9,6 +9,11 @@ class Repo(peewee.Model):
|
|||
revision = peewee.CharField(null=True)
|
||||
app_list = peewee.CharField(null=True)
|
||||
|
||||
state = peewee.CharField(choices=(
|
||||
('working', 'Working'),
|
||||
('other_than_working', 'Other than working'),
|
||||
), default="other_than_working")
|
||||
|
||||
class Meta:
|
||||
database = db
|
||||
|
||||
|
|
7
run.py
7
run.py
|
@ -173,6 +173,12 @@ async def monitor_apps_lists(type="stable"):
|
|||
|
||||
await create_job(app_id, app_list_name, repo, job_command_last_part)
|
||||
|
||||
repo_state = "working" if app_data["state"] in ("working", "validated") else "other_than_working"
|
||||
|
||||
if repo.state != repo_state:
|
||||
repo.state = repo_state
|
||||
repo.save()
|
||||
|
||||
# new app
|
||||
else:
|
||||
task_logger.info(f"New application detected: {app_id} in {app_list_name}, scheduling a new job")
|
||||
|
@ -181,6 +187,7 @@ async def monitor_apps_lists(type="stable"):
|
|||
url=app_data["git"]["url"],
|
||||
revision=commit_sha,
|
||||
app_list=app_list_name,
|
||||
state="working" if app_data["state"] in ("working", "validated") else "other_than_working",
|
||||
)
|
||||
|
||||
await create_job(app_id, app_list_name, repo, job_command_last_part)
|
||||
|
|
Loading…
Add table
Reference in a new issue