Skip to content

pruneEol action deletes 0 images due to oras discover output format change #2045

@gdams

Description

@gdams

The cleanAcrImages --action pruneEol command always reports 0 deleted images, even when lifecycle referrer artifacts with expired EOL dates exist and are properly attached to image manifests.

Root Cause

Newer versions of oras changed the JSON output format of oras discover --format json. The output now uses a referrers property instead of manifests:

{
  "reference": "registry.azurecr.io/repo@sha256:...",
  "referrers": [
    {
      "artifactType": "application/vnd.microsoft.artifact.lifecycle",
      "annotations": {
        "vnd.microsoft.artifact.lifecycle.end-of-life.date": "2025-09-08"
      }
    }
  ]
}

OrasDiscoverData only defines a Manifests property:

public class OrasDiscoverData
{
    public List<Oci.Manifest>? Manifests { get; set; }
}

Since the JSON key is referrers, Manifests always deserializes as null. This causes LifecycleAnnotationExists to return false for every manifest, so HasExpiredEol never identifies any image as expired.

Steps to Reproduce

  1. Attach lifecycle EOL annotations to images using oras attach
  2. Wait for the EOL date + age threshold to pass
  3. Run cleanAcrImages --action pruneEol --age
  4. Observe Total images deleted: 0 in the summary, despite expired EOL annotations being present

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions