Documentation
¶
Index ¶
- Constants
- func ExecuteCommand(ctx context.Context, in string, opts ...pluginx.ExecuteCommandMutation) (string, error)
- func NewExecutor(cache *bigcache.BigCache, ver string) executor.Executor
- type Author
- type Config
- type DiffCommand
- type Executor
- type GitHubCmdService
- type GitHubCommand
- type GlobalCommandFlags
- type KustomizationCommandAliases
- type KustomizationDiffCommand
- type KustomizationDiffCommandFlags
- type KustomizeDiffCmdService
- type PRDetails
Constants ¶
const (
PluginName = "flux"
)
Variables ¶
This section is empty.
Functions ¶
func ExecuteCommand ¶
func ExecuteCommand(ctx context.Context, in string, opts ...pluginx.ExecuteCommandMutation) (string, error)
ExecuteCommand is a syntax sugar for running CLI commands.
Types ¶
type Config ¶
type Config struct {
Logger config.Logger `yaml:"log"`
GitHub struct {
Auth struct {
// The GitHub access token.
// Instruction for creating a token can be found here: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/#creating-a-token.
// When not provided some functionality may not work. For example, adding a comment under pull request.
AccessToken string `yaml:"accessToken"`
} `yaml:"auth"`
} `yaml:"github"`
// Fields not exposed to the user in the JSON schema
TmpDir pluginx.TmpDir `yaml:"tmpDir"`
}
Config holds Flux executor configuration.
type DiffCommand ¶
type DiffCommand struct {
KustomizationCommandAliases
GitHub *struct {
Comment *struct {
URL string `arg:"--url"`
ArtifactID string `arg:"--cache-id"`
} `arg:"subcommand:comment"`
} `arg:"subcommand:gh"`
Artifact *struct {
Tool []string `arg:"positional"`
} `arg:"subcommand:artifact"`
}
DiffCommand holds diff sub-commands. We use it to customize the execution process.
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor provides functionality for running Flux.
func (*Executor) Execute ¶
func (d *Executor) Execute(ctx context.Context, in executor.ExecuteInput) (executor.ExecuteOutput, error)
Execute returns a given command as a response.
type GitHubCmdService ¶
type GitHubCmdService struct {
// contains filtered or unexported fields
}
func NewGitHubCmdService ¶
func NewGitHubCmdService(log logrus.FieldLogger) *GitHubCmdService
func (*GitHubCmdService) Run ¶
func (k *GitHubCmdService) Run(ctx context.Context, diffCmd *GitHubCommand, cfg Config, opts ...pluginx.ExecuteCommandMutation) (executor.ExecuteOutput, error)
func (*GitHubCmdService) ShouldHandle ¶
func (k *GitHubCmdService) ShouldHandle(command string) (*GitHubCommand, bool)
type GitHubCommand ¶
type GitHubCommand struct {
Command []string `arg:"positional"`
}
type GlobalCommandFlags ¶
type GlobalCommandFlags struct {
CacheDir string `arg:"--cache-dir"`
DisableCompression bool `arg:"--disable-compression"`
InsecureSkipTLSVerify bool `arg:"--insecure-skip-tls-verify"`
KubeAPIBurst int `arg:"--kube-api-burst"`
KubeAPIQPS float32 `arg:"--kube-api-qps"`
Namespace string `arg:"-n,--namespace"`
Timeout time.Duration `arg:"--timeout"`
Token string `arg:"--token"`
Verbose bool `arg:"--verbose"`
}
func (GlobalCommandFlags) ToString ¶
func (g GlobalCommandFlags) ToString() string
type KustomizationCommandAliases ¶
type KustomizationCommandAliases struct {
Kustomization *KustomizationDiffCommand `arg:"subcommand:kustomization"`
Ks *KustomizationDiffCommand `arg:"subcommand:ks"`
}
KustomizationCommandAliases holds different names for kustomization subcommand. Unfortunately, it's a go-arg limitation that we cannot on a single entry have subcommand aliases.
func (KustomizationCommandAliases) Get ¶
func (u KustomizationCommandAliases) Get() *KustomizationDiffCommand
Get returns HistoryCommand that were unpacked based on the alias used by user.
type KustomizationDiffCommand ¶
type KustomizationDiffCommand struct {
AppName string `arg:"positional"`
KustomizationDiffCommandFlags
GlobalCommandFlags
}
func (KustomizationDiffCommand) ToCmdString ¶
func (k KustomizationDiffCommand) ToCmdString() string
type KustomizationDiffCommandFlags ¶
type KustomizationDiffCommandFlags struct {
IgnorePaths []string `arg:"--ignore-paths,separate"`
KustomizationFile string `arg:"--kustomization-file"`
Path string `arg:"--path"`
ProgressBar bool `arg:"--progress-bar"`
GitHubRef string `arg:"--github-ref"`
}
func (KustomizationDiffCommandFlags) ToString ¶
func (k KustomizationDiffCommandFlags) ToString() string
type KustomizeDiffCmdService ¶
type KustomizeDiffCmdService struct {
// contains filtered or unexported fields
}
KustomizeDiffCmdService provides functionality to run the flux diff kustomization process with Botkube related enhancements such as GitHub integration.
func NewKustomizeDiffCmdService ¶
func NewKustomizeDiffCmdService(cache *bigcache.BigCache, log logrus.FieldLogger) *KustomizeDiffCmdService
NewKustomizeDiffCmdService returns a new KustomizeDiffCmdService instance.
func (*KustomizeDiffCmdService) Run ¶
func (k *KustomizeDiffCmdService) Run(ctx context.Context, diffCmd *DiffCommand, kubeConfigPath string, kubeConfigBytes []byte, cfg Config) (executor.ExecuteOutput, error)
Run consumes the output of ShouldHandle method and runs specified command.
func (*KustomizeDiffCmdService) ShouldHandle ¶
func (k *KustomizeDiffCmdService) ShouldHandle(command string) (*DiffCommand, bool)
ShouldHandle returns true if commands should be handled by this service.