Skip to content

skaffold fix generates wrong yaml path for deploy/kubectl/manifests #8564

Description

@mirober

Expected behavior

skaffold fix should correctly update yaml paths to take account of v1->v2 changes.

Actual behavior

At least for me it seems to be producing an invalid config, that causes an error when run.

Information

  • Skaffold version: v2.2.0
  • Operating system: Ubuntu
  • Installed via: Google Cloud SDK
  • Contents of skaffold.yaml:
apiVersion: skaffold/v1
kind: Config
metadata:
  name: demo-service
build:
  artifacts:
  - image: my-image
    docker: {}
deploy:
  kubectl:
    manifests:
    - k8s/env_configmap.yaml
profiles:
  - name: test-profile
    patches:
      - op: replace
        path: /deploy/kubectl/manifests/0
        value: k8s/test_configmap.yaml

Steps to reproduce the behavior

Paste the above skaffold file into an empty directory and run skaffold fix. This produces:

apiVersion: skaffold/v4beta3
kind: Config
metadata:
  name: demo-service
build:
  artifacts:
    - image: my-image
      docker: {}
manifests:
  rawYaml:
    - k8s/env_configmap.yaml
deploy:
  kubectl: {}
profiles:
  - name: test-profile
    patches:
      - op: replace
        path: /manifests/rawYaml/manifests/0
        value: k8s/test_configmap.yaml

The path in the new patch - /manifests/rawYaml/manifests/0 is incorrect. It should just be /manifests/rawYaml/0.

Trying to deploy the config results in this error:

parsing skaffold config: failed to apply profiles to config "demo-service" defined in file "/home/mike/testing/skaffold.yaml": applying profile "test-profile": invalid path: /manifests/rawYaml/manifests/0. There's an issue with one of the profiles defined in config "demo-service" in file "/home/mike/testing/skaffold.yaml"; refer to the documentation on how to author valid profiles: https://skaffold.dev/docs/environment/profiles/.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions