From 169496396b13753b93de7279e906bc657f2359f4 Mon Sep 17 00:00:00 2001 From: Khai Do <zaro0508@gmail.com> Date: Thu, 16 Jun 2016 23:14:34 -0700 Subject: [PATCH] Refactor gerrit commentlinks parameter Refactor the commentlinks to allow review.o.o and review-dev.o.o to define seperate comment links. We essentially want to point review.o.o story links to storyboard.o.o and review-dev.o.o links to storyboard-dev.o.o Change-Id: I70e5791a76ca97756613c393e598978ec13c8271 --- modules/openstack_project/manifests/gerrit.pp | 44 +------------------ modules/openstack_project/manifests/review.pp | 42 ++++++++++++++++++ .../openstack_project/manifests/review_dev.pp | 42 ++++++++++++++++++ 3 files changed, 86 insertions(+), 42 deletions(-) diff --git a/modules/openstack_project/manifests/gerrit.pp b/modules/openstack_project/manifests/gerrit.pp index af41884579..c09b5bac02 100644 --- a/modules/openstack_project/manifests/gerrit.pp +++ b/modules/openstack_project/manifests/gerrit.pp @@ -78,6 +78,7 @@ class openstack_project::gerrit ( $index_threads = 1, $download = {}, $receive_max_object_size_limit = '100 m', + $commentlinks = [], ) { class { 'jeepyb::openstackwatch': @@ -142,48 +143,7 @@ class openstack_project::gerrit ( httpd_maxthreads => $httpd_maxthreads, httpd_maxqueued => $httpd_maxqueued, httpd_maxwait => $httpd_maxwait, - commentlinks => [ - { - name => 'bugheader', - match => '([Cc]loses|[Pp]artial|[Rr]elated)-[Bb]ug:\\s*#?(\\d+)', - link => 'https://launchpad.net/bugs/$2', - }, - { - name => 'bug', - match => '\\b[Bb]ug:? #?(\\d+)', - link => 'https://launchpad.net/bugs/$1', - }, - { - name => 'story', - match => '\\b[Ss]tory:? #?(\\d+)', - link => 'https://storyboard.openstack.org/#!/story/$1', - }, - { - name => 'blueprint', - match => '(\\b[Bb]lue[Pp]rint\\b|\\b[Bb][Pp]\\b)[ \\t#:]*([A-Za-z0-9\\-]+)', - link => 'https://blueprints.launchpad.net/openstack/?searchtext=$2', - }, - { - name => 'testresult', - match => '<li>([^ ]+) <a href=\"[^\"]+\" target=\"_blank\">([^<]+)</a> : ([^ ]+)([^<]*)</li>', - html => '<li class=\"comment_test\"><span class=\"comment_test_name\"><a href=\"$2\">$1</a></span> <span class=\"comment_test_result\"><span class=\"result_$3\">$3</span>$4</span></li>', - }, - { - name => 'launchpadbug', - match => '<a href=\"(https://bugs\\.launchpad\\.net/[a-zA-Z0-9\\-]+/\\+bug/(\\d+))[^\"]*\">[^<]+</a>', - html => '<a href=\"$1\">$1</a>' - }, - { - name => 'changeid', - match => '(I[0-9a-f]{8,40})', - link => '/#q,$1,n,z', - }, - { - name => 'gitsha', - match => '(<p>|[\\s(])([0-9a-f]{40})(</p>|[\\s.,;:)])', - html => '$1<a href=\"/#q,$2,n,z\">$2</a>$3', - }, - ], + commentlinks => $commentlinks, trackingids => [ { name => 'storyboard', diff --git a/modules/openstack_project/manifests/review.pp b/modules/openstack_project/manifests/review.pp index ebb39d8d9c..e6d4709107 100644 --- a/modules/openstack_project/manifests/review.pp +++ b/modules/openstack_project/manifests/review.pp @@ -140,6 +140,48 @@ class openstack_project::review ( token_private_key => $token_private_key, swift_username => $swift_username, swift_password => $swift_password, + commentlinks => [ + { + name => 'bugheader', + match => '([Cc]loses|[Pp]artial|[Rr]elated)-[Bb]ug:\\s*#?(\\d+)', + link => 'https://launchpad.net/bugs/$2', + }, + { + name => 'bug', + match => '\\b[Bb]ug:? #?(\\d+)', + link => 'https://launchpad.net/bugs/$1', + }, + { + name => 'story', + match => '\\b[Ss]tory:? #?(\\d+)', + link => 'https://storyboard.openstack.org/#!/story/$1', + }, + { + name => 'blueprint', + match => '(\\b[Bb]lue[Pp]rint\\b|\\b[Bb][Pp]\\b)[ \\t#:]*([A-Za-z0-9\\-]+)', + link => 'https://blueprints.launchpad.net/openstack/?searchtext=$2', + }, + { + name => 'testresult', + match => '<li>([^ ]+) <a href=\"[^\"]+\" target=\"_blank\">([^<]+)</a> : ([^ ]+)([^<]*)</li>', + html => '<li class=\"comment_test\"><span class=\"comment_test_name\"><a href=\"$2\">$1</a></span> <span class=\"comment_test_result\"><span class=\"result_$3\">$3</span>$4</span></li>', + }, + { + name => 'launchpadbug', + match => '<a href=\"(https://bugs\\.launchpad\\.net/[a-zA-Z0-9\\-]+/\\+bug/(\\d+))[^\"]*\">[^<]+</a>', + html => '<a href=\"$1\">$1</a>' + }, + { + name => 'changeid', + match => '(I[0-9a-f]{8,40})', + link => '/#q,$1,n,z', + }, + { + name => 'gitsha', + match => '(<p>|[\\s(])([0-9a-f]{40})(</p>|[\\s.,;:)])', + html => '$1<a href=\"/#q,$2,n,z\">$2</a>$3', + }, + ], download => { 'command' => ['checkout', 'cherry_pick', 'pull', 'format_patch'], 'scheme' => ['ssh', 'anon_http', 'anon_git'], diff --git a/modules/openstack_project/manifests/review_dev.pp b/modules/openstack_project/manifests/review_dev.pp index 8c92b3d154..1990b792ae 100644 --- a/modules/openstack_project/manifests/review_dev.pp +++ b/modules/openstack_project/manifests/review_dev.pp @@ -77,6 +77,48 @@ class openstack_project::review_dev ( swift_username => $swift_username, swift_password => $swift_password, replication_force_update => true, + commentlinks => [ + { + name => 'bugheader', + match => '([Cc]loses|[Pp]artial|[Rr]elated)-[Bb]ug:\\s*#?(\\d+)', + link => 'https://launchpad.net/bugs/$2', + }, + { + name => 'bug', + match => '\\b[Bb]ug:? #?(\\d+)', + link => 'https://launchpad.net/bugs/$1', + }, + { + name => 'story', + match => '\\b[Ss]tory:? #?(\\d+)', + link => 'https://storyboard-dev.openstack.org/#!/story/$1', + }, + { + name => 'blueprint', + match => '(\\b[Bb]lue[Pp]rint\\b|\\b[Bb][Pp]\\b)[ \\t#:]*([A-Za-z0-9\\-]+)', + link => 'https://blueprints.launchpad.net/openstack/?searchtext=$2', + }, + { + name => 'testresult', + match => '<li>([^ ]+) <a href=\"[^\"]+\" target=\"_blank\">([^<]+)</a> : ([^ ]+)([^<]*)</li>', + html => '<li class=\"comment_test\"><span class=\"comment_test_name\"><a href=\"$2\">$1</a></span> <span class=\"comment_test_result\"><span class=\"result_$3\">$3</span>$4</span></li>', + }, + { + name => 'launchpadbug', + match => '<a href=\"(https://bugs\\.launchpad\\.net/[a-zA-Z0-9\\-]+/\\+bug/(\\d+))[^\"]*\">[^<]+</a>', + html => '<a href=\"$1\">$1</a>' + }, + { + name => 'changeid', + match => '(I[0-9a-f]{8,40})', + link => '/#q,$1,n,z', + }, + { + name => 'gitsha', + match => '(<p>|[\\s(])([0-9a-f]{40})(</p>|[\\s.,;:)])', + html => '$1<a href=\"/#q,$2,n,z\">$2</a>$3', + }, + ], replication => [ { name => 'github',