gitserver

package
v3.11.18-1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Overview

Package gitserver provides a smart Git HTTP server that can also set and remove hooks. The server is lightweight (<7M compiled with a ~2M footprint) and can mirror remote repositories in a containerized environment.

Index

Constants

View Source
const (
	EnvironmentHelp = `` /* 2291-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func GetClient added in v1.3.0

func GetClient() (buildv1client.Interface, error)

GetClient returns a build client.

func GetRepositoryBuildConfigs added in v1.3.0

func GetRepositoryBuildConfigs(c buildv1client.Interface, name string, out io.Writer) error

func RepositoryURL

func RepositoryURL(config *Config, name string, r *http.Request) *url.URL

RepositoryURL creates the public URL for the named git repo. If both config.URL and request are nil, the returned URL will be nil.

func Start

func Start(config *Config) error

Types

type Clone

type Clone struct {
	URL   URL
	Hooks map[string]string
}

Clone is a repository to clone

type Config

type Config struct {
	Home        string
	GitBinary   string
	URL         *url.URL
	InternalURL *url.URL

	AllowHooks      bool
	AllowPush       bool
	AllowLazyCreate bool

	HookDirectory string
	MaxHookBytes  int64

	Listen string

	AuthenticatorFn func(http http.Handler) http.Handler

	CleanBeforeClone bool
	InitialClones    map[string]Clone

	AuthMessage string
}

Config represents the configuration to use for running the server

func NewDefaultConfig

func NewDefaultConfig() *Config

NewDefaultConfig returns a default server config.

func NewEnvironmentConfig added in v1.3.0

func NewEnvironmentConfig() (*Config, error)

NewEnvironmentConfig sets up the initial config from environment variables TODO break out the code that generates the handler functions so that they can be individually unit tested. Also separate out the code that generates the initial set of clones.

type URL

type URL struct {
	URL  url.URL
	Type URLType
}

URL represents a "Git URL"

func MustParse

func MustParse(rawurl string) *URL

MustParse parses a "Git URL" and panics on failure

func ParseURL

func ParseURL(rawurl string) (*URL, error)

ParseURL parses a "Git URL"

func (URL) IsLocal

func (u URL) IsLocal() bool

IsLocal returns true if the Git URL refers to a local repository

func (URL) LocalPath

func (u URL) LocalPath() string

LocalPath returns the path to a local repository in OS-native format. It is assumed that IsLocal() is true

func (URL) String

func (u URL) String() string

String returns a string representation of the URL

func (URL) StringNoFragment

func (u URL) StringNoFragment() string

StringNoFragment returns a string representation of the URL without its fragment

type URLType

type URLType int

URLType indicates the type of the URL (see above)

const (
	// URLTypeURL is the URL type (see above)
	URLTypeURL URLType = iota
	// URLTypeSCP is the SCP type (see above)
	URLTypeSCP
	// URLTypeLocal is the local type (see above)
	URLTypeLocal
)

func (URLType) GoString

func (t URLType) GoString() string

GoString returns a Go string representation of the URLType

func (URLType) String

func (t URLType) String() string

String returns a string representation of the URLType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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