From 6b90b0090cb55d03b0251f700dc682cf6d72057e Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Sep 29 2017 15:17:42 +0000 Subject: Merge branch 'release/1.4' --- diff --git a/ansible/files/sync2jira.py b/ansible/files/sync2jira.py index e349a12..d9f9278 100644 --- a/ansible/files/sync2jira.py +++ b/ansible/files/sync2jira.py @@ -49,10 +49,12 @@ config = { 'odcs': { 'project': 'FACTORY', 'component': None, }, 'fedrepo_req': { 'project': 'FACTORY', 'component': None, }, - 'releng': { 'project': 'RCM', 'component': 'Fedora', }, - 'pungi-fedora': { 'project': 'RCM', 'component': 'Fedora', }, + # Unwanted until we have two-way sync. + #'releng': { 'project': 'RCM', 'component': 'Fedora', }, + #'pungi-fedora': { 'project': 'RCM', 'component': 'Fedora', }, 'modularity': { 'project': 'RHELPLAN', 'component': None, 'labels': 'appstream', }, + 'fedora-ci/AtomicCi': { 'project': 'RHELPLAN', 'component': None, 'labels': 'sst_phoebe_testing_process_rhel8'}, }, 'github': { 'nirzari/review-rot': {'project': 'DEVOPSA', 'component': None, }, @@ -67,15 +69,17 @@ config = { 'fedora-infra/bodhi': { 'project': 'FACTORY', 'component': None, }, + 'fedora-modularity/f27-content-tracking': { 'project': 'RHELPLAN', 'component': None, 'labels': 'appstream', }, + # Handy utils #'ralphbean/finishline': { 'project': 'FACTORY', 'component': None, }, - #'product-definition-center/product-definition-center': { - # 'project': 'PDC', 'component': 'PDC Github', }, - #'product-definition-center/pdc-client': { - # 'project': 'PDC', 'component': 'PDC Github', }, - #'product-definition-center/pdc-ruby-gem': { - # 'project': 'PDC', 'component': 'PDC Github', }, + 'product-definition-center/product-definition-center': { + 'project': 'PDC', 'component': 'PDC Github', }, + 'product-definition-center/pdc-client': { + 'project': 'PDC', 'component': 'PDC Github', }, + 'product-definition-center/pdc-ruby-gem': { + 'project': 'PDC', 'component': 'PDC Github', }, 'Commonjava/indy': {'project': 'NOS', 'component': 'Indy'}, 'Commonjava/indy-docker': {'project': 'NOS', 'component': 'Indy'}, diff --git a/setup.py b/setup.py index 3aa9ce1..ca0c365 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ with open('test-requirements.txt', 'rb') as f: setup( name='sync2jira', - version='1.3', + version='1.4', description="Sync pagure and github issues to jira, via fedmsg", long_description=long_description, author='Ralph Bean', diff --git a/sync2jira/downstream.py b/sync2jira/downstream.py index f065074..249036f 100644 --- a/sync2jira/downstream.py +++ b/sync2jira/downstream.py @@ -61,12 +61,12 @@ def get_existing_jira_issue_legacy(issue, config): """ kwargs = dict(issue.downstream.items()) - kwargs["'External issue URL'"] = "'%s'" % issue.url + kwargs["External issue URL"] = "%s" % issue.url kwargs = sorted(kwargs.items(), key=operator.itemgetter(0)) client = jira.client.JIRA(**config['sync2jira']['jira']) query = " AND ".join([ - "=".join([k, v]) for k, v in kwargs + "=".join(["'%s'" % k, "'%s'" % v]) for k, v in kwargs if v is not None ]) + " AND (resolution is null OR resolution = Duplicate)" results = client.search_issues(query) @@ -129,9 +129,9 @@ def create_jira_issue(issue, config): ) if issue.downstream['project']: kwargs['project'] = dict(key=issue.downstream['project']) - if issue.downstream['component']: + if issue.downstream.get('component'): kwargs['components'] = [dict(name=issue.downstream['component'])] # TODO - make this a list in the config - if issue.downstream['labels']: + if issue.downstream.get('labels'): labels = issue.downstream['labels'] if not isinstance(labels, list): labels = [labels] diff --git a/sync2jira/upstream.py b/sync2jira/upstream.py index 21bc960..2cfee83 100644 --- a/sync2jira/upstream.py +++ b/sync2jira/upstream.py @@ -58,6 +58,9 @@ def handle_github_message(msg, config): def handle_pagure_message(msg, config): upstream = msg['msg']['project']['name'] + ns = msg['msg']['project'].get('namespace') or None + if ns: + upstream = '{ns}/{upstream}'.format(ns=ns, upstream=upstream) mapped_repos = config['sync2jira']['map']['pagure'] if upstream not in mapped_repos: