Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support History/Build configs in an immutable way #358

Merged
merged 15 commits into from
Mar 3, 2023
Merged

Conversation

baronfel
Copy link
Member

@baronfel baronfel commented Feb 24, 2023

I was looking towards support for scratch containers, and I reasoned that I still wanted to use the ImageConfig type to store all of the user-supplied information, but in the case of the 'scratch' image there would be no base config. Therefore some of the required properties in a configuration would need to be specified more manually. So I elevated them to first-class fields in the ImageConfig type.

As part of that, I got around to an item I've wanted to do for a while - adding a log to the History collection in the config to trace the fact that we made one of the layers.

Here's what the history of one of our generated test containers looks like when viewed under docker history <imagename>:

image

Docker Desktop also has a more detailed view:

image

@baronfel baronfel requested a review from a team February 24, 2023 23:42
.editorconfig Outdated Show resolved Hide resolved
Microsoft.NET.Build.Containers/ImageConfig.cs Show resolved Hide resolved
Microsoft.NET.Build.Containers/ImageConfig.cs Show resolved Hide resolved
Microsoft.NET.Build.Containers/ImageConfig.cs Show resolved Hide resolved
Microsoft.NET.Build.Containers/ImageConfig.cs Outdated Show resolved Hide resolved
Microsoft.NET.Build.Containers/ImageConfig.cs Show resolved Hide resolved
Microsoft.NET.Build.Containers/Layer.cs Show resolved Hide resolved
Copy link
Member

@vlada-shubina vlada-shubina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes looks ok, but no tests is a concern. Do you need a hand with tests?

.editorconfig Outdated Show resolved Hide resolved
Microsoft.NET.Build.Containers/Constants.cs Show resolved Hide resolved
Microsoft.NET.Build.Containers/ImageConfig.cs Show resolved Hide resolved
@vlada-shubina
Copy link
Member

imo, with those changes on, having full model makes more sense and it looks more as it now.
However it might be easier to use ready solutions as DockerRegistryClient as discussed previously, if we need more interaction with the model.

@baronfel
Copy link
Member Author

re: DockerRegistryClient

yeah, I was thinking about that and wondering how much more source-build pain we wanted to incur :)

@baronfel
Copy link
Member Author

baronfel commented Mar 1, 2023

I added some tests, but then I started getting so many errors compiling in the build environment - I think because the net472 build is getting included in the unit tests in some way. That feels wrong. I am very confident in these changes with the tests, though.

@vlada-shubina
Copy link
Member

I added some tests, but then I started getting so many errors compiling in the build environment - I think because the net472 build is getting included in the unit tests in some way. That feels wrong. I am very confident in these changes with the tests, though.

let me check it tomorrow, I think it's worth to include those tests. Feel free to merge if you need this PR earlier.

@baronfel
Copy link
Member Author

baronfel commented Mar 2, 2023

Thank you @vlada-shubina for the second set of eyes! I can wait for your findings.

@vlada-shubina
Copy link
Member

Thank you @vlada-shubina for the second set of eyes! I can wait for your findings.

had to rebase to make conflict resolution easier.
previously merged PRs included net472 build for UnitTests, but ImageConfig has to be excluded.
I made it safer by removing UnitTests from net472 build and making dependency only for net7.0, however ideally it should be gone at some point.

@baronfel
Copy link
Member Author

baronfel commented Mar 3, 2023

Thanks Vlada - I agree with everything you wrote. If you're satisfied, can you approve so this can be merged?

@baronfel baronfel merged commit ec1cfff into main Mar 3, 2023
@baronfel baronfel deleted the support-history branch March 3, 2023 16:10
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.

2 participants