vcs

package
v0.10.5 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	StubMetadata = Metadata{
		Branch: Branch{
			Name: "stub-branch",
		},
		Commit: Commit{
			SHA:         "stub-sha",
			AuthorName:  "stub-author",
			AuthorEmail: "stub@stub.com",
			Time:        time.Time{},
			Message:     "stub-message",
		},
	}
)

Functions

This section is empty.

Types

type Branch

type Branch struct {
	Name string
}

type Commit

type Commit struct {
	SHA         string
	AuthorName  string
	AuthorEmail string
	Time        time.Time
	Message     string
}

Commit defines information for a given commit. This information is normally populated from the local vcs environment. Attributes can be overwritten by CI specific properties and variables.

type GetMetadataFunc

type GetMetadataFunc func(path string) (Metadata, error)

GetMetadataFunc defines a function that fetches data for a given vcs implementation.

type Metadata

type Metadata struct {
	Branch      Branch
	Commit      Commit
	PullRequest *PullRequest
	Pipeline    *Pipeline
}

Metadata holds a snapshot of information for a given environment and vcs system. PullRequest and Pipeline properties are only populated if running in a CI system.

func GetMetadata

func GetMetadata(path string) (Metadata, error)

GetMetadata fetches vcs metadata for the given environment. GetMetadata will attempt to try and find a GetMetadataFunc for the environment using env variables to determine the CI system. If GetMetadata cannot determine the CI system it falls back to getting the metadata from the local git filesystem.

type Pipeline

type Pipeline struct {
	ID string
}

Pipeline holds information about a specific run for a CI system. This is used to aggregate Infracost metadata across commands used in the same pipeline.

type PullRequest

type PullRequest struct {
	ID           string
	VCSProvider  string
	Title        string
	Author       string
	SourceBranch string
	BaseBranch   string
	URL          string
}

PullRequest defines information that is unique to a pull request or merge request in a CI system.

Jump to

Keyboard shortcuts

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