Documentation ¶
Index ¶
- Constants
- Variables
- func AbortJob(ctx context.Context, c kubernetes.Interface, namespace string, jobName string) (*testkube.ExecutionResult, error)
- func GetContainerLogs(ctx context.Context, c kubernetes.Interface, pod *corev1.Pod, ...) ([]byte, error)
- func GetJobPods(ctx context.Context, podsClient tcorev1.PodInterface, jobName string, ...) (*corev1.PodList, error)
- func GetPodErrorMessage(ctx context.Context, client kubernetes.Interface, pod *corev1.Pod) string
- func GetPodEventsSummary(ctx context.Context, client kubernetes.Interface, pod *corev1.Pod) (string, error)
- func GetPodExitCode(pod *corev1.Pod) int32
- func GetPodLogs(ctx context.Context, c kubernetes.Interface, namespace string, pod corev1.Pod, ...) (logs []byte, err error)
- func IsPodFailed(pod *corev1.Pod) (err error)
- func IsPodLoggable(c kubernetes.Interface, podName, namespace string) wait.ConditionWithContextFunc
- func IsPodReady(c kubernetes.Interface, podName, namespace string) wait.ConditionWithContextFunc
- func IsWaitStateFailed(state string) bool
- func MergeCommandAndArgs(command, arguments []string) (string, []string)
- func Run(dir string, command string, envMngr env.Interface, arguments ...string) (out []byte, err error)
- type Images
- type SlaveImages
- type SlavesConfigs
- type Templates
Constants ¶
const ( // VolumeDir is volume dir VolumeDir = "/data" // GitUsernameSecretName is git username secret name GitUsernameSecretName = "git-username" // GitTokenSecretName is git token secret name GitTokenSecretName = "git-token" // SlavesConfigsEnv is slave configs for creating slaves in executor SlavesConfigsEnv = "RUNNER_SLAVES_CONFIGS" )
Variables ¶
var ErrPodInitializing = errors.New("PodInitializing")
var RunnerEnvVars = []corev1.EnvVar{ { Name: "DEBUG", Value: os.Getenv("DEBUG"), }, { Name: "RUNNER_ENDPOINT", Value: os.Getenv("STORAGE_ENDPOINT"), }, { Name: "RUNNER_ACCESSKEYID", Value: os.Getenv("STORAGE_ACCESSKEYID"), }, { Name: "RUNNER_SECRETACCESSKEY", Value: os.Getenv("STORAGE_SECRETACCESSKEY"), }, { Name: "RUNNER_REGION", Value: os.Getenv("STORAGE_REGION"), }, { Name: "RUNNER_TOKEN", Value: os.Getenv("STORAGE_TOKEN"), }, { Name: "RUNNER_SSL", Value: getOr("STORAGE_SSL", "false"), }, { Name: "RUNNER_SKIP_VERIFY", Value: getOr("STORAGE_SKIP_VERIFY", "false"), }, { Name: "RUNNER_CERT_FILE", Value: os.Getenv("STORAGE_CERT_FILE"), }, { Name: "RUNNER_KEY_FILE", Value: os.Getenv("STORAGE_KEY_FILE"), }, { Name: "RUNNER_CA_FILE", Value: os.Getenv("STORAGE_CA_FILE"), }, { Name: "RUNNER_SCRAPPERENABLED", Value: getOr("SCRAPPERENABLED", "false"), }, { Name: "RUNNER_DATADIR", Value: VolumeDir, }, { Name: "RUNNER_CDEVENTS_TARGET", Value: os.Getenv("CDEVENTS_TARGET"), }, { Name: "RUNNER_COMPRESSARTIFACTS", Value: getOr("COMPRESSARTIFACTS", "false"), }, { Name: "RUNNER_CLOUD_MODE", Value: getRunnerCloudMode(), }, { Name: "RUNNER_CLOUD_API_KEY", Value: os.Getenv("TESTKUBE_CLOUD_API_KEY"), }, { Name: "RUNNER_CLOUD_API_TLS_INSECURE", Value: getOr("TESTKUBE_CLOUD_TLS_INSECURE", "false"), }, { Name: "RUNNER_CLOUD_API_URL", Value: os.Getenv("TESTKUBE_CLOUD_URL"), }, { Name: "RUNNER_DASHBOARD_URI", Value: os.Getenv("TESTKUBE_DASHBOARD_URI"), }, { Name: "CI", Value: "1", }, }
Functions ¶
func AbortJob ¶ added in v1.5.35
func AbortJob(ctx context.Context, c kubernetes.Interface, namespace string, jobName string) (*testkube.ExecutionResult, error)
AbortJob - aborts Kubernetes Job with no grace period
func GetContainerLogs ¶ added in v1.9.15
func GetContainerLogs(ctx context.Context, c kubernetes.Interface, pod *corev1.Pod, container, namespace string, tailLines *int64) ([]byte, error)
GetContainerLogs returns container logs
func GetJobPods ¶ added in v1.5.35
func GetJobPods(ctx context.Context, podsClient tcorev1.PodInterface, jobName string, retryNr, retryCount int) (*corev1.PodList, error)
GetJobPods returns job pods
func GetPodErrorMessage ¶ added in v1.10.39
GetPodErrorMessage returns pod error message
func GetPodEventsSummary ¶ added in v1.15.0
func GetPodEventsSummary(ctx context.Context, client kubernetes.Interface, pod *corev1.Pod) (string, error)
GetPodEventsSummary returns pod events summary
func GetPodExitCode ¶ added in v1.15.0
GetPodExitCode returns pod exit code
func GetPodLogs ¶ added in v1.5.35
func GetPodLogs(ctx context.Context, c kubernetes.Interface, namespace string, pod corev1.Pod, logLinesCount ...int64) (logs []byte, err error)
GetPodLogs returns pod logs bytes
func IsPodFailed ¶ added in v1.9.15
IsPodFailed checks if pod failed pod can be in wait state with reason which is error for us on the end
func IsPodLoggable ¶ added in v1.6.11
func IsPodLoggable(c kubernetes.Interface, podName, namespace string) wait.ConditionWithContextFunc
IsPodLoggable defines if pod is ready to get logs from it
func IsPodReady ¶ added in v1.5.35
func IsPodReady(c kubernetes.Interface, podName, namespace string) wait.ConditionWithContextFunc
IsPodReady defines if pod is ready or failed for logs scrapping
func IsWaitStateFailed ¶ added in v1.9.15
IsWaitStateFailed defines possible failed wait state those states are defined and throwed as errors in Kubernetes runtime https://github.com/kubernetes/kubernetes/blob/127f33f63d118d8d61bebaba2a240c60f71c824a/pkg/kubelet/kuberuntime/kuberuntime_container.go#L59
func MergeCommandAndArgs ¶ added in v1.12.0
MergeCommandAndArgs prepares command and args for Run method
func Run ¶
func Run(dir string, command string, envMngr env.Interface, arguments ...string) (out []byte, err error)
Run runs executor process wrapped in json line output wraps stdout lines into JSON chunks we want it to have common interface for agent stdin <- testkube.Execution, stdout <- stream of json logs LoggedExecuteInDir will put wrapped JSON output to stdout AND get RAW output into out var json logs can be processed later on watch of pod logs
Types ¶
type Images ¶ added in v1.7.16
Images contains images for executor
func SyncDefaultExecutors ¶ added in v1.7.16
func SyncDefaultExecutors( executorsClient executorsclientv1.Interface, namespace string, executors []testkube.ExecutorDetails, readOnlyExecutors bool, ) (images Images, err error)
SyncDefaultExecutors creates or updates default executors
type SlaveImages ¶ added in v1.15.0
type SlavesConfigs ¶ added in v1.15.0
type SlavesConfigs struct { Images SlaveImages `json:"images"` ServiceAccountName string `json:"serviceAccountName"` CertificateSecret string `json:"certificateSecret"` SlavePodTemplate string `json:"slavePodTemplate"` ImagePullSecrets []string `json:"imagePullSecrets"` EnvConfigMaps []testkube.EnvReference `json:"envConfigMaps"` EnvSecrets []testkube.EnvReference `json:"envSecrets"` ActiveDeadlineSeconds int `json:"activeDeadlineSeconds"` }
func GetSlavesConfigs ¶ added in v1.15.0
func GetSlavesConfigs(initImage string, slavesMeta executorv1.SlavesMeta, registry string, serviceAccountName string, certificateSecret string, slavePodTemplate string, imagePullSecrets []string, envConfigMaps []testkube.EnvReference, envSecrets []testkube.EnvReference, activeDeadlineSeconds int, ) SlavesConfigs