Skip to content

Commit 57aa1c6

Browse files
authored
use hub master if we are in pre-release (#196)
Co-authored-by: AlteredCoder <AlteredCoder>
1 parent b7286d6 commit 57aa1c6

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

cmd/crowdsec-cli/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"github.com/crowdsecurity/crowdsec/pkg/cwhub"
55
"github.com/crowdsecurity/crowdsec/pkg/cwversion"
66
log "github.com/sirupsen/logrus"
7+
"golang.org/x/mod/semver"
78
)
89

910
func inSlice(s string, slice []string) bool {
@@ -38,6 +39,9 @@ func setHubBranch() error {
3839

3940
if cwversion.Version == latest {
4041
cwhub.HubBranch = "master"
42+
} else if semver.Compare(cwversion.Version, latest) == 1 { // if current version is greater than the latest we are in pre-release
43+
log.Debugf("Your current crowdsec version seems to be a pre-release (%s)", cwversion.Version)
44+
cwhub.HubBranch = "master"
4145
} else {
4246
log.Warnf("Crowdsec is not the latest version. Current version is '%s' and latest version is '%s'. Please update it!", cwversion.Version, latest)
4347
log.Warnf("As a result, you will not be able to use parsers/scenarios/collections added to Crowdsec Hub after CrowdSec %s", latest)

0 commit comments

Comments
 (0)