akuity / kargo-render

Tool and library for managing rendered, environment-specific branches
Apache License 2.0
41 stars 17 forks source link

Render all branches by default #295

Closed benjamin-bergia closed 1 month ago

benjamin-bergia commented 1 month ago

Would it be possible for the action command to render all the branches in the kargo-render.yaml file by default. And if targetBranch is provided only then limit itself to these branches?

In most of our repository we end up rendering everything when there is a change and having to always update the github workflow to add a branch that I just added in my kargo-render.yaml is not very convenient.

krancour commented 1 month ago

The tricky thing about that is it's quite common for the rules in a kargo-render.yaml file to match many branches using a regex instead of matching explicitly named branches. The involvement of regexes makes the concept of "all branches" rather nebulous.

benjamin-bergia commented 1 month ago

I see. I don't use regex at all in my configs so that's probably why I felt it was kind of redundant. An alternative might be to all regex in the action config. This way people could have a targetBranch like env/*-test for example.

krancour commented 1 month ago

Doesn't env/*-test match an infinite number of branches?

benjamin-bergia commented 1 month ago

Not sure what you mean. Do you mean in the sense my example is wrong or in the sense that targetBranch would always match?

krancour commented 1 month ago

What I meant is: If you specified a target branch of env/*-test doesn't that match an infinite number of branches? It matches:

benjamin-bergia commented 1 month ago

Oh I might be understanding the targetBranch input of the action wrong. I thought targetBranch was a sort of filter applied on the result of running kargo-render on the kargo-render.yaml file. But from your comment it looks like targetBranch is passed to kargo-render to tell it which branch to render.

In this case it might make more sense to user regex in my kargo-render.yaml and only specify branches with targetBranch.

krancour commented 1 month ago

But from your comment it looks like targetBranch is passed to kargo-render to tell it which branch to render.

Yes. This is correct. It's: "Please prepare according to the rules in kargo-render.yaml."

In this case it might make more sense to user regex in my kargo-render.yaml and only specify branches with targetBranch.

Also yes. That would be the common thing -- keep your kargo-render.yaml nice and DRY by specifying one set of rules that will match any env/*. Either the Action or Kargo proper tells Kargo Render what branch(es) to prepare.