Add some images with multiple tags.
This commit is contained in:
parent
0eaf879af8
commit
cffb906d64
2 changed files with 12 additions and 6 deletions
18
initdb.py
18
initdb.py
|
@ -24,7 +24,7 @@ def __gen_checksum():
|
|||
|
||||
|
||||
def create_subtree(repo, structure, parent):
|
||||
num_nodes, subtrees, last_node_tag = structure
|
||||
num_nodes, subtrees, last_node_tags = structure
|
||||
|
||||
# create the nodes
|
||||
for i in range(num_nodes):
|
||||
|
@ -40,9 +40,13 @@ def create_subtree(repo, structure, parent):
|
|||
|
||||
parent = new_image
|
||||
|
||||
if last_node_tag:
|
||||
model.create_or_update_tag(repo.namespace, repo.name, last_node_tag,
|
||||
new_image.docker_image_id)
|
||||
if last_node_tags:
|
||||
if not isinstance(last_node_tags, list):
|
||||
last_node_tags = [last_node_tags]
|
||||
|
||||
for tag_name in last_node_tags:
|
||||
model.create_or_update_tag(repo.namespace, repo.name, tag_name,
|
||||
new_image.docker_image_id)
|
||||
|
||||
for subtree in subtrees:
|
||||
create_subtree(repo, subtree, new_image)
|
||||
|
@ -77,11 +81,13 @@ if __name__ == '__main__':
|
|||
new_user_2.verified = True
|
||||
new_user_2.save()
|
||||
|
||||
__generate_repository(new_user_1, 'simple', False, [], (4, [], 'latest'))
|
||||
__generate_repository(new_user_1, 'simple', False, [], (4, [],
|
||||
['latest', 'prod']))
|
||||
|
||||
__generate_repository(new_user_1, 'complex', False, [],
|
||||
(2, [(3, [], 'v2.0'),
|
||||
(1, [(1, [(1, [], 'latest')], 'staging'),
|
||||
(1, [(1, [(1, [], ['latest', 'prod'])],
|
||||
'staging'),
|
||||
(1, [], None)], None)], None))
|
||||
|
||||
__generate_repository(new_user_2, 'publicrepo', True, [],
|
||||
|
|
BIN
test.db
BIN
test.db
Binary file not shown.
Reference in a new issue