Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
gen-payload: remove old tags from multi imagestream for non-stream as…
Browse files Browse the repository at this point in the history
…sembly

We only need to keep 5 old imagestreamtags for stream assembly. Non-stream
assemblies should contain one single tag.

For more info, see https://coreos.slack.com/archives/GDBRP5YJH/p1661329456656149
  • Loading branch information
vfreex committed Sep 21, 2022
1 parent 6816629 commit c60bd20
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions doozerlib/cli/release_gen_payload.py
Expand Up @@ -1001,18 +1001,23 @@ def add_multi_nightly_release(obj: oc.APIObject):
if obj_model.spec.tags is oc.Missing:
obj_model.spec["tags"] = []

# For normal 4.x-art-latest, we update the imagestream with individual component images
# and the release controller formulates the nightly. For multi-arch, this is not
# possible (notably, the CI internal registry does not support manifest lists). Instead,
# in the ocp-multi namespace, the 4.x-art-latest imagestreams are configured
# `as: Stable`: https://github.com/openshift/release/pull/24130
# This means the release controller treats entries in these imagestreams the same way it
# treats it when ART tags into is/release; i.e. it treats it as an official release.
# With this comes the responsibility to prune nightlies ourselves.
release_tags: List = obj_model.spec["tags"]
while len(release_tags) > 5: # keep at most 5 tags
release_tags.pop(0)
# [lmeyer] Q: doesn't this leave the tag in the status still? are they reliably removed?

if self.runtime.assembly_type is AssemblyTypes.STREAM:
# For normal 4.x-art-latest, we update the imagestream with individual component images
# and the release controller formulates the nightly. For multi-arch, this is not
# possible (notably, the CI internal registry does not support manifest lists). Instead,
# in the ocp-multi namespace, the 4.x-art-latest imagestreams are configured
# `as: Stable`: https://github.com/openshift/release/pull/24130
# This means the release controller treats entries in these imagestreams the same way it
# treats it when ART tags into is/release; i.e. it treats it as an official release.
# With this comes the responsibility to prune nightlies ourselves.
while len(release_tags) > 5: # keep at most 5 tags
release_tags.pop(0)
# [lmeyer] Q: doesn't this leave the tag in the status still? are they reliably removed?
else:
# For non-stream 4.x-art-assembly-$name, old imagestreamtags should be removed.
release_tags.clear()

# Now append a tag for our new nightly.
release_tags.append({
Expand Down

0 comments on commit c60bd20

Please sign in to comment.