cloudbase / garm

GitHub Actions Runner Manager
Apache License 2.0
134 stars 25 forks source link

Tag validation should be case insensitive #295

Closed Hdom closed 1 month ago

Hdom commented 1 month ago

Hello, I've noticed that GitHub's runner software tag validation is case insensitive but the login in findPoolByTags seems to be case sensitive.

https://github.com/cloudbase/garm/blob/main/database/sql/pools.go#L187

Our current workaround includes lowercasing input tags and lowercasing stored tags in the comparison:

for i, tag := range tags {
    tags[i] = strings.ToLower(tag)
}
where := fmt.Sprintf("lower(tags.name) in ? and %s = ? and enabled = true", fieldName)

Do you think we could get this included?

gabriel-samfira commented 1 month ago

We can add a COLLATE NOCASE in that WHERE tags.name IN clause. Adding a PR soon.

gabriel-samfira commented 1 month ago

can you give this a try: https://github.com/cloudbase/garm/pull/296