Project

Profile

Help

Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.

Story #6338

Updated by ipanova@redhat.com over 4 years ago

Add the ability to limit tag using a regexp wildcard character '*' 

 For example: 

 upstream taglist is 
 ``` 
 [ 
 'openshift-4', 
 'openshift-3.11' 
 'openshift-3', 
 'openshift-3.10' 
 'latest' 
 'foo' 
 ]` 
 ``` 

 When specifying `whitelist-tags=[openshift-3.*, latest, bla-bla]` it will mirror down **only**: 
 ``` 
 [ 
 'openshift-3.11' 
 'openshift-3', 
 'openshift-3.10' 
 'latest' 
 ] 
 ``` 


 **solution** 

 ``` 
 In [61]: upstream_tags = [  
     ...: 'openshift-4',  
     ...: 'openshift-3.11',  
     ...: 'openshift-3',  
     ...: 'openshift-3.10',  
     ...: 'latest',  
     ...: 'foo'  
     ...: ]                                                                                                                                                                                                          



 In [63]: whitelisttags = ['openshift-3.*', 'latest', 'bla-bla', 'openshift-3.11']                                                                                                                                   

 In [64]: import re  
     ...: tags_to_mirror = []  
     ...: for i in whitelisttags:  
     ...:       rex = re.compile(i)  
     ...:       for tag in upstream_tags:  
     ...:           tags_to_mirror.extend(rex.findall(tag))  
     ...:           
                                                                                                                                                                                                 

 In [65]: tags_to_mirror                                                                                                                                                                                             
 Out[65]: ['openshift-3.11', 'openshift-3', 'openshift-3.10', 'latest', 'openshift-3.11'] 

 In [66]: set(tags_to_mirror)                                                                                                                                                                                        
 Out[66]: {'latest', 'openshift-3', 'openshift-3.10', 'openshift-3.11'} 
 ``` 

Back