@@ -1533,6 +1533,10 @@ def fetch_docker_tags(self):
15331533 the -t flag.
15341534 """
15351535
1536+ # list to store the already parsed components (useful when forks are
1537+ # given to the pipeline string via -t flag
1538+ list_of_parsed = []
1539+
15361540 # fetches terminal width and subtracts 3 because we always add a
15371541 # new line character and we want a space at the beggining and at the end
15381542 # of each line
@@ -1562,12 +1566,20 @@ def fetch_docker_tags(self):
15621566 # Skip first init process and iterate through the others
15631567 for p in self .processes [1 :]:
15641568 template = p .template
1569+ # if component has already been printed then skip and don't print
1570+ # again
1571+ if template in list_of_parsed :
1572+ continue
1573+
1574+ list_of_parsed .append (template )
1575+
15651576 # fetch repo name from directives of the template. Since some
15661577 # components like integrity_coverage doesn't have a directives with
15671578 # container, thus if no directive there the script will skip this
15681579 # template
15691580 try :
15701581 repo = p .directives [template ]["container" ]
1582+ default_version = p .directives [template ]["version" ]
15711583 except KeyError :
15721584 continue
15731585 # make the request to docker hub
@@ -1581,7 +1593,10 @@ def fetch_docker_tags(self):
15811593 # parse response content to dict and fetch results key
15821594 r_content = json .loads (r .content )["results" ]
15831595 for version in r_content :
1584- tags_list .append ([template , repo , version ["name" ]])
1596+ printed_version = (version ["name" ] + "*" ) \
1597+ if version ["name" ] == default_version \
1598+ else version ["name" ]
1599+ tags_list .append ([template , repo , printed_version ])
15851600 else :
15861601 tags_list .append ([template , repo , "No DockerHub tags" ])
15871602
@@ -1607,7 +1622,8 @@ def fetch_docker_tags(self):
16071622 * entry , * final_width ), color )
16081623 )
16091624 # assures that the entire line gets the same color
1610- sys .stdout .write ("\n " )
1625+ sys .stdout .write ("\n {0: >{1}}\n " .format ("(* = default)" ,
1626+ terminal_width + 3 ))
16111627
16121628 def build (self ):
16131629 """Main pipeline builder
0 commit comments