pkg

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFlags

func AddFlags(cmd *cobra.Command)

func IPAllowlistHandler

func IPAllowlistHandler(handler http.Handler, allowed []*net.IPNet) http.Handler

func InstrumentHandler

func InstrumentHandler(handler http.Handler) http.Handler

func ParseCIDRs

func ParseCIDRs(inputs []string) []*net.IPNet

func SecretKeyHandler

func SecretKeyHandler(handler http.Handler, name string, key string) http.Handler

Types

type Config

type Config struct {
	ListenAddr string   `mapstructure:"listen_address" hcl:"listen_address,optional"`
	LogLevel   string   `hcl:"log_level,optional"`
	AllowedIPs []string `hcl:"allowed_ips,optional"`
	SecretKey  string   `hcl:"secret_key,optional"`
	ArgoToken  string   `hcl:"argocd_token"`
	ArgoUrl    string   `hcl:"argocd_url"`

	Repositories []RepositoryConfig `hcl:"repository,block"`
	Deployments  []DeploymentConfig `hcl:"deployment,block"`
}

func LoadConfig

func LoadConfig(configPath string, flags *pflag.FlagSet) (Config, error)

type Deployment

type Deployment struct {
	Name            string
	RepositoryName  string
	KustomizePath   string
	CommitMessage   *template.Template
	Images          []string
	ApplicationName string
}

func NewDeployment

func NewDeployment(cfg DeploymentConfig) (*Deployment, error)

func (Deployment) Apply

func (d Deployment) Apply(worktree *git.Worktree, newTag string, user string) (string, error)

type DeploymentConfig

type DeploymentConfig struct {
	Name          string   `hcl:"name,label"`
	Repository    string   `hcl:"repository"`
	Path          string   `hcl:"path,optional"`
	Images        []string `hcl:"image"`
	CommitMessage string   `hcl:"message,optional"`
	ArgoName      string   `hcl:"argocd_app,optional"`
}

type Repository

type Repository struct {
	Mutex sync.Mutex
	// contains filtered or unexported fields
}

func NewRepository

func NewRepository(cfg RepositoryConfig) *Repository

func (*Repository) Discard

func (r *Repository) Discard()

func (*Repository) Fetch

func (r *Repository) Fetch(ctx context.Context) (error, string)

func (*Repository) Push

func (r *Repository) Push(ctx context.Context) (error, string)

func (*Repository) Worktree

func (r *Repository) Worktree() (*git.Worktree, error)

type RepositoryConfig

type RepositoryConfig struct {
	Name string `hcl:"name,label"`

	Url      string `hcl:"url"`
	Branch   string `hcl:"branch,optional"`
	Username string `hcl:"username"`
	Password string `hcl:"password"`

	CommitterName  string `hcl:"committer_name"`
	CommitterEmail string `hcl:"committer_email"`
}

type WebhookServer

type WebhookServer struct {
	http.Server
	// contains filtered or unexported fields
}

func NewServer

func NewServer(cfg Config) *WebhookServer

func (*WebhookServer) ServeHTTP

func (s *WebhookServer) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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