Documentation ¶
Index ¶
- Constants
- func IsPodReady(c *kubernetes.Clientset, podName, namespace string) wait.ConditionFunc
- func NewJobSpec(log *zap.SugaredLogger, options JobOptions) (*batchv1.Job, error)
- type ExecutionCounter
- type JobClient
- func (c *JobClient) AbortK8sJob(jobName string) *testkube.ExecutionResult
- func (c *JobClient) CreatePersistentVolume(name string) error
- func (c *JobClient) CreatePersistentVolumeClaim(name string) error
- func (c *JobClient) GetJobPods(podsClient tcorev1.PodInterface, jobName string, retryNr, retryCount int) (*corev1.PodList, error)
- func (c *JobClient) GetLastLogLineError(ctx context.Context, pod corev1.Pod) error
- func (c *JobClient) GetPodLogError(ctx context.Context, pod corev1.Pod) (logsBytes []byte, err error)
- func (c *JobClient) GetPodLogs(pod corev1.Pod, logLinesCount ...int64) (logs []byte, err error)
- func (c *JobClient) LaunchK8sJob(repo result.Repository, execution testkube.Execution, options JobOptions) (result testkube.ExecutionResult, err error)
- func (c *JobClient) LaunchK8sJobSync(repo result.Repository, execution testkube.Execution, options JobOptions) (result testkube.ExecutionResult, err error)
- func (c *JobClient) TailJobLogs(id string, logs chan []byte) (err error)
- func (c *JobClient) TailPodLogs(ctx context.Context, pod corev1.Pod, logs chan []byte) (err error)
- type JobOptions
Constants ¶
const ( // GitUsernameSecretName is git username secret name GitUsernameSecretName = "git-username" // GitUsernameEnvVarName is git username environment var name GitUsernameEnvVarName = "RUNNER_GITUSERNAME" // GitTokenSecretName is git token secret name GitTokenSecretName = "git-token" // GitTokenEnvVarName is git token environment var name GitTokenEnvVarName = "RUNNER_GITTOKEN" )
Variables ¶
This section is empty.
Functions ¶
func IsPodReady ¶ added in v0.8.3
func IsPodReady(c *kubernetes.Clientset, podName, namespace string) wait.ConditionFunc
IsPodReady defines if pod is ready or failed for logs scrapping
func NewJobSpec ¶ added in v0.6.4
func NewJobSpec(log *zap.SugaredLogger, options JobOptions) (*batchv1.Job, error)
NewJobSpec is a method to create new job spec
Types ¶
type ExecutionCounter ¶ added in v1.2.15
type JobClient ¶
type JobClient struct { ClientSet *kubernetes.Clientset Repository result.Repository Namespace string Cmd string Log *zap.SugaredLogger // contains filtered or unexported fields }
JobClient data struct for managing running jobs
func NewJobClient ¶
func NewJobClient(namespace, initImage, jobTemplate string, metrics ExecutionCounter) (*JobClient, error)
NewJobClient returns new JobClient instance
func (*JobClient) AbortK8sJob ¶
func (c *JobClient) AbortK8sJob(jobName string) *testkube.ExecutionResult
AbortK8sJob aborts K8S by job name
func (*JobClient) CreatePersistentVolume ¶
CreatePersistentVolume creates persistent volume
func (*JobClient) CreatePersistentVolumeClaim ¶
CreatePersistentVolumeClaim creates PVC with given name
func (*JobClient) GetJobPods ¶ added in v0.6.4
func (c *JobClient) GetJobPods(podsClient tcorev1.PodInterface, jobName string, retryNr, retryCount int) (*corev1.PodList, error)
GetJobPods returns job pods
func (*JobClient) GetLastLogLineError ¶ added in v0.8.3
GetLastLogLineError return error if last line is failed
func (*JobClient) GetPodLogError ¶ added in v0.8.3
func (c *JobClient) GetPodLogError(ctx context.Context, pod corev1.Pod) (logsBytes []byte, err error)
GetPodLogError returns last line as error
func (*JobClient) GetPodLogs ¶
GetPodLogs returns pod logs bytes
func (*JobClient) LaunchK8sJob ¶
func (c *JobClient) LaunchK8sJob(repo result.Repository, execution testkube.Execution, options JobOptions) ( result testkube.ExecutionResult, err error)
LaunchK8sJob launches new job and run executor of given type TODO consider moving storage based operation up in hierarchy TODO Consider moving launch of K8s job as always sync
func (*JobClient) LaunchK8sJobSync ¶ added in v0.7.6
func (c *JobClient) LaunchK8sJobSync(repo result.Repository, execution testkube.Execution, options JobOptions) ( result testkube.ExecutionResult, err error)
LaunchK8sJobSync launches new job and run executor of given type TODO Consider moving launch of K8s job as always sync TODO Consider moving storage calls level up (remove dependency from here)
func (*JobClient) TailJobLogs ¶ added in v0.6.4
TailJobLogs - locates logs for job pod(s)