Skip to content

chore: add utilities for Windows Docker image publishing#310

Merged
EdSchouten merged 1 commit intobuildbarn:mainfrom
CaerusKaru:adam/windows
Feb 2, 2026
Merged

chore: add utilities for Windows Docker image publishing#310
EdSchouten merged 1 commit intobuildbarn:mainfrom
CaerusKaru:adam/windows

Conversation

@CaerusKaru
Copy link
Contributor

Currently, Buildbarn repos publish the artifacts from
cross-compiled builds of the various ecosystem binaries. However,
this leaves the user to manage pulling those artifacts and
distributing/consuming them in their respective environments. For
customers leveraging Kubernetes or other containerized settings,
this creates a greater burden than Linux consumers.

In a previous commit, the image handling was moved to rules_img,
however rules_img does not allow for the necessary manifest
layering to include a Windows image (with a distinct base layer).
Therefore, we add an additional macro that reverts back to the
original rules_oci publish stream, until rules_img can be updated
to support that behavior. For images that do not benefit from a
Windows build-out (e.g. the non-RBE images), the new path can
still be safely utilized.

@aspect-workflows
Copy link

aspect-workflows bot commented Jan 29, 2026

Test

All tests were cache hits

29 tests (100.0%) were fully cached saving 6s.

@EdSchouten
Copy link
Member

In a previous commit, the image handling was moved to rules_img, however rules_img does not allow for the necessary manifest layering to include a Windows image (with a distinct base layer).

Can't we fix rules_img to support this?

@CaerusKaru
Copy link
Contributor Author

Can't we fix rules_img to support this?

Of course we can, but I don't maintain that library, nor do I have the time to manage such a fix. What I do know is that rules_oci works for this case, and the way I've structured this commit, a) most images will continue to use it; and b) once it is patched, it would be trivial to move the images we do apply this to back to it.

@EdSchouten
Copy link
Member

@malt3 Would you happen to have any input on this matter?

@malt3
Copy link
Contributor

malt3 commented Jan 29, 2026

I believe we do support Windows, but there may be issues when combining separate base images on different platforms (where those do not use a common image index).
Happy to add support for this soon-ish, but I don't want to block any important features from being added to Buildbarn.

@EdSchouten
Copy link
Member

Given that we never built container images for Windows before, this PR adds a new feature. As far as I know, it does not fix a regression. I am therefore tempted to not merge this in its current form, but ask @CaerusKaru and @malt3 to collaborate on building this on top of rules_img.

@CaerusKaru
Copy link
Contributor Author

Will leave this PR here until the rules_img patch is ready, then pick it up again and add the new platforms.

@malt3
Copy link
Contributor

malt3 commented Jan 31, 2026

I now added partial support for select on base images here: bazel-contrib/rules_img#390.

In short, we allow select on the base image as long as all of the omitted blobs during lazy pulling can be downloaded from a single upstream. In this case, we would need to set the layer_handling attribute for one or both of the base images to "eager" so that the PullInfo is only used for distroless or nanoserver (or neither).

I'll consider adding support for true merging of PullInfo in the future, but this requires larger code changes that will take more time.

github-merge-queue bot pushed a commit to bazel-contrib/rules_img that referenced this pull request Jan 31, 2026
)

- Select PullInfo from manifests with non-empty missing_blobs instead of
first
- Only reject conflicting PullInfos when they have non-overlapping
missing blobs
- Add detailed error message showing conflicting repositories and
missing blobs
- Add e2e test for index with platform-selected base images
(Linux/Windows)

Work towards supporting
buildbarn/bb-storage#310.
@CaerusKaru
Copy link
Contributor Author

@malt3 that's ok, the eager pull is acceptable here. Can you push a new version to BCR? Using git_override with the latest SHA results in toolchain errors.

@malt3
Copy link
Contributor

malt3 commented Jan 31, 2026

On it! I'll comment here once this makes it into the bcr.

Edit: rules_img 0.3.4 is out and includes the PR.

@CaerusKaru CaerusKaru force-pushed the adam/windows branch 2 times, most recently from dee2c6f to 4deac21 Compare January 31, 2026 23:07
@CaerusKaru
Copy link
Contributor Author

@EdSchouten I think we're set then, as of latest commit

@EdSchouten
Copy link
Member

Can you please run Buildifier to re-add the missing newline at the end of the file?

I guess you're using VSCode, right? It is known for generating malformed text files by default.

Currently, Buildbarn repos publish the artifacts from
cross-compiled builds of the various ecosystem binaries. However,
this leaves the user to manage pulling those artifacts and
distributing/consuming them in their respective environments. For
customers leveraging Kubernetes or other containerized settings,
this creates a greater burden than Linux consumers.

In a previous commit, the image handling was moved to rules_img,
however rules_img does not allow for the necessary manifest
layering to include a Windows image (with a distinct base layer).
Therefore, we add an additional macro that reverts back to the
original rules_oci publish stream, until rules_img can be updated
to support that behavior. For images that do not benefit from a
Windows build-out (e.g. the non-RBE images), the new path can
still be safely utilized.
@CaerusKaru
Copy link
Contributor Author

Can you please run Buildifier to re-add the missing newline at the end of the file?

I guess you're using VSCode, right? It is known for generating malformed text files by default.

Good catch; fixed.

@EdSchouten EdSchouten merged commit 742fac7 into buildbarn:main Feb 2, 2026
3 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.

3 participants

Comments