-
Notifications
You must be signed in to change notification settings - Fork 567
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
Mariner Image Customizer boilerplate #5982
Conversation
@@ -0,0 +1,16 @@ | |||
# Mariner Image Customizer API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, we should probably keep all the libraries in pkg
directory.
The reason, I request this is because, I have proposed that we have a distinction between main
packages and lib
packages.
Reference:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I am fond of that code layout. Having Go directories with the same name (e.g. specreader
and pkg/specreader
) can make writing Go code kind of annoying as it forces you to rename one of the packages in the imports.
I also want to avoid the case where the package name is something overly generic. Hence, why I have imagecustomizerapi
and not imagecustomizer/api
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved imagecustomizerlib
into pkg
but kept imagecustomizer
and imagecustomizerapi
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only request is that we track any "internal" code via something like we do for the imager, scheduler, etc.
go_internal_files = $(shell find $(TOOLS_DIR)/internal/ -type f -name '*.go')
go_pkg_files = $(shell find $(TOOLS_DIR)/pkg/ -type f -name '*.go')
go_imagegen_files = $(shell find $(TOOLS_DIR)/imagegen/ -type f -name '*.go')
go_scheduler_files = $(shell find $(TOOLS_DIR)/scheduler -type f -name '*.go')
go_common_files = $(go_module_files) $(go_internal_files) $(go_imagegen_files) $(go_pkg_files) $(go_scheduler_files) $(STATUS_FLAGS_DIR)/got_go_deps.flag $(BUILD_DIR)/tools/internal.test_coverage
Its not particularly elegant but it makes sure we rebuild all the go tools if any of the shared libraries change.
"github.com/microsoft/CBL-Mariner/toolkit/tools/internal/safechroot" | ||
) | ||
|
||
func doCustomizations(baseConfigPath string, config *imagecustomizerapi.SystemConfig, imageChroot *safechroot.Chroot) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to open a discussion on a possibility of Trident calling into this function more directly. Trident will be also setting up chroot during image deployment and could take advantage of this function. We can of course create a more suitable wrapper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had another comment above, but maybe in the future we can hook into these functions as part of the normal image build flow as well.
released and doesn't provide any backwards compatibility guarantees. | ||
|
||
While currently the new image config and imgcustomizer config are very similar, in the | ||
future there is the possibility they will diverge. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few of us had a idle thought about splitting the existing imager tool in two. What are your thoughts on taking the "customization" parts of the imager tool out, and using this tool as an extra step even for offline buidls? (Or at least the same libraries)
That would couple this tool more closely with the image config.json format, although which direction that coupling happens in isn't clear to me.
"github.com/microsoft/CBL-Mariner/toolkit/tools/internal/safechroot" | ||
) | ||
|
||
func doCustomizations(baseConfigPath string, config *imagecustomizerapi.SystemConfig, imageChroot *safechroot.Chroot) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had another comment above, but maybe in the future we can hook into these functions as part of the normal image build flow as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
You may want to consider adding a --version
option to the boilerplate.
bfb52fc
to
370979b
Compare
Merge Checklist
All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)
*-static
subpackages, etc.) have had theirRelease
tag incremented../cgmanifest.json
,./toolkit/scripts/toolchain/cgmanifest.json
,.github/workflows/cgmanifest.json
)./SPECS/LICENSES-AND-NOTICES/data/licenses.json
,./SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md
,./SPECS/LICENSES-AND-NOTICES/LICENSE-EXCEPTIONS.PHOTON
)*.signatures.json
filessudo make go-tidy-all
andsudo make go-test-coverage
passSummary
This creates the boilerplate for Mariner Image Customizer (imgcustomizer) tool. In addition, it implements
AdditionalFiles
since that is one of the simplest features to implement.Change Log
chroot
to allow partitions to be mounted before the default partitions.AdditionalFiles
in imgcustomizer.AdditionalFiles
JSON/YAML.AdditionalFiles
logic.Does this affect the toolchain?
NO
Test Methodology