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

Merged
earl-warren merged 1 commit from earl-warren/act:wip-dns into main 2025-07-22 07:54:10 +00:00
Contributor
  • 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

- 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
Contributor

cascading-pr updated at forgejo/runner#722

cascading-pr updated at https://code.forgejo.org/forgejo/runner/pulls/722
viceice left a comment
Owner

otherwise LGTM

otherwise LGTM
@ -403,2 +403,4 @@
}
func sanitizeNetworkAlias(ctx context.Context, original string) string {
logger := common.Logger(ctx)

I would move this inside the if condition for performance reasons

I would move this inside the if condition for performance reasons
Author
Contributor
https://code.forgejo.org/forgejo/act/compare/6960e67280a4da126f88d077e44d36a48b182a04..0969687bf33c58276d88835324f375700ccf5f8b
earl-warren marked this conversation as resolved
@ -404,1 +404,4 @@
func sanitizeNetworkAlias(ctx context.Context, original string) string {
logger := common.Logger(ctx)
sanitized := regexp.MustCompile("[^A-Z0-9-]").ReplaceAllString(strings.ToUpper(original), "_")

shouldn't we store the regex statically for performance?

shouldn't we store the regex statically for performance?
Author
Contributor

Agreed on both: it keeps the footprint of this change to a minimum.

6960e67280..0969687bf3

Agreed on both: it keeps the footprint of this change to a minimum. https://code.forgejo.org/forgejo/act/compare/6960e67280a4da126f88d077e44d36a48b182a04..0969687bf33c58276d88835324f375700ccf5f8b
earl-warren marked this conversation as resolved
earl-warren force-pushed wip-dns from 6960e67280
All checks were successful
checks / unit (pull_request) Successful in 4m23s
checks / integration (pull_request) Successful in 1m57s
/ cascade (pull_request_target) Successful in 42m18s
to 0969687bf3
Some checks failed
checks / unit (pull_request) Successful in 1m46s
checks / integration (pull_request) Successful in 1m41s
/ cascade (pull_request_target) Failing after 26s
2025-07-22 06:05:36 +00:00
Compare
Contributor

cascading-pr updated at forgejo/runner#722

cascading-pr updated at https://code.forgejo.org/forgejo/runner/pulls/722
viceice approved these changes 2025-07-22 07:03:22 +00:00
earl-warren deleted branch wip-dns 2025-07-22 07:54:11 +00:00
Commenting is not possible because the repository is archived.
No reviewers
No milestone
No project
No assignees
3 participants
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/act!190
No description provided.