Documentation
¶
Index ¶
- Constants
- Variables
- func CreateConfig(airshipConfigPath string, overwrite bool) error
- func EncodeString(given string) string
- func NewErrIncompatibleAuthOptions(fo []string, ao string) error
- func RunGetManifest(cfgFactory Factory, manifestName string, w io.Writer) error
- func RunSetManifest(o *ManifestOptions, airconfig *Config, writeToStorage bool) (bool, error)
- func RunUseContext(desiredContext string, airconfig *Config) error
- type Config
- func (c *Config) AddContext(ctxName string, opts ...ContextOption) *Context
- func (c *Config) AddManagementConfig(mgmtCfgName string, opts ...ManagementConfigOption) *ManagementConfiguration
- func (c *Config) AddManifest(theManifest *ManifestOptions) *Manifest
- func (c *Config) AddRepository(manifest *Manifest, theManifest *ManifestOptions) (*Repository, error)
- func (c *Config) CurrentContextInventoryRepositoryName() (string, error)
- func (c *Config) CurrentContextManagementConfig() (*ManagementConfiguration, error)
- func (c *Config) CurrentContextManifest() (*Manifest, error)
- func (c *Config) CurrentContextMetadataPath() (string, error)
- func (c *Config) CurrentContextPhaseRepositoryDir() (string, error)
- func (c *Config) CurrentContextTargetPath() (string, error)
- func (c *Config) EnsureComplete() error
- func (c *Config) GetContext(cName string) (*Context, error)
- func (c *Config) GetContexts() []*Context
- func (c *Config) GetCurrentContext() (*Context, error)
- func (c *Config) GetManagementConfiguration(name string) (*ManagementConfiguration, error)
- func (c *Config) GetManifest(name string) (*Manifest, error)
- func (c *Config) GetManifests() []*Manifest
- func (c *Config) LoadConfig() error
- func (c *Config) LoadedConfigPath() string
- func (c *Config) ModifyContext(context *Context, opts ...ContextOption)
- func (c *Config) ModifyManagementConfig(mgmtConfig *ManagementConfiguration, opts ...ManagementConfigOption)
- func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions) error
- func (c *Config) ModifyRepository(repository *Repository, theManifest *ManifestOptions) error
- func (c *Config) PersistConfig(overwrite bool) error
- func (c *Config) Purge() error
- func (c *Config) SetFs(fsys fs.FileSystem)
- func (c *Config) SetLoadedConfigPath(lcp string)
- func (c *Config) String() string
- func (c *Config) ToYaml() ([]byte, error)
- func (c *Config) WorkDir() (dir string, err error)
- type Context
- type ContextOption
- type ContextOptions
- type ErrAuthTypeNotSupported
- type ErrCheckFile
- type ErrConfigFailed
- type ErrConfigFileExists
- type ErrConflictingAuthOptions
- type ErrConflictingClusterOptions
- type ErrConflictingContextOptions
- type ErrDecodingCredentials
- type ErrEmptyContextName
- type ErrEmptyManagementConfigurationName
- type ErrIncompatibleAuthOptions
- type ErrInvalidConfig
- type ErrManagementConfigurationNotFound
- type ErrMissingConfig
- type ErrMissingCurrentContext
- type ErrMissingFlag
- type ErrMissingManagementConfiguration
- type ErrMissingManifestName
- type ErrMissingPhaseDocument
- type ErrMissingPhaseRepo
- type ErrMissingRepoCheckoutOptions
- type ErrMissingRepoURL
- type ErrMissingRepositoryName
- type ErrMutuallyExclusiveCheckout
- type ErrRepoSpecRequiresURL
- type ErrRepositoryNotFound
- type ErrUnknownManagementType
- type ErrWrongOutputFormat
- type Factory
- type InventoryMeta
- type ManagementConfigOption
- func SetManagementConfigInsecure(insecure bool) ManagementConfigOption
- func SetManagementConfigMgmtType(mgmtType string) ManagementConfigOption
- func SetManagementConfigSystemActionRetries(sysActionRetries int) ManagementConfigOption
- func SetManagementConfigSystemRebootDelay(sysRebootDelay int) ManagementConfigOption
- func SetManagementConfigUseProxy(useProxy bool) ManagementConfigOption
- type ManagementConfiguration
- type Manifest
- type ManifestOptions
- type Metadata
- type Permissions
- type PhaseMeta
- type RepoAuth
- type RepoCheckout
- type RepoFetch
- type Repository
- func (repo *Repository) String() string
- func (repo *Repository) ToAuth() (transport.AuthMethod, error)
- func (repo *Repository) ToCheckoutOptions() *git.CheckoutOptions
- func (repo *Repository) ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions
- func (repo *Repository) ToFetchOptions(auth transport.AuthMethod) *git.FetchOptions
- func (repo *Repository) URL() string
- func (repo *Repository) Validate() error
- type RunSetContextOptions
- type RunSetManagementConfigOptions
Constants ¶
const (
AirshipConfig = "config"
AirshipConfigAPIVersion = AirshipConfigGroup + "/" + AirshipConfigVersion
AirshipConfigDir = ".airship"
AirshipConfigEnv = "AIRSHIPCONFIG"
AirshipConfigGroup = "airshipit.org"
AirshipConfigKind = "Config"
AirshipConfigVersion = "v1alpha1"
AirshipDefaultContext = "default"
AirshipDefaultDirectoryPermission = 0750
AirshipDefaultFilePermission = 0640
AirshipDefaultManagementConfiguration = "default"
AirshipDefaultManifest = "default"
AirshipDefaultManifestRepo = "treasuremap"
AirshipDefaultManifestRepoLocation = "https://opendev.org/airship/" + AirshipDefaultManifestRepo
// Modules
AirshipDefaultManagementType = redfish.ClientType
//HomeEnvVar holds value of HOME directory from env
HomeEnvVar = "$HOME"
)
Constants defining default values
const (
DefaultSystemActionRetries = 30
DefaultSystemRebootDelay = 30
)
Default values for remote operations
const (
// DefaultTestPhaseRepo holds default repo name
DefaultTestPhaseRepo = "primary"
// DefaultManifestMetadataFile default path to manifest metadata file
DefaultManifestMetadataFile = "manifests/site/test-site/metadata.yaml"
)
Default Value for manifest
const (
SSHAuth = "ssh-key"
SSHPass = "ssh-pass"
HTTPBasic = "http-basic"
NoAuth = "none"
)
Constants for possible repo authentication types
const (
KubectlTempFilePrefix = "initinfra"
)
Default values for auxiliary parameters
Variables ¶
var (
AllowedAuthTypes = []string{SSHAuth, SSHPass, HTTPBasic, NoAuth}
)
RepoAuth methods
Functions ¶
func CreateConfig ¶
func CreateConfig(airshipConfigPath string, overwrite bool) error
CreateConfig saves default config to the specified path
func EncodeString ¶
func EncodeString(given string) string
EncodeString returns the base64 encoding of given string
func NewErrIncompatibleAuthOptions ¶
func NewErrIncompatibleAuthOptions(fo []string, ao string) error
NewErrIncompatibleAuthOptions returns Error of type ErrIncompatibleAuthOptions
func RunGetManifest ¶
func RunGetManifest(cfgFactory Factory, manifestName string, w io.Writer) error
RunGetManifest prints desired manifest(s) by its name
func RunSetManifest ¶
func RunSetManifest(o *ManifestOptions, airconfig *Config, writeToStorage bool) (bool, error)
RunSetManifest validates the given command line options and invokes AddManifest/ModifyManifest
func RunUseContext ¶
func RunUseContext(desiredContext string, airconfig *Config) error
RunUseContext validates the given context name and updates it as current context
Types ¶
type Config ¶
type Config struct {
// +optional
Kind string `json:"kind,omitempty"`
// +optional
APIVersion string `json:"apiVersion,omitempty"`
// Permissions is a struct of permissions for file and directory
Permissions Permissions `json:"permissions,omitempty"`
// Contexts is a map of referenceable names to context configs
Contexts map[string]*Context `json:"contexts"`
// Manifests is a map of referenceable names to documents
Manifests map[string]*Manifest `json:"manifests"`
// CurrentContext is the name of the context that you would like to use by default
CurrentContext string `json:"currentContext"`
// Management configuration defines management information for all baremetal hosts in a cluster.
ManagementConfiguration map[string]*ManagementConfiguration `json:"managementConfiguration"`
// contains filtered or unexported fields
}
Config holds the information required by airshipctl commands It is somewhat a superset of what a kubeconfig looks like
func NewEmptyConfig ¶
func NewEmptyConfig() *Config
NewEmptyConfig returns an initialized Config object with no default values
func (*Config) AddContext ¶
func (c *Config) AddContext(ctxName string, opts ...ContextOption) *Context
AddContext creates a new context and returns the instance of newly created context
func (*Config) AddManagementConfig ¶
func (c *Config) AddManagementConfig(mgmtCfgName string, opts ...ManagementConfigOption) *ManagementConfiguration
AddManagementConfig creates a new instance of ManagementConfig object
func (*Config) AddManifest ¶
func (c *Config) AddManifest(theManifest *ManifestOptions) *Manifest
AddManifest creates new Manifest
func (*Config) AddRepository ¶
func (c *Config) AddRepository(manifest *Manifest, theManifest *ManifestOptions) (*Repository, error)
AddRepository creates new Repository
func (*Config) CurrentContextInventoryRepositoryName ¶
func (c *Config) CurrentContextInventoryRepositoryName() (string, error)
CurrentContextInventoryRepositoryName returns phase inventory directory from current context's manifest if it is not defined PhaseRepositoryName will be used instead
func (*Config) CurrentContextManagementConfig ¶
func (c *Config) CurrentContextManagementConfig() (*ManagementConfiguration, error)
CurrentContextManagementConfig returns the management options for the current context
func (*Config) CurrentContextManifest ¶
func (c *Config) CurrentContextManifest() (*Manifest, error)
CurrentContextManifest returns the manifest for the current context
func (*Config) CurrentContextMetadataPath ¶
func (c *Config) CurrentContextMetadataPath() (string, error)
CurrentContextMetadataPath returns metadata path from current context's manifest
func (*Config) CurrentContextPhaseRepositoryDir ¶
func (c *Config) CurrentContextPhaseRepositoryDir() (string, error)
CurrentContextPhaseRepositoryDir returns phase repository directory from current context's manifest E.g. let repository url be "http://dummy.org/phaserepo.git" then repo directory under targetPath is "phaserepo"
func (*Config) CurrentContextTargetPath ¶
func (c *Config) CurrentContextTargetPath() (string, error)
CurrentContextTargetPath returns target path from current context's manifest
func (*Config) EnsureComplete ¶
func (c *Config) EnsureComplete() error
EnsureComplete verifies that a Config object is ready to use. A complete Config object meets the following criteria:
- At least 1 Context is defined
- At least 1 Manifest is defined
- The CurrentContext is set
- The CurrentContext identifies an existing Context
- The CurrentContext identifies an existing Manifest
func (*Config) GetContext ¶
func (c *Config) GetContext(cName string) (*Context, error)
GetContext returns a context instance
func (*Config) GetContexts ¶
func (c *Config) GetContexts() []*Context
GetContexts returns all of the contexts associated with the Config sorted by name
func (*Config) GetCurrentContext ¶
func (c *Config) GetCurrentContext() (*Context, error)
GetCurrentContext methods Returns the appropriate information for the current context Current Context holds labels for the appropriate config objects
func (*Config) GetManagementConfiguration ¶
func (c *Config) GetManagementConfiguration(name string) (*ManagementConfiguration, error)
GetManagementConfiguration retrieves a management configuration by name.
func (*Config) GetManifest ¶
func (c *Config) GetManifest(name string) (*Manifest, error)
GetManifest returns a Manifest instance
func (*Config) GetManifests ¶
func (c *Config) GetManifests() []*Manifest
GetManifests returns all of the Manifests associated with the Config sorted by name
func (*Config) LoadConfig ¶
func (c *Config) LoadConfig() error
LoadConfig populates the Config from the file found at airshipConfigPath. If there is no file at airshipConfigPath, this function does nothing. An error is returned if: * airshipConfigPath is the empty string * the file at airshipConfigPath is inaccessible * the file at airshipConfigPath cannot be marshaled into Config
func (*Config) LoadedConfigPath ¶
func (c *Config) LoadedConfigPath() string
LoadedConfigPath returns the file path of airship config from where the current Config object is created
func (*Config) ModifyContext ¶
func (c *Config) ModifyContext(context *Context, opts ...ContextOption)
ModifyContext updates Context object with given context options
func (*Config) ModifyManagementConfig ¶
func (c *Config) ModifyManagementConfig(mgmtConfig *ManagementConfiguration, opts ...ManagementConfigOption)
ModifyManagementConfig updates ManagementConfig object with given options
func (*Config) ModifyManifest ¶
func (c *Config) ModifyManifest(manifest *Manifest, theManifest *ManifestOptions) error
ModifyManifest set actual values to manifests
func (*Config) ModifyRepository ¶
func (c *Config) ModifyRepository(repository *Repository, theManifest *ManifestOptions) error
ModifyRepository set actual values to repository
func (*Config) PersistConfig ¶
func (c *Config) PersistConfig(overwrite bool) error
PersistConfig updates the airshipctl config file to match the current Config object. If file did not previously exist, the file will be created. The file will be overwritten if overwrite argument set to true
func (*Config) SetFs ¶
func (c *Config) SetFs(fsys fs.FileSystem)
SetFs allows to set custom filesystem used in Config object. Required for unit tests
func (*Config) SetLoadedConfigPath ¶
func (c *Config) SetLoadedConfigPath(lcp string)
SetLoadedConfigPath updates the file path of airship config in the Config object
type Context ¶
type Context struct {
// Manifest is the default manifest to be use with this context
// +optional
Manifest string `json:"manifest,omitempty"`
// Management configuration which will be used for all hosts in the cluster
ManagementConfiguration string `json:"managementConfiguration"`
}
Context is a tuple of references to a cluster (how do I communicate with a kubernetes context), a user (how do I identify myself), and a namespace (what subset of resources do I want to work with)
func NewContext ¶
func NewContext() *Context
NewContext is a convenience function that returns a new Context
type ContextOption ¶
type ContextOption func(ctx *Context)
ContextOption is a function that allows to modify context object
func SetContextManagementConfig ¶
func SetContextManagementConfig(managementConfig string) ContextOption
SetContextManagementConfig sets management config in context object
func SetContextManifest ¶
func SetContextManifest(manifest string) ContextOption
SetContextManifest sets manifest in context object
type ContextOptions ¶
type ContextOptions struct {
Name string
CurrentContext bool
Manifest string
Current bool
ManagementConfiguration string
Format string
}
ContextOptions holds all configurable options for context
type ErrAuthTypeNotSupported ¶
type ErrAuthTypeNotSupported struct {
}
ErrAuthTypeNotSupported is returned when wrong AuthType is provided
type ErrCheckFile ¶
type ErrCheckFile struct {
FlagName string
Path string
InternalErr error
}
ErrCheckFile is returned if there is error when checking file on FS
type ErrConfigFailed ¶
type ErrConfigFailed struct {
}
ErrConfigFailed returned in case of failure during configuration
type ErrConfigFileExists ¶
type ErrConfigFileExists struct {
Path string
}
ErrConfigFileExists is returned when there is an existing file at specified location
type ErrConflictingAuthOptions ¶
type ErrConflictingAuthOptions struct {
}
ErrConflictingAuthOptions returned in case both token and username/password is set at same time
type ErrConflictingClusterOptions ¶
type ErrConflictingClusterOptions struct {
}
ErrConflictingClusterOptions returned when both certificate-authority and insecure-skip-tls-verify is set at same time
type ErrConflictingContextOptions ¶
type ErrConflictingContextOptions struct {
}
ErrConflictingContextOptions returned when both context and --current is set at same time
type ErrDecodingCredentials ¶
type ErrDecodingCredentials struct {
Given string
}
ErrDecodingCredentials returned when the given string cannot be decoded
type ErrEmptyContextName ¶
type ErrEmptyContextName struct {
}
ErrEmptyContextName returned when empty context name is set
type ErrEmptyManagementConfigurationName ¶
type ErrEmptyManagementConfigurationName struct {
}
ErrEmptyManagementConfigurationName returned when attempted to create/modify management config with empty name
type ErrIncompatibleAuthOptions ¶
type ErrIncompatibleAuthOptions struct {
ForbiddenOptions []string
AuthType string
}
ErrIncompatibleAuthOptions is returned when incompatible AuthTypes are provided
type ErrInvalidConfig ¶
type ErrInvalidConfig struct {
What string
}
ErrInvalidConfig returned in case of incorrect configuration
type ErrManagementConfigurationNotFound ¶
type ErrManagementConfigurationNotFound struct {
Name string
}
ErrManagementConfigurationNotFound describes a situation in which a user has attempted to reference a management configuration that cannot be referenced.
type ErrMissingConfig ¶
type ErrMissingConfig struct {
What string
}
ErrMissingConfig returned in case of missing configuration
type ErrMissingCurrentContext ¶
type ErrMissingCurrentContext struct {
}
ErrMissingCurrentContext returned in case --current used without setting current-context
type ErrMissingFlag ¶
type ErrMissingFlag struct {
FlagName string
}
ErrMissingFlag is returned when flag is not provided
type ErrMissingManagementConfiguration ¶
type ErrMissingManagementConfiguration struct {
// contains filtered or unexported fields
}
ErrMissingManagementConfiguration means the management configuration was not defined for the active cluster.
type ErrMissingManifestName ¶
type ErrMissingManifestName struct {
}
ErrMissingManifestName is returned when manifest name is empty
type ErrMissingPhaseDocument ¶
type ErrMissingPhaseDocument struct {
PhaseName string
}
ErrMissingPhaseDocument returned when appropriate Phase document was not found in the filesystem
type ErrMissingPhaseRepo ¶
type ErrMissingPhaseRepo struct {
}
ErrMissingPhaseRepo returned when Phase Repository is not set in context manifest
type ErrMissingRepoCheckoutOptions ¶
type ErrMissingRepoCheckoutOptions struct {
}
ErrMissingRepoCheckoutOptions is returned if repository checkout options is empty in set-manifest
type ErrMissingRepoURL ¶
type ErrMissingRepoURL struct {
}
ErrMissingRepoURL is returned if repository is empty when using --phase in set-manifest
type ErrMissingRepositoryName ¶
type ErrMissingRepositoryName struct {
RepoType string
}
ErrMissingRepositoryName is returned if repository name is empty when using in set-manifest
type ErrMutuallyExclusiveCheckout ¶
type ErrMutuallyExclusiveCheckout struct {
}
ErrMutuallyExclusiveCheckout is returned if mutually exclusive options are given as checkout options
type ErrRepoSpecRequiresURL ¶
type ErrRepoSpecRequiresURL struct {
}
ErrRepoSpecRequiresURL is returned when repository URL is not specified
type ErrRepositoryNotFound ¶
type ErrRepositoryNotFound struct {
Name string
}
ErrRepositoryNotFound is returned if repository is empty when using in set-manifest
type ErrUnknownManagementType ¶
type ErrUnknownManagementType struct {
Type string
}
ErrUnknownManagementType describes a situation in which an unknown management type is listed in the airshipctl config.
type ErrWrongOutputFormat ¶
type ErrWrongOutputFormat struct {
Wrong string
Possible []string
}
ErrWrongOutputFormat is returned when unknown output format is defined for printing config
type Factory ¶
type Factory func() (*Config, error)
Factory is a function which returns ready to use config object and error (if any)
func CreateFactory ¶
func CreateFactory(airshipConfigPath *string) Factory
CreateFactory returns function which creates ready to use Config object
type InventoryMeta ¶
type InventoryMeta struct {
Path string `json:"path,omitempty"`
}
InventoryMeta holds inventory metadata, this is to be extended in the future when we have more information how to handle non-baremetal inventories path is a kustomize entrypoint against which we will build bundle containing bmh hosts
type ManagementConfigOption ¶
type ManagementConfigOption func(mgmtConf *ManagementConfiguration)
ManagementConfigOption is a function that allows to modify ManagementConfig object
func SetManagementConfigInsecure ¶
func SetManagementConfigInsecure(insecure bool) ManagementConfigOption
SetManagementConfigInsecure sets Insecure option in ManagementConfig object
func SetManagementConfigMgmtType ¶
func SetManagementConfigMgmtType(mgmtType string) ManagementConfigOption
SetManagementConfigMgmtType sets Type in ManagementConfig object
func SetManagementConfigSystemActionRetries ¶
func SetManagementConfigSystemActionRetries(sysActionRetries int) ManagementConfigOption
SetManagementConfigSystemActionRetries sets SystemActionRetries in ManagementConfig object
func SetManagementConfigSystemRebootDelay ¶
func SetManagementConfigSystemRebootDelay(sysRebootDelay int) ManagementConfigOption
SetManagementConfigSystemRebootDelay sets SystemRebootDelay in ManagementConfig object
func SetManagementConfigUseProxy ¶
func SetManagementConfigUseProxy(useProxy bool) ManagementConfigOption
SetManagementConfigUseProxy sets UseProxy in ManagementConfig object
type ManagementConfiguration ¶
type ManagementConfiguration struct {
// Insecure indicates whether the SSL certificate should be checked on remote management requests.
Insecure bool `json:"insecure,omitempty"`
// SystemActionRetries is the number of attempts to poll a host for a status.
SystemActionRetries int `json:"systemActionRetries,omitempty"`
// SystemRebootDelay is the number of seconds to wait between power actions (e.g. shutdown, startup).
SystemRebootDelay int `json:"systemRebootDelay,omitempty"`
// Type the type of out-of-band management that will be used for baremetal orchestration, e.g. redfish.
Type string `json:"type"`
// UseProxy indicates whether airshipctl should transmit remote management requests through a proxy server when
// one is configured in an environment.
UseProxy bool `json:"useproxy,omitempty"`
}
ManagementConfiguration defines configuration data for all remote systems within a context.
func NewManagementConfiguration ¶
func NewManagementConfiguration() *ManagementConfiguration
NewManagementConfiguration returns a management configuration with default values.
func (*ManagementConfiguration) SetType ¶
func (m *ManagementConfiguration) SetType(managementType string) error
SetType is a helper function that sets and validates the management type.
type Manifest ¶
type Manifest struct {
// PhaseRepositoryName is a name of the repo, that contains site/<site-name> directory
// and is a starting point for building document bundle
PhaseRepositoryName string `json:"phaseRepositoryName"`
// InventoryRepositoryName is a name of the repo contains inventory objects
// to be used mostly with baremetal deployments
// If not defined PhaseRepositoryName will be used to locate inventory
InventoryRepositoryName string `json:"inventoryRepositoryName"`
// ExtraRepositories is the map of extra repositories addressable by a name
Repositories map[string]*Repository `json:"repositories,omitempty"`
// TargetPath Local Target path for working or home directory for all Manifest Cloned/Returned/Generated
TargetPath string `json:"targetPath"`
// MetadataPath path to a metadata file relative to TargetPath
MetadataPath string `json:"metadataPath"`
}
Manifest is a tuple of references to a Manifest (how do Identify, collect , find the yaml manifests that airship uses to perform its operations)
func NewManifest ¶
func NewManifest() *Manifest
NewManifest is a convenience function that returns a new Manifest object with non-nil maps
func (*Manifest) GetMetadataPath ¶
func (m *Manifest) GetMetadataPath() string
GetMetadataPath returns MetadataPath field
func (*Manifest) GetTargetPath ¶
func (m *Manifest) GetTargetPath() string
GetTargetPath returns TargetPath field
type ManifestOptions ¶
type ManifestOptions struct {
Name string
RepoName string
URL string
Branch string
CommitHash string
Tag string
Force bool
IsPhase bool
TargetPath string
MetadataPath string
}
ManifestOptions holds all configurable options for manifest configuration
type Metadata ¶
type Metadata struct {
Inventory *InventoryMeta `json:"inventory,omitempty"`
PhaseMeta *PhaseMeta `json:"phase,omitempty"`
}
Metadata holds entrypoints for phases, inventory and clusterctl
type Permissions ¶
type Permissions struct {
DirectoryPermission uint32
FilePermission uint32
}
Permissions has the permissions for file and directory
type PhaseMeta ¶
type PhaseMeta struct {
// path is a kustomize entrypoint against which we will build bundle with phase objects
Path string `json:"path,omitempty"`
// docEntryPointPrefix is the path prefix for documentEntryPoint field in the phase config
// If it is defined in the manifest metadata then it will be prepended
// to the documentEntryPoint defined in the phase itself. So in this case the full path will be
// targetPath + phaseRepoDir + docEntryPointPrefix + documentEntryPoint
// E.g. let
// targetPath (defined in airship config file) be /tmp
// phaseRepoDir (this is the last part of the repo url given in the airship config file) be reponame
// docEntryPointPrefix (defined in metadata) be foo/bar and
// documentEntryPoint (defined in a phase) be baz/xyz
// then the full path to the document bundle will be /tmp/reponame/foo/bar/baz/xyz
// If docEntryPointPrefix is empty or not given at all, then the full path will be
// targetPath + phaseRepoDir + documentEntryPoint (in our case /tmp/reponame/baz/xyz)
DocEntryPointPrefix string `json:"docEntryPointPrefix,omitempty"`
}
PhaseMeta holds phase metadata
type RepoAuth ¶
type RepoAuth struct {
// Type of authentication method to be used with given repository
// supported types are "ssh-key", "ssh-pass", "http-basic", "none"
Type string `json:"type,omitempty"`
//KeyPassword is a password decrypt ssh private key (used with ssh-key auth type)
KeyPassword string `json:"keyPass,omitempty"`
// KeyPath is path to private ssh key on disk (used with ssh-key auth type)
KeyPath string `json:"sshKey,omitempty"`
//HTTPPassword is password for basic http authentication (used with http-basic auth type)
HTTPPassword string `json:"httpPass,omitempty"`
// SSHPassword is password for ssh password authentication (used with ssh-pass)
SSHPassword string `json:"sshPass,omitempty"`
// Username to authenticate against git remote (used with any type)
Username string `json:"username,omitempty"`
}
RepoAuth struct describes method of authentication against given repository
type RepoCheckout ¶
type RepoCheckout struct {
// CommitHash is full hash of the commit that will be used to checkout
CommitHash string `json:"commitHash"`
// Branch is the branch name to checkout
Branch string `json:"branch"`
// Tag is the tag name to checkout
Tag string `json:"tag"`
// Ref is the ref to checkout
// for example refs/changes/04/691202/5
Ref string `json:"ref,omitempty"`
// ForceCheckout is a boolean to indicate whether to use the `--force` option when checking out
ForceCheckout bool `json:"force"`
// LocalBranch is a boolean to indicate whether the Branch is local one. False by default
LocalBranch bool `json:"localBranch"`
}
RepoCheckout container holds information how to checkout repository Each field is mutually exclusive
type RepoFetch ¶
type RepoFetch struct {
// RemoteRefSpec is used for remote fetches such as gerrit change
// requests and github pull requests. The format of the refspec is an
// optional +, followed by <src>:<dst>, where <src> is the pattern for
// references on the remote side and <dst> is where those references
// will be written locally. The + tells Git to update the reference
// even if it isn't a fast-forward.
// eg.: refs/changes/04/691202/5:refs/changes/04/691202/5
RemoteRefSpec string `json:"remoteRefSpec,omitempty"`
}
RepoFetch holds information on which remote ref to fetch
type Repository ¶
type Repository struct {
// URLString for Repository
URLString string `json:"url"`
// Auth holds authentication options against remote
Auth *RepoAuth `json:"auth,omitempty"`
// CheckoutOptions holds options to checkout repository
CheckoutOptions *RepoCheckout `json:"checkout,omitempty"`
// FetchOptions holds options for fetching remote refs
FetchOptions *RepoFetch `json:"fetch,omitempty"`
}
Repository struct holds the information for the remote sources of manifest yaml documents. Information such as location, authentication info, as well as details of what to get such as branch, tag, commit it, etc.
func NewRepository ¶
func NewRepository() *Repository
NewRepository is a convenience function that returns a new Repository
func (*Repository) String ¶
func (repo *Repository) String() string
String returns repository details in a string format
func (*Repository) ToAuth ¶
func (repo *Repository) ToAuth() (transport.AuthMethod, error)
ToAuth returns an implementation of transport.AuthMethod for the given auth type to establish an ssh connection
func (*Repository) ToCheckoutOptions ¶
func (repo *Repository) ToCheckoutOptions() *git.CheckoutOptions
ToCheckoutOptions returns an instance of git.CheckoutOptions with respective values(Branch/Tag/Hash) in checkout options initialized CheckoutOptions describes how a checkout operation should be performed
func (*Repository) ToCloneOptions ¶
func (repo *Repository) ToCloneOptions(auth transport.AuthMethod) *git.CloneOptions
ToCloneOptions returns an instance of git.CloneOptions with authentication and URL set CloneOptions describes how a clone should be performed
func (*Repository) ToFetchOptions ¶
func (repo *Repository) ToFetchOptions(auth transport.AuthMethod) *git.FetchOptions
ToFetchOptions returns an instance of git.FetchOptions for given authentication FetchOptions describes how a fetch should be performed
type RunSetContextOptions ¶
type RunSetContextOptions struct {
CfgFactory Factory
CtxName string
Current bool
Writer io.Writer
}
RunSetContextOptions are options required to create/modify airshipctl context
func (*RunSetContextOptions) RunSetContext ¶
func (o *RunSetContextOptions) RunSetContext(opts ...ContextOption) error
RunSetContext validates the given command line options and invokes AddContext/ModifyContext
type RunSetManagementConfigOptions ¶
type RunSetManagementConfigOptions struct {
CfgFactory Factory
MgmtCfgName string
Writer io.Writer
}
RunSetManagementConfigOptions are options required to create/modify airshipctl management config
func (*RunSetManagementConfigOptions) RunSetManagementConfig ¶
func (o *RunSetManagementConfigOptions) RunSetManagementConfig(opts ...ManagementConfigOption) error
RunSetManagementConfig validates the given command line options and invokes add/modify ManagementConfig