util

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const AutoDownloadFolderPerm = 0755

Variables

View Source
var Fatal = fatalError
View Source
var LoggingMode = logger.LogModeDefault
View Source
var ShutdownSignals = []os.Signal{
	os.Interrupt,
	syscall.SIGTERM,
}
View Source
var SystemManagerKey = contextKey{/* contains filtered or unexported fields */}
View Source
var TestError error

Functions

func CheckVersion

func CheckVersion(cmd *cobra.Command, args []string) error

func DownloadResultsHandler

func DownloadResultsHandler(
	ctx context.Context,
	cmd *cobra.Command,
	jobID string,
	downloadSettings *cliflags.DownloaderSettings,
) error

func EnsureValidVersion

func EnsureValidVersion(ctx context.Context, clientVersion, serverVersion *models.BuildVersionInfo) error

func ExecuteJob

func ExecuteJob(ctx context.Context,
	j *model.Job,
	runtimeSettings *cliflags.RunTimeSettingsWithDownload,
) (*model.Job, error)

func FakeFatalErrorHandler

func FakeFatalErrorHandler(cmd *cobra.Command, msg error, code int)

FakeFatalErrorHandler captures the error for testing, responsibility of the test to handle the exit (if any) NOTE: If your test is not idempotent, you can cause side effects (the underlying function will continue to run) Returned as text JSON to wherever RootCmd is printing.

func GetAPIClient

func GetAPIClient(ctx context.Context) *client.APIClient

func GetAPIClientV2

func GetAPIClientV2(cmd *cobra.Command) clientv2.API

func GetCleanupManager

func GetCleanupManager(ctx context.Context) *system.CleanupManager

func GetDefaultJobFolder

func GetDefaultJobFolder(jobID string) string

func Logs

func Logs(cmd *cobra.Command, options LogOptions) error

func ReadFromStdinIfAvailable

func ReadFromStdinIfAvailable(cmd *cobra.Command) ([]byte, error)

func ReadToken added in v1.2.1

func ReadToken(apiURL string) (*apimodels.HTTPCredential, error)

Read the authorization crdential associated with the passed API base URL. If there is no credential currently stored, ReadToken will return nil with no error.

func WriteToken added in v1.2.1

func WriteToken(apiURL string, cred *apimodels.HTTPCredential) error

Persistently store the authorization token against the passed API base URL. Callers may pass nil for the credential which will delete any existing stored token.

Types

type LogOptions added in v1.2.2

type LogOptions struct {
	JobID       string
	ExecutionID string
	Follow      bool
	Tail        bool
}

type Versions added in v1.1.2

type Versions struct {
	ClientVersion *models.BuildVersionInfo `json:"clientVersion,omitempty"`
	ServerVersion *models.BuildVersionInfo `json:"serverVersion,omitempty"`
	LatestVersion *models.BuildVersionInfo `json:"latestVersion,omitempty"`
	UpdateMessage string                   `json:"updateMessage,omitempty"`
}

func GetAllVersions added in v1.1.2

func GetAllVersions(ctx context.Context) (Versions, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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