Fix: make apply-job, read-app and apply-terraform-provider pass vela-…

Merged
VA
4d ago
+16-6

Description of your changes

KubeVela v1.12.0-alpha.1 validates WorkflowStepDefinition CUE templates at admission (kubevela/kubevela#7325). Three step definitions in the vela-workflow chart fail that check, so installing or upgrading the chart against vela-core 1.12 is rejected. This PR fixes them:

  • read-app: removes the unused encoding/yaml import.
  • apply-terraform-provider: removes the unused strings import.
  • apply-job: reads apply.value.status / apply.value.spec instead of apply.status / apply.spec. op.#Apply returns the applied object under value, so the old fields never existed. The conditions are guarded with != _|_ checks so continue is always a plain boolean.

The apply-job change also fixes a runtime bug that predates 1.12. With v0.7.2, every step using apply-job failed immediately with invalid cue task for evaluation: getNodeContext: nodeContext out of sync, even when the Job succeeded.

Fixes #277

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run make reviewable to ensure this PR is ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

  1. Admission validation: ran every WorkflowStepDefinition in charts/vela-workflow/templates/definitions through ValidateWorkflowStepCuexTemplate from kubevela (the function behind the 1.12 webhook). Before: 21 pass, 3 fail. After: 24 pass.
  2. End to end on k3d (Kubernetes v1.31.5): vela-core 1.12.0-alpha.1, plus the vela-workflow v0.7.2 chart and image with only these three files replaced. The chart installs cleanly.

Summary by cubic

Fixes CUE validation failures in apply-job, read-app, and apply-terraform-provider against vela-core 1.12, plus a pre-existing runtime bug in apply-job.

  • apply-job guards reads of apply.value.status and apply.value.spec.completions with != _|_ checks, so unset fields no longer fail the step or raise the "nodeContext out of sync" error on v0.7.2.
  • Removes the unused strings and encoding/yaml imports.