zarf icon indicating copy to clipboard operation
zarf copied to clipboard

Dependency Filter for a Zarf Package

Open JasonvanBrackel opened this issue 2 years ago • 3 comments

https://github.com/defenseunicorns/zarf/issues/441#issuecomment-1230466600

@Racer159

What would be really awesome (something I was thinking about earlier this weekend) would be something akin to the "only" filter but that would test for the existence of a command on the system (i.e. the same as command -v systemd) in a dependencies (or similar) block in a Zarf package. That way we could build packages that not only detect OS but also detect distros or other package deps and either try a different path or fail much more gracefully.

JasonvanBrackel avatar Sep 15 '22 15:09 JasonvanBrackel

So instead of only this would be something along the lines of a prereq field?

YrrepNoj avatar Sep 15 '22 15:09 YrrepNoj

Yes, only like what @Racer159 spells out in #706 feels like it could be too broad. The gist of all these discussions is around prerequisites. Functionally, it could be a command test, or something of the like, but focusing on it being a prereq I think gives more clarity. Thoughts @Racer159

JasonvanBrackel avatar Sep 15 '22 15:09 JasonvanBrackel

I think that works out well calling it prereq or dependency. Really what would be nice is a simple command check before a component runs. With Zarf either ignoring it for an optional component or erroring out for a required one. There may be a case for some logic in a group (i.e. oneOf and if none are able to be ran then still error out)

Racer159 avatar Sep 19 '22 17:09 Racer159

I think the core ask of this feature:

The k3s distro package currently only supports systems with systemd installed (even though k3s does support Alpine/OpenRC)

is best solved w/ flavors.

Determinizing components based upon the existence of a CLI program feels weird to me.

Closing for now. Feel free to re-open @Racer159 if you feel otherwise.

Noxsios avatar Mar 08 '24 03:03 Noxsios

I can see a tech-debt issue being created for our k3s distro to support more linux flavors.

Noxsios avatar Mar 08 '24 03:03 Noxsios