Skip to content

Add descending order, natural sorting, and count limit for tag discovery#1501

Open
kkupciunas wants to merge 6 commits intojenkinsci:masterfrom
kkupciunas:feature/descending-tags
Open

Add descending order, natural sorting, and count limit for tag discovery#1501
kkupciunas wants to merge 6 commits intojenkinsci:masterfrom
kkupciunas:feature/descending-tags

Conversation

@kkupciunas
Copy link

Description

In repositories with a large number of tags (hundreds, thousands), the current tag discovery behavior scans all tags in ascending alphabetical order (as returned by GH API). Projects that use incremental release tagging approach (e.g. semver), suffer from this behavior, because usually the newest tags are the last ones. This makes the scanning process very slow and eats up GH API calls.

This patchset adds 3 related improvements for tag discovery:

  • Descending order scanning -- a new option (global default + per-job override) to scan tags in descending order, so that most recent version tags are discovered first.
  • Natural sorting -- when descending order is enabled, tags are sorted using natural comparison instead of naive alphabetical reverse. This correctly orders version-like tags (e.g., v0.1.11 > v.0.1.2, v10.0.0>v9.0.0`) and works for any alphanumeric naming, not just semver.
  • Maximum tag count -- optional limit on the number of tags to process, available when descending order is enabled. Combined with descending order, this allows scanning only the N most recent tags, skipping expensive per-tag processing for older tags entirely.

Submitter checklist

  • Link to JIRA ticket in description, if appropriate.
  • Change is code complete and matches issue description
  • Automated tests have been added to exercise the changes
  • Reviewer's manual test instructions provided in PR description. See Reviewer's first task below.

Reviewer checklist

  • Run the changes and verify that the change matches the issue description
  • Reviewed the code
  • Verified that the appropriate tests have been written or valid explanation given

Documentation changes

  • Link to jenkins.io PR, or an explanation for why no doc changes are needed

Users/aliases to notify

@kkupciunas kkupciunas requested a review from a team as a code owner March 16, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant