Skip to content

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

@intel352

Description

@intel352

Summary
internal/drivers/app_platform_buildspec.go::buildJobSpec and buildWorkerSpec parse the image field via strFromConfig + ParseImageRef only:

if imgStr := strFromConfig(m, "image", ""); imgStr != "" {
img, err := ParseImageRef(imgStr)
if err == nil {
job.Image = img
}
}

The parent service's image is parsed via imageSpecFromConfig (line ~488), which accepts BOTH string AND structured map shapes:

func imageSpecFromConfig(cfg map[string]any) (*godo.ImageSourceSpec, error) {
switch v := cfg["image"].(type) {
case string:
return ParseImageRef(v)
case map[string]any:
// ... build from registry_type/repository/tag/registry
}
}

When operators use the structured map form on a Job (or Worker), it's silently dropped, and DO API rejects with:

job missing source spec (image, git, github, gitlab or bitbucket)

Surfaced
core-dump#173 added a postgres:18 pre_deploy db-reset job using:

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

Deploy run 25270989944 rejected the spec. Workaround in core-dump#174: switch to string form docker.io/library/postgres:18. But the inconsistency between parent-service and job/worker shape parsing should be fixed in the plugin.

Fix
Make buildJobSpec and buildWorkerSpec call imageSpecFromConfig (the parity helper) instead of inline strFromConfig + ParseImageRef.

Test plan
Test that structured-map image shape on a job (and worker) constructs the right *godo.ImageSourceSpec
Test that string image shape still works (regression)
Test that empty image yields nil image (regression)

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions