diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2015-02-01 16:12:08 +0200 |
---|---|---|
committer | Ed Bartosh <eduard.bartosh@intel.com> | 2015-02-03 13:52:19 +0200 |
commit | a03832111e1d743781209e026197560e3e2e2c53 (patch) | |
tree | 6284fe330901da0d3f7e80b6034c2b1b170ac542 | |
parent | cb263aceee9e200e62a1c59996bae813590ea049 (diff) | |
download | repa-a03832111e1d743781209e026197560e3e2e2c53.tar.gz repa-a03832111e1d743781209e026197560e3e2e2c53.tar.bz2 repa-a03832111e1d743781209e026197560e3e2e2c53.zip |
Implement repa rebuild submcommand
repa rebuild triggers re job on jenkins with action=rebuild.
Fixes: #2322
Change-Id: I5a18aeb441eeb608d3015e131d150665cd6992a1
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r-- | repa.1 | 34 | ||||
-rw-r--r-- | repa/rebuild.py | 70 | ||||
-rwxr-xr-x | setup.py | 3 |
3 files changed, 106 insertions, 1 deletions
@@ -46,6 +46,9 @@ Submission group is a temporary group of submissions, created for testing purpos .RS 2 7. \fBdiff\fR - show the difference between projects .RE +.RS 2 +8. \fBrebuild\fR - rebuild submission +.RE .\" =========================================================================== .\" Global options @@ -359,6 +362,37 @@ Print short help text about the "diff" command and exit. .RE +.\" +.\" The "rebuild" command description +.\" +.SS \fBrebuild\fR [options] <submision> + +.RS 2 +Rebuild submission by triggering 're' Jenkins job. 're' job triggering rebuild by re-exports packages in submission. By default it re-exports all packages. It's also possible to re-export only one package using --package command line option. + +.\" +.\" The "rebuild" command's options +.\" +.RS 2 +\fBOPTIONS\fR +.RS 2 +.B \-h, \-\-help +.RS 2 +Print short help text about the "rebuild" command and exit. +.RE + +.PP +.B \-c \-\-comment COMMENT +.RS 2 +Provide a comment with the explanation of a reason for rebuild. Mandatory option. +.RE + +.PP +.B \-p \-\-package <package name> +.RS 2 +Rebuild only one package. +.RE + .SH CONFIGURATION FILE .RS 2 diff --git a/repa/rebuild.py b/repa/rebuild.py new file mode 100644 index 0000000..d79b823 --- /dev/null +++ b/repa/rebuild.py @@ -0,0 +1,70 @@ +#!/usr/bin/env python +# +# This file is part of REPA: Release Engineering Process Assistant. +# +# Copyright (C) 2015 Intel Corporation +# +# REPA is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301, USA. + +""" +REPA: Release Engineering Process Assistant. + +Copyright (C) Intel Corporation 2015 +Licence: GPL version 2 +Author: Ed Bartosh <eduard.bartosh@intel.com> + +Rebuild module. +Rebuild submissions. +""" + +import sys + +from collections import namedtuple + +from repa.main import sub_main +from repa.jenkins import trigger_build + +class Rebuild(object): + """Subcommand: rebuild submissions.""" + + name = 'rebuild' + description = 'Rebuild submission' + help = description + + @staticmethod + def add_arguments(parser, _): + """Adds arguments to the parser. Called from [sub_]main.""" + parser.add_argument('submission', help='submission') + parser.add_argument('-p', '--package', help='package') + parser.add_argument('-c', '--comment', help='comment', required=True) + + @staticmethod + def run(argv): + """Command line entry point. Called from [sub_]main.""" + job = 're' + cred = namedtuple('cred', ['url', 'username', 'password'])(\ + argv.jenkins_url, argv.jenkins_user, argv.jenkins_passwd) + build, status, out = \ + trigger_build(job, {'action': 'rebuild', + 'submission': argv.submission, + 'package': argv.package, + 'target_project': argv.project, + 'comment': argv.comment}, cred) + print "Jenkins job: %s, build #%s, status: %s" % (job, build, status) + print out + return status == 'SUCCESS' + +if __name__ == '__main__': + sys.exit(sub_main(sys.argv[1:], Rebuild())) @@ -48,5 +48,6 @@ setup(name="repa", 'reject = repa.reject:Reject', 'rmgroup = repa.rmgroup:RmGroup', 'show = repa.show:Show', - 'diff = repa.diff:Diff'] + 'diff = repa.diff:Diff', + 'rebuild = repa.rebuild:Rebuild'] }) |