@@ -522,7 +522,7 @@ def visualisation_branch_html_GET(request, gitlab_project, branch_name):
522
522
production_commit_id = None
523
523
for tag in tags :
524
524
possible_host_basename , _ , host_basename_or_commit_id = tag .rpartition ("--" )
525
- if possible_host_basename :
525
+ if possible_host_basename and host_basename_or_commit_id != "prod" :
526
526
production_commit_id = host_basename_or_commit_id
527
527
break
528
528
@@ -572,9 +572,27 @@ def visualisation_branch_html_GET(request, gitlab_project, branch_name):
572
572
573
573
def visualisation_branch_html_POST (request , gitlab_project , branch_name ):
574
574
release_commit = request .POST ["release-commit" ]
575
+
576
+ # A "release" of a visualisation adds two tags to the previously generated image for that
577
+ # commit
578
+ #
579
+ # 1. A tag with the basename of the visualistion but "--prod" appended. This is so it can match
580
+ # an ECR lifecycle rule that does _not_ expire images that end in "--prod" (or at least,
581
+ # expires them in an extremely long time like 1000 years)
582
+ # 2. A tag with the basename of the visualisation. This is then used to identify and so run
583
+ # the released visualisation
584
+ #
585
+ # In a future release we could simplify and toughen this and only use the "--prod".
575
586
application_template = _application_template (gitlab_project )
576
- get_spawner (application_template .spawner ).retag (
577
- application_options (application_template ),
587
+ spawner = get_spawner (application_template .spawner )
588
+ options = application_options (application_template )
589
+ spawner .retag (
590
+ options ,
591
+ f"{ application_template .host_basename } --{ release_commit } " ,
592
+ f"{ application_template .host_basename } --prod" ,
593
+ )
594
+ spawner .retag (
595
+ options ,
578
596
f"{ application_template .host_basename } --{ release_commit } " ,
579
597
application_template .host_basename ,
580
598
)
0 commit comments