context

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SourceTypeToString = map[SourceType]string{
	// contains filtered or unexported fields
}

Functions

func IsCI

func IsCI() bool

IsCI indicates whether the CLI is run from a CI platform

func IsCircleCI added in v0.6.0

func IsCircleCI() bool

IsCircleCI indicates whether the CLI is run from a Gitlab pipeline job

func IsGithubCI

func IsGithubCI() bool

IsGithubCI indicates whether the CLI is run from a Github worflow

func IsGithubRepo

func IsGithubRepo() bool

IsGithubRepo indicates whether the CLI is run against a github repo

func IsGitlabCI

func IsGitlabCI() bool

IsGitlabCI indicates whether the CLI is run from a Gitlab pipeline job

func IsGitlabRepo

func IsGitlabRepo() bool

IsGitlabRepo indicates whether the CLI is run against a gitlab repo

Types

type CircleCIEnv added in v0.6.0

type CircleCIEnv StringMap

CircleCIEnv is a map of targeted CircleCI env variables set when running the CLI via a CircleCI workflow

func GetCircleCIEnv added in v0.6.0

func GetCircleCIEnv() CircleCIEnv

GetCircleCIEnv returns a map of CircleCI env variables

type Context

type Context struct {
	IsCI    bool            `json:"ci"`
	Runtime *RuntimeContext `json:"runtime"`
	Environ StringMap       `json:"environ"`
	Context ContextMap      `json:"context"`
	Source  interface{}     `json:"source"` // can be one of Local, Github, Gitlab sources
}

Context contains all execution data useful to Reliably when running the CLI

func NewContext

func NewContext() *Context

NewContext is a constructor to initialize a full context for Reliably

type ContextMap

type ContextMap map[string]interface{}

ContextMap ...

type GithubEnv

type GithubEnv StringMap

GithubEnv is a map of targeted GitHub env variables set when running the CLI via a Github workflow

func GetGithubEnv

func GetGithubEnv() GithubEnv

GetGithubEnv returns a map of GitHub env variables

type GithubSource

type GithubSource struct {
	Type SourceType `json:"type"`
}

GithubSource represents a GitHub repository

type GitlabEnv

type GitlabEnv StringMap

GitlabEnv is a map of targeted Gitlab env variables set when running the CLI via a Gitlab workflow

func GetGitlabEnv

func GetGitlabEnv() GitlabEnv

GetGitlabEnv returns a map of Gitlab env variables

type GitlabSource

type GitlabSource struct {
	Type SourceType `json:"type"`
}

GitlabSource represents a Gitlab project

type LocalSource

type LocalSource struct {
	Type SourceType `json:"type"`
}

LocalSource represents a local folder

type RuntimeContext

type RuntimeContext struct {
	Datetime   time.Time `json:"datetime"`
	Username   string    `json:"username"`
	Hostname   string    `json:"hostname"`
	WorkingDir string    `json:"workingdir"`
	Command    []string  `json:"command"`
	OS         string    `json:"os"`
	Arch       string    `json:"arch"`
}

RuntimeContext holds the metadata of the environment running the CLI

func NewRuntimeContext

func NewRuntimeContext() *RuntimeContext

NewRuntimeContext is a constructor to initialize a CLI execution context

type Source

type Source struct {
	Type SourceType `json:"type"`
	Hash string     `json:"hash"`
	Meta SourceMeta `json:"meta"`
}

Source is the base interface for a source files to be checked by CLI

func NewGitSource

func NewGitSource(url string) (source *Source, err error)

func (*Source) ComputeHash

func (s *Source) ComputeHash()

ComputeHash computes the hash of the source meta

type SourceMeta

type SourceMeta map[string]string

type SourceType

type SourceType uint

func (SourceType) MarshalJSON

func (st SourceType) MarshalJSON() ([]byte, error)

func (SourceType) String

func (st SourceType) String() string

type StringMap

type StringMap map[string]string

StringMap represents a map of string keys to string values

Jump to

Keyboard shortcuts

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