Skip to content

Commit

Permalink
fix(localstack): More reliable legacy tag detection
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanBaulch committed Jan 10, 2025
1 parent 3330dc1 commit 4d651db
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
6 changes: 5 additions & 1 deletion modules/localstack/localstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ func isLegacyMode(image string) bool {
parts := strings.Split(image, ":")
version := parts[len(parts)-1]

if version == "latest" {
if pos := strings.LastIndexByte(version, '-'); pos >= 0 {
version = version[0:pos]
}

if version == "latest" || version == "s3" || version == "s3-latest" || version == "stable" {
return false
}

Expand Down
13 changes: 13 additions & 0 deletions modules/localstack/localstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,25 @@ func TestIsLegacyMode(t *testing.T) {
}{
{"foo", true},
{"latest", false},
{"latest-amd64", false},
{"s3-latest", false},
{"s3-latest-amd64", false},
{"stable", false},
{"stable-amd64", false},
{"0.10.0", true},
{"0.10.0-amd64", true},
{"0.10.999", true},
{"0.10.999-amd64", true},
{"0.11", false},
{"0.11-amd64", false},
{"0.11.2", false},
{"0.11.2-amd64", false},
{"0.12", false},
{"0.12-amd64", false},
{"1", false},
{"1-amd64", false},
{"1.0", false},
{"1.0-amd64", false},
}

for _, tt := range tests {
Expand Down

0 comments on commit 4d651db

Please sign in to comment.