Add ignoreVersion & manuall version set option #560
Labels
No Label
has/backport
has/pull
in progress
invalid
kind/breaking
kind/bug
kind/build
kind/deployment
kind/docs
kind/enhancement
kind/feature
kind/lint
kind/proposal
kind/question
kind/refactor
kind/security
kind/testing
kind/translation
kind/ui
need/backport
priority/critical
priority/low
priority/maybe
priority/medium
reviewed/duplicate
reviewed/invalid
reviewed/wontfix
skip-changelog
status/blocked
status/needs-feedback
status/needs-reviews
status/wip
upstream/gitea
No Milestone
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: gitea/go-sdk#560
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "6543/go-sdk:add-option-to-set/skip-version-check"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
be able to skip version check if needed.
!!! Be careful, because using it incorrectly can result in infinite loops with pagination !!!
Should
CheckServerVersionConstraint
use the skip too?@KN4CK3R this is an exported func and should not used internaly ...
to the question: why would you externaly first set ignoreVersion and check for it avterwards ... sounds like a bug to me
and if you set a version manualy ... added test case and fixed it ;) ... you will use that one with this CheckServerVersionConstraint() too
Gitea calls CheckServerVersionConstraint in the migrations downloaders. I guess the question is if we'd want to allow ourselves to set ignore there?
@zeripath well we can set a valid version if we want to ...
... so for tests its even more interesting to "pretend" to have a specific kind of version to test against
@ -50,2 +52,4 @@
}
// ClientOptions are functions used to init a new client
type ClientOptions func(*Client) error
just a thought
ClientOptions
orClientOption
?I vote
ClientOption
Why not just name the function
IgnoreVersionCheck
? Do we really need to allow change the version number? Assume someone will change the version from1.11.0
to1.16.0
?@ -42,0 +42,4 @@
// SetGiteaVersion sets the Gitea version manually instead of querying it.
// use "0.0.0" to skip all version checks
func SetGiteaVersion(v string) ClientOption {
if v == "0.0.0" {
"0.0.0" seems a strange magic string.
well other option would be "" or make SetGiteaVersion(v *string) with v == nil check
@ -39,6 +39,24 @@ func (c *Client) CheckServerVersionConstraint(constraint string) error {
return nil
}
// SetGiteaVersion sets the Gitea version manually instead of querying it.
Also agree that
"0.0.0"
is a bit strange, maybe use empty string instead?@ -50,6 +68,9 @@ var (
// checkServerVersionGreaterThanOrEqual is internally used to speed up things and ignore issues with prerelease
@ -18,6 +18,15 @@ func TestVersion(t *testing.T) {
assert.NoError(t, err)
assert.True(t, true, rawVersion != "")
Somewhat unrelated, but prompted by the docstring above:
Maybe we need tests for typical version strings returned by gitea, including pre-release like
1.16.0+dev-661-geb69c7ec8
I dont think we should do that -> it should be ensured by our version lib
(github.com/hashicorp/go-version) - but I would sugest to migrate to my fork as it accepts pulls ;) (at gitea we already use it - just as redirect for now but the needed patches never got accepted)
I'm thinking of gitea forks like https://allspice.io have - they could differ in versioning schema ...