Skip to content

fix: support staffbase-application Helm chart image field shape#139

Merged
asadk23 merged 2 commits into
mainfrom
fix/helm-chart-image-tag-field
May 28, 2026
Merged

fix: support staffbase-application Helm chart image field shape#139
asadk23 merged 2 commits into
mainfrom
fix/helm-chart-image-tag-field

Conversation

@asadk23
Copy link
Copy Markdown
Contributor

@asadk23 asadk23 commented May 28, 2026

Problem

Some Helm chart splits the image into a mapping:

image:
  repository: foo.bar/lol/app
  tag: dev-abc123

When the action writes the full URI as a scalar to spec.values.workload.container.image, the kustomize patch replaces the mapping with a string. The chart template renders {{ .image.repository }}:{{ .image.tag }} as : — both fields resolve to empty.

Fix

Three-case dispatch in update_file():

Case 1 — legacy (Apperator): field resolves to a scalar → write full image URI unchanged. No behaviour change for existing callers.

Case 2 — auto-detect (Helm): field resolves to a !!map with a .tag property → write only INPUT_TAG to .field.tag. Caller specifies spec.values.workload.container.image, action handles the rest.

Case 3 — explicit: field path ends in .tag → write only INPUT_TAG directly to that field. For callers who prefer to be explicit.

Backwards compatibility

All existing Apperator-style callers have scalar image fields and continue to receive the full URI unchanged (case 1). No cicd.yml changes required for existing services.

@asadk23 asadk23 requested review from a team as code owners May 28, 2026 16:27
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 28, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@asadk23
Copy link
Copy Markdown
Contributor Author

asadk23 commented May 28, 2026

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request May 28, 2026
The staffbase-application Helm chart splits the image into a mapping:

  image:
    repository: registry.staffbase.com/sb-images/app
    tag: dev-abc123

When gitops-github-action writes the full URI as a scalar to
spec.values.workload.container.image, the kustomize patch replaces the
mapping with a string. The chart then renders 'image: :' — both
.image.repository and .image.tag resolve to empty.

Fix: before writing, read the type of the target field using yq.
- If the field is a mapping (!!map), write only INPUT_TAG to .field.tag
- Otherwise, write the full image URI as before (Apperator pattern)

Callers specifying spec.values.workload.container.image get the right
behaviour automatically based on what is already in their overlay file.
No changes to cicd.yml required.

Backwards compatible: all existing Apperator-style callers have scalar
image fields (!!str) and continue to receive the full URI unchanged.

Assisted-by: pi:claude-sonnet-4-5
@asadk23 asadk23 force-pushed the fix/helm-chart-image-tag-field branch from 094516a to f80c00a Compare May 28, 2026 16:41
@asadk23 asadk23 changed the title fix: write only tag when field path ends in .tag fix: auto-detect image field type to support staffbase-application chart May 28, 2026
@asadk23 asadk23 changed the title fix: auto-detect image field type to support staffbase-application chart fix: support staffbase-application Helm chart image field shape May 28, 2026
@asadk23 asadk23 merged commit a90b1cb into main May 28, 2026
10 checks passed
@asadk23 asadk23 deleted the fix/helm-chart-image-tag-field branch May 28, 2026 21:42
@github-actions github-actions Bot locked and limited conversation to collaborators May 28, 2026
@asadk23 asadk23 added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels May 28, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants