From 0353b5a7400c643bfaf18f2e7b8431c1086c1d2d Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 3 Dec 2014 12:45:34 +0100 Subject: [PATCH] contrib/bkr: allow specifying the jobtype and create "scratch" jobs by default Add a new paramter --jobtype to bkr.py --- contrib/rh-bkr/bkr.py | 11 +++++++++++ contrib/rh-bkr/job01.xml | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/rh-bkr/bkr.py b/contrib/rh-bkr/bkr.py index ee182cbfe9..5317ff0f59 100755 --- a/contrib/rh-bkr/bkr.py +++ b/contrib/rh-bkr/bkr.py @@ -479,6 +479,7 @@ class CmdSubmit(CmdBase): self.parser.add_argument('--reservesys', '-R', action='store_true', help='add task /distribution/reservesys') self.parser.add_argument('--var', '-V', action='append', help='Set template replacements (alternative to setting via environment variables') self.parser.add_argument('--hosttype', help='The host type. Known values are \'dcb\', \'infiniband\', and \'wifi\'. Anything else uses the default. This determines the $HOSTREQUIRES template') + self.parser.add_argument('--jobtype', help='The job type. Known values are \'rhel70\'. Anything else uses the default to create a retention=scratch job. This determines the $JOBTYPE template') def _prepare_rpms(self): if self.options.rpm is None: @@ -582,6 +583,15 @@ class CmdSubmit(CmdBase): def _detect_hosttype(self): return 'default' + def _process_line_get_JOBTYPE(self, key, replacement, index=None, none=None): + v = self._get_default('JOBTYPE') + if v is not None: + return v; + jobtype = self.options.jobtype + if jobtype == 'rhel70': + return 'product="cpe:/o:redhat:enterprise_linux:7.0" retention_tag="active+1"' + return 'retention_tag="scratch"' + def _process_line_get_HOSTREQUIRES(self, key, replacement, index=None, none=None): v = self._get_default('HOSTREQUIRES') if v is not None: @@ -625,6 +635,7 @@ class CmdSubmit(CmdBase): 'DISTRO_METHOD' : 'nfs', 'DISTRO_ARCH' : 'x86_64', 'HOSTREQUIRES' : _process_line_get_HOSTREQUIRES, + 'JOBTYPE' : _process_line_get_JOBTYPE, 'TEST_URL' : 'http://download.eng.brq.redhat.com/scratch/vbenes/NetworkManager-rhel-7.tar.gz', 'GIT_TARGETBRANCH' : _process_line_get_GIT_TARGETBRANCH, 'UUID' : str(uuid.uuid4()), diff --git a/contrib/rh-bkr/job01.xml b/contrib/rh-bkr/job01.xml index 0e3c928ea2..56b40a71c0 100644 --- a/contrib/rh-bkr/job01.xml +++ b/contrib/rh-bkr/job01.xml @@ -1,4 +1,4 @@ - + $WHITEBOARD $UUID $ARGV