-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat(checkver): Add gitlab support to checkver
#6486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughAdds GitLab support to checkver: updates Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant M as Manifest (json)
participant CV as bin/checkver.ps1
participant GL as GitLab Releases (Atom)
participant RX as Regex Match
Note over M,CV: New GitLab flow
M->>CV: checkver == "gitlab" or checkver.gitlab = "<repo URL>"
alt checkver == "gitlab"
CV->>CV: ensure homepage starts with "https://gitlab.com/"
CV->>CV: feed = homepage.TrimEnd('/') + "/-/releases?format=atom"
else checkver.gitlab set
CV->>CV: feed = gitlab.TrimEnd('/') + "/-/releases?format=atom"
end
CV->>GL: GET feed (Atom)
GL-->>CV: Atom XML
CV->>RX: apply default regex /\-\/releases\/(?:v|V)?([\d.]+)/
RX-->>CV: extract version
CV-->>M: return detected version
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (3)
CHANGELOG.md (1)
10-13: Tweak wording for consistency with prior entries.Consider “checkver: Add GitLab support” (mirrors existing style like “GitHub predefined hashes support”).
-**checkver**: Add GitLab to `checkver` ([#5508](https://github.com/ScoopInstaller/Scoop/issues/5508)) +**checkver:** Add GitLab support ([#5508](https://github.com/ScoopInstaller/Scoop/issues/5508))bin/checkver.ps1 (2)
172-174: Fix typo and clarify error message.“checkvar” -> “checkver”; clarify requirement.
- if (!$json.homepage.StartsWith('https://gitlab.com/')) { - error "$name checkvar expects the homepage to be a GitLab" - } + if (!$json.homepage.StartsWith('https://gitlab.com/')) { + error "$name checkver expects the homepage to start with 'https://gitlab.com/'" + }
165-171: Optional: broaden default regex to include pre-release/build suffixes.Current
([\d.]+)misses tags likev1.2.3-beta.1. If desired, align with a semver-ish capture.- } else { - $gitlabRegex = '/-/releases/(?:v|V)?([\d.]+)' - } + } else { + $gitlabRegex = '/-/releases/(?:v|V)?([0-9]+(?:\.[0-9]+)*(?:[-+][0-9A-Za-z.-]+)?)' + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
CHANGELOG.md(1 hunks)bin/checkver.ps1(1 hunks)schema.json(1 hunks)
🔇 Additional comments (1)
bin/checkver.ps1 (1)
178-181: LGTM: custom GitLab endpoint path.Using
/-/releases?format=atomwith a provided GitLab (including self-hosted) URL is sensible. Regex reuse is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
♻️ Duplicate comments (1)
bin/checkver.ps1 (1)
171-177: Fix: usehomepagewhencheckveris the stringgitlab(and improve error text).Accessing
$json.checkver.gitlabwhen$json.checkver -eq 'gitlab'(a string) will throw. Mirror the GitHub branch: build fromhomepage. Also make the error message explicit.- if ($json.checkver -eq 'gitlab') { - if (!$json.homepage.StartsWith('https://gitlab.com/')) { - error "$name checkver expects the homepage to be a GitLab" - } - $url = $json.checkver.gitlab.TrimEnd('/') + '/-/releases?format=atom' - $regex = $gitlabRegex - } + if ($json.checkver -eq 'gitlab') { + if (!$json.homepage -or !$json.homepage.StartsWith('https://gitlab.com/')) { + error "$name checkver expects the homepage to start with 'https://gitlab.com/'" + } + $url = $json.homepage.TrimEnd('/') + '/-/releases?format=atom' + $regex = $gitlabRegex + }Run to confirm no remaining string-typed property dereferences:
#!/bin/bash rg -n -C2 --type=powershell $'\$json\.checkver\s*-eq\s*\'gitlab\'' bin/checkver.ps1 rg -n -C2 --type=powershell $'\$json\.checkver\.gitlab' bin/checkver.ps1
🧹 Nitpick comments (1)
bin/checkver.ps1 (1)
165-170: Broaden default GitLab regex to match tags as well as releases (and richer semver).Many GitLab projects publish tags without Releases. Matching both improves coverage and aligns with the stated objective of tag-based version checks.
- if ($regex) { - $gitlabRegex = $regex - } else { - $gitlabRegex = '/-/releases/(?:v|V)?([\d.]+)' - } + if ($regex) { + $gitlabRegex = $regex + } else { + # Match either /-/releases/<ver> or /-/tags/<ver>; capture common semver forms + $gitlabRegex = '/-/(?:releases|tags)/(?:v|V)?(?<version>\d+(?:\.\d+)+(?:[-._][0-9A-Za-z]+)*)' + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
bin/checkver.ps1(1 hunks)
🔇 Additional comments (1)
bin/checkver.ps1 (1)
178-181: Accept prebuilt GitLab feed/collection URLs (avoid double-appending/-/releases?format=atom)Verified the proposed conditional logic against common inputs — it produces the expected URLs.
File: bin/checkver.ps1 (around lines 178–181)
- if ($json.checkver.gitlab) { - $url = $json.checkver.gitlab.TrimEnd('/') + '/-/releases?format=atom' - $regex = $gitlabRegex - } + if ($json.checkver.gitlab) { + $base = $json.checkver.gitlab.TrimEnd('/') + if ($base -match '\?format=atom$') { + $url = $base + } elseif ($base -match '/-/(releases|tags)$') { + $url = $base + '?format=atom' + } else { + $url = $base + '/-/releases?format=atom' + } + $regex = $gitlabRegex + }
Add
gitlabproperty tocheckverand Scoop manifest schema.Description
This PR adds
checkversupport for GitLab or GitLab self-hosted services with parsing atom feed of releases in that services with the predefined Regex or customized Regex.If the value of
checkverisgitlabandhomepageURL is starting with https://gitlab.com, it will make use of the homepage value as a URL to retrieve data.Or,
checkvercontainsgitlabproperty with URL from GitLab or GitLab self-hosted services, it will utilize the value to do the same thing.Motivation and Context
Currently as of September 2025, About 10 manifests in main bucket are parsing checkver from GitLab. Including other buckets, more manifests refer the GitLab URL to check the version information.
Also, I remember that someone made an issue for this topic.
(Closes #5508 )
That's why I made this PR.
How Has This Been Tested?
Manifests which contains GitLab or GitLab Self-Hosted Services in
checkverare used in the testing.Each URL must contain maintainer and repository name separated by slash, then change the property to
gitlab.Then I ran
checkver.ps1to check the new version with-fswitch to get the version forcibly to see whether the changes are working well.Tested Environment information retrieved from
$PSVersionTable:Other areas are not affected at all, But to use this feature, we need to add a new definition
gitlaboncheckverproperty in the schema.Also, manifests containing GitLab would be updated after the release of future version.
Checklist:
developbranch.Summary by CodeRabbit
New Features
Documentation