flipt-io / flipt

Enterprise-ready, GitOps enabled, CloudNative feature management solution

Home Page:https://flipt.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FLI-938] Allow passing a starting dir `flipt validate`

markphelps opened this issue · comments

Problem

Currently, the validate cli command always scans from the current directory, looking for features.yml / .flipt.yml files

Ideal Solution

It would be nice if we could take in an optional path (ie:flipt validate /tmp) to use as starting point so that you first don't have to cd into the target directory before running flipt validate

Search

  • I searched for other open and closed issues before opening this

Additional Context

No response

FLI-938

Currently flipt validate allows to specify the files relatively currently directory. You could run it like flipt validate production.yml extra/feature.yml.

if len(args) == 0 {
_, err = fs.SnapshotFromFS(logger, os.DirFS("."), opts...)
} else {
_, err = fs.SnapshotFromPaths(logger, os.DirFS("."), args, opts...)
}

There is no documentation about this use case. @GeorgeMac could you please bring some light on it?

@erka When flipt validate was initially implemented it only supported taking explicit paths in this way.
This was back when it was a prototype for the GitHub action.
We quickly updated it to make the zero argument form index aware, so that it was inline with how the backends worked, but still backwards compatible. So that flipt validate was a simple catch all, that worked exactly how running git or local over the same directory does.

However, there was a user already taking advantage of the original form, so we left the explicit paths in.

You're right we don't have the old form (explicit paths) document here https://www.flipt.io/docs/cli/commands/validate#behavior on in the CLI help text.

My suggestion here would be to add a flag --workdir or -w instead for this behaviour.

@markphelps are you fine with George's suggestion?

@markphelps are you fine with George's suggestion?

Yes I think that makes sense!