dependency

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const HivePrefix = "__hive__/"

HivePrefix is the Dockerfile image reference prefix used to denote project-local hive dependencies.

Variables

This section is empty.

Functions

This section is empty.

Types

type Graph

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

Graph represents a dependency graph of container images. Edges encode "from depends on to", meaning "to" must be built before "from".

func BuildDependencyGraph

func BuildDependencyGraph(scannedGraph *Graph, project *model.ContainerHiveProject) (*Graph, error)

BuildDependencyGraph merges a scanned dependency graph (from Dockerfile analysis) with explicit depends_on declarations from image configs.

func NewGraph

func NewGraph() *Graph

NewGraph creates an empty dependency graph.

func ScanProjectSource

func ScanProjectSource(project *model.ContainerHiveProject) *Graph

ScanProjectSource scans source Dockerfiles from the project model for __hive__/ references and builds a dependency graph. This is used by CI template generation where the rendered dist directory may not exist yet.

func ScanRenderedProject

func ScanRenderedProject(distPath string) (*Graph, error)

ScanRenderedProject scans all Dockerfiles in a rendered dist directory and builds a dependency graph based on __hive__/ references.

func (*Graph) AddDependency

func (g *Graph) AddDependency(from, to string)

AddDependency records that "from" depends on "to", meaning "to" must be built before "from".

func (*Graph) AddImage

func (g *Graph) AddImage(name string)

AddImage registers an image name as a node in the graph.

func (*Graph) Dependencies

func (g *Graph) Dependencies(name string) []string

Dependencies returns the list of images that the given image depends on.

func (*Graph) Dependents

func (g *Graph) Dependents(name string) []string

Dependents returns the list of images that depend on the given image.

func (*Graph) HasDependencies

func (g *Graph) HasDependencies() bool

HasDependencies returns true if any dependency edges exist in the graph.

func (*Graph) TopologicalSort

func (g *Graph) TopologicalSort() ([]string, error)

TopologicalSort returns a build order where dependencies come first. It uses Kahn's algorithm and returns an error if a cycle is detected.

type HiveRef

type HiveRef struct {
	ImageName string
	Tag       string
}

HiveRef represents a reference to a project-local image via the __hive__/ prefix.

func ScanDockerfileForHiveRefs

func ScanDockerfileForHiveRefs(dockerfilePath string) ([]HiveRef, error)

ScanDockerfileForHiveRefs scans a Dockerfile for FROM __hive__/<name>:<tag> references.

Jump to

Keyboard shortcuts

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