GoogleContainerTools/skaffold

Fix error message "unable to unmarshal Cloud Run Service config" for Cloud Run Job

Closed this issue · 0 comments

Expected behavior

When the Cloud Run Job specification has an error, throw error "unable to unmarshal Cloud Run Job config" is displayed to user.

https://github.com/GoogleContainerTools/skaffold/blob/v2.12.0/pkg/skaffold/deploy/cloudrun/deploy.go#L443
https://github.com/GoogleContainerTools/skaffold/blob/v2.12.0/pkg/skaffold/deploy/cloudrun/deploy.go#L300

Also it should state that the spec is either job or service, so something like "unable to unmarshal Cloud Run Service or Job api version and kind from config" would be more appropriate.
https://github.com/GoogleContainerTools/skaffold/blob/v2.12.0/pkg/skaffold/deploy/cloudrun/deploy.go#L482

Actual behavior

The error message "unable to unmarshal Cloud Run Service config" is thrown regardless of whether it is a Cloud Run Service or Job.

At the moment the same error message is used in 6 different places in deploy.go, making it a bit difficult to pinpoint the actual issue and can mislead users in their debugging efforts.

In our current effort we thought skaffold is trying to interpretate the Job spec as a Service specification, creating confusion.

Information

  • Skaffold version: v2.12.0
  • Operating system: Mac
  • Installed via: Homebrew
  • Contents of skaffold.yaml:
apiVersion: skaffold/v4beta7
kind: Config
metadata:
  name: entigo-infralib
deploy:
  cloudrun: {}
profiles:
  - name: plan
    manifests:
      rawYaml:
        - plan.yaml
  - name: apply
    manifests:
      rawYaml:
        - apply.yaml

Steps to reproduce the behavior

Create an invalid cloud run job spec and try to deploy the cloud run jobs in google cloud deploy.