-
Notifications
You must be signed in to change notification settings - Fork 19
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
fix: [CI-14984]: fixed mergeRunStep issue #240
base: master
Are you sure you want to change the base?
Conversation
Please add UTs and include a link to pipeline which shows the steps after conversion. |
Added UTs and passed alpine as a defaultImage variable. |
@@ -62,13 +62,16 @@ type ProcessedTools struct { | |||
var mavenGoals string | |||
var gradleGoals string | |||
|
|||
var defaultAlpineImage string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this image is being passed from the CLI then naming this variable using a particular image will be confusing. As per other places the more generic defaultImage
makes more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i agree with that. @Anshika2203 please change naming
@@ -963,6 +965,10 @@ func canMergeSteps(step1, step2 *harness.Step) bool { | |||
return false | |||
} | |||
|
|||
if !hasDefaultOrNoImage(exec1) || !hasDefaultOrNoImage(exec2) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case where both step1 and step2 have no image, I assume they could be merged since the image matches?
Removed the pushed flag:
The pushed flag was unnecessary and potentially confusing
The logic now handles all cases without needing to track whether something was pushed
Simplified the loop logic:
Removed the conditional check if i != len(*steps)-1
Made the merge/no-merge decision more straightforward
Fixed the last step handling:
Always append the final cursor state after the loop
This ensures we don't lose any steps regardless of whether the last step was merged or not (which was the main issue).
Also added a function which checks that if image is non-default then it will not merge.
Jenkins pipeline which I mentioned in the ticket in now returning correct output.