server
server copied to clipboard
feat(templates): allow for compile-time rulesets for template steps
Closes https://github.com/go-vela/community/issues/547
A couple things to note about this PR:
-
It does not account for runtime rules, such as
continue
andstatus
. 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
template
field for eachpipeline.Build
which 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!
Codecov Report
Merging #720 (98061bd) into main (931e938) will increase coverage by
0.03%
. The diff coverage is100.00%
.
@@ 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
Impacted Files | Coverage Δ | |
---|---|---|
compiler/native/compile.go | 62.24% <100.00%> (ø) |
|
compiler/native/expand.go | 72.41% <100.00%> (+1.73%) |
:arrow_up: |