clonerefs

package
v0.0.0-...-d7867ec Latest Latest
Warning

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

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

Documentation

Overview

Package clonerefs is a library for cloning references

Index

Constants

View Source
const (
	// JSONConfigEnvVar is the environment variable that
	// clonerefs expects to find a full JSON configuration
	// in when run.
	JSONConfigEnvVar = "CLONEREFS_OPTIONS"
	// DefaultGitUserName is the default name used in git config
	DefaultGitUserName = "ci-robot"
	// DefaultGitUserEmail is the default email used in git config
	DefaultGitUserEmail = "ci-robot@k8s.io"
)

Variables

This section is empty.

Functions

func Encode

func Encode(options Options) (string, error)

Encode will encode the set of options in the format that is expected for the configuration environment variable

func ParseRefs

func ParseRefs(value string) (*kube.Refs, error)

ParseRefs parses a human-provided string into the repo that should be cloned and the refs that need to be checked out once it is. The format is:

org,repo=base-ref[:base-sha][,pull-id[:pull-sha[:pull-ref]]]...

For the base ref and pull IDs, a SHA may optionally be provided or may be omitted for the latest available SHA. Examples:

kubernetes,test-infra=master
kubernetes,test-infra=master:abcde12
kubernetes,test-infra=master:abcde12,34
kubernetes,test-infra=master:abcde12,34:fghij56
kubernetes,test-infra=master,34:fghij56
kubernetes,test-infra=master:abcde12,34:fghij56,78
gerrit,test-infra=master:abcde12,34:fghij56:refs/changes/00/123/1

Types

type Options

type Options struct {
	// SrcRoot is the root directory under which
	// all source code is cloned
	SrcRoot string `json:"src_root"`
	// Log is the log file to which clone records are written
	Log string `json:"log"`

	// GitUserName is an optional field that is used with
	// `git config user.name`
	GitUserName string `json:"git_user_name,omitempty"`
	// GitUserEmail is an optional field that is used with
	// `git config user.email`
	GitUserEmail string `json:"git_user_email,omitempty"`

	// GitRefs are the refs to clone
	GitRefs []kube.Refs `json:"refs"`
	// KeyFiles are files containing SSH keys to be used
	// when cloning. Will be added to `ssh-agent`.
	KeyFiles []string `json:"key_files,omitempty"`

	// HostFingerPrints are ssh-keyscan host fingerprint lines to use
	// when cloning. Will be added to ~/.ssh/known_hosts
	HostFingerprints []string `json:"host_fingerprints,omitempty"`

	// MaxParallelWorkers determines how many repositories
	// can be cloned in parallel. If 0, interpreted as no
	// limit to parallelism
	MaxParallelWorkers int `json:"max_parallel_workers,omitempty"`

	CookiePath string `json:"cookie_path,omitempty"`
	// contains filtered or unexported fields
}

Options configures the clonerefs tool completely and may be provided using JSON or user-specified flags, but not both.

func (*Options) AddFlags

func (o *Options) AddFlags(fs *flag.FlagSet)

AddFlags adds flags to the FlagSet that populate the GCS upload options struct given.

func (*Options) Complete

func (o *Options) Complete(args []string)

Complete internalizes command line arguments

func (*Options) ConfigVar

func (o *Options) ConfigVar() string

ConfigVar exposes the environment variable used to store serialized configuration

func (*Options) LoadConfig

func (o *Options) LoadConfig(config string) error

LoadConfig loads options from serialized config

func (Options) Run

func (o Options) Run() error

Run clones the configured refs

func (*Options) Validate

func (o *Options) Validate() error

Validate ensures that the configuration options are valid

type OrgRepo

type OrgRepo struct {
	Org, Repo string
}

OrgRepo hold both an org and repo name.

Jump to

Keyboard shortcuts

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