Let's concentrate all the tbox_group manipulation logics into a central lib.
On Mon, Sep 28, 2020 at 03:49:19PM +0800, Zhang Yuhang wrote:
change to remove /-(\d+)$/
Exmaple: "taishan-xxx--xxx-12" remove "-12"
Signed-off-by: Zhang Yuhang zhangyuhang25@huawei.com
src/lib/web_backend.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/lib/web_backend.rb b/src/lib/web_backend.rb index 4544690..419ef86 100644 --- a/src/lib/web_backend.rb +++ b/src/lib/web_backend.rb @@ -41,16 +41,19 @@ def es_count(query) ES_CLIENT.count(index: 'jobs*', body: query)['count'] end
These comments are essential, however not enough. What's the reason or purpose for all these rules?
-# "vm-hi1620-2p8g-212" remove "-212" -# "vm-hi1620-2p8g-zzz" remove "-zzz" -# "vm-git-bisect" don't remove "-bisect" +# vm-hi1620-2p4g-12 remove -12 +# taishan-xxx--xxx-12 remove -12 +# vm-hi1620-2p4g--0x remove --0x +# vm-hi1620-2p4g-abc remove -abc +# vm-git-bisect don't remove -bisect
Thanks, Fengguang
def filter_tbox_group(es_result) result = Set.new es_result.each do |r|
- if r =~ /(^.+--.+$)|(^vm-.*-\d\w*-([a-zA-Z]+)|(\d+)$)/
index = r.index('--') || r.rindex('-')
r = r[0, index]
- remove_index = r =~ /-(\d+)$/
- if r[0, 3] == 'vm-'
endremove_index = r =~ /(--.+$)|(-\d\w*-[a-zA-Z]+$)/ || remove_index
- r = r[0, remove_index] if remove_index result.add r end result.to_a
@@ -95,7 +98,7 @@ def compare_candidates_body OS: [ { os: 'openeuler', os_version: ['1.0', '20.03'] }, { os: 'centos', os_version: ['7.6', '7.8', '8.1', 'sid'] },
{ os: 'debian', os_version: ['10', 'sid'] },
{ os: 'debian', os_version: %w[10 sid] }, { os: 'archlinux', os_version: ['5.5.0-1'] } ], os_arch: %w[aarch64 x86_64],
-- 2.23.0