mirror of
https://github.com/jenkinsci/kubernetes-operator.git
synced 2026-10-04 07:01:16 +02:00
Receive plugins' versions with underscores. (#699)
* Receive plugins versions with underscores. New jenkins plugin versions have underscores in them (example: https://plugins.jenkins.io/credentials/). The operator refuses configuration for such plug-ins as they do not match the existing regex. * Add tests to underscores in plugin versions Adds a new test to check that versions with underscores are valid. * Synchronise regexps character order to avoid range Make two related regexps more evidently similar to each other and re-order the symbols so that the - is not interpreted.
This commit is contained in:
@@ -22,9 +22,9 @@ func (p Plugin) String() string {
|
||||
|
||||
var (
|
||||
// NamePattern is the plugin name regex pattern
|
||||
NamePattern = regexp.MustCompile(`^[0-9a-zA-Z-_]+$`)
|
||||
NamePattern = regexp.MustCompile(`^[0-9a-zA-Z\-_]+$`)
|
||||
// VersionPattern is the plugin version regex pattern
|
||||
VersionPattern = regexp.MustCompile(`^[0-9a-zA-Z+\\.-]+$`)
|
||||
VersionPattern = regexp.MustCompile(`^[0-9a-zA-Z\-_+\\.]+$`)
|
||||
// DownloadURLPattern is the plugin download url regex pattern
|
||||
DownloadURLPattern = regexp.MustCompile(`https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)`)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user