Skip to content

Support cosi output type for injection API.#268

Merged
liulanze merged 5 commits into
mainfrom
user/lanzeliu/io-cosi-output-type
Jun 13, 2025
Merged

Support cosi output type for injection API.#268
liulanze merged 5 commits into
mainfrom
user/lanzeliu/io-cosi-output-type

Conversation

@liulanze
Copy link
Copy Markdown
Contributor

@liulanze liulanze commented Jun 10, 2025

Support users to set output image type as COSI when injection API gets called.


Checklist

  • Tests added/updated
  • Documentation updated (if needed)
  • Code conforms to style guidelines

@liulanze liulanze requested a review from a team as a code owner June 10, 2025 22:30
Comment thread toolkit/tools/pkg/imagecustomizerlib/artifactsinputoutput.go Outdated
if err != nil {
return fmt.Errorf("failed to convert customized raw image to output format:\n%w", err)
if detectedImageFormat == imagecustomizerapi.ImageFormatTypeCosi {
imageConnection, partUuidToFstabEntry, baseImageVerityMetadata, err := connectToExistingImage(rawImageFile,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move the collection of osRelease and osPackages into a function, to help make the code a little cleaner.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, I should have been more specific. I meant create a helper function that covers connectToExistingImage to CleanClose.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please fix.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see, please check it again.

Comment thread toolkit/tools/pkg/imagecustomizerlib/artifactsinputoutput.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/artifactsinputoutput.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/artifactsinputoutput.go Outdated
@liulanze liulanze requested a review from cwize1 June 12, 2025 22:30
Comment thread toolkit/tools/pkg/imagecustomizerlib/partitionutils.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/partitionutils.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/createuuid.go Outdated
if err != nil {
return fmt.Errorf("failed to convert customized raw image to output format:\n%w", err)
if detectedImageFormat == imagecustomizerapi.ImageFormatTypeCosi {
imageConnection, partUuidToFstabEntry, baseImageVerityMetadata, err := connectToExistingImage(rawImageFile,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry, I should have been more specific. I meant create a helper function that covers connectToExistingImage to CleanClose.

Comment thread toolkit/tools/pkg/imagecustomizerlib/createuuid.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/createuuid.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/createuuid.go Outdated
Comment thread toolkit/tools/pkg/imagecustomizerlib/createuuid.go Outdated
@liulanze liulanze force-pushed the user/lanzeliu/io-cosi-output-type branch from b77ea21 to 7ad78e8 Compare June 12, 2025 23:57
@liulanze liulanze requested a review from cwize1 June 12, 2025 23:57
Comment thread toolkit/tools/pkg/imagecustomizerlib/imagecustomizer.go
partUuidToFstabEntry map[string]diskutils.FstabEntry, verityMetadata []verityDeviceMetadata,
osRelease string, osPackages []OsPackage, imageUuid [UuidSize]byte, imageUuidStr string,
) error {
outputImageBase := strings.TrimSuffix(filepath.Base(outputImageFile), filepath.Ext(outputImageFile))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be honest, we could probably give the partition files a standard base name of partition instead of it being dynamic. This user isn't going to see these files anyway.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed, please check again.

if err != nil {
return fmt.Errorf("failed to convert customized raw image to output format:\n%w", err)
if detectedImageFormat == imagecustomizerapi.ImageFormatTypeCosi {
imageConnection, partUuidToFstabEntry, baseImageVerityMetadata, err := connectToExistingImage(rawImageFile,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please fix.

@liulanze liulanze requested a review from cwize1 June 13, 2025 20:55
@liulanze liulanze force-pushed the user/lanzeliu/io-cosi-output-type branch from f8a1d27 to 6ee21bf Compare June 13, 2025 22:06
@liulanze liulanze merged commit 965d047 into main Jun 13, 2025
8 checks passed
@liulanze liulanze deleted the user/lanzeliu/io-cosi-output-type branch June 13, 2025 22:12
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