server icon indicating copy to clipboard operation
server copied to clipboard

feat(templates): allow for compile-time rulesets for template steps

Open ecrupper opened this issue 2 years ago • 1 comments

Closes https://github.com/go-vela/community/issues/547

A couple things to note about this PR:

  1. It does not account for runtime rules, such as continue and status. 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.

  2. 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 each pipeline.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!

ecrupper avatar Oct 07 '22 23:10 ecrupper

Codecov Report

Merging #720 (98061bd) into main (931e938) will increase coverage by 0.03%. The diff coverage is 100.00%.

Impacted file tree graph

@@            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:

codecov[bot] avatar Oct 07 '22 23:10 codecov[bot]