Open yuwenma opened 3 years ago
Can you provide an example of how this fails in multi-config mode?
I think skaffold fix
only updates configs in the current skaffold.yaml
file.
@gsquared94 You are right, I guess I'm confused by this code:
The skaffold fix
has a returned config slices which iterate the current skaffold.yaml
and try to find all APIVersion from the skaffold.yaml
. But it looks like the APISchema actually only have one single APIVersion field. Why does configFactoryFromAPIVersion assumes the parsing file have a list of APIVersions?
@gsquared94 Another question: Why does skaffold fix
only upgrade the current skaffold.yaml
, rather than upgrade all its dependency skaffold.yaml files? Seems nicer for users to have a single cmd upgrading all files (especially if the root skaffold.yaml
is older than the expected, it is more likely its sub-dir skaffold.yaml
files also need an update).
Why does configFactoryFromAPIVersion assumes the parsing file have a list of APIVersions?
There can be a slice of config definitions in a single file with different versions, like rewriting examples/microservices
skaffold.yaml
:
apiVersion: skaffold/v2beta12
kind: Config
build:
artifacts:
- image: base
context: base
---
apiVersion: skaffold/v2beta13
kind: Config
requires:
- configs: [base]
build:
artifacts:
- image: leeroy-web
context: leeroy-web
requires:
- image: base
alias: BASE
- image: leeroy-app
context: leeroy-app
requires:
- image: base
alias: BASE
@gsquared94 Another question: Why does
skaffold fix
only upgrade the currentskaffold.yaml
, rather than upgrade all its dependency skaffold.yaml files? Seems nicer for users to have a single cmd upgrading all files (especially if the rootskaffold.yaml
is older than the expected, it is more likely its sub-dirskaffold.yaml
files also need an update).
There's no reason why it can't do that. But your original question needs to be addressed then, whether we upgrade all files and skip (instead of failing) for files that are at a version higher than target.
Also there should be a way to only upgrade single files, so maybe a --all
or --recursive
flag or something.
Updated proposal looks good to me. Please also add a flag --recursive
with default value true
that users can disable to go back to existing behavior.
Updated from the discussion with @gsquared94 (See below).
Information
Actual behavior
skaffolx fix --version VERSION
only upgrades the rootskaffold.yaml
(or --filename if given). Should it also upgrade the local dependencies'skaffold.yaml
?Expected behavior
When users run
skaffold fix [--version VERSION]
, they may not only want to upgrade the rootskaffold.yaml
, but the sub-directories'skaffold.yaml
. Especially if the rootskaffold.yaml
is out of date, the sub-directoriesskaffold.yaml
are more likely to be out of date as well.Proposal
skaffold fix
behavior to upgrade both the rootskaffold.yaml
and local dependentskaffold.yaml
files (which are defined in.requires.path
). @gsquared94 @tejal29 do you think we shall make this as the default behavior? Gaurav: add flag--recursive
default to true.skaffold fix
.Original question
Should
skaffold fix -version
abort or do no-op?Description
In
skaffolx fix --version VERSION
, if VERSION is older than in use version, skaffold aborts the attempts with message. e.g.Here is the source code.
As a consequence, in multi-config mode, users have no chance to use
skaffold fix --version
to upgrade their older versions if they also have some newer versions in use. Is this expected? Shouldskaffold fix --version
do no-op if the in-use versions is equal or newer than the VERSION?