Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigFile() (string, error)
- func DataHome() (string, error)
- type AtomicDeque
- type Distillery
- func (o *Distillery) Boil() error
- func (o Distillery) Clean() error
- func (o Distillery) CleanRecipe(recipe Recipe, wg *sync.WaitGroup)
- func (o Distillery) Down() error
- func (o Distillery) DownRecipe(recipe Recipe, wg *sync.WaitGroup)
- func (o Distillery) ProjectArtifacts() (string, error)
- func (o Distillery) ProjectData() (string, error)
- func (o *Distillery) UpdateRunningRecipe(recipe Recipe, wg *sync.WaitGroup)
- func (o *Distillery) UpdateRunningRecipes() error
- func (o Distillery) Validate() error
- type Recipe
- func (o Recipe) AggregateSteps(steps []string) string
- func (o Recipe) ArtifactHost(effectiveOutputDirectory string) string
- func (o Recipe) Boil(effectiveOutputDirectory *string, debug bool) error
- func (o Recipe) Clean(wg *sync.WaitGroup)
- func (o Recipe) CloneHost() string
- func (o Recipe) ConfigureEnvironmentVariable(key string, value string) string
- func (o Recipe) Destroy() error
- func (o Recipe) EffectiveProvider() string
- func (o Recipe) EnsureRsync() error
- func (o Recipe) EnsureSourceCopy() error
- func (o Recipe) EnsureVagrantfile() error
- func (o Recipe) GenerateVagrantfile() string
- func (o Recipe) IsRunning() (bool, error)
- func (o Recipe) MergeArtifacts(effectiveOutputDirectory string) error
- func (o Recipe) SyncedFolderGuestPath() string
- func (o Recipe) VagrantDown() error
- func (o Recipe) VagrantRsync() error
- func (o Recipe) VagrantRsyncBack() error
- func (o Recipe) VagrantSSH(step string, debug bool) error
- func (o Recipe) VagrantStatus() (string, error)
- func (o Recipe) VagrantUp() error
- func (o Recipe) VagrantfilePath() string
- func (o Recipe) Validate() error
Constants ¶
const ( // GuestTypePOSIX designates POSIXy environments. GuestTypePOSIX = "POSIX" // GuestTypeCygwin designates cygwin-like environments. GuestTypeCygwin = "Cygwin" // GuestTypeSmartOSGZ designates SmartOS global zone environments. GuestTypeSmartOSGZ = "SmartOSGZ" // GuestTypeHaiku designates Haiku environments. GuestTypeHaiku = "Haiku" )
const BuildbotsBasename = "buildbot-src"
BuildbotsBasename describes the base path for housing buildbot provisioning files, which aids tonixxx in excluding these (potentially large files) from recipe clones during project builds with tonixxx up and tonixxx boil.
const ConfigBasename = "tonixxx.yaml"
ConfigBasename provides the default filename for tonixxx configuration.
const DataBasename = ".tonixxx"
DataBasename describes the base path for housing tonixxx project metadata, including user build artifacts/ and Vagrant boxes during the build process.
const DefaultMaxRunningRecipes = 1
DefaultMaxRunningRecipes constrains the number of simultaneously running Vagrant boxes, in order to reduce resource strain on limited host hardware.
const DefaultOutputDirectory = "bin"
DefaultOutputDirectory locates project-wide binary aggregation at the end of a build, relative to the tonixxx per-project metadata directory.
const MaxRecipesKey = "TONIXXX_MAX_RECIPES"
MaxRecipesKey names the host environment variable for restricting the number of simultaneously running recipes, in order to reduce resource strain on limited host hardware.
const SyncKey = "TONIXXX_SYNC"
SyncKey names the guest environment variable for introspecting a VM's synced folder guest path.
const VagrantMetadataDirectory = ".vagrant"
VagrantMetadataDirectory refers to the standard directory for housing internal Vagrant files.
const VagrantSyncedFolderCygwin = "/c/vagrant"
VagrantSyncedFolderCygwin names the guest folder synced with the host, with the guest folder in UNIX-style forwardslash notation.
const VagrantSyncedFolderHaiku = "/boot/vagrant-src"
VagrantSyncedFolderHaiku names the guest folder synced with the host for Haiku OS VMs.
const VagrantSyncedFolderPOSIX = "/vagrant"
VagrantSyncedFolderPOSIX names the guest folder synced with the host for POSIXy VMs.
const VagrantSyncedFolderSmartOSGZ = "/opt/vagrant"
VagrantSyncedFolderSmartOSGZ names the guest folder synced with the host for SmartOS global zone VMs.
const VagrantfileBasename = "Vagrantfile"
VagrantfileBasename refers to the standard configuration file basename for configuring Vagrant boxes.
const Version = "0.0.13"
Version is semver.
Variables ¶
var ImplicitRecipeExclusions = []*regexp.Regexp{ regexp.MustCompile(BuildbotsBasename), regexp.MustCompile("\\.envrc"), }
ImplicitRecipeExclusions names file patterns to be automatically ignored when copying a tonixxx project's files to per-recipe directories.
var ProjectNamePattern = regexp.MustCompile(`^[a-zA-Z0-9\.\-_]+$`)
ProjectNamePattern constrains names in order to use names as-is for file paths while building a project.
var RecipeLabelPattern = regexp.MustCompile(`^[a-zA-Z0-9\.\-_]+$`)
RecipeLabelPattern constrains labels in order to use label as-is for file paths while building a project.
var VagrantStatusRunningPattern = regexp.MustCompile("running")
VagrantStatusRunningPattern identifies when a Vagrant box is running.
Functions ¶
func ConfigFile ¶
ConfigFile names the host path to the tonixxx default configuration file.
Types ¶
type AtomicDeque ¶ added in v0.0.11
type AtomicDeque struct {
// contains filtered or unexported fields
}
AtomicDeque provides a thread-safe Deque.
func NewAtomicDeque ¶ added in v0.0.11
func NewAtomicDeque() *AtomicDeque
NewAtomicDeque constructs an AtomicDeque.
func (*AtomicDeque) Append ¶ added in v0.0.11
func (o *AtomicDeque) Append(element interface{})
Append inserts an element into the deque.
func (*AtomicDeque) Pop ¶ added in v0.0.11
func (o *AtomicDeque) Pop() interface{}
Pop queries an end element from the deque and removes the element.
func (*AtomicDeque) Size ¶ added in v0.0.11
func (o *AtomicDeque) Size() int
Size queries the number of elements in the deque.
type Distillery ¶
type Distillery struct {
// Project distinguishes this build from other potential projects on the same host.
//
// Example: hello
Project string `yaml:"project"`
// OutputDirectory optionally specifices where build artifacts are found on guests.
// If OutputDirectory is nil, then artifacts are not copied back to the host.
//
// Example: bin
// Default: <nil>
OutputDirectory *string `yaml:"outputdirectory"`
// Steps enumerates build steps.
//
// Example: []string{"./configure", "make"}
Steps []string `yaml:"steps"`
// Recipes enumerates build bots.
//
// Example: []Recipe{Recipe{Label: "linux", Box: "ubuntu/xenial64"}}
Recipes []Recipe `yaml:"recipes"`
// Debug enables more logging.
//
// Example: true
Debug bool `yaml:"debug"`
// MaxRunningRecipes constrains the number of simultaneously running recipes.
// Negative indicates no constraint.
// Zero indicates unset configuration, which becomes DefaultMaxRunningRecipes.
//
// Example: 1
MaxRunningRecipes int `yaml:"maxrunningrecipes"`
// contains filtered or unexported fields
}
Distillery describes a multi-platform build configuration.
func Load ¶ added in v0.0.4
func Load(pth string) (*Distillery, error)
Load constructs a Distillery from a YAML file path.
func (*Distillery) Boil ¶
func (o *Distillery) Boil() error
Boil executes configured recipes for a distillery.
func (Distillery) Clean ¶
func (o Distillery) Clean() error
Clean destroys a project's Vagrant instances boxes and removes the project directory from ~/.tonixxx
func (Distillery) CleanRecipe ¶
func (o Distillery) CleanRecipe(recipe Recipe, wg *sync.WaitGroup)
CleanRecipe destroys a recipe's Vagrant instance box and removes the recipe artifact directory under ~/.tonixxx
func (Distillery) DownRecipe ¶ added in v0.0.4
func (o Distillery) DownRecipe(recipe Recipe, wg *sync.WaitGroup)
DownRecipe pauses a Vagrant box.
func (Distillery) ProjectArtifacts ¶
func (o Distillery) ProjectArtifacts() (string, error)
ProjectArtifacts supplies the host path to the aggregated artifacts produced for a project after any Vagrant builds.
func (Distillery) ProjectData ¶
func (o Distillery) ProjectData() (string, error)
ProjectData calculates the per-project tonixxx data directory based on a hash of the project directory absolute path.
func (*Distillery) UpdateRunningRecipe ¶ added in v0.0.11
func (o *Distillery) UpdateRunningRecipe(recipe Recipe, wg *sync.WaitGroup)
UpdateRunningRecipe collects information about a Vagrant instance.
func (*Distillery) UpdateRunningRecipes ¶ added in v0.0.4
func (o *Distillery) UpdateRunningRecipes() error
UpdateRunningRecipes collects information about Vagrant instances.
func (Distillery) Validate ¶
func (o Distillery) Validate() error
Validate applies some semantic checks to a Distillery configuration.
type Recipe ¶
type Recipe struct {
// Label (required) provides a descriptor for the artifact produced by this recipe,
// meaningful to a particular project to distinguish these artifacts
// from those artifacts produced by sister recipes.
//
// Example: "minix-i386"
Label string `yaml:"label"`
// Box (required) describes a Vagrant box name.
//
// Example: "mcandre/minix"
Box string `yaml:"box"`
// Version (optional) describes a Vagrant box version.
//
// Example: "0.0.1"
Version string `yaml:"version"`
// Provider (optional) describes a hypervisor.
//
// Example: "libvirt"
Provider string `yaml:"provider"`
// GuestType (optional) describes the kind of guest OS.
//
// Defaults to GuestTypePOSIX.
//
// Example: "Cygwin"
GuestType string `yaml:"guesttype"`
// ArtifactsGuestPath (optional) names a directory path to place source files
// into the guest before building.
//
// Defaults to a Vagrant rsync path based on known GuestType's.
//
// Example: "/vagrant"
ArtifactsGuestPath string `yaml:"artifactguestpath"`
// PreSteps (optional) lists any guest commands to execute before normal Steps.
//
// Example: []string{"sudo yum update"}
PreSteps []string `yaml:"presteps"`
// Steps (optional) lists the guest commands for building artifacts.
//
// Example: []string{"cd \"$TONIXXX_SYNC\"", "make"}
Steps []string `yaml:"steps"`
// PostSteps (optional) lists any guest commands to execute after normal Steps.
//
// Example: []string{"sudo yum clean all"}
PostSteps []string `yaml:"poststeps"`
// contains filtered or unexported fields
}
Recipe describes the user's build workflow for some target environment. By default, recipes assume "POSIX".
func (Recipe) AggregateSteps ¶
AggregateSteps constructs a logical whole command out of subcommands.
func (Recipe) ArtifactHost ¶ added in v0.0.4
ArtifactHost supplies the directory where recipe-relative artifacts are first copied upon builds.
func (Recipe) Boil ¶ added in v0.0.4
Boil executes build steps for a recipe.
The build steps may include instructions to copy select build artifacts to the SyncKey path. After a successful run of the build steps, any files in the SyncKey path are copied back to the host.
func (Recipe) Clean ¶ added in v0.0.4
Clean destroys a Vagrant instance and removes the per-recipe host directory.
func (Recipe) CloneHost ¶ added in v0.0.4
CloneHost supplies the directory path inside ~/.tonixxx in which a recipe's Vagrant clone resides.
func (Recipe) ConfigureEnvironmentVariable ¶
ConfigureEnvironmentVariable generates a shell command for configuring an environment variable.
func (Recipe) EffectiveProvider ¶ added in v0.0.10
EffectiveProvider calculates the appropriate default provider for a VM.
func (Recipe) EnsureRsync ¶ added in v0.0.4
EnsureRsync ensures that a Vagrant instance is running and that the host source is copied to the guest.
func (Recipe) EnsureSourceCopy ¶ added in v0.0.4
EnsureSourceCopy ensures that project source files are copied to the clone host.
func (Recipe) EnsureVagrantfile ¶ added in v0.0.4
EnsureVagrantfile ensures that this recipe has a Vagrantfile generated.
func (Recipe) GenerateVagrantfile ¶
GenerateVagrantfile supplies the text content of a Vagrantfile for instantiating a recipe.
func (Recipe) MergeArtifacts ¶ added in v0.0.4
MergeArtifacts copies recipe-relative build artifacts to a common, project-relative file tree.
func (Recipe) SyncedFolderGuestPath ¶
SyncedFolderGuestPath names the guest path for artifacts to be copied during building.
func (Recipe) VagrantDown ¶ added in v0.0.4
VagrantDown ensures a recipe is halted.
func (Recipe) VagrantRsync ¶ added in v0.0.4
VagrantRsync copies host-clone source files into a guest in preparation for builds.
func (Recipe) VagrantRsyncBack ¶ added in v0.0.4
VagrantRsyncBack copies guest artifacts back to a host-clone directory.
func (Recipe) VagrantSSH ¶ added in v0.0.4
VagrantSSH executes a guest command.
func (Recipe) VagrantStatus ¶ added in v0.0.4
VagrantStatus reports an instance description.
func (Recipe) VagrantfilePath ¶ added in v0.0.4
VagrantfilePath queries the path to this recipe's Vagrantfile.
