From 4682fd0f54b884093e4b01b088aff9ded5361e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Casta=C3=B1o=20Arteaga?= Date: Thu, 16 Apr 2026 14:39:54 +0200 Subject: [PATCH] Support deprecated annotation in Tekton packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergio CastaƱo Arteaga --- internal/tracker/source/tekton/tekton.go | 14 ++++++++++++++ internal/tracker/source/tekton/tekton_test.go | 3 ++- .../tekton/testdata/path3/task1/0.1/task1.yaml | 1 + 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/internal/tracker/source/tekton/tekton.go b/internal/tracker/source/tekton/tekton.go index 38e00b4d12..82b186099c 100644 --- a/internal/tracker/source/tekton/tekton.go +++ b/internal/tracker/source/tekton/tekton.go @@ -9,6 +9,7 @@ import ( "path" "path/filepath" "regexp" + "strconv" "strings" "github.com/Masterminds/semver/v3" @@ -32,6 +33,9 @@ import ( const ( // Keys used in labels and annotations in the Tekton's manifest file. + // deprecatedTKey defines if the package is deprecated. + deprecatedTKey = "tekton.dev/deprecated" + // displayNameTKey defines the package's display name. displayNameTKey = "tekton.dev/displayName" @@ -595,6 +599,16 @@ func enrichPackageFromAnnotations(p *hub.Package, annotations map[string]string) } } + // Deprecated + if v, ok := annotations[deprecatedTKey]; ok { + deprecated, err := strconv.ParseBool(v) + if err != nil { + errs = multierror.Append(errs, fmt.Errorf("%w: invalid deprecated value", errInvalidAnnotation)) + } else { + p.Deprecated = deprecated + } + } + // License p.License = annotations[licenseAnnotation] diff --git a/internal/tracker/source/tekton/tekton_test.go b/internal/tracker/source/tekton/tekton_test.go index c43036289d..f5e27f6c45 100644 --- a/internal/tracker/source/tekton/tekton_test.go +++ b/internal/tracker/source/tekton/tekton_test.go @@ -85,7 +85,7 @@ func TestTrackerSource(t *testing.T) { Version: "0.1.0", Provider: "Some organization", ContentURL: "https://github.com/user/repo/raw/master/path/task1/0.1/task1.yaml", - Digest: "7dfdce0ad1778d5c9b92115e23b92308bad5b27b0c514fa19f7a12f9ea8be4a9", + Digest: "71cb438c009785420747d5409ad016a6792135c6d1555984508ba6da6dec79cf", Repository: i.Repository, License: "Apache-2.0", Links: []*hub.Link{ @@ -140,6 +140,7 @@ func TestTrackerSource(t *testing.T) { "sample1.yaml": "sample content\n", }, }, + Deprecated: true, Signatures: []string{tekton}, Signed: true, ContainersImages: []*hub.ContainerImage{ diff --git a/internal/tracker/source/tekton/testdata/path3/task1/0.1/task1.yaml b/internal/tracker/source/tekton/testdata/path3/task1/0.1/task1.yaml index 0f49da7fea..ff40e42df5 100644 --- a/internal/tracker/source/tekton/testdata/path3/task1/0.1/task1.yaml +++ b/internal/tracker/source/tekton/testdata/path3/task1/0.1/task1.yaml @@ -26,6 +26,7 @@ metadata: artifacthub.io/screenshots: | - title: Screenshot 1 url: https://artifacthub.io/screenshot1.jpg + tekton.dev/deprecated: "true" tekton.dev/pipelines.minVersion: "0.12.1" tekton.dev/platforms: "linux/amd64, linux/arm64" tekton.dev/tags: tag1, tag2