Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Wrap errors when unmarshal Cloud Run deploy manifests fail. #9578

Conversation

jesseward
Copy link
Contributor

Fixes: #9577
Related:
Merge before/after:

Description
Minor change to wrap errors for Cloud Run Service manifest parsing.

User facing changes (remove if N/A)
This will update log output for users of Cloud Deploy and vanilla Skaffold from the CLI.

Before

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

After

INFO[0000] Skaffold &{Version:v2.13.0-45-gda515003e-dirty ConfigVersion:skaffold/v4beta12 GitVersion: GitCommit:da515003e61ce5b0d39be08a40824813a84fdf80 BuildDate:2024-11-21T00:53:36Z 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> {0xc000b9c160 <nil> <nil> <nil> <nil> <nil> <nil>} [] {[] []} [] } of type *latest.Artifact and pointer: 824634868544  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: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal string into Go struct field Container.spec.template.spec.containers.volumeMounts of type []*run.VolumeMount

Will also expect that stackdriver logs will render the error unmarshaling JSON: ... string as well.

Copy link

conventional-commit-lint-gcf bot commented Nov 21, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

Jesse Ward added 2 commits November 21, 2024 02:03
Wrap errors returned from k8syaml.Unmarshal
…d-run-deploy-error' into jesseward/wrap-cloud-run-deploy-error

Merging upstream
@jesseward jesseward changed the title Wrap errors when unmarshal Cloud Run deploy manifests. fix: Wrap errors when unmarshal Cloud Run deploy manifests. Nov 21, 2024
@jesseward jesseward changed the title fix: Wrap errors when unmarshal Cloud Run deploy manifests. fix: Wrap errors when unmarshal Cloud Run deploy manifests fail. Nov 21, 2024
Copy link
Contributor

@mattsanta mattsanta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Could you do the same if it happens with a Cloud Run Job?

return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Job config"), &proto.ActionableErr{

return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Job config"), &proto.ActionableErr{

@jesseward
Copy link
Contributor Author

Thanks for the PR!

Could you do the same if it happens with a Cloud Run Job?

thanks @mattsanta , newest commit captures the Cloud Run Job yaml unmarshal errors as well.

@mattsanta mattsanta merged commit 62c0a70 into GoogleContainerTools:main Nov 22, 2024
12 checks passed
@jesseward jesseward deleted the jesseward/wrap-cloud-run-deploy-error branch November 22, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants