Skip to content

Fix generating incorrect names for Jobs when generateName is used #718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pnovitskiy
Copy link

Discovered a case when processing of generateName produces incorrect results.

For example if you have revision 1.1515.1 it's being cut a 1.1515. and combined with suffix that starts with - character produces name that does not comply with RFC1123.

@pnovitskiy pnovitskiy requested a review from a team as a code owner May 9, 2025 14:45
@@ -754,7 +754,7 @@ func (sc *syncContext) getSyncTasks() (_ syncTasks, successful bool) {
if targetObj.GetName() == "" {
var syncRevision string
if len(sc.revision) >= 8 {
syncRevision = sc.revision[0:7]
syncRevision = strings.Trim(sc.revision[0:7], ".")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semver also allows dashes (-) and plus (+), I would trim for that too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dashes should be fine. Let's keep only letters, numbers and -.

Copy link

sonarqubecloud bot commented May 9, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
65.2% Duplication on New Code (required ≤ 30%)

See analysis details on SonarQube Cloud

Copy link

codecov bot commented May 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.65%. Comparing base (8849c3f) to head (fc2c758).
Report is 41 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #718      +/-   ##
==========================================
- Coverage   54.26%   53.65%   -0.61%     
==========================================
  Files          64       64              
  Lines        6164     6476     +312     
==========================================
+ Hits         3345     3475     +130     
- Misses       2549     2725     +176     
- Partials      270      276       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants