glu

package module
v0.0.1-prerelease5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

README

Stu - The Glu mascot

Glu

Progressive delivery that sticks

Glu is the missing piece in your CI/CD toolbelt. It is a framework for orchestrating, manipulating and introspecting the state of configuration Git repositories.


What Is It?

Glu is a framework built to enable you to implement your own custom pipelines in code.

Glu has an opinionated set of models and abstractions, which when combined, allow you to build consistent command-line and server processes for orchestrating the progression of applications and configuration across target environments.

Whats Included

  • A CLI for interacting with the state of your pipelines.
  • An API for interacting with the state of your pipelines.
  • An optional UI for visualizing and interacting with the state of your pipelines.

Use Cases

Use it to implement anything that involes automating updates to Git repositories via commits and pull-requests.

  • ✅ Track new versions of applications in source repositories (OCI, Helm etc) and trigger updates to target configuration repositories (Git).
  • ⌛️ Coordinate any combination of scheduled, event driven or manually triggered promotions from one environment to the next.
  • 🔍 Expose a single pane of glass to compare and manipulate the state of your resources in one environment to the next.
  • 🗓️ Export standardized telemetry which ties together your entire end-to-end CI/CD and promotion pipeline sequence of events.

Development

See DEVELOPMENT.md for more information.

Roadmap Ideas

In the future we plan to support more functionality, such as:

  • New sources:
    • Helm
    • Webhook / API
    • Kubernetes (direct to cluster)
  • Progressive delivery (think Kargo / Argo Rollouts)
    • Ability to guard promotion with condition checks on resource status
    • Expose status via Go function definitions on resource types
  • Pinning, history and rollback
    • Ability to view past states for phases
    • Be able to pin phases to current or manually overridden states
    • Rollback phases to previous known states

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Annotation

func Annotation(k, v string) containers.Option[Metadata]

Annotation returns a functional option for Metadata which sets a single annotation k/v pair on the provided Metadata

func Label

func Label(k, v string) containers.Option[Metadata]

Label returns a functional option for Metadata which sets a single label k/v pair on the provided Metadata

func WithUI

func WithUI(ui fs.FS) containers.Option[System]

WithUI configures the provided fs.FS implementation to be served as the filesystem mounted on the root path in the API

glu.NewSystem(ctx, glu.Name("mysystem"), glu.WithUI(ui.FS())) see: github.com/get-glu/glu/tree/main/ui sub-module for the pre-built default UI.

Types

type Config

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

Config is a utility for extracting configured sources by their name derived from glu's conventional configuration format.

func (*Config) GetCredential

func (c *Config) GetCredential(name string) (*credentials.Credential, error)

GetCredential delegates to an underlying credential source built using the same underlying credential configuration.

func (*Config) GitRepository

func (c *Config) GitRepository(ctx context.Context, name string) (_ *git.Repository, proposer srcgit.Proposer, err error)

GitRepository constructs and configures an instance of a *git.Repository using the name to lookup the relevant configuration. It caches built instances and returns the same instance for subsequent calls with the same name.

func (*Config) OCIRepository

func (c *Config) OCIRepository(name string) (_ *oci.Repository, err error)

OCIRepository constructs and configures an instance of a *oci.Repository using the name to lookup the relevant configuration. It caches built instances and returns the same instance for subsequent calls with the same name.

type Metadata

type Metadata = core.Metadata

Metadata is an alias for the core Metadata structure (see core.Metadata)

func Name

func Name(name string, opts ...containers.Option[Metadata]) Metadata

Name is a utility for quickly creating an instance of Metadata with a name (required) and optional labels / annotations

type Phase

type Phase = core.Phase

Phase is an alias for the core Phase interface (see core.Phase)

type Pipeline

type Pipeline = core.Pipeline

Pipeline is an alias for the core Pipeline interface (see core.Pipeline)

type Pipelines

type Pipelines interface {
	Pipelines() iter.Seq2[string, core.Pipeline]
}

Pipelines is a type which can list a set of configured name/Pipeline pairs.

type Resource

type Resource = core.Resource

Resource is an alias for the core Resource interface (see core.Resource)

type ResourcePipeline

type ResourcePipeline[R Resource] struct {
	// contains filtered or unexported fields
}

ResourcePipeline is a collection of phases for a given resource type R. It implements the core.Phase interface and is scoped to a single Resource implementation.

func NewPipeline

func NewPipeline[R Resource](meta Metadata, newFn func() R) *ResourcePipeline[R]

NewPipeline constructs and configures a new instance of *ResourcePipeline[R]

func (*ResourcePipeline[R]) Add

Add will add the provided resource phase to the pipeline along with configuring any dependent promotion source phases if configured to do so.

func (*ResourcePipeline[R]) Dependencies

func (p *ResourcePipeline[R]) Dependencies() map[Phase]Phase

Dependencies returns a map of Phase to Phase. This map contains mappings of Phases to their dependent promotion source Phase (if configured).

func (*ResourcePipeline[R]) Metadata

func (p *ResourcePipeline[R]) Metadata() Metadata

Metadata returns the metadata assocated with the Pipelines (name and labels).

func (*ResourcePipeline[R]) New

func (p *ResourcePipeline[R]) New() R

New calls the functions underlying resource constructor function to get a new default instance of the resource.

func (*ResourcePipeline[R]) PhaseByName

func (p *ResourcePipeline[R]) PhaseByName(name string) (Phase, error)

PhaseByName returns the Phase (if it exists) with a matching name.

func (*ResourcePipeline[R]) Phases

func (p *ResourcePipeline[R]) Phases(opts ...containers.Option[core.PhaseOptions]) iter.Seq[Phase]

Phases lists all phases in the pipeline with optional predicates.

func (*ResourcePipeline[R]) PromotedFrom

func (p *ResourcePipeline[R]) PromotedFrom(c core.ResourcePhase[R]) (core.ResourcePhase[R], bool)

PromotedFrom returns the phase which c is configured to promote from (get dependent phase).

type Server

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

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type System

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

System is the primary entrypoint for build a set of Glu pipelines. It supports functions for adding new pipelines, registering triggers running the API server and handly command-line inputs.

func NewSystem

func NewSystem(ctx context.Context, meta Metadata, opts ...containers.Option[System]) *System

NewSystem constructs and configures a new system with the provided metadata.

func (*System) AddPipeline

func (s *System) AddPipeline(fn func(context.Context, *Config) (core.Pipeline, error)) *System

AddPipeline invokes a pipeline builder function provided by the caller. The function is provided with the systems configuration and (if successful) the system registers the resulting pipeline.

func (*System) AddTrigger

func (s *System) AddTrigger(trigger Trigger) *System

AddTrigger registers a Trigger to run when the system is invoked in server mode.

func (*System) GetPipeline

func (s *System) GetPipeline(name string) (core.Pipeline, error)

GetPipeline returns a pipeline by name.

func (*System) Pipelines

func (s *System) Pipelines() iter.Seq2[string, core.Pipeline]

Pipelines returns an iterator across all name and pipeline pairs previously registered on the system.

func (*System) Run

func (s *System) Run() error

Run invokes or serves the entire system. Given command-line arguments are provided then the system is run as a CLI. Otherwise, the system runs in server mode, which means that: - The API is hosted on the configured port - Triggers are setup (schedules etc.)

type Trigger

type Trigger interface {
	Run(context.Context, Pipelines)
}

Trigger is a type with a blocking function run which can trigger calls to promote phases in a set of pipelines.

Directories

Path Synopsis
internal
git
oci
pkg
cli
fs
ui module

Jump to

Keyboard shortcuts

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