openfaas / openfaas/faas-cli

Feature: New priority order for YAML files

Open
#635 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
Go
Stars
816
Forks
230
Avg merge
6h 4m
Merged PRs (30d)
1

Description

Feature: New priority order for YAML files

Expected Behaviour

In addition to the current behaviour this feature would allow a function YAML file to be picked up by all the commands if a -f or stack.yml file is not in the current working directory.

Current Behaviour

If a stack.yml file is not found in the current working directory then a -f flag is required and the name of a YAML file. i.e. faas-cli up -f fn1.yml

Create a function

faas-cli new --lang go tester

Specify its YAML file

faas-cli up -f tester.yml

Rename to stack.yml and omit -f

mv tester.yml stack.yml
faas-cli up

Possible Solution

After the feature is implemented the following would be possible:

Create a function

faas-cli new --lang go tester

Specify no YAML file (as per stack.yml)

faas-cli up

If more than one .yml or .yaml file is found then this feature would default to the current behaviour to avoid ambiguity.

If the YAML file in the current directory is not a valid stack file then we will see some sort of parsing error.

The final priority order is:

  • -f (aka --yaml)
  • slack.yml
  • a YAML or YML file in the directory if it's the only one present

As with our other work, unit tests should be added to cover the priority-checking.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing YAML-file selection for the faas-cli commands shown, especially up, and identify where -f/--yaml and stack.yml are handled. Add unit tests for the stated priority order, including the single YAML-file fallback and ambiguous-directory case. Done means the commands select files in that order without changing the existing explicit-file behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.