Skip to content

Commit

Permalink
delete tag script filters by prefix instead of substring (grafana#1942)
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-d authored Apr 15, 2020
1 parent 658dcb8 commit fee58f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/delete_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func main() {
flag.StringVar(&auth.Username, "username", "", "username for docker hub")
flag.StringVar(&auth.Password, "password", "", "password for docker hub")
flag.StringVar(&repo, "repo", "grafana/loki", "repo to delete tags for")
flag.StringVar(&filter, "filter", "master-", "delete tags only containing this name")
flag.StringVar(&filter, "filter", "master-", "delete tags only containing this prefix")
flag.DurationVar(&maxAge, "max-age", 24*time.Hour*90, "delete tags older than this age")
flag.Parse()

Expand Down Expand Up @@ -69,7 +69,7 @@ func main() {
filtered := make([]tag, 0, len(tags))

for _, t := range tags {
if !strings.Contains(t.Name, filter) {
if !strings.HasPrefix(t.Name, filter) {
continue
}
age := time.Since(t.LastUpdated)
Expand Down

0 comments on commit fee58f1

Please sign in to comment.