openfaas / openfaas/faas-cli

Non-git directories should error on tags

Open
#769 2 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

This happened because of an edge case with a git binary version on a self-hosted runner.

When using tags of branch or sha on a directory that isn't a git repository, you get a complete error as an image name, e.g; eu.gcr.io/project/image:0.1-fatal: not a git repository (or any parent up to mount point /github) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).-fatal: not a git repository (or any parent up to mount point /github) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

This is an invalid image name, and kubernetes had some issues with this.

Expected Behaviour

Should fatal or exit back to the user (with a non zero exit code)

Current Behaviour

Creates invalid image names

Possible Solution

Exit with a non-zero exit code (so that a pipeline can exit too, in this case, the runner had checked the code out as a zip instead of git without any notice)

Steps to Reproduce (for bugs)

  1. Run faas-cli build --parallel 5 --tag=sha -f faas-stack.yml on a non-git directory

Context

Runner had changed the checkout method without notification

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 reproducing faas-cli build --parallel 5 --tag=sha -f faas-stack.yml from a non-git directory and trace the build tag handling. Done means the command exits non-zero for this condition and does not create an image name containing the Git error; add or update coverage if the repository has tests for this command.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, go
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.