env

package
v0.0.0-...-9319dc5 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GitBlob = func(path string, commit *object.Commit) (string, error) {
	if commit != nil {
		file, err := commit.File(path)
		if err == nil {
			logrus.Debugf("getting git blob_id for source file %s", path)

			blob := strings.TrimSpace(file.Hash.String())
			return blob, nil
		}
	}

	blob, err := fallbackBlob(path)

	if err != nil {
		return "", errors.WithStack(err)
	}

	return blob, nil
}

Functions

func GetHead

func GetHead() (*object.Commit, error)

func GitSHA

func GitSHA(path string) (string, error)

Types

type Environment

type Environment struct {
	Git       Git
	CI        ci
	RepoToken string `json:"-"`
}

Environment represent the current testing environment

func New

func New() (Environment, error)

New environment. If there are problems loading parts of the environment an error will be returned. Validation errors are not considered an "error" here, but should be checked further down the chain, when validation of the environment is required.

func (Environment) MarshalJSON

func (e Environment) MarshalJSON() ([]byte, error)

func (Environment) String

func (e Environment) String() string

type Git

type Git struct {
	Branch      string `json:"branch" structs:"branch"`
	CommitSHA   string `json:"commit_sha" structs:"commit_sha"`
	CommittedAt int    `json:"committed_at" structs:"committed_at"`
}

func (Git) String

func (g Git) String() string

Jump to

Keyboard shortcuts

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