Skip to content

Relax container image schema and add custom validation#323

Open
ericsciple wants to merge 2 commits intomainfrom
users/ericsciple/26-02-image
Open

Relax container image schema and add custom validation#323
ericsciple wants to merge 2 commits intomainfrom
users/ericsciple/26-02-image

Conversation

@ericsciple
Copy link
Collaborator

@ericsciple ericsciple commented Feb 4, 2026

Related PR:

Relaxing schema non-empty-string for container/service image and moving to custom validation. This matches current production behavior which allows empty string at runtime, but not parse time.

Parse Time Behavior

YAML Result
container: '' Silent (null)
container: 'docker://' Error
container: {} Error
container: {image: ''} Error
container: {image: 'docker://'} Error
container: {image: '', options: ${{ expr }}} Error
services: {svc: ''} Error
services: {svc: 'docker://'} Error
services: {svc: {}} Error
services: {svc: {image: ''}} Error

@ericsciple ericsciple force-pushed the users/ericsciple/26-02-image branch 3 times, most recently from ba800d5 to 17c2300 Compare February 5, 2026 23:05
@ericsciple ericsciple changed the title Add validation for empty container image Relax container image schema and add custom validation Feb 5, 2026
Related PR:
- actions/runner#4220

Relaxing schema non-empty-string for container/service image and moving to custom validation. This matches current production behavior which allows empty string at runtime, but not parse time.
@ericsciple ericsciple force-pushed the users/ericsciple/26-02-image branch from 17c2300 to 671f92d Compare February 5, 2026 23:12
@ericsciple ericsciple marked this pull request as ready for review February 5, 2026 23:45
@ericsciple ericsciple requested a review from a team as a code owner February 5, 2026 23:45
Copilot AI review requested due to automatic review settings February 5, 2026 23:45
Copy link
Contributor

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 pull request relaxes the JSON schema validation for container and service image properties and adds custom validation logic to match production runtime behavior. The schema type is changed from "non-empty-string" to "string", allowing empty strings to pass schema validation, while custom validation in the converter layer enforces the appropriate rules.

Changes:

  • Schema relaxation: Changed container/service image type from "non-empty-string" to "string" in workflow-v1.0.json
  • Custom validation: Implemented detailed validation logic in container.ts that handles empty strings, docker:// prefixes, expressions, and the distinction between job containers (silent on empty) and service containers (error on empty)
  • Error handling: Added handleTemplateTokenErrors wrapper to container and services conversion calls in job.ts
  • Comprehensive test coverage: Added 31 test cases covering shorthand/mapping forms, expression safety, and all error scenarios

Reviewed changes

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

Show a summary per file
File Description
workflow-parser/src/workflow-v1.0.json Changed container and service image schema type from "non-empty-string" to "string" to allow empty strings at parse time
workflow-parser/src/model/converter/container.ts Implemented custom validation for container images including empty string detection, docker:// prefix handling, expression key/value handling, and isServiceContainer flag support
workflow-parser/src/model/converter/job.ts Wrapped convertToJobContainer and convertToJobServices calls with handleTemplateTokenErrors for proper error handling
workflow-parser/src/model/converter/container.test.ts Added comprehensive test suite with 31 test cases covering all validation scenarios and expression safety
workflow-parser/testdata/skipped-tests.txt Added job-container-invalid.yml to skipped tests list

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

Add containerImageValidation experimental feature flag that gates the
new container image validation behind an opt-in toggle. When the flag
is off (default), the legacy converter logic is used. When enabled,
the improved validation with expression handling runs.

The legacy code is duplicated to keep code paths fully isolated and
make the eventual cleanup diff minimal — just delete the legacy
functions and the flag guards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant