Skip to content

Conversation

@maddox-214
Copy link

@maddox-214 maddox-214 commented Jul 8, 2025

🚀 Add image substitution support for CronJobs (Addresses #243 )
This PR enhances the image substitution logic to support CronJobs by updating container image references in structured YAML objects. It replaces fragile string-based substitution with robust object-level mutation, ensuring compatibility across all standard workload types including CronJob, Deployment, and initContainers. CLOSED BECAUSE CODE WAS USED BY #436

@maddox-214 maddox-214 marked this pull request as ready for review July 8, 2025 16:41
@maddox-214 maddox-214 self-assigned this Jul 8, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces fragile string-based image substitution with object-level YAML mutation and extends support to CronJob resources and initContainers.

  • Parses Kubernetes manifests into objects, updates image fields, and re-serializes to YAML
  • Introduces updateImagesInK8sObject and updateImageInContainerArray helpers
  • Adds CronJob spec.jobTemplate and initContainers handling
Comments suppressed due to low confidence (1)

src/utilities/manifestUpdateUtils.ts:122

  • CronJob and initContainers image updates have been added; ensure new test cases cover both spec.jobTemplate containers and initContainers to prevent regressions.
      obj?.kind?.toLowerCase() === KubernetesWorkload.CRON_JOB &&

@Tatsinnit Tatsinnit added the enhancement Feature request/improved experience label Jul 8, 2025
@benjaminbob21 benjaminbob21 requested a review from a team as a code owner July 15, 2025 16:38
obj.spec.jobTemplate.spec.template.spec.initContainers[0].image
).toBe('init:new')
})
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks good, can we add a test for updateContainerImagesInManifestFiles to validate that the yaml parsing works as expected

@maddox-214 maddox-214 closed this Jul 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Feature request/improved experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants