This repository has been archived on 2020-03-24. You can view files and clone it, but cannot push or open issues or pull requests.
quay/data/model/release.py

22 lines
737 B
Python
Raw Normal View History

2015-09-16 15:44:58 +00:00
from data.database import QuayRelease, QuayRegion, QuayService
def set_region_release(service_name, region_name, version):
service, _ = QuayService.get_or_create(name=service_name)
region, _ = QuayRegion.get_or_create(name=region_name)
2015-09-16 15:44:58 +00:00
return QuayRelease.get_or_create(service=service, version=version, region=region)
2015-09-16 15:44:58 +00:00
def get_recent_releases(service_name, region_name):
return (QuayRelease
2016-01-19 19:49:40 +00:00
.select(QuayRelease)
.join(QuayService)
.switch(QuayRelease)
.join(QuayRegion)
.where(QuayService.name == service_name,
QuayRegion.name == region_name,
QuayRelease.reverted == False,
)
.order_by(QuayRelease.created.desc()))