flux

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
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.

func NewExecutor

func NewExecutor(cache *bigcache.BigCache, ver string) executor.Executor

NewExecutor returns a new Executor instance.

Types

type Author

type Author struct {
	ID    string `json:"id,omitempty"`
	IsBot bool   `json:"is_bot,omitempty"`
	Login string `json:"login,omitempty"`
	Name  string `json:"name,omitempty"`
}

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

Execute returns a given command as a response.

func (*Executor) Help

func (d *Executor) Help(context.Context) (api.Message, error)

Help returns help message

func (*Executor) Metadata

func (d *Executor) Metadata(context.Context) (api.MetadataOutput, error)

Metadata returns details about the Flux plugin.

type GitHubCmdService

type GitHubCmdService struct {
	// contains filtered or unexported fields
}

func NewGitHubCmdService

func NewGitHubCmdService(log logrus.FieldLogger) *GitHubCmdService

func (*GitHubCmdService) Run

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

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

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.

type PRDetails

type PRDetails struct {
	Author Author `json:"author,omitempty"`
	State  string `json:"state,omitempty"`
	URL    string `json:"url,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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