vcs

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMatchingVersion = errors.New("no matching versions")

Functions

func RepoRoot

func RepoRoot(ctx context.Context, module string) (root string, path string, err error)

Types

type Auth

type Auth struct {
	Username string
	Password string
	Key      string
}

Auth defines a typical VCS authentication mechanism, such as SSH key or username/password.

func Key

func Key(key, password string) Auth

Key returns an Auth implementation that uses key file authentication mechanism.

func NoAuth

func NoAuth() Auth

NoAuth returns an Auth implementation that uses no authentication at all.

func Password

func Password(username, password string) Auth

Password returns an Auth implementation that authenticate via username and password.

type EphemeralTagStorage

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

func NewEphemeralTagStorage

func NewEphemeralTagStorage() *EphemeralTagStorage

func (*EphemeralTagStorage) Tag

func (s *EphemeralTagStorage) Tag(module string, semVer Version, short string) error

type Module

type Module interface {
	Timestamp(ctx context.Context, version Version) (time.Time, error)
	Zip(ctx context.Context, version Version) (io.ReadCloser, error)
}

Module is a source code snapshot for which one can get the commit timestamp or the actual ZIP with the source code in it.

type Taggable

type Taggable interface {
	Tag(ctx context.Context, semVer Version, short string) error
}

type VCS

type VCS interface {
	List(ctx context.Context) ([]Version, error)
	Module
}

VCS is a version control system client. It can list available versions from the remote, as well as fetch module data such as timestamp or zip snapshot.

func NewCommand

func NewCommand(l logger, cmd string, module string) VCS

func NewGit

func NewGit(l logger, dir string, module string, auth Auth) VCS

NewGit return a go-git VCS client implementation that provides information about the specific module using the pgiven authentication mechanism.

func NewGitWithEphemeralTags

func NewGitWithEphemeralTags(l logger, dir string, module string, auth Auth, storage *EphemeralTagStorage) VCS

NewGitWithEphemeralTags return a go-git VCS client implementation that provides information about the specific module using the given authentication mechanism while adding support to ephemeral tags.

func NewGoMod

func NewGoMod(l logger, module string) VCS

type Version

type Version string

Version represents a semantic version of a module.

func (Version) Hash

func (v Version) Hash() string

Hash returns a commit hash if a version is of a form v0.0.0-timestamp-hash.

func (Version) IsSemVer

func (v Version) IsSemVer() bool

IsSemVer returns true if a version string is a semantic version e.g. vX.Y.Z.

func (Version) String

func (v Version) String() string

String returns a string representation of a version

Jump to

Keyboard shortcuts

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