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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions pkg/skaffold/deploy/cloudrun/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func (d *Deployer) deployToCloudRun(ctx context.Context, out io.Writer, manifest
// figure out which type we have:
resource := &unstructured.Unstructured{}
if err = k8syaml.Unmarshal(manifest, resource); err != nil {
return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config"), &proto.ActionableErr{
return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config: %w", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down Expand Up @@ -232,7 +232,7 @@ func (d *Deployer) deployToCloudRun(ctx context.Context, out io.Writer, manifest
func (d *Deployer) deployService(crclient *run.APIService, manifest []byte, out io.Writer) (*RunResourceName, error) {
service := &run.Service{}
if err := k8syaml.Unmarshal(manifest, service); err != nil {
return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config"), &proto.ActionableErr{
return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config: %w", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down Expand Up @@ -329,7 +329,7 @@ func (d *Deployer) forceSendValueOfMaxRetries(job *run.Job, manifest []byte) {
func (d *Deployer) deployJob(crclient *run.APIService, manifest []byte, out io.Writer) (*RunResourceName, error) {
job := &run.Job{}
if err := k8syaml.Unmarshal(manifest, job); err != nil {
return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Job config"), &proto.ActionableErr{
return nil, sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Job config: %w", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down Expand Up @@ -435,7 +435,7 @@ func (d *Deployer) cleanupRun(ctx context.Context, out io.Writer, dryRun bool, m
func (d *Deployer) deleteRunService(crclient *run.APIService, out io.Writer, dryRun bool, manifest []byte) error {
service := &run.Service{}
if err := k8syaml.Unmarshal(manifest, service); err != nil {
return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config"), &proto.ActionableErr{
return sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config: %w", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down Expand Up @@ -475,7 +475,7 @@ func (d *Deployer) deleteRunService(crclient *run.APIService, out io.Writer, dry
func (d *Deployer) deleteRunJob(crclient *run.APIService, out io.Writer, dryRun bool, manifest []byte) error {
job := &run.Job{}
if err := k8syaml.Unmarshal(manifest, job); err != nil {
return 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: %w", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down Expand Up @@ -514,7 +514,7 @@ func (d *Deployer) deleteRunJob(crclient *run.APIService, out io.Writer, dryRun
func getTypeFromManifest(manifest []byte) (string, error) {
resource := &unstructured.Unstructured{}
if err := k8syaml.Unmarshal(manifest, resource); err != nil {
return "", sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config"), &proto.ActionableErr{
return "", sErrors.NewError(fmt.Errorf("unable to unmarshal Cloud Run Service config: %w", err), &proto.ActionableErr{
Message: err.Error(),
ErrCode: proto.StatusCode_DEPLOY_READ_MANIFEST_ERR,
})
Expand Down
Loading