mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 03:38:12 +08:00
Keep and use the full scm url instead of reconstructing it.
This commit is contained in:
5
rida.py
5
rida.py
@@ -133,13 +133,14 @@ def submit_build():
|
||||
pkg["commit"] = rida.scm.SCM(pkg["repository"]).get_latest()
|
||||
except Exception as e:
|
||||
return failure("Failed to get the latest commit: %s" % pkgname, 422)
|
||||
if not rida.scm.SCM(pkg["repository"] + "?#" + pkg["commit"]).is_available():
|
||||
full_url = pkg["repository"] + "?#" + pkg["commit"]
|
||||
if not rida.scm.SCM(full_url).is_available():
|
||||
return failure("Cannot checkout %s" % pkgname, 422)
|
||||
build = rida.database.ComponentBuild(
|
||||
module_id=module.id,
|
||||
package=pkgname,
|
||||
format="rpms",
|
||||
gitref=pkg["commit"], # TODO - re-evaluate this w.r.t. supported branches
|
||||
scmurl=full_url,
|
||||
)
|
||||
db.session.add(build)
|
||||
module.modulemd = mmd.dumps()
|
||||
|
||||
@@ -229,7 +229,7 @@ class ComponentBuild(Base):
|
||||
__tablename__ = "component_builds"
|
||||
id = Column(Integer, primary_key=True)
|
||||
package = Column(String, nullable=False)
|
||||
gitref = Column(String, nullable=False)
|
||||
scmurl = Column(String, nullable=False)
|
||||
# XXX: Consider making this a proper ENUM
|
||||
format = Column(String, nullable=False)
|
||||
task_id = Column(Integer) # This is the id of the build in koji
|
||||
|
||||
@@ -53,12 +53,13 @@ def done(config, session, msg):
|
||||
builder.buildroot_resume()
|
||||
|
||||
for component_build in unbuilt_components:
|
||||
scmurl = "{dist_git}/{package}?#{gitref}".format(
|
||||
dist_git=config.rpms_default_repository,
|
||||
package=component_build.package,
|
||||
gitref=component_build.gitref, # This is the update stream
|
||||
)
|
||||
component_build.state = koji.BUILD_STATES['BUILDING']
|
||||
log.debug("Using scmurl=%s for package=%s" % (scmurl, component_build.package))
|
||||
component_build.task_id = builder.build(artifact=component_build.package, source=scmurl)
|
||||
log.debug("Using scmurl=%s for package=%s" % (
|
||||
component_build.scmurl,
|
||||
component_build.package,
|
||||
))
|
||||
component_build.task_id = builder.build(
|
||||
artifact=component_build.package,
|
||||
source=component_build.scmurl,
|
||||
)
|
||||
session.commit()
|
||||
|
||||
@@ -58,7 +58,7 @@ class TestRepoDone(unittest.TestCase):
|
||||
"""
|
||||
component_build = mock.Mock()
|
||||
component_build.package = 'foo'
|
||||
component_build.gitref = 'beef'
|
||||
component_build.scmurl = 'full_scm_url'
|
||||
component_build.state = None
|
||||
module_build = mock.Mock()
|
||||
module_build.component_builds = [component_build]
|
||||
@@ -69,4 +69,4 @@ class TestRepoDone(unittest.TestCase):
|
||||
'msg': {'tag': 'no matches for this...'},
|
||||
}
|
||||
self.fn(config=self.config, session=self.session, msg=msg)
|
||||
build_fn.assert_called_once_with('TODO', 'dist_git_url/rpms/foo?#beef')
|
||||
build_fn.assert_called_once_with('TODO', 'full_scm_url')
|
||||
|
||||
Reference in New Issue
Block a user