Documentation ¶
Index ¶
- Variables
- func FlagErrorChecking(flagInfo *FlagInfo) error
- func GetImages(flagInfo *FlagInfo) (*ImageInfo, *ImageInfo, error)
- type FlagInfo
- type ImageInfo
- func (image *ImageInfo) Cleanup() error
- func (image *ImageInfo) GetCosImage(cosCloudPath, projectID string) error
- func (image *ImageInfo) GetGcsImage(gcsPath string) error
- func (image *ImageInfo) GetLocalImage(localPath string) error
- func (image *ImageInfo) MountImage(arr []string) error
- func (image *ImageInfo) Rename(flagInfo *FlagInfo) error
Constants ¶
This section is empty.
Variables ¶
var BinaryDiffTypes = []string{"Version", "BuildID", "Rootfs", "Kernel-command-line", "Stateful-partition", "Partition-structure", "Sysctl-settings", "OS-config", "Kernel-configs"}
BinaryDiffTypes is a list of all valid binary differnce types
Functions ¶
func FlagErrorChecking ¶
FlagErrorChecking validates command-line flags stored in the FlagInfo struct Input:
(*FlagInfo) flagInfo - A struct that stores all flag input
Output: nil on success, else error
func GetImages ¶
GetImages reads in all the flags and handles the input based on its type. Input:
(*FlagInfo) flagInfo - A struct that holds input preference from the user
Output:
(*ImageInfo) image1 - A struct that stores relevent info for image1 (*ImageInfo) image2 - A struct that stores relevent info for image2
Types ¶
type FlagInfo ¶
type FlagInfo struct { // Args Image1 string Image2 string // Input Types LocalPtr bool GcsPtr bool CosCloudPtr bool // Authentication ProjectIDPtr string // Binary BinaryDiffPtr string BinaryTypesSelected []string // Package PackageSelected bool // Commit CommitSelected bool // Release Notes ReleaseNotesSelected bool // Verbosity of output // If true, full Rootfs, Os-Config, and Stateful Partition output is shown. // Else false (default), Rootfs and Stateful Partition directories listed on files // pointed to by CompressRootfsFile and CompressStatefulFile respectively are compressed. // For OS-configs difference, all /etc entries that are listed in CompressRootfsFile are ignored. Verbose bool // File used to compress directories in the output from Rootfs difference and // for ignore entries under /etc for OS-Config difference // (either user provided or default CompressRootfs.txt) CompressRootfsFile string // Slice of CompressRootfsFile CompressRootfsSlice []string // File used to compress directories in the output from Stateful-partition difference // (either user provided or default CompressStateful.txt) CompressStatefulFile string // Slice of CompressRootfsFile CompressStatefulSlice []string // Output OutputSelected string }
FlagInfo holds input preference from the user
func ParseFlags ¶
ParseFlags reads and validates the flags from the command-line Input: None (Command-line flags and args) Output:
(*FlagInfo) flagInfo - A struct that holds input preference from the user
type ImageInfo ¶
type ImageInfo struct { // Input Overhead TempDir string // Temporary directory holding the mounted image and disk file DiskFile string // Path to the DOS/MBR disk partition file StatePartition1 string // Path to mounted directory of partition #1, stateful partition RootfsPartition3 string // Path to mounted directory of partition #3, Rootfs-A EFIPartition12 string // Path to mounted directory of partition #12, EFI-System LoopDevice1 string // Active loop device for mounted image LoopDevice3 string // Active loop device for mounted image LoopDevice12 string // Active loop device for mounted image // Binary info Version string // Major cos version BuildID string // Minor cos version PartitionFile string // Path to the file storing the disk partition structure from "sgdisk" SysctlSettingsFile string // Path to the /etc/sysctrl.d/00-sysctl.conf file of an image KernelCommandLine string // The kernel command line boot-time parameters stored in partition 12 efi/boot/grub.cfg KernelConfigsFile string // Path to the ".config" file downloaded from GCS that holds a build's kernel configs }
ImageInfo stores all relevant information on a COS image
func (*ImageInfo) Cleanup ¶
Cleanup is a ImageInfo method that removes a mounted directory & loop device Input:
(*ImageInfo) image - A struct that holds the relevent info to clean up
Output: nil on success, else error
func (*ImageInfo) GetCosImage ¶
GetCosImage calls the cloud build api to export a public COS image to a a GCS bucket and then calls GetGcsImage() to download that image from GCS. ADC is used for authorization. Input:
(*ImageInfo) image - A struct that holds the relevent CosCloudPath "bucket/image" and projectID for the stored COS Image
Output: nil on success, else error
func (*ImageInfo) GetGcsImage ¶
GetGcsImage is an ImagInfo method that calls the GCS client api to download a COS image from a GCS bucket, unzips it, and mounts relevant partitions. ADC is used for authorization Input:
(string) gcsPath - GCS "bucket/object" path for stored COS Image (.tar.gz file)
Output: nil on success, else error
func (*ImageInfo) GetLocalImage ¶
GetLocalImage is an ImageInfo method that creates a temporary directory to loop device mount the disk.raw file stored on the local file system Input:
(string) localPath - Local path to the disk.raw file
Output: nil on success, else error
func (*ImageInfo) MountImage ¶
MountImage is an ImagInfo method that mounts partitions 1,3 and 12 of the image into the temporary directory Input:
(string) arr - List of binary types selected from the user
Output: nil on success, else error