Documentation ¶
Index ¶
- Constants
- Variables
- func SaveTmpl(aPath string, f *Forge) error
- type AppFlowYaml
- type AppModel
- type AppStruct
- func (a *AppStruct) Flags() (flags []string)
- func (a *AppStruct) Get(flag string) (value *goforjj.ValueStruct, found bool, source string)
- func (a *AppStruct) MarshalYAML() (interface{}, error)
- func (a *AppStruct) Model() AppModel
- func (a *AppStruct) Name() string
- func (a *AppStruct) Set(source, flag, value string) (updated bool)
- func (a *AppStruct) SetHandler(source string, from func(field string) (string, bool), ...) (updated bool)
- func (a *AppStruct) UnmarshalYAML(unmarchal func(interface{}) error) error
- type AppYamlStruct
- type AppsStruct
- type DefaultRepoAppSettingsStruct
- type DefaultSettingsStruct
- type DeployForgeModel
- type DeployForgeYaml
- func (f *DeployForgeYaml) Get(object, instance, key string) (value *goforjj.ValueStruct, _ bool, source string)
- func (f *DeployForgeYaml) GetInstances(object string) (ret []string)
- func (f *DeployForgeYaml) GetObjectInstance(object, instance string) interface{}
- func (f *DeployForgeYaml) GetRepo(name string) (r *RepoStruct, found bool)
- func (f *DeployForgeYaml) GetString(object, instance, key string) (string, bool, string)
- func (f *DeployForgeYaml) HasApps(rules ...string) (found bool, err error)
- func (f *DeployForgeYaml) Init(forge *ForgeYaml) bool
- func (f *DeployForgeYaml) Model() ForgeModel
- func (f *DeployForgeYaml) NewRepoStruct(name string) (repo *RepoStruct)
- func (f *DeployForgeYaml) ObjectLen(object string) int
- func (f *DeployForgeYaml) Remove(object, name, key string)
- func (f *DeployForgeYaml) Set(source, object, name, key, value string)
- func (f *DeployForgeYaml) SetDefault(source, object, name, key, value string)
- func (f *DeployForgeYaml) SetHandler(source, object, name string, from func(string) (string, bool), ...)
- type DeploymentCoreStruct
- func (d *DeploymentCoreStruct) AttachRepo(repo *RepoStruct, organization string)
- func (d *DeploymentCoreStruct) AttachedRepo() (repo *RepoStruct)
- func (d *DeploymentCoreStruct) GetRepoPath() string
- func (d *DeploymentCoreStruct) GetReposPath() string
- func (d *DeploymentCoreStruct) GitCommit(message string) (_ error)
- func (d *DeploymentCoreStruct) GitDefineRemote(name, uri string) (err error)
- func (d *DeploymentCoreStruct) GitPush(force bool) (_ error)
- func (d *DeploymentCoreStruct) GitRemoteReady() bool
- func (d *DeploymentCoreStruct) GitResetBranchFromRemote(branch, remote string)
- func (d *DeploymentCoreStruct) GitSetRepo(aPath, origin string) (err error)
- func (d *DeploymentCoreStruct) GitSyncFrom(remote, branch string) error
- func (d *DeploymentCoreStruct) GitSyncUp() error
- func (d *DeploymentCoreStruct) InSync() bool
- func (d *DeploymentCoreStruct) Name() string
- func (d *DeploymentCoreStruct) RunInContext(doRun func() error) (err error)
- func (d *DeploymentCoreStruct) SwitchTo(branch string) error
- type DeploymentStruct
- type Deployments
- type DeploymentsModel
- func (dm *DeploymentsModel) Get(deployName string) (_ DeploymentCoreStruct)
- func (dm *DeploymentsModel) GetFromName(deployName, object, instance, key string) (ret string)
- func (dm *DeploymentsModel) GetFromPRO(object, instance, key string) string
- func (dm *DeploymentsModel) GetFromType(deployType, object, instance, key string) (ret map[string]string)
- type Forge
- func (f *Forge) Apps() map[string]*AppStruct
- func (f *Forge) BuildForjfileInMem() (err error)
- func (f *Forge) CheckInfraPath(infraAbsPath string) error
- func (f *Forge) DeployForjfile() *DeployForgeYaml
- func (f *Forge) Forjfile_name() string
- func (f *Forge) Forjfiles_name() (ret []string)
- func (f *Forge) Get(object, instance, key string) (value *goforjj.ValueStruct, _ bool, source string)
- func (f *Forge) GetADeployment(deploy string) (v *DeploymentStruct, found bool)
- func (f *Forge) GetDeclaredFlows() (result []string)
- func (f *Forge) GetDeployment() string
- func (f *Forge) GetDeploymentPROType() (v *DeploymentStruct, err error)
- func (f *Forge) GetDeploymentType(deployType string) (Deployments, bool)
- func (f *Forge) GetDeployments() (result Deployments)
- func (f *Forge) GetDeploymentsModel() (ret *DeploymentsModel)
- func (f *Forge) GetForjfileFileLoaded() string
- func (f *Forge) GetForjfileTemplateFileLoaded() string
- func (f *Forge) GetInfraInstance() (_ string)
- func (f *Forge) GetInfraName() string
- func (f *Forge) GetInfraRepo() *RepoStruct
- func (f *Forge) GetInstances(object string) (ret []string)
- func (f *Forge) GetObjectInstance(object, instance string) interface{}
- func (f *Forge) GetRepo(name string) (r *RepoStruct, found bool)
- func (f *Forge) GetString(object, instance, key string) (string, bool, string)
- func (f *Forge) GetUpstreamApps() (v AppsStruct, found bool)
- func (f *Forge) InMemForjfile() *DeployForgeYaml
- func (f *Forge) InfraPath() string
- func (f *Forge) Init() bool
- func (f *Forge) IsDirty() bool
- func (f *Forge) IsLoaded() (ret bool)
- func (f *Forge) Load(deployTo string) (loaded bool, err error)
- func (f *Forge) MergeFromDeployment(deployTo string) (result *DeployForgeYaml, err error)
- func (f *Forge) Model(instance string) (fModel ForgeModel)
- func (f *Forge) ObjectLen(object string) int
- func (f *Forge) Remove(object, name, key string)
- func (f *Forge) Save() error
- func (f *Forge) Saved()
- func (f *Forge) Set(source, object, name, key, value string)
- func (f *Forge) SetDefault(source, object, name, key, value string)
- func (f *Forge) SetDeployment(deployTo string)
- func (f *Forge) SetFromTemplate(ft *ForjfileTmpl)
- func (f *Forge) SetInfraAsRepo()
- func (f *Forge) SetInfraPath(infraPath string, create_request bool) error
- func (f *Forge) SetRelPath(relPath string)
- func (f *Forge) SetTo(dest, source, object, name, key, value string)
- func (f *Forge) Validate() error
- type ForgeModel
- type ForgeYaml
- type ForjSettingsStruct
- func (s *ForjSettingsStruct) Flags() (flags []string)
- func (s *ForjSettingsStruct) Get(instance, key string) (value *goforjj.ValueStruct, found bool, source string)
- func (s *ForjSettingsStruct) GetInstance(instance string) interface{}
- func (f *ForjSettingsStruct) MarshalYAML() (interface{}, error)
- func (s *ForjSettingsStruct) Set(source, instance, key, value string)
- func (r *ForjSettingsStruct) SetHandler(source, instance string, from func(field string) (string, bool), ...)
- type ForjSettingsStructTmpl
- type ForjValue
- func (v *ForjValue) Clean(_ string) (_ bool)
- func (v *ForjValue) Get() string
- func (v *ForjValue) IsDefault() (_ bool)
- func (v ForjValue) MarshalYAML() (interface{}, error)
- func (v *ForjValue) Set(aValue string) (updated bool)
- func (v *ForjValue) SetDefault(aDefValue string) (updated bool)
- func (v *ForjValue) UnmarshalYAML(unmarshal func(interface{}) error) error
- type ForjValues
- type ForjfileTmpl
- type GroupStruct
- func (g *GroupStruct) AddMembers(members ...string) (count int)
- func (a *GroupStruct) Flags() (flags []string)
- func (g *GroupStruct) Get(field string) (value *goforjj.ValueStruct, found bool, source string)
- func (g *GroupStruct) GetMembers() []string
- func (g *GroupStruct) HasMember(member_exist string) bool
- func (g *GroupStruct) RemoveMembers(members ...string) (count int)
- func (g *GroupStruct) Set(source, field, value string)
- func (r *GroupStruct) SetHandler(source string, from func(field string) (string, bool), keys ...string)
- type GroupsStruct
- type RepoAppModel
- type RepoFlow
- type RepoModel
- func (r *RepoModel) From(repo *RepoStruct)
- func (r RepoModel) Get(field string) (val string)
- func (r *RepoModel) HasApps(rules ...string) (_ bool)
- func (r RepoModel) IsCurrentDeploy() bool
- func (r RepoModel) IsDeployable() bool
- func (r RepoModel) Owner() string
- func (r RepoModel) RemoteType() string
- func (r RepoModel) RemoteUrl() string
- func (r RepoModel) Role() (val string)
- func (r RepoModel) UpstreamAPIUrl() string
- type RepoStruct
- func (r *RepoStruct) AttachedToDeployment() string
- func (r *RepoStruct) Flags() (flags []string)
- func (r *RepoStruct) Get(field string) (value *goforjj.ValueStruct, found bool, source string)
- func (r *RepoStruct) GetApps(rules ...string) (apps map[string]*AppStruct, err error)
- func (r *RepoStruct) GetString(field string) (_ string, _ string)
- func (r *RepoStruct) HasApps(rulesList ...string) (found bool, err error)
- func (r *RepoStruct) HasValues(rules ...string) (found bool, err error)
- func (r *RepoStruct) IsCurrentDeploy() (ret bool)
- func (r *RepoStruct) IsInfra() bool
- func (r *RepoStruct) Model() RepoModel
- func (r *RepoStruct) Name() string
- func (r *RepoStruct) Owner() string
- func (r *RepoStruct) Register()
- func (r *RepoStruct) RemoteGit() string
- func (r *RepoStruct) RemoteType() string
- func (r *RepoStruct) RemoteUrl() string
- func (r *RepoStruct) Role() string
- func (r *RepoStruct) Set(source, field, value string)
- func (r *RepoStruct) SetApp(appRelName, appName string) (updated *bool, _ error)
- func (r *RepoStruct) SetCurrentDeploy()
- func (r *RepoStruct) SetHandler(source string, from func(field string) (string, bool), keys ...string)
- func (r *RepoStruct) SetInstanceOwner(owner string)
- func (r *RepoStruct) SetInternalRelApp(appRelName, appName string) (updated *bool, _ error)
- func (r *RepoStruct) SetPluginOwner(d *drivers.Driver)
- func (r *RepoStruct) UpstreamAPIUrl() string
- type ReposStruct
- type UserStruct
- type UsersStruct
- type Workspace
- func (w *Workspace) Check_exist() (bool, error)
- func (w *Workspace) CleanUnwantedEntries()
- func (w *Workspace) Data() (result map[string]WorkspaceExport)
- func (w *Workspace) EnsureExist() (wPath string, err error)
- func (w *Workspace) Error() error
- func (w *Workspace) Get(field string) (value string, found bool)
- func (w *Workspace) GetDefault(field string) (value string, found bool)
- func (w *Workspace) GetString(field string) (value string)
- func (w *Workspace) Infra() (ret *goforjj.PluginRepo)
- func (w *Workspace) InfraPath() string
- func (w *Workspace) Init(cliSetup func(string) string, non_ws_entries ...string)
- func (w *Workspace) Len() int
- func (w *Workspace) Load() error
- func (w *Workspace) Name() string
- func (w *Workspace) Path() string
- func (w *Workspace) RequireWorkspacePath() error
- func (w *Workspace) Save()
- func (w *Workspace) Set(field, value string, persistent bool) bool
- func (w *Workspace) SetDefault(field, value string)
- func (w *Workspace) SetError(err error) error
- func (w *Workspace) SetFrom(aWorkspace WorkspaceStruct)
- func (w *Workspace) SetInfra(infra *goforjj.PluginRepo)
- func (w *Workspace) SetPath(Workspace_path string) error
- func (w *Workspace) SocketPath(subdirs string) (socketPath string)
- func (w *Workspace) Unset(field string) (updated bool)
- type WorkspaceData
- type WorkspaceExport
- type WorkspaceStruct
Constants ¶
const ( DevDeployType = "DEV" ProDeployType = "PRO" )
const ( FieldRepoName = "name" FieldRepoUpstream = "upstream" FieldRepoApps = "apps" FieldRepoGitRemote = "git-remote" FieldRepoRemote = "remote" FieldRepoRemoteURL = "remote-url" FieldRepoTitle = "title" FieldRepoFlow = "flow" FieldRepoTemplate = "repo-template" FieldRepoDeployName = "deployment-name" FieldRepoDeployType = "deployment-type" FieldRepoRole = "role" FieldCurrentDeployRepo = "current-deployment-repo" )
const ( // DockerBinPathField identify full path to the docker binary. DockerBinPathField = "docker-bin-path" // ContribRepoPathField identify collection of paths of contribution repositories ContribRepoPathField = "contrib-repo-path" // FlowRepoPathField identify collection of path to the flow repositories. FlowRepoPathField = "flow-repo-path" // RepoTemplateRepoPathField identify collection of path to the repository template repositories. RepoTemplateRepoPathField = "repotemplate-repo-path" // PluginsSocketDirsPathField identify full path to the plugins sockets directory PluginsSocketDirsPathField = "plugins-socket-dirs-path" // PluginsSocketBaseField identify the base path of PluginsSocketDirsPathField PluginsSocketBaseField = "plugins-socket-base-path" // PluginsSocketDirField identify the dir name of PluginsSocketDirsPathField PluginsSocketDirField = "plugins-socket-dir-name" // OrganizationField identify the organization name OrganizationField = "organization" // InfraInstanceNameField identify the instance name InfraInstanceNameField = "infra-instance-name" //InfraDriverNameField identify the infra driver name InfraDriverNameField = "infra-driver-name" )
Variables ¶
var ForjValueSelectDefault bool
TODO: Add a function/cap to forjj to generate Forjfile with Default values (ForjValueSelectDefault = true)
Functions ¶
Types ¶
type AppFlowYaml ¶
type AppStruct ¶
type AppStruct struct { AppYamlStruct `yaml:",inline"` // contains filtered or unexported fields }
func NewAppStruct ¶
func NewAppStruct() (ret *AppStruct)
func (*AppStruct) Get ¶
Get return the flag value. found is true if value exist in more or if the value is not empty
func (*AppStruct) MarshalYAML ¶
func (*AppStruct) SetHandler ¶
func (*AppStruct) UnmarshalYAML ¶
type AppYamlStruct ¶
type AppYamlStruct struct { Type string Driver string Version string // TODO: Support for object dedicated to the application instance (not shared) // Objects map[string]map[string]string Flows map[string]AppFlowYaml `yaml:",omitempty"` More map[string]string `yaml:",inline"` // contains filtered or unexported fields }
type AppsStruct ¶
type DefaultRepoAppSettingsStruct ¶
DefaultRepoAppSettingsStruct contains a collection of default options/values to apply to Repoitories.
type DefaultSettingsStruct ¶
type DefaultSettingsStruct struct { UpstreamInstance string `yaml:"upstream-instance,omitempty"` // TODO: to remove - obsolete Flow string `yaml:",omitempty"` DevDeploy string `yaml:"dev-deploy,omitempty"` More map[string]string `yaml:",inline"` // contains filtered or unexported fields }
func (*DefaultSettingsStruct) Get ¶
func (s *DefaultSettingsStruct) Get(key string) (value *goforjj.ValueStruct, found bool, source string)
Get return the value of the default setting.
func (*DefaultSettingsStruct) Set ¶
func (s *DefaultSettingsStruct) Set(source, key, value string)
Set udpate the value of the default setting key.
type DeployForgeModel ¶
type DeployForgeModel struct { // LocalSettings should not be used from a Forjfile except if this one is a template one. LocalSettings WorkspaceStruct ForjSettings ForjSettingsStruct Infra RepoModel Deploy RepoModel Repos map[string]RepoModel Apps map[string]AppModel Users UsersStruct Groups GroupsStruct // Collection of Object/Name/Keys=values More map[string]map[string]ForjValues `yaml:",inline,omitempty"` }
func NewDeployForgeModel ¶
func NewDeployForgeModel(forge *DeployForgeYaml) (ret *DeployForgeModel)
NewDeployForgeModel return a DeployForgeYaml model object
type DeployForgeYaml ¶
type DeployForgeYaml struct { LocalSettings WorkspaceStruct `yaml:"local-settings,omitempty"` // ignored if Normal Forjfile. Otherwise, this is a template Forjfile. ForjSettings ForjSettingsStruct `yaml:"forj-settings"` Infra *RepoStruct Repos ReposStruct `yaml:"repositories"` Apps AppsStruct `yaml:"applications"` Users UsersStruct Groups GroupsStruct // Collection of Object/Name/Keys=values More map[string]map[string]ForjValues `yaml:",inline,omitempty"` // contains filtered or unexported fields }
DeployForgeYaml represents a dedicated deployed Forge.
func NewDeployForgeYaml ¶
func NewDeployForgeYaml() (result *DeployForgeYaml)
NewDeployForgeYaml creates an empty pre-initialized object.
func (*DeployForgeYaml) Get ¶
func (f *DeployForgeYaml) Get(object, instance, key string) (value *goforjj.ValueStruct, _ bool, source string)
Get return the value of the object instance key as ValueStruct.
func (*DeployForgeYaml) GetInstances ¶
func (f *DeployForgeYaml) GetInstances(object string) (ret []string)
GetInstances return a list of instances from an object type.
func (*DeployForgeYaml) GetObjectInstance ¶
func (f *DeployForgeYaml) GetObjectInstance(object, instance string) interface{}
func (*DeployForgeYaml) GetRepo ¶
func (f *DeployForgeYaml) GetRepo(name string) (r *RepoStruct, found bool)
GetRepo return the object found
func (*DeployForgeYaml) GetString ¶
func (f *DeployForgeYaml) GetString(object, instance, key string) (string, bool, string)
GetString return the value in String. It ignore the origin of the data (default or not)
func (*DeployForgeYaml) HasApps ¶
func (f *DeployForgeYaml) HasApps(rules ...string) (found bool, err error)
HasApps return a bool if rules are all true on at least one application. a rule is a string formatted as '<key>:<value>' a rule is true on an application if it has the key value set to <value>
If the rule is not well formatted, an error is returned. If the repo has no application, HasApps return false. If no rules are provided and at least one application exist, HasApps return true.
TODO: Write Unit test of HasApps
func (*DeployForgeYaml) Init ¶
func (f *DeployForgeYaml) Init(forge *ForgeYaml) bool
Init ensure all object are well initialized to avoid core dump
func (*DeployForgeYaml) Model ¶
func (f *DeployForgeYaml) Model() ForgeModel
func (*DeployForgeYaml) NewRepoStruct ¶
func (f *DeployForgeYaml) NewRepoStruct(name string) (repo *RepoStruct)
NewRepoStruct create a new Repo in the Forjfile.
func (*DeployForgeYaml) ObjectLen ¶
func (f *DeployForgeYaml) ObjectLen(object string) int
ObjectLen returns the number of instances of object type.
func (*DeployForgeYaml) Remove ¶
func (f *DeployForgeYaml) Remove(object, name, key string)
Remove a key value found in the object instance
func (*DeployForgeYaml) Set ¶
func (f *DeployForgeYaml) Set(source, object, name, key, value string)
Set a value to the object instance key.
func (*DeployForgeYaml) SetDefault ¶
func (f *DeployForgeYaml) SetDefault(source, object, name, key, value string)
SetDefault a value as default value in the object instance key.
func (*DeployForgeYaml) SetHandler ¶
func (f *DeployForgeYaml) SetHandler(source, object, name string, from func(string) (string, bool), set func(*ForjValue, string) bool, keys ...string)
SetHandler define the core set function, and call `from` function to determine the source of the data. (set/default or not found)
type DeploymentCoreStruct ¶
type DeploymentCoreStruct struct { Desc string `yaml:"description,omitempty"` Type string Pars map[string]string `yaml:"parameters,omitempty"` // contains filtered or unexported fields }
DeploymentCoreStruct contains only deployment information. anything others kind of information
func (*DeploymentCoreStruct) AttachRepo ¶
func (d *DeploymentCoreStruct) AttachRepo(repo *RepoStruct, organization string)
func (*DeploymentCoreStruct) AttachedRepo ¶
func (d *DeploymentCoreStruct) AttachedRepo() (repo *RepoStruct)
AttachedRepo return the Deployment attached repository. If found, it returns the repo attached. nil otherwise.
func (*DeploymentCoreStruct) GetRepoPath ¶
func (d *DeploymentCoreStruct) GetRepoPath() string
GetRepoPath returns the absolute path of the current deployment repository.
func (*DeploymentCoreStruct) GetReposPath ¶
func (d *DeploymentCoreStruct) GetReposPath() string
GetReposPath returns the absolute path to all deployment repositories.
func (*DeploymentCoreStruct) GitCommit ¶
func (d *DeploymentCoreStruct) GitCommit(message string) (_ error)
GitCommit do the commit in the Deployment repository.
func (*DeploymentCoreStruct) GitDefineRemote ¶
func (d *DeploymentCoreStruct) GitDefineRemote(name, uri string) (err error)
GitDefineRemote helps to configure a deployment repository with a remote
func (*DeploymentCoreStruct) GitPush ¶
func (d *DeploymentCoreStruct) GitPush(force bool) (_ error)
GitPush do a git push depending on the previous Git SyncFrom, a push can take place
func (*DeploymentCoreStruct) GitRemoteReady ¶
func (d *DeploymentCoreStruct) GitRemoteReady() bool
InSync return true is deployment local repo is already connected and were synced at east once. If not sync, you may need to call d.SyncUp()
func (*DeploymentCoreStruct) GitResetBranchFromRemote ¶
func (d *DeploymentCoreStruct) GitResetBranchFromRemote(branch, remote string)
GitResetBranchFromRemote clean current branch, check out to the requested branch and reset against remote branch. The reset is not made if the fetch return an error.
func (*DeploymentCoreStruct) GitSetRepo ¶
func (d *DeploymentCoreStruct) GitSetRepo(aPath, origin string) (err error)
GitSetRepo define where the Deployment repo is located. It creates the repo even just empty and sync if possible and origin given. It switch to master branch
func (*DeploymentCoreStruct) GitSyncFrom ¶
func (d *DeploymentCoreStruct) GitSyncFrom(remote, branch string) error
GitSyncFrom refresh the remote, and synchronize.
func (*DeploymentCoreStruct) GitSyncUp ¶
func (d *DeploymentCoreStruct) GitSyncUp() error
GitSyncUp set and report sync status
func (*DeploymentCoreStruct) InSync ¶
func (d *DeploymentCoreStruct) InSync() bool
InSync return true is deployment local repo is already connected and were synced at east once. If not sync, you may need to call d.SyncUp()
func (*DeploymentCoreStruct) Name ¶
func (d *DeploymentCoreStruct) Name() string
func (*DeploymentCoreStruct) RunInContext ¶
func (d *DeploymentCoreStruct) RunInContext(doRun func() error) (err error)
runInContext ensure GIT commands are executed in the right GIT repo context.
func (*DeploymentCoreStruct) SwitchTo ¶
func (d *DeploymentCoreStruct) SwitchTo(branch string) error
SwitchTo move to the requested branch if files were updated, they are stashed and restored in the other branch !!! Conflict can happen !!!
type DeploymentStruct ¶
type DeploymentStruct struct { DeploymentCoreStruct `yaml:",inline"` Details *DeployForgeYaml `yaml:"define,omitempty"` }
DeploymentStruct represent the data structure of all deployment.
func (DeploymentStruct) MarshalYAML ¶
func (d DeploymentStruct) MarshalYAML() (interface{}, error)
MarshalYAML provides the encoding part for DeploymentStruct
In short we do not want to encode forjj deployment details) info except the core.
func (*DeploymentStruct) RunInContext ¶
func (d *DeploymentStruct) RunInContext(doRun func() error) (err error)
RunInContext run GIT commands in the GIT repo context.
func (*DeploymentStruct) UpdateDeploymentCoreData ¶
func (d *DeploymentStruct) UpdateDeploymentCoreData(data DeploymentCoreStruct)
UpdateDeploymentCoreData set all DeploymentCore data
type Deployments ¶
type Deployments map[string]*DeploymentStruct
Deployments is a collection deployment
func (Deployments) GetADeployment ¶
func (d Deployments) GetADeployment(deploy string) (v *DeploymentStruct, found bool)
GetADeployment return the Deployment Object wanted
func (Deployments) GetDeploymentPROType ¶
func (d Deployments) GetDeploymentPROType() (v *DeploymentStruct, err error)
GetDeploymentPROType return the PRO deployment structure
func (Deployments) GetDeploymentType ¶
func (d Deployments) GetDeploymentType(deployType string) (v Deployments, found bool)
GetDeploymentType return a list of deployment type.
func (Deployments) One ¶
func (d Deployments) One() (v *DeploymentStruct)
type DeploymentsModel ¶
type DeploymentsModel struct {
// contains filtered or unexported fields
}
DeploymentsModel is the ;odel structure of Deployments for text/template
func NewDeploymentsModel ¶
func NewDeploymentsModel(list Deployments) (ret *DeploymentsModel)
NewDeploymentsModel return a model of Deployments
func (*DeploymentsModel) Get ¶
func (dm *DeploymentsModel) Get(deployName string) (_ DeploymentCoreStruct)
GetFromName get attribute of a PRO deploy type
func (*DeploymentsModel) GetFromName ¶
func (dm *DeploymentsModel) GetFromName(deployName, object, instance, key string) (ret string)
GetFromName get attribute of a PRO deploy type
func (*DeploymentsModel) GetFromPRO ¶
func (dm *DeploymentsModel) GetFromPRO(object, instance, key string) string
GetFromPRO get attribute of a PRO deploy type
func (*DeploymentsModel) GetFromType ¶
func (dm *DeploymentsModel) GetFromType(deployType, object, instance, key string) (ret map[string]string)
GetFromType get attributes of a collection of deploy of one type
type Forge ¶
type Forge struct {
// contains filtered or unexported fields
}
Forge is the Memory expand of a repository Forjfile.
func (*Forge) BuildForjfileInMem ¶
BuildForjfileInMem return a merge of the Master forjfile with the current deployment.
func (*Forge) CheckInfraPath ¶
CheckInfraPath will check if: - a Forjfile is found - is stored in a repository in root path.
func (*Forge) DeployForjfile ¶
func (f *Forge) DeployForjfile() *DeployForgeYaml
DeployForjfile return the Forjfile master object
func (*Forge) Forjfile_name ¶
func (*Forge) Forjfiles_name ¶
func (*Forge) Get ¶
func (f *Forge) Get(object, instance, key string) (value *goforjj.ValueStruct, _ bool, source string)
Get return the value and status of the object instance key
func (*Forge) GetADeployment ¶
func (f *Forge) GetADeployment(deploy string) (v *DeploymentStruct, found bool)
GetADeployment return the Deployment Object wanted
func (*Forge) GetDeclaredFlows ¶
GetDeclaredFlows returns the list of flow to load from the Master Forjfile and the deploy Forjfile.
func (*Forge) GetDeployment ¶
GetDeployment returns the current deployment environment
func (*Forge) GetDeploymentPROType ¶
func (f *Forge) GetDeploymentPROType() (v *DeploymentStruct, err error)
GetDeploymentPROType return the PRO deployment structure
func (*Forge) GetDeploymentType ¶
func (f *Forge) GetDeploymentType(deployType string) (Deployments, bool)
GetDeploymentType return the first found
func (*Forge) GetDeployments ¶
func (f *Forge) GetDeployments() (result Deployments)
GetDeployments returns all deployments.
func (*Forge) GetDeploymentsModel ¶
func (f *Forge) GetDeploymentsModel() (ret *DeploymentsModel)
func (*Forge) GetForjfileFileLoaded ¶
func (*Forge) GetForjfileTemplateFileLoaded ¶
func (*Forge) GetInfraInstance ¶
func (*Forge) GetInfraName ¶
func (*Forge) GetInfraRepo ¶
func (f *Forge) GetInfraRepo() *RepoStruct
GetInfraRepo return the infra repository object if defined.
func (*Forge) GetInstances ¶
func (*Forge) GetObjectInstance ¶
func (*Forge) GetRepo ¶
func (f *Forge) GetRepo(name string) (r *RepoStruct, found bool)
GetRepo return the object found
func (*Forge) GetUpstreamApps ¶
func (f *Forge) GetUpstreamApps() (v AppsStruct, found bool)
func (*Forge) InMemForjfile ¶
func (f *Forge) InMemForjfile() *DeployForgeYaml
DeployForjfile return the Forjfile master object
func (*Forge) MergeFromDeployment ¶
func (f *Forge) MergeFromDeployment(deployTo string) (result *DeployForgeYaml, err error)
MergeFromDeployment provide a merge between Master and Deployment Forjfile.
func (*Forge) Model ¶
func (f *Forge) Model(instance string) (fModel ForgeModel)
Model defines a simple struct to expose Current Application (ie driver instance)
func (*Forge) SetDefault ¶
func (*Forge) SetDeployment ¶
SetDeployment defines the current deployment to use.
func (*Forge) SetFromTemplate ¶
func (f *Forge) SetFromTemplate(ft *ForjfileTmpl)
func (*Forge) SetInfraAsRepo ¶
func (f *Forge) SetInfraAsRepo()
SetInfraAsRepo create the infra repo in the list of repositories (Repos)
Forjj deals with this list of repositories but saved specifically as Infra dedicated section in Forjfile.
func (*Forge) SetInfraPath ¶
func (*Forge) SetRelPath ¶
type ForgeModel ¶
type ForgeModel struct { Application AppModel // contains filtered or unexported fields }
func (ForgeModel) Get ¶
func (f ForgeModel) Get(object, instance, key string) (ret string)
Get return the value of the object instance key
func (ForgeModel) HasApps ¶
func (f ForgeModel) HasApps(rules ...string) (_ bool)
HasApps returns true if forge has all listed apps.
type ForgeYaml ¶
type ForgeYaml struct { Deployments Deployments ForjCore DeployForgeYaml `yaml:",inline"` // contains filtered or unexported fields }
ForgeYaml represents the master Forjfile or a piece of the Forjfile model.
func NewForgeYaml ¶
func NewForgeYaml() (ret *ForgeYaml)
type ForjSettingsStruct ¶
type ForjSettingsStruct struct { Organization string ForjSettingsStructTmpl `yaml:",inline"` // contains filtered or unexported fields }
forj/settings: Collection of key/value pair
func (*ForjSettingsStruct) Flags ¶
func (s *ForjSettingsStruct) Flags() (flags []string)
func (*ForjSettingsStruct) Get ¶
func (s *ForjSettingsStruct) Get(instance, key string) (value *goforjj.ValueStruct, found bool, source string)
func (*ForjSettingsStruct) GetInstance ¶
func (s *ForjSettingsStruct) GetInstance(instance string) interface{}
func (*ForjSettingsStruct) MarshalYAML ¶
func (f *ForjSettingsStruct) MarshalYAML() (interface{}, error)
func (*ForjSettingsStruct) Set ¶
func (s *ForjSettingsStruct) Set(source, instance, key, value string)
func (*ForjSettingsStruct) SetHandler ¶
type ForjSettingsStructTmpl ¶
type ForjSettingsStructTmpl struct { Default DefaultSettingsStruct RepoApps DefaultRepoAppSettingsStruct `yaml:"default-repo-apps,omitempty"` // Default repo Application More map[string]string `yaml:",inline"` }
type ForjValue ¶
type ForjValue struct {
// contains filtered or unexported fields
}
func (ForjValue) MarshalYAML ¶
func (*ForjValue) SetDefault ¶
func (*ForjValue) UnmarshalYAML ¶
type ForjValues ¶
func (ForjValues) Map ¶
func (v ForjValues) Map() (values map[string]string)
Map returns a map[string]string of all values stored.
It returns values setup with Set and if not found, returns Default value.
func (ForjValues) MarshalYAML ¶
func (v ForjValues) MarshalYAML() (interface{}, error)
type ForjfileTmpl ¶
type ForjfileTmpl struct { Workspace WorkspaceStruct // See workspace.go // contains filtered or unexported fields }
ForjfileTmpl is the Memory expansion of a Forjfile model (used to create a Forge)
type GroupStruct ¶
type GroupStruct struct { Role string `yaml:",omitempty"` Members []string `yaml:",omitempty"` More map[string]string `yaml:",inline"` // contains filtered or unexported fields }
func (*GroupStruct) AddMembers ¶
func (g *GroupStruct) AddMembers(members ...string) (count int)
func (*GroupStruct) Flags ¶
func (a *GroupStruct) Flags() (flags []string)
Flags returns the list of keys of this object.
func (*GroupStruct) Get ¶
func (g *GroupStruct) Get(field string) (value *goforjj.ValueStruct, found bool, source string)
func (*GroupStruct) GetMembers ¶
func (g *GroupStruct) GetMembers() []string
func (*GroupStruct) HasMember ¶
func (g *GroupStruct) HasMember(member_exist string) bool
func (*GroupStruct) RemoveMembers ¶
func (g *GroupStruct) RemoveMembers(members ...string) (count int)
func (*GroupStruct) Set ¶
func (g *GroupStruct) Set(source, field, value string)
func (*GroupStruct) SetHandler ¶
type GroupsStruct ¶
type GroupsStruct map[string]*GroupStruct
type RepoAppModel ¶
type RepoModel ¶
type RepoModel struct { Apps map[string]RepoAppModel // contains filtered or unexported fields }
RepoModelStruct is the RepoStruct model
func (*RepoModel) From ¶
func (r *RepoModel) From(repo *RepoStruct)
From build the repo model from a RepoStruct
func (*RepoModel) HasApps ¶
HasApps check is repo applications rules return true or not. a rule is true if the key:value is found in the application object attached.
See details in RepoStruct.HasApps()
func (RepoModel) IsCurrentDeploy ¶
IsCurrentDeploy returns true if the current repo is the current deployment repository.
func (RepoModel) IsDeployable ¶
IsDeployable return true if the repository identified is deployable in the current deployment context
func (RepoModel) RemoteType ¶
RemoteType return the remote type field
func (RepoModel) UpstreamAPIUrl ¶
UpstreamAPIUrl return the remote API url field
type RepoStruct ¶
type RepoStruct struct { Deployment string `yaml:"deploy-repo-of,omitempty"` Upstream string `yaml:"upstream-app,omitempty"` // Name of the application upstream hosting this repository. GitRemote string `yaml:"git-remote,omitempty"` Title string `yaml:",omitempty"` RepoTemplate string `yaml:"repo-template,omitempty"` Flow RepoFlow `yaml:",omitempty"` More map[string]string `yaml:",inline"` Apps map[string]string `yaml:"in-relation-with,omitempty"` // key: <AppRelName>, value: <appName> // contains filtered or unexported fields }
func (*RepoStruct) AttachedToDeployment ¶
func (r *RepoStruct) AttachedToDeployment() string
func (*RepoStruct) Flags ¶
func (r *RepoStruct) Flags() (flags []string)
Flags provide the list of existing keys in a repo object.
func (*RepoStruct) Get ¶
func (r *RepoStruct) Get(field string) (value *goforjj.ValueStruct, found bool, source string)
Get return the value for a field.
func (*RepoStruct) GetApps ¶
func (r *RepoStruct) GetApps(rules ...string) (apps map[string]*AppStruct, err error)
func (*RepoStruct) HasApps ¶
func (r *RepoStruct) HasApps(rulesList ...string) (found bool, err error)
HasApps return a bool if rules are all true on at least one application.
Supported rules syntax are defined by rules module a rule is a string formatted with following syntax and meaning: - '<key>:<value>' or '<key>=<value>' - True if key has value equal to <value>. '<key>:<value>' is kept for compatibility but is obsolete. - '<key>!=<value>' - True if key has a value NOT equal to <value> - '<key>=/<regexp>/' - True if key has value respecting <regexp>. - '<key>!=/<regexp>/' - True if key has a value NOT respecting <regexp>
a rule is true on an application if it has the key value set to <value>
If the rule is not well formatted, an error is returned. If the repo has no application, HasApps return false. If no rules are provided and at least one application exist, HasApps return true. If all rules are true, HasApps return true
TODO: Write Unit test of HasApps
func (*RepoStruct) HasValues ¶
func (r *RepoStruct) HasValues(rules ...string) (found bool, err error)
func (*RepoStruct) IsCurrentDeploy ¶
func (r *RepoStruct) IsCurrentDeploy() (ret bool)
IsCurrentDeploy return True if this repo is the current deployment repository
func (*RepoStruct) IsInfra ¶
func (r *RepoStruct) IsInfra() bool
func (*RepoStruct) Model ¶
func (r *RepoStruct) Model() RepoModel
func (*RepoStruct) Owner ¶
func (r *RepoStruct) Owner() string
func (*RepoStruct) RemoteGit ¶
func (r *RepoStruct) RemoteGit() string
func (*RepoStruct) RemoteType ¶
func (r *RepoStruct) RemoteType() string
func (*RepoStruct) RemoteUrl ¶
func (r *RepoStruct) RemoteUrl() string
func (*RepoStruct) Role ¶
func (r *RepoStruct) Role() string
func (*RepoStruct) Set ¶
func (r *RepoStruct) Set(source, field, value string)
func (*RepoStruct) SetApp ¶
func (r *RepoStruct) SetApp(appRelName, appName string) (updated *bool, _ error)
SetApp Define the Forjfile application name to link with the repo.
return: updated bool : true if the app has been updated. error : set if error has been found. updated is then nil.
func (*RepoStruct) SetCurrentDeploy ¶
func (r *RepoStruct) SetCurrentDeploy()
SetCurrentDeploy set True if this repo IS the current deployment repository No check made on other repositories. At a time, only one repository should be considered as the current deployment repository
func (*RepoStruct) SetHandler ¶
func (r *RepoStruct) SetHandler(source string, from func(field string) (string, bool), keys ...string)
SetHandler is the generic setter function.
func (*RepoStruct) SetInstanceOwner ¶
func (r *RepoStruct) SetInstanceOwner(owner string)
func (*RepoStruct) SetInternalRelApp ¶
func (r *RepoStruct) SetInternalRelApp(appRelName, appName string) (updated *bool, _ error)
SetInternalRelApp will set the appName connected to the repo But if the Forjfile has a setup, this one will forcefully used. return: updated bool : true if the app has been updated. error : set if error has been found. updated is then nil.
func (*RepoStruct) SetPluginOwner ¶
func (r *RepoStruct) SetPluginOwner(d *drivers.Driver)
func (*RepoStruct) UpstreamAPIUrl ¶
func (r *RepoStruct) UpstreamAPIUrl() string
type ReposStruct ¶
type ReposStruct map[string]*RepoStruct
func (ReposStruct) AllHasAppWith ¶
func (r ReposStruct) AllHasAppWith(rules ...string) (found bool, err error)
AllHasAppWith verify rules on all repos and returned true if all respect the rule.
func (ReposStruct) HasAppWith ¶
func (r ReposStruct) HasAppWith(rules ...string) (found bool, err error)
HasAppWith return true if at least one repo respect the rule.
func (ReposStruct) MarshalYAML ¶
func (r ReposStruct) MarshalYAML() (interface{}, error)
func (ReposStruct) SetRelapps ¶
func (r ReposStruct) SetRelapps(relAppName, appName string) (_ error)
type UserStruct ¶
type UserStruct struct { Role string More map[string]string `yaml:",inline"` // contains filtered or unexported fields }
func (*UserStruct) Flags ¶
func (u *UserStruct) Flags() (flags []string)
Flags returns the list of keys found in this object.
func (*UserStruct) Get ¶
func (u *UserStruct) Get(field string) (value *goforjj.ValueStruct, found bool, source string)
func (*UserStruct) Set ¶
func (u *UserStruct) Set(source, field, value string)
func (*UserStruct) SetHandler ¶
type UsersStruct ¶
type UsersStruct map[string]*UserStruct
type Workspace ¶
type Workspace struct {
// contains filtered or unexported fields
}
Define the workspace data saved at create/update time. Workspace data are not controlled by any git repo. It is local. Usually, we stored data to found out where the infra is. But it can store any data that is workspace environment specific. like where is the docker static binary.
func (*Workspace) Check_exist ¶
Check_exist Check if a workspace exist or not
func (*Workspace) CleanUnwantedEntries ¶
func (w *Workspace) CleanUnwantedEntries()
CleanUnwantedEntries is called before save to remove some unwanted data in the Workspace file. Ex: infra-path
func (*Workspace) Data ¶
func (w *Workspace) Data() (result map[string]WorkspaceExport)
Data provides the list of workspace variables stored.
func (*Workspace) EnsureExist ¶
EnsureExist Ensure workspace path exists. So, if missing, it will be created. The current path (pwd) is moved to the existing workspace path.
func (*Workspace) Get ¶
Get return the value of the requested field and found if was found. Get do not extract the default value if not found to get the Default value, use GetDefault()
func (*Workspace) GetDefault ¶
GetDefault return the default value of the requested field and found if was found.
func (*Workspace) GetString ¶
GetString return the data of the requested field. If not found, it return the default value
func (*Workspace) Infra ¶
func (w *Workspace) Infra() (ret *goforjj.PluginRepo)
Infra return the Infra data object
func (*Workspace) InfraPath ¶
InfraPath Return the path which contains the workspace. As the workspace is in the root or the infra repository, that path is then the Infra path. Note: The infra name is the repository name, ie the upstream repo name. This name is not necessarily the base name of the Infra path, because we can clone to a different name.
func (*Workspace) Load ¶
Load workspace information from the forjj.json Workspace path is get from forjj and set kept in the workspace as reference for whole forjj thanks to a.w.Path()
func (*Workspace) RequireWorkspacePath ¶
func (*Workspace) Set ¶
Set save field/value pair in the workspace. If persistent is true, this data will be stored in the internal persistent workspace data Save will check this flag to update the .forj-workspace/forjj.json
func (*Workspace) SetDefault ¶
SetDefault save field/value pair in the workspace as default value. This value is set to the internal if not set or if unset
func (*Workspace) SetFrom ¶
func (w *Workspace) SetFrom(aWorkspace WorkspaceStruct)
func (*Workspace) SetInfra ¶
func (w *Workspace) SetInfra(infra *goforjj.PluginRepo)
SetInfra save the infra object in the workspace internal data
func (*Workspace) SocketPath ¶
SocketPath creates a socket path if it doesn't exist. This information is stored in the workspace forjj.json file
type WorkspaceData ¶
type WorkspaceData struct { Organization string // Workspace Organization name Driver string // Infra upstream driver name Instance string // Infra upstream instance name Infra *goforjj.PluginRepo // Infra-repo definition WorkspaceStruct // Struct shared with local-settings of a Forjfile model }
WorkspaceData contains the structured data saved as json
type WorkspaceExport ¶
type WorkspaceStruct ¶
type WorkspaceStruct struct { DockerBinPath string `yaml:"docker-exe-path"` // Docker static binary path Contrib_repo_path string `yaml:"contribs-repo"` // Contrib Repo path used. Flow_repo_path string `yaml:"flows-repo"` // Flow repo path used. Repotemplate_repo_path string `yaml:"repotemplates-repo"` // Repotemplate Path used. SocketDir string `yaml:"-"` // Calculated field. Full path to forjj plugins sockets dir - Shared with plugins containers. Composed by `SocketDirName`/`SocketBaseName`. SocketDirName string `yaml:"socker-dir-name"` // Base path containing the sockets directory - Shared in DooD CI context - Can be defined in Yaml by a Forjfile model. More map[string]string `yaml:",inline"` // contains filtered or unexported fields }
WorkspaceStruct represents the yaml structure of a workspace.
Source Files ¶
- app.go
- app_model.go
- apps.go
- default_repo_app_settings.go
- default_settings_struct.go
- deploy_forge_model.go
- deploy_forge_yaml.go
- deployment.go
- deployment_core-git.go
- deployment_core.go
- deployments.go
- deployments_model.go
- forge.go
- forge_model.go
- forge_yaml.go
- forj_settings.go
- group.go
- repo.go
- repo_app_model.go
- repo_model.go
- repos.go
- user.go
- users.go
- value.go
- values.go
- workspace-data.go
- workspace.go