gitreceive

package
v2.13.7+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2020 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CacheKeyPattern is the template for location cache dirs.
	CacheKeyPattern = "home/%s/cache"
	// GitKeyPattern is the template for storing git key files.
	GitKeyPattern = "home/%s:git-%s"
)

Variables

This section is empty.

Functions

func Run

func Run(conf *Config, fs sys.FS, env sys.Env, storageDriver storagedriver.StorageDriver) error

Run runs the git-receive hook. This func is effectively the main for the git-receive hook, although it is called from the main in boot.go.

Types

type Config

type Config struct {
	// k8s service discovery env vars
	ControllerHost       string `envconfig:"DEIS_CONTROLLER_SERVICE_HOST" required:"true"`
	ControllerPort       string `envconfig:"DEIS_CONTROLLER_SERVICE_PORT" required:"true"`
	RegistryHost         string `envconfig:"DEIS_REGISTRY_SERVICE_HOST" required:"true"`
	RegistryPort         string `envconfig:"DEIS_REGISTRY_SERVICE_PORT" required:"true"`
	RegistryProxyPort    string `envconfig:"DEIS_REGISTRY_PROXY_PORT" default:"5555"`
	RegistryLocation     string `envconfig:"DEIS_REGISTRY_LOCATION" default:"on-cluster"`
	RegistrySecretPrefix string `envconfig:"DEIS_REGISTRY_SECRET_PREFIX" default:"private-registry"`

	GitHome                       string `envconfig:"GIT_HOME" required:"true"`
	SSHConnection                 string `envconfig:"SSH_CONNECTION" required:"true"`
	SSHOriginalCommand            string `envconfig:"SSH_ORIGINAL_COMMAND" required:"true"`
	Repository                    string `envconfig:"REPOSITORY" required:"true"`
	Username                      string `envconfig:"USERNAME" required:"true"`
	Fingerprint                   string `envconfig:"FINGERPRINT" required:"true"`
	PodNamespace                  string `envconfig:"POD_NAMESPACE" required:"true"`
	StorageRegion                 string `envconfig:"STORAGE_REGION" default:"us-east-1"`
	Debug                         bool   `envconfig:"DEIS_DEBUG" default:"false"`
	BuilderPodTickDurationMSec    int    `envconfig:"BUILDER_POD_TICK_DURATION" default:"100"`
	BuilderPodWaitDurationMSec    int    `envconfig:"BUILDER_POD_WAIT_DURATION" default:"900000"` // 15 minutes
	ObjectStorageTickDurationMSec int    `envconfig:"OBJECT_STORAGE_TICK_DURATION" default:"500"`
	ObjectStorageWaitDurationMSec int    `envconfig:"OBJECT_STORAGE_WAIT_DURATION" default:"300000"` // 5 minutes
	SessionIdleIntervalMsec       int    `envconfig:"SESSION_IDLE_INTERVAL" default:"10000"`         // 10 seconds
	SlugBuilderImage              string `envconfig:"SLUGBUILDER_IMAGE_NAME" required:"true"`
	DockerBuilderImage            string `envconfig:"DOCKERBUILDER_IMAGE_NAME" required:"true"`
	SlugBuilderImagePullPolicy    string `envconfig:"SLUG_BUILDER_IMAGE_PULL_POLICY" default:"Always"`
	DockerBuilderImagePullPolicy  string `envconfig:"DOCKER_BUILDER_IMAGE_PULL_POLICY" default:"Always"`
	StorageType                   string `envconfig:"BUILDER_STORAGE" default:"minio"`
	BuilderPodNodeSelector        string `envconfig:"BUILDER_POD_NODE_SELECTOR" default:""`
}

Config is the envconfig (http://github.com/kelseyhightower/envconfig) compatible struct for the builder's git-receive hook.

func (Config) App

func (c Config) App() string

App returns the application name represented by c. The app name is the same as c.Repository with the last '.' and beyond stripped off.

func (Config) BuilderPodTickDuration

func (c Config) BuilderPodTickDuration() time.Duration

BuilderPodTickDuration returns the size of the interval used to check for the end of the execution of a Pod building an application.

func (Config) BuilderPodWaitDuration

func (c Config) BuilderPodWaitDuration() time.Duration

BuilderPodWaitDuration returns the maximum time to wait for the end of the execution of a Pod building an application.

func (*Config) CheckDurations

func (c *Config) CheckDurations()

CheckDurations checks if ticks for builder and object storage are not bigger than the maximum duration. In case of this it will set the tick to the default.

func (Config) ObjectStorageTickDuration

func (c Config) ObjectStorageTickDuration() time.Duration

ObjectStorageTickDuration returns the size of the interval used to check for the end of an operation that involves the object storage.

func (Config) ObjectStorageWaitDuration

func (c Config) ObjectStorageWaitDuration() time.Duration

ObjectStorageWaitDuration returns the maximum time to wait for the end of an operation that involves the object storage.

func (Config) SessionIdleInterval

func (c Config) SessionIdleInterval() time.Duration

SessionIdleInterval returns the ticker interval to wait for status

type SlugBuilderInfo

type SlugBuilderInfo struct {
	// contains filtered or unexported fields
}

SlugBuilderInfo contains all of the object storage related information needed to pass to a slug builder.

func NewSlugBuilderInfo

func NewSlugBuilderInfo(appName string, shortSha string, disableCaching bool) *SlugBuilderInfo

NewSlugBuilderInfo creates and populates a new SlugBuilderInfo based on the given data

func (SlugBuilderInfo) AbsoluteProcfileKey

func (s SlugBuilderInfo) AbsoluteProcfileKey() string

AbsoluteProcfileKey returns the PushKey plus the standard procfile name.

func (SlugBuilderInfo) AbsoluteSlugObjectKey

func (s SlugBuilderInfo) AbsoluteSlugObjectKey() string

AbsoluteSlugObjectKey returns the PushKey plus the final filename of the slug.

func (SlugBuilderInfo) CacheKey

func (s SlugBuilderInfo) CacheKey() string

CacheKey returns the object storage key that the slug builder will use to store the cache in it's application specific and persisted between deploys (doesn't contain git-sha)

func (SlugBuilderInfo) DisableCaching

func (s SlugBuilderInfo) DisableCaching() bool

DisableCaching dictates whether or not the slugbuilder should persist the buildpack cache.

func (SlugBuilderInfo) PushKey

func (s SlugBuilderInfo) PushKey() string

PushKey returns the object storage key that the slug builder will store the slug in. The returned value only contains the path to the folder, not including the final filename.

func (SlugBuilderInfo) TarKey

func (s SlugBuilderInfo) TarKey() string

TarKey returns the object storage key from which the slug builder will download for the tarball (from which it uses to build the slug). The returned value only contains the path to the folder, not including the final filename.

Jump to

Keyboard shortcuts

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