Skip to content

Support OS-less images in Bakery #386

@bschwedler

Description

@bschwedler

Problem

Bakery requires every image version to have at least one OS entry with non-empty extension and tagDisplayName fields. Both fields enforce regex patterns that require at least one character (^[a-zA-Z0-9_-]+$ and ^[a-zA-Z0-9_.-]+$), making empty strings invalid.

This prevents building images that don't need an OS, such as:

  • Init containers based on scratch that only copy static files
  • Utility images with statically-linked Go binaries
  • Any image where the final stage is FROM scratch

Context

The workbench-session-init image was recently refactored to use FROM scratch since it only contains pre-built static binaries from the rsp-session-multi tarball. The builder stage uses Ubuntu to download and extract the tarball, but the final image has no OS. Despite this, Bakery still requires an OS entry (Ubuntu 24.04), resulting in misleading tags like workbench-session-init:2026.01.1-ubuntu-24.04 for an image that contains no Ubuntu.

Relevant code: posit_bakery/config/shared.py lines 14-34 define ExtensionField and TagDisplayNameField with patterns that reject empty strings.

Proposed solution

Allow OS extension and tagDisplayName to be empty strings (or omitted entirely) so that:

  • The Containerfile has no OS suffix (e.g., just Containerfile.jinja2)
  • Tags omit the OS component (e.g., workbench-session-init:2026.01.1 with no -ubuntu-24.04 suffix)

This could be implemented by:

  1. Making the regex patterns accept empty strings: ^[a-zA-Z0-9_.-]*$
  2. Or adding a new OS-less image mode that skips OS-related naming entirely

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    cvp:1Minor enhancements, such as those suggested by customers that fit with planned workdockerRelated to container images we producetdp:1The individual working on it notices.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions