packages

package
v0.35.4 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2023 License: Apache-2.0 Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package packages provides abstract tools for managing a packaged release.

Package packages provides abstract tools for managing a packaged release.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleRelease

func HandleRelease(ctx context.Context, base string, client *http.Client, p Package, r Release, allReleases map[string][]Release) error

HandleRelease processes the files for a given release of the specified Package.

func ReadConfig

func ReadConfig(path string) (retval map[string]*Package, err error)

ReadConfig reads a set of Packages (as a map from package name to package configuration) from a yaml file a the selected path

Types

type Asset

type Asset struct {
	Name string
	URL  string
	// contains filtered or unexported fields
}

Asset provides an abstract interface for describing a resource which should be stored on the disk.

func CollectReleaseAssets

func CollectReleaseAssets(p Package, r Release, allReleases map[string][]Release) []Asset

func (Asset) Less

func (a Asset) Less(b Asset) bool

Less provides a method for implementing `sort.Slice` to ensure that assets are applied in the correct order.

type AssetFilter

type AssetFilter struct {
	// IncludeArtifacts is a set of regep patterns to select which artifacts
	// from a release should be downloaded and included. If no IncludeArtifacts
	// are supplied, all files from the release will be included.
	IncludeArtifacts []string `json:"include"`
	// ExcludeArtifacts is a set of regexp patterns to remove artifacts which
	// would otherwise be selected by IncludeArtifacts.
	ExcludeArtifacts []string `json:"exclude,omitempty"`

	// Rename provides a mechanism to remap artifacts from one filename to
	// another.
	Rename map[string]string
}

AssetFilter provides an interface for selecting and managing assets within a release.

func (*AssetFilter) Accept

func (af *AssetFilter) Accept(name string) string

Accept provides a method which can be supplied to `FilterAssets` to handle `IncludeArtifacts` and `ExcludeArtifacts`.

type GitHubSource

type GitHubSource struct {
	// Repo is the path to a repo in GitHub, using the "org/repo" format.
	Repo string `json:"repo"`
}

GitHubSource represents a software package which is released via GitHub releases.

type Package

type Package struct {
	// Name is a top-level directory name that the releases should be stored in.
	// This is collected from a map key in the configuration and is not directly
	// loaded from YAML.
	Name string `json:"-"`

	// If Alternatives is true, this will be considered an "alternatives"
	// collection, which contains single file alternatives for each Additional
	// item based on the latest minor (but not patch) versions of Primary.
	Alternatives bool

	// Primary is the primary source of release artifacts; collections of
	// release artifacts will be numbered based on the primary source's release
	// numbering scheme.
	Primary Source

	// Additional sources provide secondary artifacts which should be bundled
	// with the artifacts of the primary release. This can be useful (for
	// example) to select plugins which should be included with a base package.
	Additional []Source `json:",omitempty"`
}

Package represents a single deployable set of software artifacts, possibly composed of several repo-level releases.

func (*Package) String

func (p *Package) String() string

String implements fmt.Stringer.

type Release

type Release struct {
	Org     string
	Repo    string
	TagName string
	Created time.Time
	Assets  assetList //[]Asset
}

Release provides an interface for a release which contains multiple assets at the same release (TagName)

func LastN

func LastN(latestVersion string, minors int, allReleases []Release) []Release

LastN selects the last N minor releases (including all patch releases) for a given sequence of releases, which need not be sorted.

func (Release) Less

func (r Release) Less(b Release) bool

Less provides a sort on Releases by TagName.

func (Release) String

func (r Release) String() string

String implements `fmt.Stringer`.

type S3Source added in v0.21.0

type S3Source struct {
	// Bucket is the path to a Blob storage bucket
	Bucket string
	// Prefix is the path within a Blob storage bucket
	Prefix string
}

S3Source represents a set of yaml documents published to a blob storage bucket.

type Source

type Source struct {
	AssetFilter `json:",inline"`
	// GitHub represents software released on GitHub using GitHub releases.
	GitHub GitHubSource `json:"github,omitempty"`
	// S3 represents software manifests stored in an blob storage service under
	// a specified prefix. The blob paths should end with "vX.Y.Z/<asset name>"
	S3 S3Source `json:"s3,omitempty"`
	// EventingService represents the name of the service for the eventing source
	EventingService string `json:"eventingService,omitempty"`

	// Overrides provides a mechanism for modifying include/exclude (and
	// possibly other settings) on a per-release or per-minor-version basis, to
	// allow fixing up discontinuities in release patterns.
	Overrides map[string]AssetFilter `json:"overrides"`
}

Source is represents the release artifacts of a given project or repo, which provides a sequence of semver-tagged artifact collections for an individual release.

func (*Source) Accept

func (s *Source) Accept(ver string) func(name string) string

Accept determines the best acceptance function for the given version, taking into account overrides.

func (*Source) OrgRepo

func (s *Source) OrgRepo() (string, string)

OrgRepo returns the GitHub org and repo associated with this Source.

NOTE: this is totally a smell, because it's GitHub specific. The GitHub adapter outside package should probably handle this split if needed for the github library.

func (*Source) String

func (s *Source) String() string

String implements fmt.Stringer.

Jump to

Keyboard shortcuts

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