v1alpha1

package
v0.0.563 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Overview

Package v1alpha1 contains LighthouseJob +k8s:openapi-gen=true +k8s:deepcopy-gen=package,register +k8s:conversion-gen=github.com/jenkins-x/lighthouse/pkg/apis/lighthouse +k8s:defaulter-gen=TypeMeta +groupName=lighthouse.jenkins.io

Index

Constants

View Source
const (
	// JobSpecEnv is a legacy Prow variable with "type:(type)"
	JobSpecEnv = "JOB_SPEC"
	// JobNameEnv is the name of the job
	JobNameEnv = "JOB_NAME"
	// JobTypeEnv is the type of job
	JobTypeEnv = "JOB_TYPE"
	// RepoOwnerEnv is the org/owner for the repository we're building
	RepoOwnerEnv = "REPO_OWNER"
	// RepoNameEnv is the name of the repository we're building
	RepoNameEnv = "REPO_NAME"
	// PullBaseRefEnv is the base ref (such as master) for a pull request
	PullBaseRefEnv = "PULL_BASE_REF"
	// PullBaseShaEnv is the actual commit sha for the base for a pull request
	PullBaseShaEnv = "PULL_BASE_SHA"
	// PullRefsEnv is the refs and shas for the base and PR, like "master:abcd1234...,123:5678abcd..." for PR-123.
	PullRefsEnv = "PULL_REFS"
	// PullNumberEnv is the pull request number
	PullNumberEnv = "PULL_NUMBER"
	// PullPullShaEnv is the pull request's sha
	PullPullShaEnv = "PULL_PULL_SHA"
)

Environment variables to be added to the pipeline we kick off

Variables

View Source
var (
	// SchemeBuilder collects functions that add things to a scheme.
	SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
	// AddToScheme applies all the stored functions to the scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)
View Source
var SchemeGroupVersion = schema.GroupVersion{Group: lighthouse.GroupName, Version: "v1alpha1"}

SchemeGroupVersion is group version used to register these objects

Functions

func Kind

func Kind(kind string) schema.GroupKind

Kind takes an unqualified kind and returns back a Group qualified GroupKind

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type ByNum

type ByNum []Pull

ByNum implements sort.Interface for []Pull to sort by ascending PR number.

func (ByNum) DeepCopy

func (in ByNum) DeepCopy() ByNum

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ByNum.

func (ByNum) DeepCopyInto

func (in ByNum) DeepCopyInto(out *ByNum)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (ByNum) Len

func (prs ByNum) Len() int

func (ByNum) Less

func (prs ByNum) Less(i, j int) bool

func (ByNum) Swap

func (prs ByNum) Swap(i, j int)

type DecorationConfig

type DecorationConfig struct {
	// Timeout is how long the pod utilities will wait
	// before aborting a job with SIGINT.
	Timeout *Duration `json:"timeout,omitempty"`
	// GracePeriod is how long the pod utilities will wait
	// after sending SIGINT to send SIGKILL when aborting
	// a job. Only applicable if decorating the PodSpec.
	GracePeriod *Duration `json:"grace_period,omitempty"`

	/*
		// UtilityImages holds pull specs for utility container
		// images used to decorate a PodSpec.
		UtilityImages *UtilityImages `json:"utility_images,omitempty"`
		// GCSConfiguration holds options for pushing logs and
		// artifacts to GCS from a job.
		GCSConfiguration *GCSConfiguration `json:"gcs_configuration,omitempty"`
	*/
	// GCSCredentialsSecret is the name of the Kubernetes secret
	// that holds GCS push credentials.
	GCSCredentialsSecret string `json:"gcs_credentials_secret,omitempty"`
	// SSHKeySecrets are the names of Kubernetes secrets that contain
	// SSK keys which should be used during the cloning process.
	SSHKeySecrets []string `json:"ssh_key_secrets,omitempty"`
	// SSHHostFingerprints are the fingerprints of known SSH hosts
	// that the cloning process can trust.
	// Launch with ssh-keyscan [-t rsa] host
	SSHHostFingerprints []string `json:"ssh_host_fingerprints,omitempty"`
	// SkipCloning determines if we should clone source code in the
	// initcontainers for jobs that specify refs
	SkipCloning *bool `json:"skip_cloning,omitempty"`
	// CookieFileSecret is the name of a kubernetes secret that contains
	// a git http.cookiefile, which should be used during the cloning process.
	CookiefileSecret string `json:"cookiefile_secret,omitempty"`
}

DecorationConfig specifies how to augment pods.

This is primarily used to provide automatic integration with gubernator and testgrid.

func (*DecorationConfig) DeepCopy

func (in *DecorationConfig) DeepCopy() *DecorationConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DecorationConfig.

func (*DecorationConfig) DeepCopyInto

func (in *DecorationConfig) DeepCopyInto(out *DecorationConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DecorationConfig) Validate

func (d *DecorationConfig) Validate() error

Validate ensures all the values set in the DecorationConfig are valid.

type Duration

type Duration struct {
	Duration time.Duration
}

Duration is a wrapper around time.Duration that parses times in either 'integer number of nanoseconds' or 'duration string' formats and serializes to 'duration string' format.

func (*Duration) DeepCopy

func (in *Duration) DeepCopy() *Duration

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Duration.

func (*Duration) DeepCopyInto

func (in *Duration) DeepCopyInto(out *Duration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Duration) MarshalJSON

func (d *Duration) MarshalJSON() ([]byte, error)

MarshalJSON marshals a duration object to a byte array

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshal a byte array into a Duration object

type LighthouseJob

type LighthouseJob struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   LighthouseJobSpec   `json:"spec,omitempty"`
	Status LighthouseJobStatus `json:"status,omitempty"`
}

