[copr] master: 2 tests fixed, one still failing (284071f)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 284071fcf288218bfbd1c367afa610bf3fc76595
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 30 18:59:47 2013 +0200
2 tests fixed, one still failing
>---------------------------------------------------------------
copr.spec | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/copr.spec b/copr.spec
index 84f8a55..a636425 100644
--- a/copr.spec
+++ b/copr.spec
@@ -242,7 +242,7 @@ pushd coprs_frontend
TMPFILE=$(mktemp)
COPR_CONFIG="$(pwd)/config/copr_unit_test.conf" ./manage.py test | tee $TMPFILE
# remove this when tests are fixed
-grep "3 failed, 63 passed" $TMPFILE
+grep "1 failed, 65 passed" $TMPFILE
popd
%pre backend
10 years, 6 months
[copr] master: fix failing test test_fail_on_missing_dash (37a1563)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 37a1563b7faff1c12edcf50da4b2f599b11697ef
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 30 18:57:14 2013 +0200
fix failing test test_fail_on_missing_dash
_______________ TestCoprRepoGeneration.test_fail_on_missing_dash _______________
self = <test_coprs_ns.test_coprs_general.TestCoprRepoGeneration object at 0x4cdcd90>
def test_fail_on_missing_dash(self):
r = self.tc.get('/coprs/reponamewithoutdash/repo/')
assert r.status_code == 404
> assert 'Bad repository name' in r.data
E assert 'Bad repository name' in '<!doctype html>\n<html>\n<head>\n <title>Not Found</title>\n <link rel=stylesheet type=text/css href="/static/copr.... <div class="page-inner">\n \n \n Copr with name repo does not exist.\n \n\n </div>\n</div>\n</body>\n</html>'
E + where '<!doctype html>\n<html>\n<head>\n <title>Not Found</title>\n <link rel=stylesheet type=text/css href="/static/copr.... <div class="page-inner">\n \n \n Copr with name repo does not exist.\n \n\n </div>\n</div>\n</body>\n</html>' = <Response 830 bytes [404 NOT FOUND]>.data
tests/test_views/test_coprs_ns/test_coprs_general.py:393: AssertionError
>---------------------------------------------------------------
.../test_views/test_coprs_ns/test_coprs_general.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
index 57f5c26..499f892 100644
--- a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
+++ b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
@@ -390,7 +390,7 @@ class TestCoprRepoGeneration(CoprsTestCase):
def test_fail_on_missing_dash(self):
r = self.tc.get('/coprs/reponamewithoutdash/repo/')
assert r.status_code == 404
- assert 'Bad repository name' in r.data
+ assert 'Copr with name repo does not exist' in r.data
def test_fail_on_nonexistent_copr(self):
r = self.tc.get('/coprs/bogus-nonexistent-repo/repo/')
10 years, 6 months
[copr] master: fixing test_fail_on_nonexistent_copr test (75fbcb6)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 75fbcb651141e71dbf17e9da2953a9357e908d17
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 30 18:55:26 2013 +0200
fixing test_fail_on_nonexistent_copr test
addressing:
def test_fail_on_nonexistent_copr(self):
r = self.tc.get('/coprs/bogus-nonexistent-repo/repo/')
assert r.status_code == 404
> assert 'bogus/nonexistent-repo does not exist' in r.data
E assert 'bogus/nonexistent-repo does not exist' in '<!doctype html>\n<html>\n<head>\n <title>Not Found</title>\n <link rel=stylesheet type=text/css href="/static/copr.... <div class="page-inner">\n \n \n Copr with name repo does not exist.\n \n\n </div>\n</div>\n</body>\n</html>'
E + where '<!doctype html>\n<html>\n<head>\n <title>Not Found</title>\n <link rel=stylesheet type=text/css href="/static/copr.... <div class="page-inner">\n \n \n Copr with name repo does not exist.\n \n\n </div>\n</div>\n</body>\n</html>' = <Response 830 bytes [404 NOT FOUND]>.data
>---------------------------------------------------------------
.../test_views/test_coprs_ns/test_coprs_general.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
index a636287..57f5c26 100644
--- a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
+++ b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
@@ -395,7 +395,7 @@ class TestCoprRepoGeneration(CoprsTestCase):
def test_fail_on_nonexistent_copr(self):
r = self.tc.get('/coprs/bogus-nonexistent-repo/repo/')
assert r.status_code == 404
- assert 'bogus/nonexistent-repo does not exist' in r.data
+ assert 'Copr with name repo does not exist' in r.data
def test_fail_on_no_finished_builds(self, f_users, f_coprs, f_db):
r = self.tc.get(
10 years, 6 months
[copr] master: run frontend unit tests when building package (a0d5b0b)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit a0d5b0bf159be3a7d577a3b64c5a08224225fab1
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 30 09:54:14 2013 +0200
run frontend unit tests when building package
right now are 3 tests failing. Fix this later.
>---------------------------------------------------------------
copr.spec | 18 ++++++++++++++++++
coprs_frontend/config/copr_unit_test.conf | 8 ++++----
coprs_frontend/manage.py | 3 ++-
3 files changed, 24 insertions(+), 5 deletions(-)
diff --git a/copr.spec b/copr.spec
index 4e90fa3..84f8a55 100644
--- a/copr.spec
+++ b/copr.spec
@@ -85,6 +85,16 @@ Requires: python-flexmock
%if 0%{?rhel} < 7 && 0%{?rhel} > 0
BuildRequires: python-argparse
%endif
+# check
+BuildRequires: python-flask
+BuildRequires: python-flask-script
+BuildRequires: python-flask-sqlalchemy
+BuildRequires: python-flask-openid
+BuildRequires: python-flask-whooshee
+BuildRequires: python-pylibravatar
+BuildRequires: python-flask-wtf
+BuildRequires: pytest
+BuildRequires: python-flexmock
%description frontend
COPR is lightweight build system. It allows you to create new project in WebUI,
@@ -227,6 +237,14 @@ install -d %{buildroot}%{_mandir}/man8
install -p -m 644 man/%{name}-selinux-enable.8 %{buildroot}/%{_mandir}/man8/
install -p -m 644 man/%{name}-selinux-relabel.8 %{buildroot}/%{_mandir}/man8/
+%check
+pushd coprs_frontend
+TMPFILE=$(mktemp)
+COPR_CONFIG="$(pwd)/config/copr_unit_test.conf" ./manage.py test | tee $TMPFILE
+# remove this when tests are fixed
+grep "3 failed, 63 passed" $TMPFILE
+popd
+
%pre backend
getent group copr >/dev/null || groupadd -r copr
getent passwd copr >/dev/null || \
diff --git a/coprs_frontend/config/copr_unit_test.conf b/coprs_frontend/config/copr_unit_test.conf
index ffb4d66..7eacf66 100644
--- a/coprs_frontend/config/copr_unit_test.conf
+++ b/coprs_frontend/config/copr_unit_test.conf
@@ -1,8 +1,8 @@
# Directory and files where is stored Copr database files
-#DATA_DIR = '/var/lib/copr/data'
-DATABASE = '/var/lib/copr/coprs_frontend/tests/data/copr.db'
-OPENID_STORE = '/var/lib/copr/coprs_frontend/tests/data/openid_store'
-WHOOSHEE_DIR = '/var/lib/copr/coprs_frontend/tests/data/whooshee'
+DATA_DIR = '/tmp'
+DATABASE = '/tmp/copr.db'
+OPENID_STORE = '/tmp/openid_store'
+WHOOSHEE_DIR = '/tmp/whooshee'
#SECRET_KEY = 'put_some_secret_here'
#BACKEND_PASSWORD = 'password_here'
diff --git a/coprs_frontend/manage.py b/coprs_frontend/manage.py
index ab811d8..01bcbf7 100755
--- a/coprs_frontend/manage.py
+++ b/coprs_frontend/manage.py
@@ -16,7 +16,8 @@ from coprs.logic import coprs_logic
class TestCommand(Command):
def run(self, test_args):
os.environ['COPRS_ENVIRON_UNITTEST'] = '1'
- os.environ['COPR_CONFIG'] = '/etc/copr/copr_unit_test.conf'
+ if not (('COPR_CONFIG' in os.environ) and os.environ['COPR_CONFIG']):
+ os.environ['COPR_CONFIG'] = '/etc/copr/copr_unit_test.conf'
os.environ['PYTHONPATH'] = '.'
subprocess.call(['py.test'] + (test_args or []))
10 years, 6 months
[copr] master: Adjust URLs in the unit-tests to their new structure (73761b3)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 73761b3b463ef5db7b385badf39fb5d85e1a7e34
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Sep 27 15:07:37 2013 +0200
Adjust URLs in the unit-tests to their new structure
These tests should be failing since I changed the urls structure in coprs_build.py.
>---------------------------------------------------------------
.../test_views/test_coprs_ns/test_coprs_builds.py | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
index f512b18..21a8dc7 100644
--- a/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
+++ b/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_builds.py
@@ -4,14 +4,14 @@ from tests.coprs_test_case import CoprsTestCase, TransactionDecorator
class TestCoprShowBuilds(CoprsTestCase):
def test_copr_show_builds(self, f_users, f_coprs, f_builds, f_db):
- r = self.tc.get('/coprs/detail/{0}/{1}/builds/'.format(self.u2.name, self.c2.name))
+ r = self.tc.get('/coprs/{0}/{1}/builds/'.format(self.u2.name, self.c2.name))
assert r.data.count('<tr class="build-') == 2
class TestCoprAddBuild(CoprsTestCase):
@TransactionDecorator('u1')
def test_copr_owner_can_add_build(self, f_users, f_coprs, f_db):
self.db.session.add_all([self.u1, self.c1])
- r = self.test_client.post('/coprs/detail/{0}/{1}/new_build/'.format(self.u1.name, self.c1.name),
+ r = self.test_client.post('/coprs/{0}/{1}/new_build/'.format(self.u1.name, self.c1.name),
data = {'pkgs': 'http://testing'},
follow_redirects = True)
assert self.models.Build.query.first().pkgs == 'http://testing'
@@ -19,7 +19,7 @@ class TestCoprAddBuild(CoprsTestCase):
@TransactionDecorator('u1')
def test_copr_allowed_user_can_add_build(self, f_users, f_coprs, f_copr_permissions, f_db):
self.db.session.add_all([self.u2, self.c2])
- r = self.test_client.post('/coprs/detail/{0}/{1}/new_build/'.format(self.u2.name, self.c2.name),
+ r = self.test_client.post('/coprs/{0}/{1}/new_build/'.format(self.u2.name, self.c2.name),
data = {'pkgs': 'http://testing'},
follow_redirects = True)
assert self.models.Build.query.first().pkgs == 'http://testing'
@@ -28,7 +28,7 @@ class TestCoprAddBuild(CoprsTestCase):
@TransactionDecorator('u1')
def test_copr_not_yet_allowed_user_cant_add_build(self, f_users, f_coprs, f_copr_permissions, f_db):
self.db.session.add_all([self.u2, self.c3])
- r = self.test_client.post('/coprs/detail/{0}/{1}/new_build/'.format(self.u2.name, self.c3.name),
+ r = self.test_client.post('/coprs/{0}/{1}/new_build/'.format(self.u2.name, self.c3.name),
data = {'pkgs': 'http://testing'},
follow_redirects = True)
assert not self.models.Build.query.first()
@@ -36,7 +36,7 @@ class TestCoprAddBuild(CoprsTestCase):
@TransactionDecorator('u3')
def test_copr_user_without_permission_cant_add_build(self, f_users, f_coprs, f_copr_permissions, f_db):
self.db.session.add_all([self.u1, self.c1])
- r = self.test_client.post('/coprs/detail/{0}/{1}/new_build/'.format(self.u1.name, self.c1.name),
+ r = self.test_client.post('/coprs/{0}/{1}/new_build/'.format(self.u1.name, self.c1.name),
data = {'pkgs': 'http://testing'},
follow_redirects = True)
assert not self.models.Build.query.first()
@@ -46,7 +46,7 @@ class TestCoprCancelBuild(CoprsTestCase):
@TransactionDecorator('u1')
def test_copr_build_submitter_can_cancel_build(self, f_users, f_coprs, f_builds, f_db):
self.db.session.add_all([self.u1, self.c1, self.b1])
- r = self.test_client.post('/coprs/detail/{0}/{1}/cancel_build/{2}/'.format(self.u1.name, self.c1.name, self.b1.id),
+ r = self.test_client.post('/coprs/{0}/{1}/cancel_build/{2}/'.format(self.u1.name, self.c1.name, self.b1.id),
data = {},
follow_redirects = True)
self.db.session.add(self.b1)
@@ -56,7 +56,7 @@ class TestCoprCancelBuild(CoprsTestCase):
@TransactionDecorator('u2')
def test_copr_build_non_submitter_cannot_cancel_build(self, f_users, f_coprs, f_builds, f_db):
self.db.session.add_all([self.u1, self.c1, self.b1])
- r = self.test_client.post('/coprs/detail/{0}/{1}/cancel_build/{2}/'.format(self.u1.name, self.c1.name, self.b1.id),
+ r = self.test_client.post('/coprs/{0}/{1}/cancel_build/{2}/'.format(self.u1.name, self.c1.name, self.b1.id),
data = {},
follow_redirects = True)
self.db.session.add(self.b1)
10 years, 6 months
[copr] master: Adjust the CLI to call the adjuste endpoint of the API (6e81c52)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 6e81c5292afe900f4b58b19f277113073864433c
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Sep 27 15:07:36 2013 +0200
Adjust the CLI to call the adjuste endpoint of the API
>---------------------------------------------------------------
copr_cli/subcommands.py | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/copr_cli/subcommands.py b/copr_cli/subcommands.py
index 3c4da9d..c3293a7 100644
--- a/copr_cli/subcommands.py
+++ b/copr_cli/subcommands.py
@@ -47,12 +47,12 @@ def listcoprs(username=None):
user = get_user()
del(user['token'])
- copr_api_url = get_api_url()
- url = '{0}/owned/'.format(copr_api_url)
-
if username:
user['username'] = username
+ copr_api_url = get_api_url()
+ url = '{0}/coprs/{1}/'.format(copr_api_url, user['username'])
+
req = requests.get(url, params=user)
if '<title>Sign in Coprs</title>' in req.text:
@@ -128,7 +128,7 @@ def create(name, chroots=[], description=None, instructions=None,
""" Create a new copr. """
user = get_user()
copr_api_url = get_api_url()
- URL = '{0}/copr/new/'.format(copr_api_url)
+ URL = '{0}/coprs/{1}/new/'.format(copr_api_url, user['username'])
repos = None
if type(repos) == list():
@@ -163,7 +163,7 @@ def build(copr, pkgs, memory, timeout):
""" Build a new package into a given copr. """
user = get_user()
copr_api_url = get_api_url()
- URL = '{0}/coprs/detail/{1}/{2}/new_build/'.format(
+ URL = '{0}/coprs/{1}/{2}/new_build/'.format(
copr_api_url,
user['username'],
copr)
10 years, 6 months
[copr] master: Adjust API endpoint to reflects the UI endpoints in their url structure (8a53950)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 8a53950d445ac04000c948169a2d69f582a45da0
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Fri Sep 27 15:07:35 2013 +0200
Adjust API endpoint to reflects the UI endpoints in their url structure
>---------------------------------------------------------------
coprs_frontend/coprs/views/api_ns/api_general.py | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/coprs_frontend/coprs/views/api_ns/api_general.py b/coprs_frontend/coprs/views/api_ns/api_general.py
index 7130509..205f561 100644
--- a/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -44,9 +44,9 @@ def api_new_token():
return flask.redirect(flask.url_for('api_ns.api_home'))
-(a)api_ns.route('/copr/new/', methods=['POST'])
+(a)api_ns.route('/coprs/<username>/new/', methods=['POST'])
@api_login_required
-def api_new_copr():
+def api_new_copr(username):
""" Receive information from the user on how to create its new copr,
check their validity and create the corresponding copr.
@@ -101,8 +101,8 @@ def api_new_copr():
return jsonout
-(a)api_ns.route('/owned/')
-(a)api_ns.route('/owned/<username>/')
+(a)api_ns.route('/coprs/')
+(a)api_ns.route('/coprs/<username>/')
def api_coprs_by_owner(username=None):
""" Return the list of coprs owned by the given user.
username is taken either from GET params or from the URL itself
@@ -133,8 +133,7 @@ def api_coprs_by_owner(username=None):
return jsonout
-(a)api_ns.route('/coprs/detail/<username>/<coprname>/new_build/',
- methods=["POST"])
+(a)api_ns.route('/coprs/<username>/<coprname>/new_build/', methods=["POST"])
@api_login_required
def copr_new_build(username, coprname):
form = forms.BuildForm(csrf_enabled=False)
10 years, 6 months
[copr] master: add releasers.conf (17f3fb2)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 17f3fb2951e8cde13e1f028990726655855c2b07
Author: Miroslav Suchý <msuchy(a)redhat.com>
Date: Mon Sep 30 05:54:28 2013 +0200
add releasers.conf
>---------------------------------------------------------------
rel-eng/releasers.conf | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/rel-eng/releasers.conf b/rel-eng/releasers.conf
new file mode 100644
index 0000000..9e93b92
--- /dev/null
+++ b/rel-eng/releasers.conf
@@ -0,0 +1,11 @@
+[fedora-git]
+releaser = tito.release.FedoraGitReleaser
+branches = master f20 f19
+
+[fedora-git-master]
+releaser = tito.release.FedoraGitReleaser
+branches = master
+
+[fedora-git-all]
+releaser = tito.release.FedoraGitReleaser
+branches = master f20 f19 f18
10 years, 7 months
[copr] master: First pass at adding fedmsg hooks. (f814691)
by Miroslav Suchý
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit f814691f3895a7fa24818d9e020b7479a350b800
Author: Ralph Bean <rbean(a)redhat.com>
Date: Tue Mar 5 10:21:09 2013 -0500
First pass at adding fedmsg hooks.
>---------------------------------------------------------------
backend/dispatcher.py | 59 ++++++++++++++++++++++++++++++++++++++++++++-----
copr-be.conf.example | 5 ++++
copr-be.py | 2 +-
copr.spec | 1 +
4 files changed, 60 insertions(+), 7 deletions(-)
diff --git a/backend/dispatcher.py b/backend/dispatcher.py
index 8ad5b70..4817eeb 100644
--- a/backend/dispatcher.py
+++ b/backend/dispatcher.py
@@ -13,6 +13,11 @@ import ansible.errors
from ansible import callbacks
import requests
+try:
+ import fedmsg
+except ImportError:
+ pass # fedmsg is optional
+
@@ -95,18 +100,40 @@ class Worker(multiprocessing.Process):
if ip:
self.callback.log('creating worker: %s' % ip)
- self.event('creating worker: %s' % ip)
+ self.event('worker.create', 'creating worker: {ip}', dict(ip=ip))
else:
self.callback.log('creating worker: dynamic ip')
- self.event('creating worker: dynamic ip')
+ self.event('worker.create', 'creating worker: dynamic ip')
+
+ def event(self, topic, template, content=None):
+ """ Multi-purpose logging method.
+
+ Logs messages to two different destinations:
+ - The internal "events" queue for communicating back to the
+ dispatcher.
+ - The fedmsg bus. Messages are posted asynchronously to a
+ zmq.PUB socket.
+
+ """
+
+ content = content or {}
+ what = template.format(**content)
- def event(self, what):
if self.ip:
who = 'worker-%s-%s' % (self.worker_num, self.ip)
else:
who = 'worker-%s' % (self.worker_num)
self.events.put({'when':time.time(), 'who':who, 'what':what})
+ try:
+ content['who'] = who
+ content['what'] = what
+ if self.opts.fedmsg_enabled:
+ fedmsg.publish(modname="copr", topic=topic, msg=content)
+ except Exception, e:
+ # XXX - Maybe log traceback as well with traceback.format_exc()
+ self.callback.log('failed to publish message: %s' % e)
+ pass # But continue on happily.
def spawn_instance(self):
"""call the spawn playbook to startup/provision a building instance"""
@@ -261,14 +288,30 @@ class Worker(multiprocessing.Process):
self.callback.log('failure to setup instance: %s' % e)
raise
+ # This assumes there are certs and a fedmsg config on disk
+ try:
+ if self.opts.fedmsg_enabled:
+ fedmsg.init(name="relay_inbound", cert_prefix="copr", active=True)
+ except Exception, e:
+ self.callback.log('failed to initialize fedmsg: %s' % e)
+ pass # But continue on happily.
+
status = 1
job.started_on = time.time()
self.mark_started(job)
- self.event('build start: user:%s copr:%s build:%s ip:%s pid:%s' % (job.user_name, job.copr_name, job.build_id, ip, self.pid))
+ template = 'build start: user:{user} copr:{copr} build:{build} ip:{ip} pid:{pid}'
+ content = dict(user=job.user_name, copr=job.copr_name,
+ build=job.build_id, ip=ip, pid=self.pid)
+ self.event('build.start', template, content)
for chroot in job.chroots:
- self.event('chroot start: chroot:%s user:%s copr:%s build:%s ip:%s pid:%s' % (chroot, job.user_name, job.copr_name, job.build_id, ip, self.pid))
+ template = 'chroot start: chroot:{chroot} user:{user} copr:{copr} build:{build} ip:{ip} pid:{pid}'
+ content = dict(chroot=chroot, user=job.user_name,
+ copr=job.copr_name, build=job.build_id,
+ ip=ip, pid=self.pid)
+ self.event('chroot.start', template, content)
+
chroot_destdir = job.destdir + '/' + chroot
# setup our target dir locally
if not os.path.exists(chroot_destdir):
@@ -314,7 +357,11 @@ class Worker(multiprocessing.Process):
job.status = status
self.return_results(job)
self.callback.log('worker finished build: %s' % ip)
- self.event('build end: user:%s copr:%s build:%s ip:%s pid:%s status:%s' % (job.user_name, job.copr_name, job.build_id, ip, self.pid, job.status))
+ template = 'build end: user:{user} copr:{copr} build:{build} ip:{ip} pid:{pid} status:{status}'
+ content = dict(user=job.user_name, copr=job.copr_name,
+ build=job.build_id, ip=ip, pid=self.pid,
+ status=job.status)
+ self.event('build.end', template, content)
# clean up the instance
if self.create:
self.terminate_instance(ip)
diff --git a/copr-be.conf.example b/copr-be.conf.example
index f109cae..3d8cdf1 100644
--- a/copr-be.conf.example
+++ b/copr-be.conf.example
@@ -51,6 +51,11 @@ worker_logdir=/var/log/copr/workers/
# default is true
#daemonize=true
+# publish fedmsg notifications from workers if true
+# default is false
+#fedmsg_enabled=false
+
+
[builder]
# default is 1800
timeout=3600
diff --git a/copr-be.py b/copr-be.py
index 1bac8ff..c836592 100755
--- a/copr-be.py
+++ b/copr-be.py
@@ -166,6 +166,7 @@ class CoprBackend(object):
opts.destdir = _get_conf(cp, 'backend', 'destdir', None)
opts.daemonize = _get_conf(cp, 'backend', 'daemonize', True)
opts.exit_on_worker = _get_conf(cp, 'backend', 'exit_on_worker', False)
+ opts.fedmsg_enabled = _get_conf(cp, 'backend', 'fedmsg_enabled', False)
opts.sleeptime = int(_get_conf(cp, 'backend', 'sleeptime', 10))
opts.num_workers = int(_get_conf(cp, 'backend', 'num_workers', 8))
opts.timeout = int(_get_conf(cp, 'builder', 'timeout', 1800))
@@ -319,4 +320,3 @@ if __name__ == '__main__':
except KeyboardInterrupt, e:
print "\nUser cancelled, may need cleanup\n"
sys.exit(0)
-
diff --git a/copr.spec b/copr.spec
index 4a90921..4e90fa3 100644
--- a/copr.spec
+++ b/copr.spec
@@ -55,6 +55,7 @@ Requires: createrepo
Requires: python-bunch
Requires: python-requests
Requires: logrotate
+Requires: fedmsg
%description backend
COPR is lightweight build system. It allows you to create new project in WebUI,
10 years, 7 months