feat(templates): allow for compile-time rulesets for template steps#720
Merged
feat(templates): allow for compile-time rulesets for template steps#720
Conversation
Codecov Report
@@ Coverage Diff @@
## main #720 +/- ##
==========================================
+ Coverage 58.09% 58.12% +0.03%
==========================================
Files 255 255
Lines 15880 15892 +12
==========================================
+ Hits 9226 9238 +12
Misses 6249 6249
Partials 405 405
|
cognifloyd
approved these changes
Mar 10, 2023
Member
cognifloyd
left a comment
There was a problem hiding this comment.
A little hacky, yes. But I think that's ok here. Let's get the functionality and then figure out if we need a more extensive refactor.
plyr4
approved these changes
Apr 12, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes go-vela/community#547
A couple things to note about this PR:
It does not account for runtime rules, such as
continueandstatus. The reason being: templates are compiled and merged into the parent pipeline, and there is no way of referring to a template-level ruleset once that has happened.This PR struck me as the only way to accommodate rulesets at a template level without re-hauling a bit. Another idea would be to create a
templatefield for eachpipeline.Buildwhich carries the slice of steps (or perhaps references to them) as well as the ruleset. In other words: a lot of work.That said, I recognize this solution is a bit hacky, and if we'd rather come to a conclusion on whether or not we want this feature in the first place (and if so, probably work on a proposal to establish a design), that would be a viable outcome for this PR! Let me know your thoughts!