Jobs - #866
Open
ndeloof wants to merge 5 commits into
Open
Conversation
Closed
ndeloof
force-pushed
the
jobs
branch
7 times, most recently
from
July 31, 2026 06:40
ccbf84f to
efe70a9
Compare
ndeloof
force-pushed
the
jobs
branch
2 times, most recently
from
August 18, 2026 07:10
45b794d to
0619779
Compare
Load representative compose files and compare the fully-loaded project against committed golden JSON/YAML outputs (UPDATE_GOLDEN=1 regenerates them). This pins the observable loader behavior before the container specification gets restructured in the next commits. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
…onfig Layer the container configuration: - ContainerSpec holds the attributes shared by anything that runs a container (runtime configuration: image, command, resources, mounts, networking, ...) - WorkloadSpec holds the attributes meaningful for orchestrated workloads: build, depends_on, expose, healthcheck, ports, stdin_open, tty - ServiceConfig embeds both and keeps the service-only attributes (deploy, develop, scale, container_name, links, hooks, ...) The JSON schema mirrors this layering with container_spec and workload_spec $defs composed into the service definition, and the interpolation type-cast and canonicalization registries are organized by the same layers. No behavior change: promoted fields keep the exact same yaml/json tags, and the golden files only reflect the new attribute ordering in marshalled output. This layering is the ground for reusing the container specification beyond services (jobs, pre_start init containers). Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
ndeloof
added a commit
to docker/compose
that referenced
this pull request
Aug 19, 2026
compose-spec/compose-go#866 layers the service configuration: ContainerSpec (anything running a container), WorkloadSpec (services and jobs) and service-only attributes, with pre_start hooks carrying the full container specification (PreStartHook) while exec hooks (post_start/pre_stop) lose the fields they never should have had. Promoted field access is source-compatible; what this adapts is: - composite literals setting moved fields, wrapped into the embedded ContainerSpec/WorkloadSpec (production code and tests, rewritten mechanically with an AST tool, long lines re-split by hand) - pre_start hook handling typed against PreStartHook - the api test asserting exec-hook images are not collected now states the property is enforced by construction: ServiceHook has no image No behavior change. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Implements compose-spec#656: a pre_start hook is an init container run to completion before the service starts, and now accepts the complete container specification instead of a restricted command/image subset. PreStartHook embeds ContainerSpec (plus per_replica); attributes not declared on the hook are inherited from the parent service (image via normalization, as before). The schema, path resolution, canonicalization and interpolation casts reuse the container_spec layer for services.*.pre_start.*, so hook attributes behave exactly as their service counterparts. Exec hooks (post_start/pre_stop) are unchanged: they run inside the service container and keep rejecting container-level attributes. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Implements compose-spec#642: jobs are containers that run to completion, triggered manually or on schedule. JobConfig composes the same ContainerSpec and WorkloadSpec layers as services, plus job-only triggers (manual, schedule with cron/timezone/concurrency/missed_fires; a plain crontab string canonicalizes into a schedule object). Jobs go through the full loading pipeline exactly as services do: merge/override, extends, include, environment resolution, profiles, normalization, path resolution, defaults — implemented by iterating the existing per-service logic over both keys. Registries organized by specification layer (interpolation casts, canonicalization, omitempty) get the jobs.* prefixes, so container_spec attribute handling is declared once and applies wherever a container is declared. Consistency rules: service and job names share a single namespace so a name always resolves to exactly one of them; a service cannot depend on a job; a job can depend on services and other jobs. Per-attribute loader tests cover every container_spec/workload_spec attribute declared on a job. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
WithSelectedJob returns a Project narrowed to the services the named job depends on, enabling the job's profile when it is declared under an inactive one. The job itself is not added to Services: it is up to the runtime to create its container when triggered. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
ndeloof
added a commit
to docker/compose
that referenced
this pull request
Aug 19, 2026
…go#866) Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
ndeloof
added a commit
to docker/compose
that referenced
this pull request
Aug 19, 2026
compose-spec/compose-go#866 layers the service configuration: ContainerSpec (anything running a container), WorkloadSpec (services and jobs) and service-only attributes, with pre_start hooks carrying the full container specification (PreStartHook) while exec hooks (post_start/pre_stop) lose the fields they never should have had. Promoted field access is source-compatible; what this adapts is: - composite literals setting moved fields, wrapped into the embedded ContainerSpec/WorkloadSpec (production code and tests, rewritten mechanically with an AST tool, long lines re-split by hand) - pre_start hook handling typed against PreStartHook - the api test asserting exec-hook images are not collected now states the property is enforced by construction: ServiceHook has no image No behavior change. Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
implements compose-spec/compose-spec#642
The container configuration is extracted as a layered specification —
ContainerSpec(anything that runs a container: services, jobs,pre_startinit containers) /WorkloadSpec(services and jobs: build, depends_on, expose, healthcheck, ports, stdin_open, tty) / service-only attributes.pre_starthooks carry the full container specification (#656), and the canonicalization/path-resolution/interpolation registries follow the same layering (which also fixes interpolation casts never applying to jobs).