GoogleContainerTools / GoogleContainerTools/skaffold
Skaffold should offer a command-line flag to cause execution (working-directory) to be performed alongside the Skaffold config file.
- Dominant language
- Go
- Stars
- 15.9k
- Forks
- 1.7k
- Avg merge
- 3d 9h
- Merged PRs (30d)
- 10
Description
(taken from design doc by @briandealwis - go/skaffold-run-from-here)
### Introduction
Skaffold has a mismatch between the execution models of:
- the root module vs dependent modules
- the command-line and the IDEs
We see issues such as https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues/379 / https://github.com/GoogleContainerTools/skaffold/issues/5355, and more.
### Background / Motivation
- Skaffold normally resolves paths from the working directory where it was invoked
- Paths in `skaffold build -f dir/to/skaffold.yaml` are not resolved from `dir/to`
- This is used by Cloud Code and `gcloud code` for referencing generated skaffold.yaml placed in $TMP
- This behaviour follows the common Unix/CLI standards:
- `docker build -f dev/Dockerfile .` files are resolved from `.` (or the path specified), not `dev`
- `go build`: the go.mod is resolved from cwd
- `make -f dev/Makefile all`
- …except this isn't the case for referenced modules, where Skaffold appears to run from the directory hosting the skaffold.yaml
- When the IDEs launch Skaffold, they currently set the working directory to the directory containing the skaffold.yaml. But this is not visible in the UI and so users can be confused when they try to run Skaffold from the command-line.
### Design / Proposal
Skaffold should offer a command-line flag to cause execution to be performed alongside the Skaffold config file.
### Solution
#### Alternative flag to `-f` (new flag `-F`) to implicitly use module-mode
```
$ skaffold build -F path/to/skaffold.yaml
```
Skaffold will effectively set its working directory to be alongside the specified config file. This flag would be mutually exclusive with `-f`.
- Pros:
- Looks similar to `-f`
- Supports alternative config file names
- Cons:
- Looks similar to `-f`
- Inconsistent with modules as a module only uses a file named `skaffold.yaml`
### Alternative Solutions
See alternative solutions here - https://gist.github.com/aaron-prindle/386cc4d0018e55c5615859584ffbb8fa
Contributor guide
Assessment
This issue has not been assessed yet.