Commit 5a94962
chore: Refactor GenerateTaskRun with improved modularity
The existing TaskRun generation logic was concentrated in a single monolithic
GenerateTaskRun function, making it difficult to maintain, test, and debug
individual configuration aspects. This created tight coupling and poor separation
of concerns.
Decomposed the monolithic GenerateTaskRun into a comprehensive function.
orchestrated by smaller, single-responsibility helper functions. Each
configuration aspect now has its own dedicated applyXFeature* function.
This approach enables better error isolation, easier unit testing of individual
components, and clearer code organization. Enhanced error messages now provide
specific context about which BuildRun and strategy caused failures, improving
debugging experience for operators.
Key architectural changes:
- Made GenerateTaskRun as the main entry point and removed the GenerateTaskSpec
- Extracted applyNodeSelectors, applyTolerations, applyScheduler functions
- Renamed addBuildStrategySteps → applyBuildStrategySteps for consistency
- Renamed addStrategyParametersToTaskSpec → applyStrategyParametersToTaskSpec
- Introduced initializeTaskRun, buildTaskSpec, and createBaseTaskSpec helpers
- Improved error messages with BuildRun and strategy context
Signed-off-by: ayushsatyam146 <ayushsatyam146@gmail.com>1 parent a0ebc4a commit 5a94962
File tree
2 files changed
+1481
-642
lines changed- pkg/reconciler/buildrun/resources
2 files changed
+1481
-642
lines changed
0 commit comments