Documentation
¶
Index ¶
- type Answers
- type Business
- type Cloud
- type Commands
- type Config
- func (c *Config) Check() error
- func (config *Config) ExecuteCommand(path string, logger *logrus.Logger, command string, arguments string, ...) (string, error)
- func (c *Config) Force() bool
- func (config *Config) GetFrameworkCommands(framework string) FrameworkDef
- func (config *Config) GetVersion() string
- func (c *Config) Init()
- func (c *Config) IsDryRun() bool
- func (c *Config) NoBanner() bool
- func (c *Config) NoCleanup() bool
- func (c *Config) OnlineHelp() bool
- func (config *Config) OpenOnlineHelp(cliCmd string, logger *logrus.Logger) bool
- func (config *Config) RenderTemplate(name string, tmpl string, input Replacements) (string, error)
- func (c *Config) Save(usedConfig string) (string, error)
- func (config *Config) SetDefaultValues()
- func (c *Config) UseCmdLog() bool
- func (config *Config) WriteCmdLog(path string, cmd string) error
- func (config *Config) WriteVariablesFile(project *Project, pipelineSettings Pipeline, replacements Replacements) (string, error)
- type Directory
- type DomainType
- type Environment
- type EnvironmentAnswers
- type Framework
- type FrameworkDef
- type FrameworkDefCmd
- type FrameworkDefVersion
- type Help
- type Init
- type InputConfig
- type Internal
- type Network
- type NetworkBase
- type Operation
- type Options
- type Output
- type Overrides
- type Package
- type Phase
- type Pipeline
- func (p *Pipeline) GetFilePath(filetype string, workingDir string, name string) string
- func (p *Pipeline) GetSupported() []string
- func (p *Pipeline) GetVariableTemplate(workingDir string) string
- func (p *Pipeline) IsSupported(name string) bool
- func (p *Pipeline) ReplacePatterns(config *Config, inputs Replacements, dir string) []error
- type PipelineFile
- type PipelineReplacement
- type Platform
- type Project
- type ProjectAnswers
- type ReplaceConfig
- type Replacements
- type SelfConfig
- type Settings
- func (s *Settings) CheckCmdVersions(config *Config, logger *logrus.Logger, path string, tmpPath string) ([]models.Command, string)
- func (s *Settings) CompareVersion(constraint string, version string, logger *logrus.Logger) bool
- func (s *Settings) GetPipelines(name string) []Pipeline
- func (s *Settings) GetRequiredVersion(name string) string
- type SettingsFramework
- type SettingsFrameworkCommands
- type Setup
- type SourceControl
- type Stacks
- type StacksComponent
- type State
- type Terraform
- type TerraformBackend
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Answers ¶
type Answers struct { CompanyName string `survey:"company_name"` CompanyDomain string `survey:"company_domain"` CompanyComponent string `survey:"company_component"` Pipeline string `survey:"pipeline"` CloudPlatform string `survey:"cloud_platform"` TerraformGroup string `survey:"terraform_group"` TerraformStorage string `survey:"terraform_storage"` TerraformContainer string `survey:"terraform_container"` NetworkDomainExternal string `survey:"network_domain_external"` NetworkDomainInternal string `survey:"network_domain_internal"` Options []string `survey:"options"` WorkingDir string `survey:"working_dir"` ProjectCount int `survey:"project_count"` EnvironmentCount int `survey:"environment_count"` }
Answers is the object that results from the command line, when run in interactive mode, are added to.
func (*Answers) RunInteractive ¶
type Config ¶
type Config struct { Commands Commands `mapstructure:"commands"` FrameworkDefs []FrameworkDef `mapstructure:"frameworks" yaml:"frameworks"` Input InputConfig `mapstructure:"input" yaml:"input"` Internal Internal Help Help `mapstructure:"help"` Replace []ReplaceConfig Self SelfConfig Stacks Stacks `mapstructure:"stacks" yaml:"stacks"` // Holds the information about the projects in stacks }
func (*Config) Check ¶
Check checks the configuration and ensures that there are some projects to work with and that the chosen pipeline is supported It also sets some defaults based on other settings in the configuration
func (*Config) ExecuteCommand ¶
func (config *Config) ExecuteCommand(path string, logger *logrus.Logger, command string, arguments string, show bool, force bool) (string, error)
ExecuteCommand executes the command and arguments that have been supplied to the function
func (*Config) GetFrameworkCommands ¶
func (config *Config) GetFrameworkCommands(framework string) FrameworkDef
GetFrameworkCommands gets the list of commands that are associated with the specified framework. This is so that their existence on the PATH can be checked
func (*Config) GetVersion ¶
GetVersion returns the current version of the application It will check to see uif the Version is empty, if it is, it will set and identifiable local build version
func (*Config) NoCleanup ¶
NoCleanup returns a boolean stating if the app should perform cleanup functions
func (*Config) OpenOnlineHelp ¶
OpenOnlineHelp opens the relevant help for the specified CLI command
func (*Config) RenderTemplate ¶
renderTemplate takes any string and attempts to replace items in it based on the values in the supplied Input object
func (*Config) Save ¶
Save saves the user's configuration to a file This is only applicable if a configuration file has not been used and the option to save the configuration has been set as an option
func (*Config) SetDefaultValues ¶
func (config *Config) SetDefaultValues()
SetDefaultValues sets values in the config object that are based off other values in the config object For example, if the internal domain name has not been set then it will be based on the external domain name, with the TLD replaced with `internal`
func (*Config) WriteCmdLog ¶
WriteCmdLog writes the command out a log file in the directory that the CLI is being run The cmd is only written out if the option to do so has been set in the config
func (*Config) WriteVariablesFile ¶
func (config *Config) WriteVariablesFile(project *Project, pipelineSettings Pipeline, replacements Replacements) (string, error)
WriteVariablesFile writes out the variables template file for the build pipeline
type DomainType ¶
type Environment ¶
type EnvironmentAnswers ¶
type Framework ¶
type Framework struct { Type string `mapstructure:"type"` Option string `mapstructure:"option"` Version string `mapstructure:"version" yaml:",omitempty"` // Version of the project to download Properties []string `mapstructure:"properties" yaml:",omitempty"` // additional properties to be specified that need to be passed to project commands DeploymentMode string `mapstructure:"deployment_mode" yaml:"deployment_mode,omitempty"` //AKS or ACA }
type FrameworkDef ¶
type FrameworkDef struct { Name string `mapstructure:"name" yaml:"name"` Commands []FrameworkDefCmd `mapstructure:"commands" yaml:"commands"` }
func (*FrameworkDef) GetCmdList ¶ added in v0.4.17
func (fd *FrameworkDef) GetCmdList() []string
type FrameworkDefCmd ¶ added in v0.4.17
type FrameworkDefCmd struct { Name string `mapstructure:"name" yaml:"name"` Version FrameworkDefVersion `mapstructure:"version" yaml:"version"` }
type FrameworkDefVersion ¶
type Help ¶
type Help struct { Root string `mapstructure:"root"` Scaffold string `mapstructure:"scaffold"` Interactive string `mapstructure:"interactive"` Version string `mapstructure:"version"` Export string `mapstructure:"export"` }
Help struct holds the urls for the help pages for the different commands
type Init ¶
type Init struct {
Operations []Operation `mapstructure:"operations"`
}
Init holds the operations that should be performed before any work is done on the working project
type InputConfig ¶
type InputConfig struct { // Version of the application Version string `yaml:"-"` // Define the logging parameters Log models.Log `mapstructure:"log"` Directory Directory `mapstructure:"directory"` Business Business `mapstructure:"business"` Cloud Cloud `mapstructure:"cloud"` Network Network `mapstructure:"network"` Pipeline string `mapstructure:"pipeline"` Project []Project `mapstructure:"project"` Terraform Terraform `mapstructure:"terraform"` SettingsFile string `mapstructure:"settingsfile" json:",omitempty"` Options Options `mapstructure:"options"` Overrides Overrides `mapstructure:"overrides"` Environment []Environment `mapstructure:"environment"` // Set values to accept from the command line when running setup Global bool `mapstructure:"global" yaml:"-"` Folders []string `mapstructure:"folders" yaml:"-"` }
Config is used to map the configuration onto the application models
func (*InputConfig) CheckFrameworks ¶
func (ic *InputConfig) CheckFrameworks(config *Config) []models.Command
CheckFrameworks iterates around each of the projects and builds up a list of the frameworks that have been specified. It will then check that each of the framework binaries are present in the path. If there are not then the ones that are not present are returned to the calling function
func (*InputConfig) ValidateInput ¶
func (ic *InputConfig) ValidateInput() []string
ValidateInput checks the input object and ensures that values are correctly formatted For example the company name should not contain spaces, so this will replace any spaces with an underscore
type Internal ¶
type Internal struct {
Files map[string]interface{}
}
func (*Internal) GetFileContent ¶
func (*Internal) GetFileContentString ¶
func (*Internal) GetFilename ¶
type Network ¶
type Network struct {
Base NetworkBase `mapstructure:"base"`
}
type NetworkBase ¶
type NetworkBase struct {
Domain DomainType `mapstructure:"domain"`
}
type Options ¶
type Options struct { CmdLog bool `mapstructure:"cmdlog"` DryRun bool `mapstructure:"dryrun"` SaveConfig bool `mapstructure:"save" yaml:"-"` NoCleanup bool `mapstructure:"nocleanup" yaml:"-"` Force bool `mapstructure:"force" yaml:"-"` NoBanner bool `mapstructure:"nobanner"` NoCLIVersion bool `mapstructure:"nocliversion"` Token string `mapstructure:"token" json:"-"` OnlineHelp bool `mapstructure:"onlinehelp" json:"-"` NoScaffold bool `mapstructure:"noscaffold" json:"-"` }
Options holds the options for the CLI, such as turning on cmd logging
type Output ¶
type Output struct {
Input InputConfig `mapstructure:"input" yaml:"input"`
}
type Package ¶
type Pipeline ¶
type Pipeline struct { Type string `mapstructure:"type"` File []PipelineFile `mapstructure:"files"` Template []PipelineFile `mapstructure:"templates"` Items []string `mapstructure:"items"` Replacements []PipelineReplacement `mapstructure:"replacements"` }
func (*Pipeline) GetFilePath ¶
GetFilePath iterates around the either the File or Template slice looking for the specified name, if the name is found then it will return the path associated with the name
func (*Pipeline) GetSupported ¶
GetSupported returns a slice of all the currently supported pipelines This is determined using reflection on the current object
func (*Pipeline) GetVariableTemplate ¶
func (*Pipeline) IsSupported ¶
IsSupported states if the specified pipeline is supported by Stacks This is only used to state which overall pipelines are possible, each project can define the pipelines that it supports within this overall group
func (*Pipeline) ReplacePatterns ¶
func (p *Pipeline) ReplacePatterns(config *Config, inputs Replacements, dir string) []error
ReplacePatterns replaces the phrases that are found in the build file according to the regex pattern with the specified value
type PipelineFile ¶
type PipelineReplacement ¶
type Project ¶
type Project struct { Name string `mapstructure:"name"` Framework Framework `mapstructure:"framework"` Platform Platform `mapstructure:"platform" json:",omitempty"` SourceControl SourceControl `mapstructure:"sourcecontrol"` SettingsFile string `mapstructure:"settingsfile" json:",omitempty"` Cloud Cloud `mapstructure:"cloud"` Directory Directory `yaml:"-"` // Holds the workingdir and tempdir for the project Settings Settings `yaml:"-"` // Hold the settings for the current project Phases []Phase `yaml:"-"` // Holds the phases for the operations }
func (*Project) GetId ¶
GetId returns a consistent identifier for the name of the project It will change all to lowercase and replace spaces with an "_"
func (*Project) ReadSettings ¶
ReadSettings reads in the settings file for the current project Returns the path to the file that was read for the project settings and any errors that were raised The operations are also read in and the phases object is created
type ProjectAnswers ¶
type ProjectAnswers struct { Name string `survey:"name"` FrameworkType string `survey:"framework_type"` FrameworkOption string `survey:"framework_option"` FrameworkVersion string `survey:"framework_version"` FrameworkProperties string `survey:"framework_properties"` FrameworkDeploymentMode string `survey:"framework_deployment_mode"` PlatformType string `survey:"platform_type"` SourceControlType string `survey:"source_control_type"` SourceControlUrl string `survey:"source_control_url"` CloudRegion string `survey:"cloud_region"` CloudGroup string `survey:"cloud_group"` }
ProjectAnswers are the list of answers that are provided for each project defined on the command line
type ReplaceConfig ¶
type Replacements ¶
type Replacements struct { Input InputConfig Project Project }
type SelfConfig ¶
func (*SelfConfig) AddPath ¶
func (selfConfig *SelfConfig) AddPath(project Project, path string)
SetPaths sets the current project path
func (*SelfConfig) GetPath ¶
func (selfConfig *SelfConfig) GetPath(project Project) string
GetPath returns the path for the current project
type Settings ¶
type Settings struct { Framework SettingsFramework `mapstructure:"framework"` Pipeline []Pipeline `mapstructure:"pipeline"` Init Init `mapstructure:"init"` Setup Setup `mapstructure:"setup"` }
Settings holds the settings for each project as read from the `stackscli.yml` file in the project
func (*Settings) CheckCmdVersions ¶ added in v0.4.17
func (s *Settings) CheckCmdVersions(config *Config, logger *logrus.Logger, path string, tmpPath string) ([]models.Command, string)
CheckCmdVersions checks that all of the commands that have been specified for the component exist and that they are the correct version.
It takes the following parameters: - config: A pointer to the Config struct containing the framework commands. - logger: A logger instance from the logrus package for logging errors and information. - path: The file path where the commands should be executed. - tmpPath: A temporary file path used for specific command checks.
It returns a slice of models.Command containing the commands that do not meet the specified version constraints, and an info string providing additional information.
func (*Settings) CompareVersion ¶
CompareVersion compares the specified version against the contsraint
func (*Settings) GetPipelines ¶
GetPipelines attempts to return all pipelines settings for the named pipeline
func (*Settings) GetRequiredVersion ¶
GetRequiredVersion interrogates the list of framework versions to determine if any specific version is required for building the application
type SettingsFramework ¶
type SettingsFramework struct { Name string `mapstructure:"name"` Commands []SettingsFrameworkCommands `mapstructure:"commands"` }
type Setup ¶
type Setup struct {
Operations []Operation `mapstructure:"operations"`
}
Setup holds the operaions that should be performed after the projet has been added to the working directory
type SourceControl ¶
type Stacks ¶
type Stacks struct {
Components map[string]StacksComponent `mapstructure:"components" yaml:"components"`
}
func (*Stacks) GetComponentCount ¶
func (*Stacks) GetComponentNames ¶
GetComponentNames returns a sorted slice of the components that are defined and removes any duplicates
func (*Stacks) GetComponentOptions ¶
GetComponentOptions analyses the StacksComponent slice and returns all of the options that are associated with the specified framework
func (*Stacks) GetComponentPackage ¶
func (*Stacks) GetComponentPackageRef ¶
type StacksComponent ¶
type StacksComponent struct { Group string `mapstructure:"group" yaml:"group"` Name string `mapstructure:"name" yaml:"name"` Package Package `mapstructure:"package" yaml:"package"` }
func (*StacksComponent) GetName ¶
func (sc *StacksComponent) GetName() string
GetName returns the name of the component by combining the group and the name
type Terraform ¶
type Terraform struct {
Backend TerraformBackend `mapstructure:"backend" yaml:",omitempty"`
}
type TerraformBackend ¶
Source Files
¶
- answers.go
- business.go
- cloud.go
- commands.go
- config.go
- directory.go
- environment.go
- framework.go
- framework_def.go
- framework_def_cmd.go
- framework_def_version.go
- help.go
- input_config.go
- internal.go
- network.go
- network_base.go
- options.go
- output.go
- overrides.go
- package.go
- phase.go
- pipeline.go
- platform.go
- project.go
- replacements.go
- settings.go
- sourcecontrol.go
- stacks.go
- stacks_component.go
- state.go
- terraform.go
- terraform_backend.go