Make sure builds are queued under a transaction. This should prevent a queue item from existing without its repository build object (or vice versa).
This commit is contained in:
parent
8b331b453e
commit
208c97776f
1 changed files with 11 additions and 9 deletions
|
@ -10,6 +10,7 @@ from flask.ext.principal import identity_changed
|
|||
from random import SystemRandom
|
||||
|
||||
from data import model
|
||||
from data.database import db
|
||||
from app import app, login_manager, dockerfile_build_queue, notification_queue
|
||||
from auth.permissions import QuayDeferredPermissionUser
|
||||
from auth import scopes
|
||||
|
@ -222,6 +223,7 @@ def start_build(repository, dockerfile_id, tags, build_name, subdir, manual,
|
|||
'build_subdir': subdir
|
||||
}
|
||||
|
||||
with app.config['DB_TRANSACTION_FACTORY'](db):
|
||||
build_request = model.create_repository_build(repository, token, job_config,
|
||||
dockerfile_id, build_name,
|
||||
trigger, pull_robot_name=pull_robot_name)
|
||||
|
|
Reference in a new issue