Skip to content

deploy/cloudrun/deploy.go is not wrapping k8syaml.Unmarshal error, causing user pain when debugging bad manifests #9577

@jesseward

Description

@jesseward

Expected behavior

Users desire detailed error logging in the event that a Cloud Run manifest.yaml does not adhere to schema and fails to unmarshal.

For example, the error unable to unmarshal Cloud Run Service config, does not include the wrapped k8syaml.Unmarshal error.

We expect the error wrapped onto the string, for example cannot unmarshal string into Go struct field Container.spec.template.spec.containers.volumeMounts of type []*run.VolumeMount

Actual behavior

Cloud Run (triggered via Cloud Deploy) jobs can become problematic to debug when manifest.yaml does not conform to desired Cloud Run Service config schema. The manifest is not fully validated when uploading/creating the job, so the user is only aware of the problem during attempts to run the pipeline/job and will result in failure.

Note that the following logging output captured from Cloud Deploy has the targets configured at debug verbosity.

image

Or running via the skaffold binary directly

skaffold -v info apply manifest.yaml --filename=skaffold.yaml
INFO[0000] Skaffold &{Version:v2.13.0-45-gda515003e ConfigVersion:skaffold/v4beta12 GitVersion: GitCommit:da515003e61ce5b0d39be08a40824813a84fdf80 BuildDate:2024-11-21T00:39:25Z GoVersion:go1.23-20240626-RC01 cl/646990413 +5a18e79687 X:fieldtrack,boringcrypto Compiler:gc Platform:linux/amd64 User:}  subtask=-1 task=DevLoop
INFO[0000] Loaded Skaffold defaults from "/usr/local/google/home/jesseward/.skaffold/config"  subtask=-1 task=DevLoop
INFO[0000] map entry found when executing locate for &{my-img . <nil> {0xc000e400b0 <nil> <nil> <nil> <nil> <nil> <nil>} [] {[] []} [] } of type *latest.Artifact and pointer: 824648009344  subtask=-1 task=DevLoop
INFO[0000] DOCKER_HOST env is not set, using the host from docker context.  subtask=-1 task=DevLoop
INFO[0000] no kpt renderer or deployer found, skipping hydrated-dir creation  subtask=-1 task=DevLoop
INFO[0000] build concurrency first set to 1 parsed from *runner.pipelineBuilderWithHooks[0]  subtask=-1 task=DevLoop
INFO[0000] final build concurrency value is 1            subtask=-1 task=DevLoop
Starting deploy...
unable to unmarshal Cloud Run Service config

Information

  • Skaffold version: v2.13.0-45-gda515003e (main branch)
  • Operating system: gLinux
  • Installed via: Source
  • Contents of skaffold.yaml manifest.yaml will reproduce:

Note the volumeMounts is meant to be an array.

apiVersion: serving.knative.dev/v1
kind: Service
metadata:
  name: cloud-run-service
spec:
  template:
    spec:
      containers:
        - image: my-img
          volumeMounts: blah

Steps to reproduce the behavior

  1. skaffold -v info apply manifest.yaml --filename=skaffold.yaml

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions