source

package
v0.4.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package source fetches the code that becomes a deployment from wherever it lives. A deployment used to require compose content in hand; a Provider turns a Descriptor (a git URL, an upload token, a webhook delivery) into a directory on disk. Providers register behind one interface so a new source is an added registration, not a change to the deploy flow, and no single source (git today) is special.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Username string
	Token    string
}

Auth is credential material a provider needs to reach a private source.

type Descriptor

type Descriptor struct {
	Type   string
	Ref    string
	Params map[string]string
	Auth   *Auth
}

Descriptor names a source and how to reach it. Params carries provider-specific options (branch, subpath, ...). Auth is resolved by the caller from the credential manager, so a provider never sees a raw credential id and the package stays free of any credential-store dependency.

type GitProvider

type GitProvider struct{}

GitProvider fetches a source by shallow-cloning a git repository. It shells out to the git binary rather than embedding a git implementation, matching how the agent already drives docker and nftables.

func (GitProvider) Fetch

func (GitProvider) Fetch(ctx context.Context, d Descriptor, destDir string, log func(string)) (*Result, error)

Fetch shallow-clones d.Ref into destDir. A branch and a subpath within the repository are honoured through d.Params. Private repositories authenticate with d.Auth, injected into the clone URL. The .git directory is removed so the deployment stays a plain directory of files with no VCS metadata.

func (GitProvider) Type

func (GitProvider) Type() string

type Provider

type Provider interface {
	Type() string
	Fetch(ctx context.Context, d Descriptor, destDir string, log func(string)) (*Result, error)
}

Provider fetches a source into destDir. log, when non-nil, receives progress lines (a provider must not send secrets through it). destDir is the provider's to populate; the caller owns creating and cleaning up its parent.

type Registry

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

Registry resolves a source type to its provider.

func NewRegistry

func NewRegistry(providers ...Provider) *Registry

NewRegistry indexes the providers by their Type(). A later registration for the same type wins, which keeps the call site a plain list.

func (*Registry) Get

func (r *Registry) Get(typ string) (Provider, bool)

Get returns the provider for a source type, or false when none is registered.

func (*Registry) Types

func (r *Registry) Types() []string

Types lists the registered source types.

type Result

type Result struct {
	Dir      string
	Revision string
}

Result reports where the fetched source landed and which revision it was, so the caller can find the compose file and record provenance.

Jump to

Keyboard shortcuts

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