mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-02 10:20:31 +08:00
Add 'scratch' and 'srpms' attributes to data model for module scratch builds,
and update tests accordingly. Signed-off-by: Merlin Mathesius <mmathesi@redhat.com>
This commit is contained in:
@@ -197,6 +197,8 @@ class ModuleBuild(MBSBase):
|
||||
# Koji tag to which tag the Content Generator Koji build.
|
||||
cg_build_koji_tag = db.Column(db.String) # This gets set after wait
|
||||
scmurl = db.Column(db.String)
|
||||
scratch = db.Column(db.Boolean, default=False)
|
||||
srpms = db.Column(db.String)
|
||||
owner = db.Column(db.String, nullable=False)
|
||||
time_submitted = db.Column(db.DateTime, nullable=False)
|
||||
time_modified = db.Column(db.DateTime)
|
||||
@@ -485,7 +487,7 @@ class ModuleBuild(MBSBase):
|
||||
|
||||
@classmethod
|
||||
def create(cls, session, conf, name, stream, version, modulemd, scmurl, username,
|
||||
context=None, rebuild_strategy=None, publish_msg=True):
|
||||
context=None, rebuild_strategy=None, scratch=False, srpms=[], publish_msg=True):
|
||||
now = datetime.utcnow()
|
||||
module = cls(
|
||||
name=name,
|
||||
@@ -499,7 +501,9 @@ class ModuleBuild(MBSBase):
|
||||
time_submitted=now,
|
||||
time_modified=now,
|
||||
# If the rebuild_strategy isn't specified, use the default
|
||||
rebuild_strategy=rebuild_strategy or conf.rebuild_strategy
|
||||
rebuild_strategy=rebuild_strategy or conf.rebuild_strategy,
|
||||
scratch=scratch,
|
||||
srpms=dumps(srpms) if srpms else '[]',
|
||||
)
|
||||
# Add a state transition to "init"
|
||||
mbt = ModuleBuildTrace(state_time=now, state=module.state)
|
||||
@@ -643,6 +647,8 @@ class ModuleBuild(MBSBase):
|
||||
'owner': self.owner,
|
||||
'rebuild_strategy': self.rebuild_strategy,
|
||||
'scmurl': self.scmurl,
|
||||
'scratch': self.scratch,
|
||||
'srpms': loads(self.srpms) if self.srpms else [],
|
||||
'siblings': self.siblings,
|
||||
'state_reason': self.state_reason,
|
||||
'time_completed': _utc_datetime_to_iso(self.time_completed),
|
||||
|
||||
@@ -129,6 +129,8 @@ class TestViews:
|
||||
assert data['context'] == '00000000'
|
||||
assert data['name'] == 'nginx'
|
||||
assert data['owner'] == 'Moe Szyslak'
|
||||
assert data['scratch'] is False
|
||||
assert data['srpms'] == []
|
||||
assert data['stream'] == '1'
|
||||
assert data['siblings'] == []
|
||||
assert data['state'] == 5
|
||||
@@ -190,6 +192,8 @@ class TestViews:
|
||||
assert data['owner'] == 'Moe Szyslak'
|
||||
assert data['scmurl'] == ('git://pkgs.domain.local/modules/nginx'
|
||||
'?#ba95886c7a443b36a9ce31abda1f9bef22f2f8c9')
|
||||
assert data['scratch'] is False
|
||||
assert data['srpms'] == []
|
||||
assert data['siblings'] == []
|
||||
assert data['state'] == 5
|
||||
assert data['state_name'] == 'ready'
|
||||
@@ -274,7 +278,9 @@ class TestViews:
|
||||
"rebuild_strategy": "changed-and-after",
|
||||
"scmurl": ("git://pkgs.domain.local/modules/testmodule"
|
||||
"?#ca95886c7a443b36a9ce31abda1f9bef22f2f8c9"),
|
||||
"scratch": False,
|
||||
"siblings": [],
|
||||
"srpms": [],
|
||||
"state": 1,
|
||||
"state_name": "wait",
|
||||
"state_reason": None,
|
||||
@@ -311,7 +317,9 @@ class TestViews:
|
||||
"rebuild_strategy": "changed-and-after",
|
||||
"scmurl": ("git://pkgs.domain.local/modules/postgressql"
|
||||
"?#aa95886c7a443b36a9ce31abda1f9bef22f2f8c9"),
|
||||
"scratch": False,
|
||||
"siblings": [],
|
||||
"srpms": [],
|
||||
"state": 3,
|
||||
"state_name": "done",
|
||||
"state_reason": None,
|
||||
@@ -358,7 +366,9 @@ class TestViews:
|
||||
"rebuild_strategy": "changed-and-after",
|
||||
"scmurl": ("git://pkgs.domain.local/modules/nginx"
|
||||
"?#ba95886c7a443b36a9ce31abda1f9bef22f2f8c9"),
|
||||
"scratch": False,
|
||||
"siblings": [2],
|
||||
"srpms": [],
|
||||
"state": 5,
|
||||
"state_name": "ready",
|
||||
"state_reason": None,
|
||||
|
||||
Reference in New Issue
Block a user