Skip to content

Commit 418b489

Browse files
committed
allow more than single digit agent versions
1 parent 9780cdf commit 418b489

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

internal/nginx/manager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const (
5454
var (
5555
ossre = regexp.MustCompile(`(?P<name>\S+)/(?P<version>\S+)`)
5656
plusre = regexp.MustCompile(`(?P<name>\S+)/(?P<version>\S+).\((?P<plus>\S+plus\S+)\)`)
57-
agentre = regexp.MustCompile(`v(?P<major>\d).?(?P<minor>\d)?.?(?P<patch>\d)?`)
57+
agentre = regexp.MustCompile(`v(?P<major>\d+).?(?P<minor>\d+)?.?(?P<patch>\d+)?`)
5858
)
5959

6060
// ServerConfig holds the config data for an upstream server in NGINX Plus.

internal/nginx/version_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,14 @@ func TestExtractAgentVersionValues(t *testing.T) {
223223
patch: 0,
224224
err: false,
225225
},
226+
{
227+
name: "v2 semver",
228+
input: "v2.40.15",
229+
major: 2,
230+
minor: 40,
231+
patch: 15,
232+
err: false,
233+
},
226234
{
227235
name: "v3 semver",
228236
input: "v3.0.0-hash",

0 commit comments

Comments
 (0)