Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aaron-prindle/386cc4d0018e55c5615859584ffbb8fa to your computer and use it in GitHub Desktop.

Select an option

Save aaron-prindle/386cc4d0018e55c5615859584ffbb8fa to your computer and use it in GitHub Desktop.
### Alternative Solutions
#### Alternative flag to `-f` (new flag `-w`) to set working directory
Explicit flag specify working directory
Skaffold will effectively set its working directory to the specified path.
```
$ skaffold build -f path/to/skaffold.yaml -W path/to
```
- Pros:
- Very flexible
- Cons:
- Some visual stutter, especially with full paths likely to be used and shown in the IDEs
- Inconsistent with modules as a module only uses a file named `skaffold.yaml`
#### Additional flag `-M` which when set in conjuction with `-f` sets working dir to path of the `-f /path/skaffold.yaml` file
Explicit flag to request resolution relative to skaffold.yaml
Provide a command-line flag to request resolution relative to skaffold.yaml. Call it "module mode" since it is similar to handling of module dependencies.
```
$ skaffold build --module-mode -f path/to/skaffold.yaml
$ skaffold build -M -f path/to/skaffold.yaml
```
Skaffold will effectively set its working directory to be alongside the specified config file.
- Pros:
- Explicit
- Supports alternative config file names
- Cons:
- Inconsistent with modules as a module only uses a file named `skaffold.yaml`
#### New mutually exclusive flag `-M` which causes the path to be treated identically to if the path was included as a module dependency
Explicit module flag to to path with skaffold.yaml
Introduce a new `-M` / `--module` flag that is mutually exclusive with `-f`. This flag causes the path to be treated identically to if the path was included as a module dependency.
```
$ skaffold build --module path/to
$ skaffold build --M path/to
```
Will error if path/to/skaffold.yaml does not exist.
Using this flag should provide identical results as running:
$ (cd path/to; skaffold build -f skaffold.yaml)
- Pros:
- Root module is treated like a sub-module
- Promotes re-use as a module
- When the path/to is absolute, can be copied and pasted and run from anywhere.
- Cons:
- Does not support using alternative config file names
- Does not address full problem: IDEs currently allow selecting for a skaffold config file (e.g., with a different name), which would then not be modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment