commands

package
v0.0.0-...-a8b8e24 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestCreateURLPath     = "/api/beta/cfgmgmt/rollouts/test_create"
	CreateRolloutsURLPath = "/api/beta/cfgmgmt/rollouts/create"

	ConfigFileBasename        = ".automate_collector.toml"
	PrivateConfigFileBasename = ".automate_collector_private.toml"
	NonHiddenConfigBasename   = "automate_collector.toml"

	GitIgnoreContent = `
# .automate_collector_private.toml contains Chef Automate credentials:
.automate_collector_private.toml
`
)
View Source
const (
	// Set the Automate URL to use. Overrides all configuration.
	AutomateURLEnvVar = "CHEF_AC_AUTOMATE_URL"
	// Set the Automate Auth Token to use. Overrides all configuration.
	AutomateTokenEnvVar = "CHEF_AC_AUTOMATE_TOKEN"
	// Whether to disable verification of Automate's TLS (SSL) certificates. If
	// set to "false", certificates will be verified. If set to any other value,
	// certificate verification will be disabled.
	AutomateInsecureTLSEnvVar = "CHEF_AC_AUTOMATE_INSECURE_TLS"

	// Directory where the chef-automate-collector should look for per-repo
	// configuration. The config loader will look for files named
	// `.automate_collector.toml`  and `.automate_collector_private.toml` in this
	// directory.
	RepoConfigDirPathEnvVar = "CHEF_AC_REPO_CONFIG_DIR"
	// Directory where the chef-automate-collector should look for per-user
	// configuration. The config loader will look for a file named
	// `automate_collector.toml` inside this directory.
	UserConfigDirPathEnvVar = "CHEF_AC_USER_CONFIG_DIR"
	// Directory where the chef-automate-collector should look for systemwide
	// configuration. The config loader will look for a file named
	// `automate_collector.toml` inside this directory.
	SystemConfigDirPathEnvVar = "CHEF_AC_SYSTEM_CONFIG_DIR"

	// Whether to disable loading per-repo configuration. If set to "false,"
	// per-repo config will be loaded. If set to any other value, per-repo config
	// will not be loaded.
	NoRepoConfigEnvVar = "CHEF_AC_NO_REPO_CONFIG"
	// Whether to disable loading per-user configuration. If set to "false,"
	// per-repo config will be loaded. If set to any other value, per-user config
	// will not be loaded.
	NoUserConfigEnvVar = "CHEF_AC_NO_USER_CONFIG"
	// Whether to disable loading systemwide configuration. If set to "false,"
	// per-repo config will be loaded. If set to any other value, systemwide
	// config will not be loaded.
	NoSystemConfigEnvVar = "CHEF_AC_NO_SYSTEM_CONFIG"

	// Whether to disable reporting new rollouts to Chef Automate. If set to
	// "false," reports will be sent. If set to any other value, reports will not
	// be sent.
	DisableReportNewRolloutEnvVar = "CHEF_AC_DISABLE_COLLECTOR"

	// Name of the git remote to use when detecting the git URL. The default
	// remote name to check is "origin"
	GitRemoteNameEnvVar = "CHEF_AC_GIT_REMOTE_NAME"
)

Variables

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

type AutomateCollectorConfig

type AutomateCollectorConfig interface {
	IsAutomateCollectorConfig() bool
}

type AutomateConfig

type AutomateConfig struct {
	URL string `toml:"url"`

	InsecureTLS bool `toml:"-"`
	// contains filtered or unexported fields
}

func (*AutomateConfig) ApplyValuesFrom

func (a *AutomateConfig) ApplyValuesFrom(other *AutomateConfig)

func (*AutomateConfig) ApplyValuesFromEnv

func (a *AutomateConfig) ApplyValuesFromEnv()

func (*AutomateConfig) CreateRolloutURL

func (a *AutomateConfig) CreateRolloutURL() (*url.URL, error)

func (*AutomateConfig) Redacted

func (a *AutomateConfig) Redacted() *PrivateAutomateConfig

func (*AutomateConfig) Test

func (a *AutomateConfig) Test() error

func (*AutomateConfig) TestURL

func (a *AutomateConfig) TestURL() (*url.URL, error)

