builds

package
v2.1.134 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2020 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// LabelBuildName the label used on a pod for the build name
	LabelBuildName    = "build.knative.dev/buildName"
	LabelOldBuildName = "build-name"

	// LabelPipelineRunName the label used on a pod created via Build Pipeline for the build name.
	LabelPipelineRunName = "tekton.dev/pipelineRun"

	// LabelTaskName the label used on a pod created via Tekton for the task name
	LabelTaskName = "tekton.dev/task"

	// LabelTaskRunName the label used on a pod created via Tekton for the taskrun name
	LabelTaskRunName = "tekton.dev/taskRun"
)

Variables

This section is empty.

Functions

func GetBranchName

func GetBranchName() string

GetBranchName returns the branch name using environment variables and/or pod Downward API

func GetBranchNameFromLabels

func GetBranchNameFromLabels(m map[string]string) string

GetBranchNameFromLabels returns the branch name from the given pod labels

func GetBuildLogsForPod

func GetBuildLogsForPod(podInterface v1.PodInterface, pod *corev1.Pod) ([]byte, error)

GetBuildLogsForPod returns the pod log for a Knative Build style build pod which is based on init containers

func GetBuildNumber

func GetBuildNumber() string

GetBuildNumber returns the build number using environment variables and/or pod Downward API files

func GetBuildNumberFromLabels

func GetBuildNumberFromLabels(m map[string]string) string

GetBuildNumberFromLabels returns the

func GetBuildNumberFromLabelsWithKeys

func GetBuildNumberFromLabelsWithKeys(m map[string]string, keys ...string) string

GetBuildNumberFromLabelsWithKeys returns the build number from the given Pod labels

func GetBuildPacks

func GetBuildPacks(jxClient versioned.Interface, ns string) (map[string]*v1.BuildPack, []string, error)

GetBuildPacks returns a map of the BuildPacks along with the correctly ordered names

func GetBuildPods

func GetBuildPods(kubeClient kubernetes.Interface, ns string) ([]*corev1.Pod, error)

GetBuildPods returns all the build pods in the given namespace

func GetPipelineRunPods

func GetPipelineRunPods(kubeClient kubernetes.Interface, ns string, prName string) ([]*corev1.Pod, error)

GetPipelineRunPods gets the pods for a given PipelineRun name.

func GetValueFromLabels

func GetValueFromLabels(m map[string]string, keys ...string) string

GetValueFromLabels returns the first label with the given key

func LoadDownwardAPILabels

func LoadDownwardAPILabels(text string) map[string]string

LoadDownwardAPILabels parses the /etc/podinfo/labels text into a map of label values

func SortBuildPacks

func SortBuildPacks(buildPacks []v1.BuildPack)

SortBuildPacks sorts the build packs in order

func SortBuildPodInfos

func SortBuildPodInfos(buildPodInfos []*BuildPodInfo)

Types

type BaseBuildInfo

type BaseBuildInfo interface {
	GetBuild() string
}

BaseBuildInfo is an interface that is implemented by both BuildPodInfo here and tekton.PipelineRunInfo

type BuildPackOrder

type BuildPackOrder []v1.BuildPack

BuildPackOrder used to sort the build packs in label order

func (BuildPackOrder) Len

func (a BuildPackOrder) Len() int

func (BuildPackOrder) Less

func (a BuildPackOrder) Less(i, j int) bool

func (BuildPackOrder) Swap

func (a BuildPackOrder) Swap(i, j int)

type BuildPodInfo

type BuildPodInfo struct {
	PodName           string
	Name              string
	Organisation      string
	Repository        string
	Branch            string
	Build             string
	Context           string
	BuildNumber       int
	Pipeline          string
	LastCommitSHA     string
	LastCommitMessage string
	LastCommitURL     string
	GitURL            string
	FirstStepImage    string
	CreatedTime       time.Time
	GitInfo           *gits.GitRepository
	Pod               *corev1.Pod
}

func CreateBuildPodInfo

func CreateBuildPodInfo(pod *corev1.Pod) *BuildPodInfo

CreateBuildPodInfo creates a BuildPodInfo from a Pod

func (BuildPodInfo) GetBuild

func (b BuildPodInfo) GetBuild() string

GetBuild gets the build identifier

func (*BuildPodInfo) MatchesPipeline

func (b *BuildPodInfo) MatchesPipeline(activity *v1.PipelineActivity) bool

MatchesPipeline returns true if this build info matches the given pipeline

func (*BuildPodInfo) Status

func (b *BuildPodInfo) Status() string

Status returns the build status

type BuildPodInfoFilter

type BuildPodInfoFilter struct {
	Owner      string
	Repository string
	Branch     string
	Build      string
	Filter     string
	Pod        string
	Pending    bool
	Context    string
	GitURL     string
}

func (*BuildPodInfoFilter) BuildMatches

func (o *BuildPodInfoFilter) BuildMatches(info *BuildPodInfo) bool

BuildMatches returns true if the build info matches the filter

func (*BuildPodInfoFilter) BuildNumber

func (o *BuildPodInfoFilter) BuildNumber() int

BuildNumber returns the integer build number filter if specified

func (*BuildPodInfoFilter) LabelSelectorsForActivity

func (o *BuildPodInfoFilter) LabelSelectorsForActivity() []string

LabelSelectorsForActivity returns a slice of label selectors relevant to PipelineActivity corresponding to the filter

func (*BuildPodInfoFilter) LabelSelectorsForBuild

func (o *BuildPodInfoFilter) LabelSelectorsForBuild() []string

LabelSelectorsForBuild returns a slice of label selectors corresponding to the filter

func (*BuildPodInfoFilter) Validate

func (o *BuildPodInfoFilter) Validate() error

Validate validates the build filter

type BuildPodInfoOrder

type BuildPodInfoOrder []*BuildPodInfo

func (BuildPodInfoOrder) Len

func (a BuildPodInfoOrder) Len() int

func (BuildPodInfoOrder) Less

func (a BuildPodInfoOrder) Less(i, j int) bool

func (BuildPodInfoOrder) Swap

func (a BuildPodInfoOrder) Swap(i, j int)

type JenkinsConverter

type JenkinsConverter struct {
	Indentation          string
	KubernetesPluginMode bool
	ProjectConfig        *config.ProjectConfig
	// contains filtered or unexported fields
}

func NewJenkinsConverter

func NewJenkinsConverter(projectConfig *config.ProjectConfig) *JenkinsConverter

NewJenkinsConverter creates a new JenkinsConverter instance

func (*JenkinsConverter) String

func (j *JenkinsConverter) String() string

func (*JenkinsConverter) ToJenkinsfile

func (j *JenkinsConverter) ToJenkinsfile() (string, error)

Jump to

Keyboard shortcuts

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