Skip to content

fix: buildJobSpec/buildWorkerSpec — accept structured map image shape (parity with parent service)#66

Merged
intel352 merged 2 commits intomainfrom
copilot/build-image-field-accept-structured-map
May 5, 2026
Merged

fix: buildJobSpec/buildWorkerSpec — accept structured map image shape (parity with parent service)#66
intel352 merged 2 commits intomainfrom
copilot/build-image-field-accept-structured-map

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 5, 2026

buildJobSpec and buildWorkerSpec only parsed the image field as a string via ParseImageRef, silently dropping the structured map form and causing DO API rejections ("job missing source spec"). The parent service already handled both shapes via imageSpecFromConfig.

Changes

  • app_platform_buildspec.go — replace inline strFromConfig + ParseImageRef in buildJobSpec and buildWorkerSpec with imageSpecFromConfig, which accepts both string and map shapes:
// Before
if imgStr := strFromConfig(m, "image", ""); imgStr != "" {
    img, err := ParseImageRef(imgStr)
    if err == nil {
        job.Image = img
    }
}

// After
if img, err := imageSpecFromConfig(m); err == nil {
    job.Image = img
}
  • app_platform_buildspec_test.go — adds coverage for structured map, string, and empty image for both jobs and workers:
    • TestBuildAppSpec_Jobs_ImageMapShape / TestBuildAppSpec_Workers_ImageMapShape
    • TestBuildAppSpec_Jobs_ImageStringShape / TestBuildAppSpec_Workers_ImageStringShape (regression)
    • TestBuildAppSpec_Jobs_ImageEmpty / TestBuildAppSpec_Workers_ImageEmpty (regression)

The structured map form now works on jobs and workers the same way it does on services:

image:
  registry_type: DOCKER_HUB
  repository: library/postgres
  tag: "18"

Copilot AI requested review from Copilot and removed request for Copilot May 5, 2026 08:01
Copilot AI changed the title [WIP] Update buildJobSpec and buildWorkerSpec to accept structured map shape fix: buildJobSpec/buildWorkerSpec — accept structured map image shape (parity with parent service) May 5, 2026
Copilot AI requested a review from intel352 May 5, 2026 08:02
@intel352 intel352 marked this pull request as ready for review May 5, 2026 08:03
Copilot AI review requested due to automatic review settings May 5, 2026 08:03
Copy link
Copy Markdown

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 fixes App Platform build spec generation so buildJobSpec and buildWorkerSpec accept the image field in both supported canonical shapes—either a flat string image ref or a structured map[string]any—matching the behavior already used for the primary service image. This prevents structured image configs from being silently ignored for jobs/workers, which can lead to downstream DigitalOcean API rejections.

Changes:

  • Updated buildJobSpec and buildWorkerSpec to use imageSpecFromConfig (string-or-map) instead of only parsing string image refs.
  • Added tests covering job/worker image handling for structured map shape, string shape (regression), and missing image (regression).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
internal/drivers/app_platform_buildspec.go Switch job/worker image parsing to imageSpecFromConfig to support both string and structured map image shapes.
internal/drivers/app_platform_buildspec_test.go Add coverage for job/worker image parsing across map/string/empty cases.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@intel352 intel352 merged commit 9bade5f into main May 5, 2026
8 of 9 checks 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.

buildJobSpec / buildWorkerSpec image field — accept structured map shape (parity with parent service)

3 participants