LighthouseJob contains the arguments to create a Jenkins X Pipeline and to report on it

func (*LighthouseJob) DeepCopy

func (in *LighthouseJob) DeepCopy() *LighthouseJob

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LighthouseJob.

func (*LighthouseJob) DeepCopyInto

func (in *LighthouseJob) DeepCopyInto(out *LighthouseJob)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LighthouseJob) DeepCopyObject

func (in *LighthouseJob) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type LighthouseJobList

type LighthouseJobList struct {
	metav1.TypeMeta `json:",inline"`
	// +optional
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []LighthouseJob `json:"items"`
}

LighthouseJobList represents a list of pipeline options

func (*LighthouseJobList) DeepCopy

func (in *LighthouseJobList) DeepCopy() *LighthouseJobList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LighthouseJobList.

func (*LighthouseJobList) DeepCopyInto

func (in *LighthouseJobList) DeepCopyInto(out *LighthouseJobList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LighthouseJobList) DeepCopyObject

func (in *LighthouseJobList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type LighthouseJobSpec

type LighthouseJobSpec struct {
	// Type is the type of job and informs how
	// the jobs is triggered
	Type PipelineKind `json:"type,omitempty"`
	// Namespace defines where to create pods/resources.
	Namespace string `json:"namespace,omitempty"`
	// Job is the name of the job
	Job string `json:"job,omitempty"`
	// Refs is the code under test, determined at
	// runtime by Prow itself
	Refs *Refs `json:"refs,omitempty"`
	// Context is the name of the status context used to
	// report back to GitHub
	Context string `json:"context,omitempty"`
	// RerunCommand is the command a user would write to
	// trigger this job on their pull request
	RerunCommand string `json:"rerun_command,omitempty"`
	// MaxConcurrency restricts the total number of instances
	// of this job that can run in parallel at once
	MaxConcurrency int `json:"max_concurrency,omitempty"`
}

LighthouseJobSpec the spec of a pipeline request

func (*LighthouseJobSpec) DeepCopy

func (in *LighthouseJobSpec) DeepCopy() *LighthouseJobSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LighthouseJobSpec.

func (*LighthouseJobSpec) DeepCopyInto

func (in *LighthouseJobSpec) DeepCopyInto(out *LighthouseJobSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*LighthouseJobSpec) GetBranch

func (s *LighthouseJobSpec) GetBranch() string

GetBranch returns the branch name corresponding to the refs on this spec.

func (*LighthouseJobSpec) GetEnvVars

func (s *LighthouseJobSpec) GetEnvVars() map[string]string

GetEnvVars gets a map of the environment variables we'll set in the pipeline for this spec.

type LighthouseJobStatus

type LighthouseJobStatus struct {
	// State is the full state of the job
	State PipelineState `json:"state,omitempty"`
	// ActivityName is the name of the PipelineActivity associated with this job, if any.
	ActivityName string `json:"activityName,omitempty"`
	// Description is used for the description of the commit status we report.
	Description string `json:"description,omitempty"`
	// ReportURL is the link that will be used in the commit status.
	ReportURL string `json:"reportURL,omitempty"`
	// StartTime is when the job was created.
	StartTime metav1.Time `json:"startTime,omitempty"`
	// CompletionTime is when the job finished reconciling and entered a terminal state.
	CompletionTime *metav1.Time `json:"completionTime,omitempty"`
	// LastReportState is the state from the last time we reported commit status for this job.
	LastReportState string `json:"lastReportState,omitempty"`
	// LastCommitSHA is the commit that will be/has been reported to on the SCM provider
	LastCommitSHA string `json:"lastCommitSHA,omitempty"`
}

LighthouseJobStatus represents the status of a pipeline

func (*LighthouseJobStatus) DeepCopy

func (in *LighthouseJobStatus) DeepCopy() *LighthouseJobStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LighthouseJobStatus.

func (*LighthouseJobStatus) DeepCopyInto

func (in *LighthouseJobStatus) DeepCopyInto(out *LighthouseJobStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type PipelineKind

type PipelineKind string

PipelineKind specifies how the job is triggered.

const (
	// PresubmitJob means it runs on unmerged PRs.
	PresubmitJob PipelineKind = "presubmit"
	// PostsubmitJob means it runs on each new commit.
	PostsubmitJob PipelineKind = "postsubmit"
	// Periodic job means it runs on a time-basis, unrelated to git changes.
	PeriodicJob PipelineKind = "periodic"
	// BatchJob tests multiple unmerged PRs at the same time.
	BatchJob PipelineKind = "batch"
)

Various job types.

type PipelineState

type PipelineState string

PipelineState specifies the current pipelne status

const (
	// TriggeredState for pipelines that have been triggered
	TriggeredState PipelineState = "triggered"

	// PendingState pipeline is pending
	PendingState PipelineState = "pending"

	// RunningState pipeline is running
	RunningState PipelineState = "running"

	// SuccessState pipeline is successful
	SuccessState PipelineState = "success"

	// FailureState failed
	FailureState PipelineState = "failure"

	// AbortedState aborted
	AbortedState PipelineState = "aborted"
)

Various job types.

func ToPipelineState

func ToPipelineState(status v1.ActivityStatusType) PipelineState

ToPipelineState converts the PipelineActivity state to LighthouseJob state

type Pull

type Pull struct {
	Number int    `json:"number"`
	Author string `json:"author"`
	SHA    string `json:"sha"`
	Title  string `json:"title,omitempty"`

	// Ref is git ref can be checked out for a change
	// for example,
	// github: pull/123/head
	// gerrit: refs/changes/00/123/1
	Ref string `json:"ref,omitempty"`
	// Link links to the pull request itself.
	Link string `json:"link,omitempty"`
	// CommitLink links to the commit identified by the SHA.
	CommitLink string `json:"commit_link,omitempty"`
	// AuthorLink links to the author of the pull request.
	AuthorLink string `json:"author_link,omitempty"`
}

Pull describes a pull request at a particular point in time.

func (*Pull) DeepCopy

func (in *Pull) DeepCopy() *Pull

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pull.

func (*Pull) DeepCopyInto

func (in *Pull) DeepCopyInto(out *Pull)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Refs

type Refs struct {
	// Org is something like kubernetes or k8s.io
	Org string `json:"org"`
	// Repo is something like test-infra
	Repo string `json:"repo"`
	// RepoLink links to the source for Repo.
	RepoLink string `json:"repo_link,omitempty"`

	BaseRef string `json:"base_ref,omitempty"`
	BaseSHA string `json:"base_sha,omitempty"`
	// BaseLink is a link to the commit identified by BaseSHA.
	BaseLink string `json:"base_link,omitempty"`

	Pulls []Pull `json:"pulls,omitempty"`

	// PathAlias is the location under <root-dir>/src
	// where this repository is cloned. If this is not
	// set, <root-dir>/src/github.com/org/repo will be
	// used as the default.
	PathAlias string `json:"path_alias,omitempty"`
	// CloneURI is the URI that is used to clone the
	// repository. If unset, will default to
	// `https://github.com/org/repo.git`.
	CloneURI string `json:"clone_uri,omitempty"`
	// SkipSubmodules determines if submodules should be
	// cloned when the job is run. Defaults to true.
	SkipSubmodules bool `json:"skip_submodules,omitempty"`
	// CloneDepth is the depth of the clone that will be used.
	// A depth of zero will do a full clone.
	CloneDepth int `json:"clone_depth,omitempty"`
}

Refs describes how the repo was constructed.

func (*Refs) DeepCopy

func (in *Refs) DeepCopy() *Refs

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Refs.

func (*Refs) DeepCopyInto

func (in *Refs) DeepCopyInto(out *Refs)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Refs) String

func (r *Refs) String() string

Jump to

Keyboard shortcuts

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