mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-02-13 10:05:15 +08:00
Merge branch 'ridad' of ssh://pagure.io/fm-orchestrator into ridad
This commit is contained in:
@@ -19,9 +19,9 @@ port = 5000
|
||||
# Set to zero to disable polling
|
||||
polling_interval = 60
|
||||
|
||||
rpms_default_repository = git://pkgs.fedoraproject.org/rpms/
|
||||
rpms_default_repository = git://pkgs.stg.fedoraproject.org/rpms/
|
||||
rpms_allow_repository = False
|
||||
rpms_default_cache = http://pkgs.fedoraproject.org/repo/pkgs/
|
||||
rpms_default_cache = http://pkgs.stg.fedoraproject.org/repo/pkgs/
|
||||
rpms_allow_cache = False
|
||||
|
||||
ssl_enabled = True
|
||||
|
||||
@@ -40,6 +40,7 @@ import datetime
|
||||
import time
|
||||
import random
|
||||
import string
|
||||
import kobo.rpmlib
|
||||
|
||||
import munch
|
||||
from OpenSSL.SSL import SysCallError
|
||||
@@ -123,9 +124,10 @@ class GenericBuilder:
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def buildroot_add_artifacts(self, artifacts):
|
||||
def buildroot_add_artifacts(self, artifacts, install=False):
|
||||
"""
|
||||
:param artifacts: list of artifacts to be available in buildroot
|
||||
:param install=False: pre-install artifact in buildroot (otherwise "make it available for install")
|
||||
add artifacts into buildroot, can be used to override buildroot macros
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
@@ -161,13 +163,14 @@ class Builder:
|
||||
|
||||
def retry(callback, **kwargs):
|
||||
attempt = 0
|
||||
log.debug("retry() calling %r(kwargs=%r)" % (callback, kwargs))
|
||||
while True:
|
||||
try:
|
||||
callback(**kwargs)
|
||||
break
|
||||
except SysCallError:
|
||||
attempt += 1
|
||||
log.debug("Retry(): attempt=%d retrying callback." % attempt)
|
||||
log.warn("retry(attempt=%d) calling %r(kwargs=%r)" % (attempt, callback, kwargs))
|
||||
|
||||
class KojiModuleBuilder(GenericBuilder):
|
||||
""" Koji specific builder class """
|
||||
@@ -259,9 +262,9 @@ It should NEVER be installed on any system as it will really mess up
|
||||
%build
|
||||
|
||||
%install
|
||||
mkdir -p %buildroot/%_rpmconfigdir/macro.d 2>/dev/null |:
|
||||
echo %%dist %dist > %buildroot/%_rpmconfigdir/macro.modules
|
||||
chmod 644 %buildroot/%_rpmconfigdir/macro.modules
|
||||
mkdir -p %buildroot/%_rpmconfigdir/macros.d 2>/dev/null |:
|
||||
echo %%dist %dist > %buildroot/%_rpmconfigdir/macros.d/macro.modules
|
||||
chmod 644 %buildroot/%_rpmconfigdir/macros.d/macro.modules
|
||||
|
||||
|
||||
%files
|
||||
@@ -370,11 +373,23 @@ chmod 644 %buildroot/%_rpmconfigdir/macro.modules
|
||||
log.info("%r adding deps for %r" % (self, tags))
|
||||
self._koji_add_many_tag_inheritance(self.module_build_tag, tags)
|
||||
|
||||
def buildroot_add_artifacts(self, artifacts):
|
||||
def buildroot_add_artifacts(self, artifacts, install=False):
|
||||
"""
|
||||
:param artifacts - list of artifacts to add to buildroot
|
||||
:param install=False - force install artifact (if it's not dragged in as dependency)
|
||||
"""
|
||||
# TODO: import /usr/bin/koji's TaskWatcher()
|
||||
log.info("%r adding artifacts %r" % (self, artifacts))
|
||||
dest_tag = self._get_tag(self.module_build_tag)['id']
|
||||
for nvr in artifacts:
|
||||
self.koji_session.tagBuild(self._get_tag(self.module_build_tag)['id'], nvr, force=True)
|
||||
self.koji_session.tagBuild(dest_tag, nvr, force=True)
|
||||
if install:
|
||||
# we usually want just srpm-build
|
||||
for group in ('srpm-build',):
|
||||
pkg_info = kobo.rpmlib.parse_nvr(nvr)
|
||||
log.info("%r adding %s to group %s" % (self, pkg_info['name'], group))
|
||||
self.koji_session.groupPackageListAdd(dest_tag, group, pkg_info['name'])
|
||||
|
||||
|
||||
def wait_task(self, task_id):
|
||||
"""
|
||||
|
||||
@@ -52,7 +52,6 @@ def wait(config, session, msg):
|
||||
module_info = build.json()
|
||||
if module_info['state'] != rida.BUILD_STATES["wait"]:
|
||||
# XXX: not sure why did we get here from state == 2 (building) FIXTHIS
|
||||
print("Invalid state %s for wait()" % module_info['state'])
|
||||
log.error("Invalid state %s for wait(). Msg=%s" % (module_info['state'], msg))
|
||||
return
|
||||
log.info("Found module_info=%s from message" % module_info)
|
||||
@@ -81,9 +80,10 @@ def wait(config, session, msg):
|
||||
# TODO -- this has to go eventually.. otherwise, we can only build one
|
||||
# module at a time and that just won't scale.
|
||||
builder.wait_task(task_id)
|
||||
# TODO -- do cleanup if this fails
|
||||
|
||||
artifact = get_artifact_from_srpm(srpm)
|
||||
builder.buildroot_add_artifacts([artifact,]) # pretty much srpm filename
|
||||
builder.buildroot_add_artifacts([artifact,], install=True) # tag && add to srpm-build group
|
||||
builder.buildroot_ready(artifacts=[artifact,])
|
||||
|
||||
build.transition(config, state="build") # Wait for the buildroot to be ready.
|
||||
|
||||
@@ -235,6 +235,7 @@ class Poller(threading.Thread):
|
||||
'msg_id': 'a faked internal message',
|
||||
'topic': 'org.fedoraproject.prod.buildsys.build.state.change',
|
||||
'msg': {
|
||||
'msg_id': 'a faked internal message',
|
||||
'task_id': component_build.task_id,
|
||||
'new': koji.BUILD_STATES['FAILED'],
|
||||
},
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"scmurl": "git://pkgs.stg.fedoraproject.org/modules/testmodule.git?#5188d22b255c9f54798926959f43967a057ca690"
|
||||
"scmurl": "git://pkgs.stg.fedoraproject.org/modules/testmodule.git?#d0c328b61a1b842bb5c400fc8eeb588af7746d2d"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user