Help us shape the future of Go! Take the 2026 Go Developer Survey

ctx

package
v1.11.4 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EnvGitHubActions = "GITHUB_ACTIONS"

EnvGitHubActions is used to detect that we are running inside a GitHub Action

View Source
const EnvGitLabCI = "GITLAB_CI"

EnvGitLabCI is used to detect that we are running inside a GitLab CI job.

Variables

This section is empty.

Functions

func GetContext

func GetContext() (*v1.BuildContext, error)

Types

type GitHubContext added in v1.9.2

type GitHubContext struct {
	ServerURL string `env:"GITHUB_SERVER_URL"`

	ProjectDir          string `env:"GITHUB_WORKSPACE"`
	ProjectNamespace    string `env:"GITHUB_REPOSITORY"`
	ProjectPath         string `env:"PROJECT_PATH"`
	ProjectPathOverride string `env:"PROJECT_PATH_OVERRIDE"`

	JobID string `env:"GITHUB_RUN_ID"`

	RegistryUsername string `env:"GITHUB_ACTOR"`
	RegistryPassword string `env:"GITHUB_TOKEN"`

	CommitSha     string `env:"GITHUB_SHA"`
	CommitRefName string `env:"GITHUB_REF_NAME"`
	CommitRefType string `env:"GITHUB_REF_TYPE"`
}

func (*GitHubContext) Normalise added in v1.9.2

func (c *GitHubContext) Normalise() v1.BuildContext

type GitLabContext

type GitLabContext struct {
	ProjectURL          string `env:"CI_PROJECT_URL"`
	ProjectDir          string `env:"CI_PROJECT_DIR"`
	ProjectPath         string `env:"PROJECT_PATH"`
	ProjectPathOverride string `env:"PROJECT_PATH_OVERRIDE"`
	DefaultBranch       string `env:"CI_DEFAULT_BRANCH"`

	ConfigPath string `env:"CI_CONFIG_PATH"`

	JobImage     string `env:"CI_JOB_IMAGE"`
	JobID        string `env:"CI_JOB_ID"`
	JobStartedAt string `env:"CI_JOB_STARTED_AT"`

	Registry         string `env:"CI_REGISTRY"`
	RegistryImage    string `env:"CI_REGISTRY_IMAGE"`
	RegistryUser     string `env:"CI_REGISTRY_USER"`
	RegistryPassword string `env:"CI_REGISTRY_PASSWORD"`

	CommitBranch   string `env:"CI_COMMIT_BRANCH"`
	CommitTag      string `env:"CI_COMMIT_TAG"`
	CommitSha      string `env:"CI_COMMIT_SHA"`
	CommitShortSha string `env:"CI_COMMIT_SHORT_SHA"`
	CommitRefName  string `env:"CI_COMMIT_REF_NAME"`
}

GitLabContext contains the ambient environment variables that are set by GitLab CI.

func (*GitLabContext) Normalise

func (c *GitLabContext) Normalise() v1.BuildContext

type Normalisable

type Normalisable interface {
	Normalise() v1.BuildContext
}

Jump to

Keyboard shortcuts

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