Skip to content

fix: coerce env var values to strings for Kubernetes compatibility#150

Merged
vigneshrajsb merged 1 commit intomainfrom
fix/stringify-k8s-env-values
Mar 27, 2026
Merged

fix: coerce env var values to strings for Kubernetes compatibility#150
vigneshrajsb merged 1 commit intomainfrom
fix/stringify-k8s-env-values

Conversation

@vigneshrajsb
Copy link
Copy Markdown
Contributor

Summary

  • Kubernetes requires all env[].value fields to be strings, but env vars sourced from JSONB storage can contain numeric values (e.g., port numbers stored as 5432 instead of "5432")
  • This causes kubectl apply to fail with: cannot unmarshal number into Go struct field EnvVar.value of type string
  • Added String() coercion in both engines.ts (build container env) and utils.ts (deploy job env) where env var objects are constructed

Test plan

  • Added test in buildkit.test.ts verifying numeric env values (e.g., APP_PORT: 3000) are coerced to strings in the generated job YAML
  • Added test in utils.test.ts verifying createJob coerces numeric env values to strings
  • All 29 nativeBuild tests pass
  • Lint passes

Kubernetes requires all env[].value fields to be strings. When env vars
come from JSONB storage, numeric values like port numbers are preserved
as numbers, causing kubectl apply to fail with:
"cannot unmarshal number into Go struct field EnvVar.value of type string"
@vigneshrajsb vigneshrajsb requested a review from a team as a code owner March 27, 2026 20:01
@vigneshrajsb vigneshrajsb merged commit 1d1879d into main Mar 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant