inrepo

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: Apache-2.0 Imports: 27 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// TektonAPIVersion the default tekton API version
	TektonAPIVersion = "tekton.dev/v1beta1"

	// DefaultParameters the annotation used to disable default parameters
	DefaultParameters = "lighthouse.jenkins-x.io/defaultParameters"

	// LoadFileRefPattern the regular expression to match which Pipeline/Task references to load via files
	LoadFileRefPattern = "lighthouse.jenkins-x.io/loadFileRefs"

	// PrependStepURL loads the steps from the given URL and prepends them to the given Task
	PrependStepURL = "lighthouse.jenkins-x.io/prependStepsURL"

	// AppendStepURL loads the steps from the given URL and appends them to the end of the Task steps
	AppendStepURL = "lighthouse.jenkins-x.io/appendStepsURL"
)
View Source
const DELIMIER = "#"

Variables

View Source
var (
	// VersionStreamVersions allows you to register version stream values of ful repository names in the format
	// `owner/name` mapping to the version SHA/branch/tag
	VersionStreamVersions = map[string]string{}
)

Functions

func ConvertPipelineToPipelineRun added in v0.0.858

func ConvertPipelineToPipelineRun(from *tektonv1beta1.Pipeline, message string, defaultValues *DefaultValues) (*tektonv1beta1.PipelineRun, error)

ConvertPipelineToPipelineRun converts the Pipeline to a PipelineRun

func ConvertTaskRunToPipelineRun added in v0.0.858

func ConvertTaskRunToPipelineRun(from *tektonv1beta1.TaskRun, message string, defaultValues *DefaultValues) (*tektonv1beta1.PipelineRun, error)

ConvertTaskRunToPipelineRun converts the TaskRun to a PipelineRun

func ConvertTaskToPipelineRun added in v0.0.858

func ConvertTaskToPipelineRun(from *tektonv1beta1.Task, message string, defaultValues *DefaultValues) (*tektonv1beta1.PipelineRun, error)

ConvertTaskToPipelineRun converts the Task to a PipelineRun

func DefaultPipelineParameters added in v0.0.866

func DefaultPipelineParameters(prs *v1beta1.PipelineRun) (*v1beta1.PipelineRun, error)

DefaultPipelineParameters defaults the parameter specs and parameter values from lighthouse onto the PipelineRun and its nested PipelineSpec and Tasks

func Generate

func Generate(fileBrowsers *filebrowser.FileBrowsers, fc filebrowser.FetchCache, cache *ResolverCache, sharedConfig *config.Config, sharedPlugins *plugins.Configuration, owner, repo, eventRef string) (*config.Config, *plugins.Configuration, error)

Generate generates the in repository config if enabled for this repository otherwise return the shared config

func IsScmNotFound added in v0.0.858

func IsScmNotFound(err error) bool

IsScmNotFound returns true if the error is a not found error

func LoadTektonResourceAsPipelineRun added in v0.0.858

func LoadTektonResourceAsPipelineRun(resolver *UsesResolver, data []byte) (*tektonv1beta1.PipelineRun, error)

LoadTektonResourceAsPipelineRun loads a PipelineRun, Pipeline, Task or TaskRun and convert it to a PipelineRun if necessary

func LoadTriggerConfig

func LoadTriggerConfig(fileBrowsers *filebrowser.FileBrowsers, fc filebrowser.FetchCache, cache *ResolverCache, ownerName string, repoName string, sha string) (*triggerconfig.Config, error)

LoadTriggerConfig loads the `lighthouse.yaml` configuration files in the repository

func MergeTriggers

func MergeTriggers(cfg *config.Config, pluginCfg *plugins.Configuration, fileBrowsers *filebrowser.FileBrowsers, fc filebrowser.FetchCache, cache *ResolverCache, ownerName string, repoName string, sha string) (bool, error)

MergeTriggers merges the configuration with any `lighthouse.yaml` files in the repository

func OverrideEnv added in v0.0.918

func OverrideEnv(from []v1.EnvVar, overrides []v1.EnvVar, modify bool) []v1.EnvVar

OverrideEnv override either replaces or adds the given env vars

func OverrideEnvFrom added in v0.0.918

func OverrideEnvFrom(from []v1.EnvFromSource, overrides []v1.EnvFromSource, modify bool) []v1.EnvFromSource

OverrideEnvFrom override either replaces or adds the given env froms

func OverrideResourceList added in v1.0.4

func OverrideResourceList(requests v1.ResourceList, override v1.ResourceList, modify bool) v1.ResourceList

OverrideResourceList overrides resource list properties

func OverrideResources added in v1.0.4

