diff --git a/rida.py b/rida.py index eac87544..f62373fb 100755 --- a/rida.py +++ b/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() diff --git a/rida/database.py b/rida/database.py index 4fe2d71e..d87ddb4f 100644 --- a/rida/database.py +++ b/rida/database.py @@ -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 diff --git a/rida/scheduler/handlers/repos.py b/rida/scheduler/handlers/repos.py index 2f1ad620..43341c5f 100644 --- a/rida/scheduler/handlers/repos.py +++ b/rida/scheduler/handlers/repos.py @@ -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() diff --git a/tests/test_scheduler/test_repo_done.py b/tests/test_scheduler/test_repo_done.py index 8cdd4004..85afea6d 100644 --- a/tests/test_scheduler/test_repo_done.py +++ b/tests/test_scheduler/test_repo_done.py @@ -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')