openfaas / openfaas/faas-cli

Pull default templates when running faas-cli build

Open
#997 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Running faas-cli build fails when templates are missing from the template folder. While the command should fail in this case the behaviour is confusing because it also fails for default templates from the official template repo while other commands like faas-cli publish pull the default templates automatically when they are missing.

Expected Behaviour

Pull templates from the official template repo automatically when they are missing.

Current Behaviour

Running faas-cli build does not pull the templates from the official template repo automatically.

Why do you need this?

Who is this for?

What company is this for? Are you listed in the ADOPTERS.md file?

Are you a GitHub Sponsor (Yes/No?)

Check at: https://github.com/sponsors/openfaas

  • Yes
  • No

List All Possible Solutions and Workarounds

Pull the default templates automatically before building.
Workaround: run faas-cli template pull before faas-cli build

Which Solution Do You Recommend?

Make the beaviour consistent with the other commands and expand the template directory automatically.

Steps to Reproduce (for bugs)

  1. Remove the template directory from an existing functions project.
  2. Run faas-cli build
  3. See the build fail because of missing templates.

Context

This issue was discovered while splitting out the GitHub Actions workflow for the openfaas store functions.

Your Environment

  • FaaS-CLI version ( Full output from: faas-cli version ):
CLI:
 commit:  f8c3e0f878eec5c5bcfff315b7cc1f27d56344cc
 version: 0.16.29
  • Docker version ( Full output from: docker version ):
Client: Docker Engine - Community
 Version:           26.1.4
 API version:       1.45
 Go version:        go1.21.11
 Git commit:        5650f9b
 Built:             Wed Jun  5 11:28:57 2024
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          26.1.4
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       de5c9cf
  Built:            Wed Jun  5 11:28:57 2024
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.33
  GitCommit:        d2d58213f83a351ca8f528a95fbd145f5654e957
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)?

  • Operating System and version (e.g. Linux, Windows, MacOS):

Linux, Ubuntu 22.04.4 LTS
  • Link to your project or a code example to reproduce issue:

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 with the faas-cli build and template pull entry points, then compare how faas-cli publish handles missing default templates. Reproduce the failure after removing the template directory; done means faas-cli build retrieves the official templates automatically and proceeds consistently with the other commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
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.