1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

fix: sanitize network aliases to be valid DNS names (#190)

- s/[^A-Z0-9-]/_/g
- add a log line in case the name is sanitized

Closes forgejo/runner#226

---

It is breaking because it will fail jobs that rely on service names that contain characters that are sanitized

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/190
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
This commit is contained in:
Earl Warren 2025-07-22 07:54:10 +00:00 committed by earl-warren
parent 4a8d6556c7
commit 2be7a6f1a5
2 changed files with 21 additions and 2 deletions

View file

@ -711,6 +711,14 @@ func Test_createSimpleContainerName(t *testing.T) {
}
}
func TestSanitizeNetworkAlias(t *testing.T) {
same := "SAME"
assert.Equal(t, same, sanitizeNetworkAlias(context.Background(), same))
original := "OR.IGIN'A-L"
sanitized := "OR_IGIN_A-L"
assert.Equal(t, sanitized, sanitizeNetworkAlias(context.Background(), original))
}
func TestPrepareJobContainer(t *testing.T) {
yaml := `
on: