MCPcopy
hub / github.com/devtron-labs/devtron / ValidatePluginVersion

Function ValidatePluginVersion

pkg/plugin/utils/utils.go:104–113  ·  view source on GitHub ↗
(version string)

Source from the content-addressed store, hash-verified

102}
103
104func ValidatePluginVersion(version string) error {
105 if !strings.Contains(version, "v") {
106 version = fmt.Sprintf("v%s", version)
107 }
108 // semantic versioning validation on plugin's version
109 if !semver.IsValid(version) {
110 return util.NewApiError(http.StatusBadRequest, bean2.PluginVersionNotSemanticallyCorrectError, bean2.PluginVersionNotSemanticallyCorrectError)
111 }
112 return nil
113}
114
115// StripVersionSuffixFromName removes version suffix patterns like "v1.0.0", "v1.0", "v1" from the end of plugin names.
116// This is used during migration to ensure plugins with names like "DockerSlim v1.0.0" and "DockerSlim"

Callers 1

Calls 2

NewApiErrorFunction · 0.92
IsValidMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…