artifacts

package
v0.91.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const EnvWorkflowDonFamily = "CRE_DON_FAMILY"

EnvWorkflowDonFamily is the env name for CRE.don_family in CLD config; ApplyDeployDefaults takes cfg.CRE instead.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactsResolver

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

ArtifactsResolver resolves workflow WASM and config paths from BinarySource and ConfigSource via local files or remote fetch.

func NewArtifactsResolver

func NewArtifactsResolver(workDir string, opts ...ArtifactsResolverOption) (*ArtifactsResolver, error)

NewArtifactsResolver returns a resolver for workDir (non-empty after trim). for Github release assets, the resolver uses the GitHub API to fetch release info and download assets using GITHUB_TOKEN/GH_TOKEN env vars (github_http.go).

func (*ArtifactsResolver) ResolveBinary

func (r *ArtifactsResolver) ResolveBinary(ctx context.Context, src BinarySource) (string, error)

ResolveBinary resolves a .wasm path.

func (*ArtifactsResolver) ResolveConfig

func (r *ArtifactsResolver) ResolveConfig(ctx context.Context, src ConfigSource) (string, error)

ResolveConfig resolves a config file path.

func (*ArtifactsResolver) WorkDir

func (r *ArtifactsResolver) WorkDir() string

WorkDir returns the directory used for downloads and temp artifacts. Callers may pass it to os.RemoveAll after use.

type ArtifactsResolverOption

type ArtifactsResolverOption func(*ArtifactsResolver)

ArtifactsResolverOption configures NewArtifactsResolver.

func WithHTTPClient

func WithHTTPClient(c *http.Client) ArtifactsResolverOption

WithHTTPClient sets the HTTP client for remote artifact fetches. When omitted, http.DefaultClient is used

type BinarySource

type BinarySource struct {
	ExternalRef *externalBinaryRef `json:"externalRef,omitempty" yaml:"externalRef,omitempty"`
	LocalPath   string             `json:"localPath,omitempty" yaml:"localPath,omitempty"`
}

BinarySource is either a local path to an existing WASM file or an external reference. Create via NewBinarySourceLocal, NewBinarySourceURL, or NewBinarySourceGitHubRelease, or unmarshal from JSON/YAML and call BinarySource.Validate.

func NewBinarySourceGitHubRelease

func NewBinarySourceGitHubRelease(repo, releaseTag, assetName, sha256 string) (BinarySource, error)

NewBinarySourceGitHubRelease returns a validated BinarySource for a GitHub release asset.

func NewBinarySourceLocal

func NewBinarySourceLocal(localPath string) BinarySource

NewBinarySourceLocal returns a BinarySource for a local .wasm file at localPath.

func NewBinarySourceURL

func NewBinarySourceURL(rawURL, sha256 string) (BinarySource, error)

NewBinarySourceURL returns a validated BinarySource for a direct URL download with SHA-256 verification.

func (*BinarySource) IsExternal

func (b *BinarySource) IsExternal() bool

IsExternal reports whether the binary source uses an external reference.

func (*BinarySource) IsLocal

func (b *BinarySource) IsLocal() bool

IsLocal reports whether the binary source is a local filesystem path.

func (*BinarySource) Validate

func (b *BinarySource) Validate() error

Validate trims LocalPath and checks that exactly one of local path or external ref is set.

type ConfigSource

type ConfigSource struct {
	ExternalRef *externalConfigRef `json:"externalRef,omitempty" yaml:"externalRef,omitempty"`
	LocalPath   string             `json:"localPath,omitempty" yaml:"localPath,omitempty"`
}

ConfigSource is either a local config file or an external reference. Create via NewConfigSourceLocal, NewConfigSourceURL, or NewConfigSourceGitHub, or unmarshal from JSON/YAML and call ConfigSource.Validate.

func NewConfigSourceGitHub

func NewConfigSourceGitHub(repo, ref, path string) (ConfigSource, error)

NewConfigSourceGitHub returns a validated ConfigSource for a GitHub file via the Contents API.

func NewConfigSourceLocal

func NewConfigSourceLocal(localPath string) ConfigSource

NewConfigSourceLocal returns a ConfigSource for a local config file at localPath.

func NewConfigSourceURL

func NewConfigSourceURL(rawURL string) (ConfigSource, error)

NewConfigSourceURL returns a validated ConfigSource for a direct URL download.

func (*ConfigSource) IsExternal

func (c *ConfigSource) IsExternal() bool

IsExternal reports whether the config source uses an external reference.

func (*ConfigSource) IsLocal

func (c *ConfigSource) IsLocal() bool

IsLocal reports whether the config source is a local filesystem path.

func (*ConfigSource) Validate

func (c *ConfigSource) Validate() error

Validate trims LocalPath and checks that exactly one of local path or external ref is set.

type WorkflowBundle

type WorkflowBundle struct {
	WorkflowName string       `json:"workflowName" yaml:"workflowName"`
	Binary       BinarySource `json:"binary" yaml:"binary"`
	Config       ConfigSource `json:"config" yaml:"config"`
	DonFamily    string       `json:"donFamily,omitempty" yaml:"donFamily,omitempty"`
}

WorkflowBundle describes workflow deploy inputs: pre-built WASM and config.

func (*WorkflowBundle) ApplyDeployDefaults

func (w *WorkflowBundle) ApplyDeployDefaults(cre cfgenv.CREConfig)

ApplyDeployDefaults sets DonFamily from cre when empty. No-op if w is nil.

func (*WorkflowBundle) Validate

func (w *WorkflowBundle) Validate() error

Validate trims string fields and validates the workflow bundle.

Jump to

Keyboard shortcuts

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