Skip to content

Bug: Canary deployment the promote action doesn't fail even when kubectl apply return error #305

@cha7ri

Description

@cha7ri

What happened?

I changed an immutable field in the deployment matchLabels , when deploying it using canary, the promote action should fail because it can't apply the new deployment manifest, but it didn't.
I can see the kubectl error in the logs

  The Deployment "forked-myapp-dev" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"forked-myapp-dev", "app.kubernetes.io/name":"myapp-tmp"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

I think the issue from the code is the exit code is not handled here

promoteResult = await PodCanaryHelper.deployPodCanary(

I think the issue can be fixed by adding checkForErros like here https://github.com/Azure/k8s-deploy/blob/93550c22f0e0656c2a6b0cf5252a94cc3e2710fc/src/strategyHelpers/deploymentHelper.ts#L58C10-L58C24

Expected behaviour

The pipeline should fail if it can't apply the manifest

Version

  • I am using the latest version

Runner

self-hosted

Relevant log output

  The Deployment "forked-myapp-dev" is invalid: spec.selector: Invalid value: v1.LabelSelector{MatchLabels:map[string]string{"app.kubernetes.io/instance":"forked-myapp-dev", "app.kubernetes.io/name":"myapp-tmp"}, MatchExpressions:[]v1.LabelSelectorRequirement(nil)}: field is immutable

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingidleInactive for 14 days

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions