summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Bartosh <eduard.bartosh@intel.com>2015-02-01 21:38:11 +0200
committerEd Bartosh <eduard.bartosh@intel.com>2015-02-03 21:03:25 +0200
commit5f8cbd38fe90433bc6419484d19befe9eadecaf2 (patch)
tree30d8492d301c64d2e1aa5fe63d18c2ed87502c07
parent15e407bdddb1c32f404c0ec955d279056e0c2d77 (diff)
downloadrepa-5f8cbd38fe90433bc6419484d19befe9eadecaf2.tar.gz
repa-5f8cbd38fe90433bc6419484d19befe9eadecaf2.tar.bz2
repa-5f8cbd38fe90433bc6419484d19befe9eadecaf2.zip
Implement repa remove
repa remove triggers re job on jenkins with action=remove. Fixes: #2323 Change-Id: Ieb2e779b82d360b34ef0342bb947d6f5b4833955 Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
-rw-r--r--repa.129
-rw-r--r--repa/remove.py68
-rwxr-xr-xsetup.py3
3 files changed, 99 insertions, 1 deletions
diff --git a/repa.1 b/repa.1
index 7650a85..289e88e 100644
--- a/repa.1
+++ b/repa.1
@@ -55,6 +55,9 @@ Submission group is a temporary group of submissions, created for testing purpos
.RS 2
10. \fBunlock\fR - unlock submission
.RE
+.RS 2
+11. \fBremove\fR - remove submission
+.RE
.\" ===========================================================================
.\" Global options
@@ -450,6 +453,32 @@ Provide a comment with the explanation of a reason for unlock.
.RE
+.\"
+.\" The "remove" command description
+.\"
+.SS \fBremove\fR [options] <submision>
+
+.RS 2
+Remove submission by triggering 're' Jenkins job. 're' job remove prerelease OBS project.
+
+.\"
+.\" The "remove" command's options
+.\"
+.RS 2
+\fBOPTIONS\fR
+.RS 2
+.B \-h, \-\-help
+.RS 2
+Print short help text about the "remove" command and exit.
+.RE
+
+.PP
+.B \-c \-\-comment COMMENT
+.RS 2
+Provide a comment with the explanation of a reason for remove. This is mandatory option.
+.RE
+
+
.SH CONFIGURATION FILE
.RS 2
diff --git a/repa/remove.py b/repa/remove.py
new file mode 100644
index 0000000..f06cbbf
--- /dev/null
+++ b/repa/remove.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>
+
+Remove module.
+Remove submission.
+"""
+
+import sys
+
+from collections import namedtuple
+
+from repa.main import sub_main
+from repa.jenkins import trigger_build
+
+class Remove(object):
+ """Subcommand: remove submissions."""
+
+ name = 'remove'
+ description = 'Remove 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': 'remove',
+ '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:], Remove()))
diff --git a/setup.py b/setup.py
index 3078c9d..1ab6cc4 100755
--- a/setup.py
+++ b/setup.py
@@ -51,5 +51,6 @@ setup(name="repa",
'diff = repa.diff:Diff',
'rebuild = repa.rebuild:Rebuild',
'lock = repa.lock:Lock',
- 'unlock = repa.unlock:Unlock']
+ 'unlock = repa.unlock:Unlock',
+ 'remove = repa.remove:Remove']
})