diff --git a/models.py b/models.py index 1e9af77..8822b79 100644 --- a/models.py +++ b/models.py @@ -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 diff --git a/run.py b/run.py index f1acc28..6cd86b6 100644 --- a/run.py +++ b/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)