diff options
author | Ed Bartosh <eduard.bartosh@intel.com> | 2015-02-01 21:07:32 +0200 |
---|---|---|
committer | Ed Bartosh <eduard.bartosh@intel.com> | 2015-02-03 21:02:09 +0200 |
commit | 15e407bdddb1c32f404c0ec955d279056e0c2d77 (patch) | |
tree | 2293902912d220df451aa838e9aeb233b793cd17 | |
parent | 9ca8c63af3f92f2c7d71d119ef7ef7f2a735f2ac (diff) | |
download | repa-15e407bdddb1c32f404c0ec955d279056e0c2d77.tar.gz repa-15e407bdddb1c32f404c0ec955d279056e0c2d77.tar.bz2 repa-15e407bdddb1c32f404c0ec955d279056e0c2d77.zip |
Implement repa lock/unlock
repa lock triggers re job on jenkins with action=lock.
repa unlock triggers re job on jenkins with action=lock.
Fixes: #2321
Change-Id: I9ce75d14056f1044986703454031b4d071cee07c
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r-- | repa.1 | 57 | ||||
-rw-r--r-- | repa/lock.py | 68 | ||||
-rw-r--r-- | repa/unlock.py | 68 | ||||
-rwxr-xr-x | setup.py | 4 |
4 files changed, 196 insertions, 1 deletions
@@ -49,6 +49,12 @@ Submission group is a temporary group of submissions, created for testing purpos .RS 2 8. \fBrebuild\fR - rebuild submission .RE +.RS 2 +9. \fBlock\fR - lock submission +.RE +.RS 2 +10. \fBunlock\fR - unlock submission +.RE .\" =========================================================================== .\" Global options @@ -393,6 +399,57 @@ Provide a comment with the explanation of a reason for rebuild. Mandatory option Rebuild only one package. .RE +.\" +.\" The "lock" command description +.\" +.SS \fBlock\fR [options] <submision> + +.RS 2 +Lock submission by triggering 're' Jenkins job. 're' job locks submission by disabling build in prerelease OBS project. + +.\" +.\" The "lock" command's options +.\" +.RS 2 +\fBOPTIONS\fR +.RS 2 +.B \-h, \-\-help +.RS 2 +Print short help text about the "lock" command and exit. +.RE + +.PP +.B \-c \-\-comment COMMENT +.RS 2 +Provide a comment with the explanation of a reason for lock. Mandatory option. +.RE + +.\" +.\" The "unlock" command description +.\" +.SS \fBunlock\fR [options] <submision> + +.RS 2 +Unlock submission by triggering 're' Jenkins job. 're' job unlocks submission by re-enabling build in prerelease OBS project. + +.\" +.\" The "unlock" command's options +.\" +.RS 2 +\fBOPTIONS\fR +.RS 2 +.B \-h, \-\-help +.RS 2 +Print short help text about the "unlock" command and exit. +.RE + +.PP +.B \-c \-\-comment COMMENT +.RS 2 +Provide a comment with the explanation of a reason for unlock. +.RE + + .SH CONFIGURATION FILE .RS 2 diff --git a/repa/lock.py b/repa/lock.py new file mode 100644 index 0000000..9edd966 --- /dev/null +++ b/repa/lock.py @@ -0,0 +1,68 @@ +#!/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> + +Lock module. +Lock submissions. +""" + +import sys + +from collections import namedtuple + +from repa.main import sub_main +from repa.jenkins import trigger_build + +class Lock(object): + """Subcommand: lock submissions.""" + + name = 'lock' + description = 'Lock 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('-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': 'lock', + 'submission': argv.submission, + '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:], Lock())) diff --git a/repa/unlock.py b/repa/unlock.py new file mode 100644 index 0000000..47e0fec --- /dev/null +++ b/repa/unlock.py @@ -0,0 +1,68 @@ +#!/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> + +Unlock module. +Unlock submissions. +""" + +import sys + +from collections import namedtuple + +from repa.main import sub_main +from repa.jenkins import trigger_build + +class Unlock(object): + """Subcommand: unlock submissions.""" + + name = 'unlock' + description = 'Unlock 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('-c', '--comment', help='comment') + + @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': 'unlock', + 'submission': argv.submission, + '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:], Unlock())) @@ -49,5 +49,7 @@ setup(name="repa", 'rmgroup = repa.rmgroup:RmGroup', 'show = repa.show:Show', 'diff = repa.diff:Diff', - 'rebuild = repa.rebuild:Rebuild'] + 'rebuild = repa.rebuild:Rebuild', + 'lock = repa.lock:Lock', + 'unlock = repa.unlock:Unlock'] }) |