Refine app detection

Switch to regexp
This commit is contained in:
2025-06-27 14:11:10 +02:00
parent 983aa592d8
commit 7531ba4b5c
4 changed files with 7 additions and 6 deletions

View File

@@ -1,3 +0,0 @@
pw
neb
ph

View File

@@ -0,0 +1,2 @@
starccm+
-podkey

View File

@@ -11,6 +11,7 @@ import (
"io/fs"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/ClusterCockpit/cc-backend/internal/repository"
@@ -111,7 +112,8 @@ func (t *AppTagger) Match(job *schema.Job) {
for _, a := range t.apps {
tag := a.tag
for _, s := range a.strings {
if strings.Contains(strings.ToLower(jobscript), fmt.Sprintf(" %s ", s)) {
matched, _ := regexp.MatchString(s, strings.ToLower(jobscript))
if matched {
if !r.HasTag(id, t.tagType, tag) {
r.AddTagOrCreateDirect(id, t.tagType, tag)
break out