Commit 4c5e3e54 authored by Mustafa Gezen's avatar Mustafa Gezen
Browse files

Add packages to compose after signing

parent 5a61dbca
......@@ -29,6 +29,10 @@ def compose() -> str:
return f"{base()}-compose"
def module_compose() -> str:
return f"{base()}-module-compose"
def testing() -> str:
return f"{base()}-testing"
......
......@@ -24,6 +24,7 @@ from typing import List, Tuple
from tortoise.transactions import atomic
from distrobuild.common import tags
from distrobuild.models import ImportStatus, Package, Import, ImportCommit
from distrobuild.session import koji_session, gl
from distrobuild.settings import settings
......@@ -34,8 +35,7 @@ from distrobuild_scheduler.utils import gitlabify
@atomic()
async def do(package: Package, package_import: Import):
tag = f"dist-{settings.tag_prefix}{settings.version}"
koji_session.packageListAdd(tag, package.name, "distrobuild")
koji_session.packageListAdd(tags.base(), package.name, "distrobuild")
branch_commits = await srpmproc.import_project(package_import.id, package.name, package_import.module)
for branch in branch_commits.keys():
......
......@@ -59,6 +59,7 @@ async def consume_messages(i: int):
def schedule_periodic_tasks():
asyncio.create_task(periodic_tasks.check_build_status())
asyncio.create_task(periodic_tasks.sign_unsigned_builds())
async def main(loop):
......
......@@ -25,6 +25,7 @@ import xmlrpc
import koji
from tortoise.transactions import atomic
from distrobuild.common import tags
from distrobuild.models import Build, BuildStatus, Package
from distrobuild.session import koji_session, mbs_client
from distrobuild.settings import settings
......@@ -38,13 +39,18 @@ async def atomic_sign_unsigned_builds():
builds = await Build.filter(signed=False, status=BuildStatus.SUCCEEDED).all()
for build in builds:
if build.koji_id:
koji_session.packageListAdd(tags.compose(), build.package.name, "distrobuild")
build_tasks = koji_session.listBuilds(taskID=build.koji_id)
for build_task in build_tasks:
koji_session.tagBuild(tags.compose(), build_task["nvr"])
build_rpms = koji_session.listBuildRPMs(build_task["build_id"])
for rpm in build_rpms:
nvr_arch = "%s.%s" % (rpm["nvr"], rpm["arch"])
await sign_koji_package(nvr_arch)
koji_session.writeSignedRPM(nvr_arch, settings.sigul_key_id)
build.signed = True
await build.save()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment