ghasum

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package ghasum provides functionality for working with and manipulating gha.sum files.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInitialized is the error used when ghasum is not expected to be
	// initialized but is.
	ErrInitialized = errors.New("ghasum is already initialized")

	// ErrNotInitialized is the error used when ghasum is expected to be
	// initialized but is not.
	ErrNotInitialized = errors.New("ghasum has not yet been initialized")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be created.
	ErrSumfileCreate = errors.New("could not create a checksum file")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be encoded.
	ErrSumfileEncode = errors.New("could not encode the checksum file")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be opened.
	ErrSumfileOpen = errors.New("could not open the checksum file")

	// ErrNotInitialized is the error used when a ghasum checksum file could not
	// be decoded.
	ErrSumfileDecode = errors.New("could not decode the checksum file")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be read.
	ErrSumfileRead = errors.New("could not read from the checksum file")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be removed.
	ErrSumfileRemove = errors.New("could not remove the checksum file")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be unlocked after usage.
	ErrSumfileUnlock = errors.New("could not unlock the checksum file")

	// ErrNotInitialized is the error used when the ghasum checksum file could not
	// be written to.
	ErrSumfileWrite = errors.New("could not write to the checksum file")
)

Functions

func Initialize

func Initialize(cfg *Config) error

Initialize will initialize ghasum for the repository specified in the given configuration.

func Update

func Update(cfg *Config, force bool) error

Update will update the ghasum checksums for the repository specified in the given configuration.

Types

type Config

type Config struct {
	// Repo is a pointer to the file system hierarchy of the target repository
	// for the operation.
	Repo fs.FS

	// Path is the absolute or relate path to the target repository for the
	// operation.
	//
	// This must be provided in addition to Repo because that does not allow for
	// non-read file system operation.
	Path string

	// Workflow is the file path (relative to Path) of the workflow that is the
	// subject of the operation. If this has the zero value all workflows in the
	// Repo will collectively be the subject of the operation instead.
	Workflow string

	// Job is the id (also known as key) of the job that is the subject of the
	// operation. If this has the zero value all jobs in the Workflow will
	// collectively be the subject of the operation instead. (If Workflow has
	// the zero value this value is ignored.)
	Job string

	// Cache is the cache that should be used for the operation.
	Cache cache.Cache
}

Config is the configuration for a ghasum operation.

type Problem

type Problem string

Problem represents an issue detected when verifying ghasum checksums.

func Verify

func Verify(cfg *Config) ([]Problem, error)

Verify will compare the stored ghasum checksums against recomputed checksums for the repository specified in the given configuration.

Verification report checksums that do not match and checksums that are missing. It does not report checksums that are not used.

Jump to

Keyboard shortcuts

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