Documentation ¶
Overview ¶
Package fs exports functionality related to all of the cos-customizer state stored on the file system.
Index ¶
- Constants
- func AppendStateFile(stateFile string, buildContext BuildContext, script string, env string) error
- func ArchiveHasObject(archive string, path string) (bool, error)
- func CopyRecursive(src string, dst string) error
- func CreateBuildContextArchive(src, dst string) error
- func CreatePersistentBuiltinContext(files *Files) error
- func CreateStateFile(files *Files) error
- func StateFileContains(stateFile string, buildContext BuildContext, script string) (bool, error)
- type BuildContext
- type Files
Constants ¶
const (
// ScratchDir is used for temp files and the like.
ScratchDir = "/tmp"
)
Variables ¶
This section is empty.
Functions ¶
func AppendStateFile ¶
func AppendStateFile(stateFile string, buildContext BuildContext, script string, env string) error
AppendStateFile appends an entry to the state file. The state file encodes a sequence of scripts to run on the preload instance.
func ArchiveHasObject ¶
ArchiveHasObject determines if the given tar archive contains the given object.
func CopyRecursive ¶
CopyRecursive calls 'cp -r <src> <dst>'.
func CreateBuildContextArchive ¶
CreateBuildContextArchive creates a tar archive of the given build context.
func CreatePersistentBuiltinContext ¶
CreatePersistentBuiltinContext copies the contents of the builtin build context to a persistent location.
func CreateStateFile ¶
CreateStateFile creates the state file.
func StateFileContains ¶
func StateFileContains(stateFile string, buildContext BuildContext, script string) (bool, error)
StateFileContains checks if an entry exists in the state file with the given build context and the given script name.
Types ¶
type BuildContext ¶
type BuildContext string
BuildContext represents the different types of build contexts that are understood by the system.
const ( // User represents the user build context. User BuildContext = "user" // Builtin represents the builtin build context. Builtin BuildContext = "builtin" )
type Files ¶
type Files struct { // UserBuildContextArchive points to the tar archive of the user build context. // The user build context contains user provided scripts and files that users can use during preloading. UserBuildContextArchive string // BuiltinBuildContextArchive points to the tar archive of the builtin build context. // The builtin build context contains scripts and files used by cos-customizer build steps. BuiltinBuildContextArchive string // PersistBuiltinBuildContext points to the directory containing the persistent builtin build context. // The persistent builtin build context persists across build steps. PersistBuiltinBuildContext string // StateFile points to the state file. This file encodes the sequence of instructions that need // to be executed on the preload VM. StateFile string // SourceImageConfig points to the source image configuration. SourceImageConfig string // BuildConfig points to the image build process configuration. BuildConfig string // DaisyWorkflow points to the Daisy workflow to template and use for preloading. DaisyWorkflow string // StartupScript points to the startup script that needs to run on the preload VM. StartupScript string // SystemdService points to the systemd service that needs to invoke the startup script on the preload VM. SystemdService string // VolatileBuiltinBuildContext points to the directory containing the volatile builtin build context. // The volatile builtin build context does not persist across build steps; changes made by one // build step are not seen by other build steps. VolatileBuiltinBuildContext string // DaisyBin points to the Daisy binary. DaisyBin string // contains filtered or unexported fields }
Files stores important file paths.
func DefaultFiles ¶
DefaultFiles builds a Files struct with a default file layout.
func (*Files) CleanupAllPersistent ¶
CleanupAllPersistent deletes everything in the persistent directory.