feature: Added '--specignore' option to pass file containing specs to be ignored for fission spec commands (#2239)
- New flag `--specignore` has been added for command fission spec [list | validate | apply | destroy] - This flag is optional. - The default spec ignore file name is `.specignore`, if the flag is not used - The spec ignore file existence will be checked in the `--specdir` path - If spec ignore file is passed to the flag, with a name other than .specignore and if it does not exist in the `--specdir` path then an error will be returned. - `--specdir` will be the root path against which the patterns will be evaluated - The behaviour of the spec ignore file will be similar to .gitignore (only for yml and yaml files). For reference: http://git-scm.com/docs/gitignore
This commit is contained in:
@@ -73,6 +73,7 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
opts.specFile = fmt.Sprintf("function-%v.yaml", fnName)
|
||||
}
|
||||
specDir := util.GetSpecDir(input)
|
||||
specIgnore := util.GetSpecIgnore(input)
|
||||
|
||||
if !toSpec {
|
||||
// check for unique function names within a namespace
|
||||
@@ -126,7 +127,8 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
var pkg *fv1.Package
|
||||
|
||||
if toSpec {
|
||||
fr, err := spec.ReadSpecs(specDir)
|
||||
|
||||
fr, err := spec.ReadSpecs(specDir, specIgnore)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error reading spec in '%v'", specDir))
|
||||
}
|
||||
@@ -166,8 +168,8 @@ func (opts *CreateSubCommand) complete(input cli.Input) error {
|
||||
}
|
||||
|
||||
if toSpec {
|
||||
specDir := util.GetSpecDir(input)
|
||||
fr, err := spec.ReadSpecs(specDir)
|
||||
|
||||
fr, err := spec.ReadSpecs(specDir, specIgnore)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("error reading spec in '%v'", specDir))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user