func OverrideResources(resources v1.ResourceRequirements, override v1.ResourceRequirements, modify bool) v1.ResourceRequirements

OverrideResources overrides any resources

func OverrideStep added in v0.0.918

func OverrideStep(step *tektonv1beta1.Step, override *tektonv1beta1.Step)

OverrideStep overrides the step with the given overrides

func OverrideStepWithStep added in v1.12.0

func OverrideStepWithStep(c *tektonv1beta1.Step, override *tektonv1beta1.Step, modify bool)

OverrideTemplateWithStep overrides the container properties

func OverrideTaskSpec added in v1.0.4

func OverrideTaskSpec(ts *tektonv1beta1.TaskSpec, override *tektonv1beta1.TaskSpec)

OverrideTaskSpec lets reuse any TaskSpec resources from the used task

func OverrideTemplateWithTemplate added in v1.12.0

func OverrideTemplateWithTemplate(c *tektonv1beta1.StepTemplate, override *tektonv1beta1.StepTemplate, modify bool)

OverrideTemplateWithStep overrides the container properties

func OverrideVolumeMounts added in v0.0.918

func OverrideVolumeMounts(from []v1.VolumeMount, overrides []v1.VolumeMount, modify bool) []v1.VolumeMount

OverrideVolumeMounts override either replaces or adds the given volume mounts

func OverrideVolumes added in v1.0.4

func OverrideVolumes(from []v1.Volume, overrides []v1.Volume, modify bool) []v1.Volume

OverrideVolumes override either replaces or adds the given volumes

func ToDefaultParams added in v1.0.7

func ToDefaultParams(params []v1beta1.ParamSpec) []v1beta1.Param

ToDefaultParams converts the param specs to default params

func ToParamSpecs added in v0.0.858

func ToParamSpecs(params []tektonv1beta1.Param) []tektonv1beta1.ParamSpec

ToParamSpecs generates param specs from the params

func ToParams added in v0.0.858

func ToParams(params []tektonv1beta1.ParamSpec) []tektonv1beta1.Param

ToParams converts the param specs to params

func ToPipelineInput added in v0.0.858

ToPipelineInput converts the task resource into pipeline inputs

func ToPipelineInputs added in v0.0.858

ToPipelineInputs converts the task resources into pipeline inputs

func ToPipelineOutput added in v0.0.858

ToPipelineOutput converts the task resource into pipeline outputs

func ToPipelineOutputs added in v0.0.858

ToPipelineOutputs converts the task resources into pipeline outputs

func ToPipelineResources added in v0.0.858

func ToPipelineResources(resources *tektonv1beta1.TaskResources) *tektonv1beta1.PipelineTaskResources

ToPipelineResources converts the task resources to piepline resources

func ToPipelineWorkspaceDeclaration added in v0.0.858

ToPipelineWorkspaceDeclaration converts the workspace declaration to a pipeline workspace declaration

func ToPipelineWorkspaceDeclarations added in v0.0.858

func ToPipelineWorkspaceDeclarations(workspaces []tektonv1beta1.WorkspaceDeclaration) []tektonv1beta1.PipelineWorkspaceDeclaration

ToPipelineWorkspaceDeclarations converts the workspace declarations to pipeline workspace declarations

func ToWorkspaceBinding added in v0.0.858

ToWorkspaceBinding converts the workspace declaration to a workspaces binding

func ToWorkspaceBindings added in v0.0.858

func ToWorkspaceBindings(workspaces []tektonv1beta1.WorkspaceDeclaration) []tektonv1beta1.WorkspaceBinding

ToWorkspaceBindings converts the workspace declarations to workspaces bindings

func ToWorkspacePipelineTaskBinding added in v0.0.858

func ToWorkspacePipelineTaskBinding(from tektonv1beta1.WorkspaceBinding) tektonv1beta1.WorkspacePipelineTaskBinding

ToWorkspacePipelineTaskBinding converts the workspace binding to a pipeline task binding

func ToWorkspacePipelineTaskBindings added in v0.0.858

func ToWorkspacePipelineTaskBindings(workspaces []tektonv1beta1.WorkspaceBinding) []tektonv1beta1.WorkspacePipelineTaskBinding

ToWorkspacePipelineTaskBindings converts the workspace bindings to pipeline task bindings

func ToWorkspacePipelineTaskBindingsFromDeclaration added in v0.0.858

func ToWorkspacePipelineTaskBindingsFromDeclaration(from tektonv1beta1.WorkspaceDeclaration) tektonv1beta1.WorkspacePipelineTaskBinding

ToWorkspacePipelineTaskBindingsFromDeclaration converts the workspace declaration to a pipeline task binding

