Skip to content

Conversation

@3405691582
Copy link
Collaborator

We want to ensure that static defaults are set when images run within particular environments, e.g., a particular GCE project. This occurs when there exists a file in /etc/defaults/cuttlefish-integration and contains static_defaults_when=<condition> (see #1859). We thus need to ensure that the cuttlefish-integration file is set appropriately; we just do this by a flag set appropriately when minting the image.

@3405691582 3405691582 requested a review from ser-io December 3, 2025 17:55
@3405691582 3405691582 requested a review from ser-io December 3, 2025 18:10
@3405691582 3405691582 requested a review from ser-io December 3, 2025 18:45
@3405691582 3405691582 force-pushed the baseimage_defaults branch 2 times, most recently from 1176acf to b573775 Compare December 3, 2025 18:54
@3405691582 3405691582 enabled auto-merge December 3, 2025 19:03
return fmt.Errorf("install cuttlefish debs error: %v", err)
}
if *defaults_cuttlefish_integration_src != "" {
if err := gce.UploadFile(project, zone, insName, *defaults_cuttlefish_integration_src, "/etc/defaults/cuttlefish-integration"); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

The image is created out of an attached disk that gets mounted in /mnt/image, the file should end up in /mnt/image/etc/defaults/cuttlefish-integration.

In this tool, the disk is mounted when executing the install.sh script in https://github.com/google/android-cuttlefish/blob/main/tools/baseimage/cmd/gce_install_cuttlefish_packages/main.go#L95.

After the installCuttlefishDebs call the disk is never unmounted, however, I'd recommend doing the copy to /mnt/image after the install.sh scripts is executed inside the installCuttlefishDebs function when the mounting happens, rather than relying on the hidden fact that installCuttlefishDebs mounts and but doesn't un-mount.

There's room for refactoring here, it can be done later thought.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed to prepend /mnt/image.

This perhaps shouldn't be part of installCuttlefishDebs necessarily, because uploading this file isn't installing a package, but we can revisit later.

Copy link
Member

Choose a reason for hiding this comment

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

It's definitely not an ideal situation. I suggested to be part of installCuttlefishDebs for now because it's only within the context of that function where we make sure the attached disk is mounted on /mnt/image. Outside of the function, it's hacky to assume there's something mounted on /mnt/image.

Then plumb that through to the script. This means that logic on the
golang side owns the knowledge of the mountpoint, and doesn't need to
assume that it knows what the mountpoint is from the shell script.
We want to ensure that static defaults are set when images run within
particular environments, e.g., a particular GCE project. This occurs
when there exists a file in `/etc/defaults/cuttlefish-integration` and
contains `static_defaults_when=<condition>` (see google#1859). We thus need to
ensure that the `cuttlefish-integration` file is set appropriately; we
just do this by uploading the file when minting the image.
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