summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2015-02-01 21:07:32 +0200
committerEd Bartosh <eduard.bartosh@intel.com>2015-02-03 21:02:09 +0200
commit15e407bdddb1c32f404c0ec955d279056e0c2d77 (patch)
tree2293902912d220df451aa838e9aeb233b793cd17
parent9ca8c63af3f92f2c7d71d119ef7ef7f2a735f2ac (diff)
downloadrepa-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.157
-rw-r--r--repa/lock.py68
-rw-r--r--repa/unlock.py68
-rwxr-xr-xsetup.py4
4 files changed, 196 insertions, 1 deletions
diff --git a/repa.1 b/repa.1
index bbbe262..7650a85 100644
--- a/repa.1
+++ b/repa.1
@@ -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()))
diff --git a/setup.py b/setup.py
index b4b012c..3078c9d 100755
--- a/setup.py
+++ b/setup.py
@@ -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']
})