func ToWorkspacePipelineTaskBindingsFromDeclarations added in v0.0.858

func ToWorkspacePipelineTaskBindingsFromDeclarations(workspaces []tektonv1beta1.WorkspaceDeclaration) []tektonv1beta1.WorkspacePipelineTaskBinding

ToWorkspacePipelineTaskBindingsFromDeclarations converts the workspace declarations to pipeline task bindings

func UseParametersAndResults added in v1.0.6

func UseParametersAndResults(ctx context.Context, loc *UseLocation, uses *v1beta1.TaskSpec) error

UseParametersAndResults adds the parameters from the used Task to the PipelineSpec if specified and the PipelineTask

func VersionStreamEnvVar added in v0.0.918

func VersionStreamEnvVar(owner string, repo string) string

VersionStreamEnvVar creates an environment variable name

Types

type DefaultValues added in v0.0.858

type DefaultValues struct {
	// ServiceAccountName
	ServiceAccountName string
	//  Timeout
	Timeout *metav1.Duration
}

DefaultValues default values applied to a PipelineRun if wrapping a Pipeline/Task/TaskRun as a PipelineRun

func NewDefaultValues added in v0.0.858

func NewDefaultValues() (*DefaultValues, error)

NewDefaultValues creatse a new default values

func (*DefaultValues) Apply added in v0.0.858

func (v *DefaultValues) Apply(prs *tektonv1beta1.PipelineRun)

Apply adds any default values that are empty in the generated PipelineRun

type GitURI added in v0.0.918

type GitURI struct {
	Server     string
	Owner      string
	Repository string
	Path       string
	SHA        string
}

GitURI the output of parsing Git URIs

func ParseGitURI added in v0.0.918

func ParseGitURI(text string) (*GitURI, error)

ParseGitURI parses git source URIs or returns nil if its not a valid URI

handles strings of the form "owner/repository(/path)@sha"

func (*GitURI) String added in v0.0.918

func (u *GitURI) String() string

String returns the string representation of the git URI

type ResolverCache added in v0.0.920

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

ResolverCache a cache of data and pipelines to minimise the git cloning with in repo configurations

func NewResolverCache added in v0.0.920

func NewResolverCache() *ResolverCache

NewResolverCache creates a new resolver cache

func (*ResolverCache) GetData added in v0.0.920

func (c *ResolverCache) GetData(sourceURI, ref string) []byte

GetData gets data from the cache if available or returns nil

func (*ResolverCache) GetPipelineRun added in v0.0.920

func (c *ResolverCache) GetPipelineRun(sourceURI, ref string) *tektonv1beta1.PipelineRun

GetPipelineRun gets the PipelineRun from the cache if available or returns nil

func (*ResolverCache) SetData added in v0.0.920

func (c *ResolverCache) SetData(sourceURI, ref string, value []byte)

SetData updates the cache

func (*ResolverCache) SetPipelineRun added in v0.0.920

func (c *ResolverCache) SetPipelineRun(sourceURI string, ref string, value *tektonv1beta1.PipelineRun)

SetPipelineRun updates the cache

type UseLocation added in v1.0.6

type UseLocation struct {
	PipelineRunSpec *v1beta1.PipelineRunSpec
	PipelineSpec    *v1beta1.PipelineSpec
	PipelineTask    *v1beta1.PipelineTask
	TaskName        string
	TaskRunSpec     *v1beta1.TaskRunSpec
	TaskSpec        *v1beta1.TaskSpec
}

UseLocation defines the location where we are using one or more steps where we may need to modify the parameters, results and workspaces

type UsesResolver added in v0.0.918

type UsesResolver struct {
	FileBrowsers     *filebrowser.FileBrowsers
	FetchCache       filebrowser.FetchCache
	Cache            *ResolverCache
	OwnerName        string
	RepoName         string
	SHA              string
	Dir              string
	Message          string
	DefaultValues    *DefaultValues
	LocalFileResolve bool
}

UsesResolver resolves the `uses:` URI syntax

func (*UsesResolver) GetData added in v0.0.918

func (r *UsesResolver) GetData(path string, ignoreNotExist bool) ([]byte, error)

GetData gets the data from the given source URI

func (*UsesResolver) UsesSteps added in v0.0.918

func (r *UsesResolver) UsesSteps(sourceURI string, taskName string, step tektonv1beta1.Step, ts *tektonv1beta1.TaskSpec, loc *UseLocation) ([]tektonv1beta1.Step, error)

UsesSteps lets resolve the sourceURI to a PipelineRun and find the step or steps for the given task name and/or step name then lets apply any overrides from the step

Jump to

Keyboard shortcuts

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