func (*AutomateConfig) WithPrivate

func (a *AutomateConfig) WithPrivate() *PrivateAutomateConfig

type CLIIO

type CLIIO struct {
	EnableVerbose bool
}

type CiMetadata

type CiMetadata struct {
	CiJobURL string `json:"ci_job_url"`
	CiJobID  string `json:"ci_job_id"`
}

func (*CiMetadata) ReadBuildkiteMetadata

func (c *CiMetadata) ReadBuildkiteMetadata()

func (*CiMetadata) ReadCIMetadata

func (c *CiMetadata) ReadCIMetadata()

func (*CiMetadata) ReadDefaultCiMetadata

func (c *CiMetadata) ReadDefaultCiMetadata()

func (*CiMetadata) ReadJenkinsMetadata

func (c *CiMetadata) ReadJenkinsMetadata()

type Config

type Config struct {
	Automate *AutomateConfig `toml:"automate"`
}

func (*Config) ApplyValuesFrom

func (c *Config) ApplyValuesFrom(other *Config)

func (*Config) ApplyValuesFromEnv

func (c *Config) ApplyValuesFromEnv()

func (*Config) IsAutomateCollectorConfig

func (c *Config) IsAutomateCollectorConfig() bool

func (*Config) Redacted

func (c *Config) Redacted() *PrivateConfig

func (*Config) WithPrivate

func (c *Config) WithPrivate() *PrivateConfig

func (*Config) WriteRepoConfigFiles

func (c *Config) WriteRepoConfigFiles() error

func (*Config) WriteUserConfigFiles

func (c *Config) WriteUserConfigFiles() error

type ConfigLoader

type ConfigLoader struct {
	RepoConfigPath        string
	RepoPrivateConfigPath string
	UserConfigPath        string
	SystemConfigPath      string
	LoadedConfig          *Config
}

func NewConfigLoader

func NewConfigLoader() *ConfigLoader

func (*ConfigLoader) Load

func (l *ConfigLoader) Load() error

func (*ConfigLoader) ViableConfigPaths

func (l *ConfigLoader) ViableConfigPaths() []string

type PolicyfileLock

type PolicyfileLock struct {
	PolicyName       string `json:"name"`
	PolicyRevisionID string `json:"revision_id"`
}

type PrivateAutomateConfig

type PrivateAutomateConfig struct {
	*AutomateConfig
	AuthToken   string `toml:"auth_token"`
	InsecureTLS bool   `toml:"insecure_tls"`
}

func (*PrivateAutomateConfig) ToConfig

func (p *PrivateAutomateConfig) ToConfig() *AutomateConfig

type PrivateConfig

type PrivateConfig struct {
	Automate *PrivateAutomateConfig `toml:"automate"`
}

func (*PrivateConfig) IsAutomateCollectorConfig

func (p *PrivateConfig) IsAutomateCollectorConfig() bool

func (*PrivateConfig) ToConfig

func (p *PrivateConfig) ToConfig() *Config

type RolloutMetadata

type RolloutMetadata struct {
	PolicyName       string `json:"policy_name"`
	PolicyNodeGroup  string `json:"policy_node_group"`
	PolicyRevisionID string `json:"policy_revision_id"`
	PolicyDomainURL  string `json:"policy_domain_url"`
	Description      string `json:"description"`
	SCMMetadata
	CiMetadata
	// contains filtered or unexported fields
}

func (*RolloutMetadata) ReadPolicyfileMetadata

func (r *RolloutMetadata) ReadPolicyfileMetadata() error

type SCMMetadata

type SCMMetadata struct {
	SCMType                string `json:"scm_type"`
	SCMWebType             string `json:"scm_web_type"`
	PolicySCMURL           string `json:"policy_scm_url"`
	PolicySCMWebURL        string `json:"policy_scm_web_url"`
	PolicySCMCommit        string `json:"policy_scm_commit"`
	PolicySCMCommitMessage string `json:"policy_scm_commit_message"`
	SCMAuthorName          string `json:"scm_author_name"`
	SCMAuthorEmail         string `json:"scm_author_email"`
	// contains filtered or unexported fields
}

func (*SCMMetadata) ReadGitMetadata

func (s *SCMMetadata) ReadGitMetadata() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL