steplibrary

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetAllStepIDs(ctx context.Context) ([]string, error)
	GetLatestStepVersions(ctx context.Context, id string) (steplibindex.LatestPointer, error)
	// GetAllStepVersions returns all available versions of a step.
	// Mirrors `index/steps/<id>/versions.json` from the V2 inventory layout.
	GetAllStepVersions(ctx context.Context, id string) ([]string, error)
	// GetStepGroupInfo returns version-independent step metadata
	// (maintainer, deprecation, asset URLs). Mirrors `steps/<id>/step-info.json`.
	GetStepGroupInfo(ctx context.Context, id string) (steplibindex.StepInfo, error)
	// GetStepModel fetches the V2 per-version step manifest (mirrors
	// `steps/<id>/<version>/step.json`, which serializes models.StepModel).
	GetStepModel(ctx context.Context, step ResolvedStepVersion) (models.StepModel, error)
}

type ActivateOutputPaths

type ActivateOutputPaths struct {
	YMLPath, CodePath string
}

type ActivatedStep

type ActivatedStep struct {
	StepInfo models.StepInfoModel

	StepYMLPath string

	ActivationType ActivationType

	// ExecutablePath is a local path to the main entrypoint of the step, ready for execution.
	// This can be an empty string if:
	// - step was activated from a git reference (we checked out the source dir directly)
	// - step was activated from a local path (we copied the source dir directly)
	// - step was activated from a steplib reference, but step.yml has no entry for pre-compiled binaries (we fallback to source checkout)
	// - step was activated from a steplib reference, but step.yml has no pre-compiled binary for the current OS+arch combo (we fallback to source checkout)
	ExecutablePath string

	// DidStepLibUpdate indicates that the local steplib cache was updated while resolving the exact step version.
	// TODO: this is a leaky abstraction and we shouldn't signal this here, but it requires a bigger refactor.
	// (stepman should keep track of this info in a file probably)
	DidStepLibUpdate bool
}

type ActivationType

type ActivationType string
const (
	ActivationTypeSteplibExecutable ActivationType = "steplib_executable"
	ActivationTypeSteplibSource     ActivationType = "steplib_source"
	ActivationTypePathRef           ActivationType = "path"
	ActivationTypeGitRef            ActivationType = "git"
)

type Client

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

func New

func New(log stepman.Logger, steplibURI, inventoryURL string, fileManager fileutil.FileManager) *Client

New builds a Client. steplibURI is the steplib identity; inventoryURL is the base URL the V2 inventory JSON is fetched from.

func (*Client) Activate

func (c *Client) Activate(ctx context.Context, stepID, version string, outputPaths ActivateOutputPaths) (ActivatedStep, error)

type HTTPAPI

type HTTPAPI struct {
	BaseURL string
	Fetcher httpfetch.Client
}

HTTPAPI fetches the V2 inventory (step_ids/latest/versions/step-info/step.json) over HTTP from a base URL.

func NewHTTPAPI

func NewHTTPAPI(baseURL string, fetcher httpfetch.Client) *HTTPAPI

func (*HTTPAPI) GetAllStepIDs

func (h *HTTPAPI) GetAllStepIDs(ctx context.Context) ([]string, error)

func (*HTTPAPI) GetAllStepVersions

func (h *HTTPAPI) GetAllStepVersions(ctx context.Context, id string) ([]string, error)

func (*HTTPAPI) GetLatestStepVersions

func (h *HTTPAPI) GetLatestStepVersions(ctx context.Context, id string) (steplibindex.LatestPointer, error)

func (*HTTPAPI) GetStepGroupInfo

func (h *HTTPAPI) GetStepGroupInfo(ctx context.Context, id string) (steplibindex.StepInfo, error)

func (*HTTPAPI) GetStepModel

func (h *HTTPAPI) GetStepModel(ctx context.Context, step ResolvedStepVersion) (models.StepModel, error)

type ResolvedStepVersion

type ResolvedStepVersion struct {
	ID, Version string
}

Directories

Path Synopsis
Package indexgen generates the V2 step library inventory tree from a bitrise-steplib source.
Package indexgen generates the V2 step library inventory tree from a bitrise-steplib source.
Package steplibindex defines the Go types for the V2 step library inventory wire format.
Package steplibindex defines the Go types for the V2 step library inventory wire format.

Jump to

Keyboard shortcuts

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