Skip to content

Commit 38f6975

Browse files
committed
Allows for '_' in job names
Signed-off-by: joshvanl <[email protected]>
1 parent 1f5ebf8 commit 38f6975

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func validateName(name string) error {
108108
return errors.New("job name cannot be empty")
109109
}
110110

111-
for _, segment := range strings.Split(strings.ToLower(name), "||") {
111+
for _, segment := range strings.Split(strings.ReplaceAll(strings.ToLower(name), "_", "-"), "||") {
112112
if errs := validation.IsDNS1123Subdomain(segment); len(errs) > 0 {
113113
return fmt.Errorf("job name is invalid %q: %s", name, strings.Join(errs, ", "))
114114
}

api_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ func Test_validateName(t *testing.T) {
480480
name: "foo.BAR||foo",
481481
expErr: false,
482482
},
483+
{
484+
name: "foo.BAR_f-oo||foo",
485+
expErr: false,
486+
},
483487
}
484488

485489
for _, test := range tests {

0 commit comments

Comments
 (0)