env

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2017 License: MIT Imports: 17 Imported by: 41

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GitBlob = func(path string, commit *object.Commit) (string, error) {
	if commit == nil {
		blob, err := fallbackBlob(path)

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

		return blob, nil
	}

	logrus.Debugf("getting git blob_id for source file %s", path)
	file, err := commit.File(path)

	if err != nil {
		logrus.Errorf("failed to find file %s\n%s", path, err)
		return "", errors.WithStack(err)
	}

	blob := strings.TrimSpace(file.Hash.String())

	return blob, nil
}

Functions

func GetHead added in v0.1.3

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