Documentation ¶
Index ¶
- Constants
- func CancelPipelineRun(ctx context.Context, tektonClient tektonclient.Interface, ns string, ...) error
- func GetPipelineActivityForPipelineRun(ctx context.Context, activityInterface typev1.PipelineActivityInterface, ...) (*v1.PipelineActivity, error)
- func PipelineRunIsComplete(pr *pipelineapi.PipelineRun) bool
- func PipelineRunIsNotPending(pr *pipelineapi.PipelineRun) bool
- type BuildPodInfoFilter
- type LogLine
- type PipelineType
- type TektonLogger
- func (t *TektonLogger) CreateBucketHTTPFn() func(string) (string, func(*http.Request), error)
- func (t *TektonLogger) Err() error
- func (t *TektonLogger) GetRunningBuildLogs(ctx context.Context, pa *v1.PipelineActivity, ...) <-chan LogLine
- func (t *TektonLogger) GetTektonPipelinesWithActivePipelineActivity(ctx context.Context, filter *BuildPodInfoFilter) ([]string, map[string]*v1.PipelineActivity, ...)
- func (t *TektonLogger) StreamPipelinePersistentLogs(logsURL string) <-chan LogLine
Constants ¶
const ( // LastBuildNumberAnnotationPrefix used to annotate SourceRepository with the latest build number for a branch LastBuildNumberAnnotationPrefix = "jenkins.io/last-build-number-for-" // LabelOwner is the label added to Tekton CRDs for the owner of the repository being built. LabelOwner = v1.LabelOwner // LabelRepo is the label added to Tekton CRDs for the repository being built. LabelRepo = v1.LabelRepository // LabelBranch is the label added to Tekton CRDs for the branch being built. LabelBranch = v1.LabelBranch // LabelBuild is the label added to Tekton CRDs for the build number. LabelBuild = v1.LabelBuild // LabelContext is the label added to Tekton CRDs for the context being built. LabelContext = "context" // LabelType is the label added to Tekton CRDs for the type of pipeline. LabelType = "jenkins.io/pipelineType" // DefaultPipelineSA is the default service account used for pipelines DefaultPipelineSA = "tekton-bot" )
Variables ¶
This section is empty.
Functions ¶
func CancelPipelineRun ¶
func CancelPipelineRun(ctx context.Context, tektonClient tektonclient.Interface, ns string, pr *pipelineapi.PipelineRun) error
CancelPipelineRun cancels a Pipeline
func GetPipelineActivityForPipelineRun ¶
func GetPipelineActivityForPipelineRun(ctx context.Context, activityInterface typev1.PipelineActivityInterface, pr *tektonapis.PipelineRun) (*v1.PipelineActivity, error)
GetPipelineActivityForPipelineRun returns the PipelineActivity for the PipelineRun if it can be found
func PipelineRunIsComplete ¶
func PipelineRunIsComplete(pr *pipelineapi.PipelineRun) bool
PipelineRunIsComplete returns true if the PipelineRun has completed or has running steps.
func PipelineRunIsNotPending ¶
func PipelineRunIsNotPending(pr *pipelineapi.PipelineRun) bool
PipelineRunIsNotPending returns true if the PipelineRun has completed or has running steps.
Types ¶
type BuildPodInfoFilter ¶
type BuildPodInfoFilter struct { Owner string Repository string Branch string Build string Filter string Pod string Pending bool Context string GitURL string }
BuildPodInfoFilter for filtering pipelines / PipelineRuns
func (*BuildPodInfoFilter) AddFlags ¶
func (o *BuildPodInfoFilter) AddFlags(cmd *cobra.Command)
AddFlags adds the CLI flags for filtering
func (*BuildPodInfoFilter) Matches ¶
func (o *BuildPodInfoFilter) Matches(pa *v1.PipelineActivity) bool
Matches returns true if the PipelineActivity matches the filter
func (*BuildPodInfoFilter) Validate ¶
func (o *BuildPodInfoFilter) Validate() error
Validate validates the settings
type LogLine ¶
LogLine is the object sent to and received from the channels in the StreamLog and WriteLog functions defined by LogWriter
type PipelineType ¶
type PipelineType int
PipelineType is used to differentiate between actual build pipelines and pipelines to create the build pipelines, aka meta pipelines.
func (PipelineType) String ¶
func (s PipelineType) String() string
type TektonLogger ¶
type TektonLogger struct { JXClient versioned.Interface TektonClient tektonclient.Interface KubeClient kubernetes.Interface Namespace string GitUsername string GitToken string BytesLimit int64 FailIfPodFails bool StorageReadTimeout time.Duration LogsRetrieverFunc retrieverFunc // contains filtered or unexported fields }
TektonLogger contains the necessary clients and the namespace to get data from the cluster, an implementation of LogWriter to write logs to and a logs retriever function to override the default way to obtain logs
func (*TektonLogger) CreateBucketHTTPFn ¶
CreateBucketHTTPFn creates a function to transform a git URL to add the token and possible header function for accessing a git based bucket
func (*TektonLogger) Err ¶
func (t *TektonLogger) Err() error
Err returns the last error that occurred during streaming logs. It should be checked after the log stream channel has been closed.
func (*TektonLogger) GetRunningBuildLogs ¶
func (t *TektonLogger) GetRunningBuildLogs(ctx context.Context, pa *v1.PipelineActivity, pipelineRuns []*tektonapis.PipelineRun, buildName string) <-chan LogLine
GetRunningBuildLogs obtains the logs of the provided PipelineActivity and streams the running build pods' logs using the provided LogWriter
func (*TektonLogger) GetTektonPipelinesWithActivePipelineActivity ¶
func (t *TektonLogger) GetTektonPipelinesWithActivePipelineActivity(ctx context.Context, filter *BuildPodInfoFilter) ([]string, map[string]*v1.PipelineActivity, map[string][]*tektonapis.PipelineRun, error)
GetTektonPipelinesWithActivePipelineActivity returns list of all PipelineActivities with corresponding Tekton PipelineRuns ordered by the PipelineRun creation timestamp and a map to obtain its reference once a name has been selected
func (*TektonLogger) StreamPipelinePersistentLogs ¶
func (t *TektonLogger) StreamPipelinePersistentLogs(logsURL string) <-chan LogLine
StreamPipelinePersistentLogs reads logs from the provided bucket URL and writes them using the provided LogWriter