Documentation ¶
Index ¶
- Constants
- Variables
- type AnalysisDriverJob
- func (j *AnalysisDriverJob) Container() *Container
- func (j *AnalysisDriverJob) ImagePullSecrets() []string
- func (j *AnalysisDriverJob) InitContainer() *Container
- func (j *AnalysisDriverJob) JobLabels() map[string]string
- func (j *AnalysisDriverJob) Name() string
- func (j *AnalysisDriverJob) Namespace() string
- func (j *AnalysisDriverJob) NodeSelector() map[string]string
- func (j *AnalysisDriverJob) PodLabels() map[string]string
- func (*AnalysisDriverJob) Volumes() []string
- type AnalysisOpts
- type AnalysisRunRequest
- type AnalysisTask
- type AutofixConfig
- type AutofixDriverJob
- func (j *AutofixDriverJob) Container() *Container
- func (j *AutofixDriverJob) ImagePullSecrets() []string
- func (j *AutofixDriverJob) InitContainer() *Container
- func (j *AutofixDriverJob) JobLabels() map[string]string
- func (j *AutofixDriverJob) Name() string
- func (j *AutofixDriverJob) Namespace() string
- func (j *AutofixDriverJob) NodeSelector() map[string]string
- func (j *AutofixDriverJob) PodLabels() map[string]string
- func (*AutofixDriverJob) Volumes() []string
- type AutofixOpts
- type AutofixRunRequest
- type AutofixTask
- type CancelCheckDriverJob
- type CancelCheckOpts
- type CancelCheckTask
- type Cleaner
- type CleanerOpts
- type Container
- type Driver
- type Facade
- type Handler
- type JobCreator
- func NewAnalysisDriverJob(run *artifact.AnalysisRun, check artifact.Check, opts *AnalysisOpts) (JobCreator, error)
- func NewAutofixDriverJob(run *artifact.AutofixRun, opts *AutofixOpts) (JobCreator, error)
- func NewPatcherDriverJob(run *artifact.PatcherRun, opts *PatcherJobOpts) (JobCreator, error)
- func NewTransformerJob(run *artifact.TransformerRun, opts *TransformerOpts) (JobCreator, error)
- type JobDeleter
- type K8sDriver
- type K8sPrinterDriver
- type KubernetesOpts
- type MarvinAnalysisConfig
- type MarvinK8sJob
- type Opts
- type PatcherDriverJob
- func (j *PatcherDriverJob) Container() *Container
- func (j *PatcherDriverJob) ImagePullSecrets() []string
- func (*PatcherDriverJob) InitContainer() *Container
- func (j *PatcherDriverJob) JobLabels() map[string]string
- func (j *PatcherDriverJob) Name() string
- func (j *PatcherDriverJob) Namespace() string
- func (j *PatcherDriverJob) NodeSelector() map[string]string
- func (j *PatcherDriverJob) PodLabels() map[string]string
- func (*PatcherDriverJob) Volumes() []string
- type PatcherJobOpts
- type PatcherRunRequest
- type PatcherTask
- type Provider
- type Resource
- type Router
- type Runner
- type Signer
- type Storer
- type TaskOpts
- type TransformerJob
- func (j *TransformerJob) Container() *Container
- func (j *TransformerJob) ImagePullSecrets() []string
- func (j *TransformerJob) InitContainer() *Container
- func (j *TransformerJob) JobLabels() map[string]string
- func (j *TransformerJob) Name() string
- func (j *TransformerJob) Namespace() string
- func (j *TransformerJob) NodeSelector() map[string]string
- func (j *TransformerJob) PodLabels() map[string]string
- func (*TransformerJob) Volumes() []string
- type TransformerMarvinConfig
- type TransformerOpts
- type TransformerRunRequest
- type TransformerTask
Constants ¶
const ( CoatVersion = "latest" LabelNameManager = "manager" LabelNameRole = "role" LabelNameApp = "application" LabelNameAnalyzer = "analyzer" EnvNameCodePath = "CODE_PATH" EnvNameToolboxPath = "TOOLBOX_PATH" EnvNameMemoryLimit = "MEMORY_LIMIT" EnvNameCPULimit = "CPU_LIMIT" EnvNameTimeLimit = "TIME_LIMIT" EnvNameOnPrem = "ON_PREM" EnvNameSSHPrivateKey = "SSH_PRIVATE_KEY" EnvNameSSHPublicKey = "SSH_PUBLIC_KEY" EnvNamePublisher = "PUBLISHER" EnvNamePublisherURL = "RESULT_HTTP_URL" EnvNamePublisherToken = "RESULT_HTTP_TOKEN" EnvNameResultTask = "RESULT_RMQ_TASK" EnvNameArtifactsCredentialsPath = "ARTIFACTS_CREDENTIALS_PATH" MarvinCmdCpy = "cp /marvin/marvin /toolbox &&" MarvinCmdBase = "/toolbox/marvin" MarvinCmdArgConfig = "--config" MarvinModeAnalyze = "--analyze" MarvinModeAutofix = "--autofix" MarvinModeTransform = "--transform" MarvinSnippetStorageType = "--snippet-storage-type" MarvinSnippetStorageBucket = "--snippet-storage-bucket" CoatCmdName = "/app/coat" CoatArgNameRunID = "--run-id" CoatArgNameCheckSeq = "--check-seq" CoatArgNameRemoteURL = "--remote-url" CoatArgNameCheckoutOid = "--checkout-oid" CoatArgNameCloneSubmodules = "--clone-submodules" CoatArgTestCoverageArtifact = "--artifacts" CoatArgNameDecryptRemote = "--decrypt-remote-url" CoatArgSnippetStorageBucket = "--snippet-storage-bucket" CoatArgSnippetStorageType = "--snippet-storage-type" CoatArgNameBaseBranch = "--base-branch" CoatArgPatchMeta = "--patch-meta" CoatArgArtifacts = "--artifacts" CoatCPULimit = "1400m" CoatMemoryLimit = "4000Mi" CoatCPURequest = "300m" CoatMemoryRequest = "500Mi" ScopeAnalysis = "analysis.*" ScopeAutofix = "autofix.*" ScopeTransform = "transform.*" AnalysisResultTask = "contrib.atlas.tasks.store_analysis_run_result" AutofixResultTask = "contrib.atlas.tasks.store_autofix_run_result" TransformerResultTask = "contrib.atlas.tasks.store_transformer_run_result" CancelCheckResultTask = "contrib.atlas.tasks.confirm_check_cancellation" PatcherResultTask = "contrib.runner.tasks.store_autofix_committer_result" )
const ( KindJob = "Job" APIVersionV1 = "batch/v1" )
const ( DriverTypePrinter = "printer" DriverTypeK8s = "k8s" )
const CleanupInterval = -1 * time.Hour
const DefaultK8sTokenPath = "/var/run/secrets/kubernetes.io/serviceaccount/token"
const (
DriverPrinter = "printer"
)
Variables ¶
var (
ErrMissingOpts = errors.New("missing opts")
)
var ErrUnknownStorageProvider = errors.New("unknown storage provider")
var VolumeMounts = map[string]string{
"codedir": "/code",
"artifactsdir": "/artifacts",
"ssh": "/home/runner/.ssh",
"marvindir": "/marvin",
}
Functions ¶
This section is empty.
Types ¶
type AnalysisDriverJob ¶
type AnalysisDriverJob struct {
// contains filtered or unexported fields
}
AnalysisDriverJob is a struct that implements the IDriverJob interface.
func (*AnalysisDriverJob) Container ¶
func (j *AnalysisDriverJob) Container() *Container
func (*AnalysisDriverJob) ImagePullSecrets ¶
func (j *AnalysisDriverJob) ImagePullSecrets() []string
func (*AnalysisDriverJob) InitContainer ¶
func (j *AnalysisDriverJob) InitContainer() *Container
func (*AnalysisDriverJob) JobLabels ¶
func (j *AnalysisDriverJob) JobLabels() map[string]string
func (*AnalysisDriverJob) Name ¶
func (j *AnalysisDriverJob) Name() string
func (*AnalysisDriverJob) Namespace ¶
func (j *AnalysisDriverJob) Namespace() string
func (*AnalysisDriverJob) NodeSelector ¶
func (j *AnalysisDriverJob) NodeSelector() map[string]string
func (*AnalysisDriverJob) PodLabels ¶
func (j *AnalysisDriverJob) PodLabels() map[string]string
func (*AnalysisDriverJob) Volumes ¶
func (*AnalysisDriverJob) Volumes() []string
type AnalysisOpts ¶
type AnalysisOpts struct { PublisherURL string PublisherToken string SnippetStorageType string SnippetStorageBucket string KubernetesOpts *KubernetesOpts }
type AnalysisRunRequest ¶
type AnalysisRunRequest struct { Run *artifact.AnalysisRun AppID string InstallationID string }
type AnalysisTask ¶
type AnalysisTask struct {
// contains filtered or unexported fields
}
func NewAnalysisTask ¶
func (*AnalysisTask) Run ¶
func (t *AnalysisTask) Run(ctx context.Context, req *AnalysisRunRequest) error
Run executes the analysis task for the given analysis run. For each check in the run, it creates a new analysis driver job and triggers the job in a separate goroutine. The function waits for all jobs to complete before returning.
The context is used to control the overall execution of the task. The run parameter contains the information about the analysis run to be executed.
If any of the driver jobs fail, Run logs the error and returns it. If all jobs complete successfully, Run returns nil.
Example usage:
err := task.Run(ctx, run) if err != nil { log.Fatal(err) }
Run is safe for concurrent use.
type AutofixConfig ¶
type AutofixConfig struct {
*artifact.MarvinAutofixConfig
}
func NewAutofixConfig ¶
func NewAutofixConfig(run *artifact.AutofixRun) (*AutofixConfig, error)
func (*AutofixConfig) Bytes ¶
func (c *AutofixConfig) Bytes() ([]byte, error)
type AutofixDriverJob ¶
type AutofixDriverJob struct {
// contains filtered or unexported fields
}
func (*AutofixDriverJob) Container ¶
func (j *AutofixDriverJob) Container() *Container
func (*AutofixDriverJob) ImagePullSecrets ¶
func (j *AutofixDriverJob) ImagePullSecrets() []string
func (*AutofixDriverJob) InitContainer ¶
func (j *AutofixDriverJob) InitContainer() *Container
func (*AutofixDriverJob) JobLabels ¶
func (j *AutofixDriverJob) JobLabels() map[string]string
func (*AutofixDriverJob) Name ¶
func (j *AutofixDriverJob) Name() string
func (*AutofixDriverJob) Namespace ¶
func (j *AutofixDriverJob) Namespace() string
func (*AutofixDriverJob) NodeSelector ¶
func (j *AutofixDriverJob) NodeSelector() map[string]string
func (*AutofixDriverJob) PodLabels ¶
func (j *AutofixDriverJob) PodLabels() map[string]string
func (*AutofixDriverJob) Volumes ¶
func (*AutofixDriverJob) Volumes() []string
type AutofixOpts ¶
type AutofixOpts struct { PublisherURL string PublisherToken string SnippetStorageType string SnippetStorageBucket string KubernetesOpts *KubernetesOpts }
type AutofixRunRequest ¶
type AutofixRunRequest struct { Run *artifact.AutofixRun AppID string InstallationID string }
type AutofixTask ¶
type AutofixTask struct {
// contains filtered or unexported fields
}
func NewAutofixTask ¶
func (*AutofixTask) Run ¶
func (t *AutofixTask) Run(ctx context.Context, req *AutofixRunRequest) error
type CancelCheckDriverJob ¶
type CancelCheckDriverJob struct {
// contains filtered or unexported fields
}
func (*CancelCheckDriverJob) Name ¶
func (j *CancelCheckDriverJob) Name() string
func (*CancelCheckDriverJob) Namespace ¶
func (j *CancelCheckDriverJob) Namespace() string
type CancelCheckOpts ¶
type CancelCheckOpts struct {
KubernetesOpts *KubernetesOpts
}
type CancelCheckTask ¶
type CancelCheckTask struct {
// contains filtered or unexported fields
}
func NewCancelCheckTask ¶
func NewCancelCheckTask(runner *Runner, opts *TaskOpts, driver Driver, signer Signer, client *http.Client) *CancelCheckTask
NewCancelCheckTask registers a new cancel check task with the supplied properties of driver, provider facade and license store.
func (*CancelCheckTask) Run ¶
func (t *CancelCheckTask) Run(ctx context.Context, run *artifact.CancelCheckRun) error
Run creates the template for the cancel check job and triggers the cancel check job.
type Cleaner ¶
type Cleaner struct {
// contains filtered or unexported fields
}
func NewCleaner ¶
func NewCleaner(driver Driver, opts *CleanerOpts) *Cleaner
type CleanerOpts ¶
type Driver ¶
type Driver interface { TriggerJob(ctx context.Context, request JobCreator) error DeleteJob(ctx context.Context, request JobDeleter) error CleanExpiredJobs(ctx context.Context, namespace string, interval *time.Duration) error }
func NewK8sDriver ¶
func NewK8sPrinterDriver ¶
func NewK8sPrinterDriver() Driver
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) HandleAnalysis ¶
func (*Handler) HandleAutofix ¶
func (*Handler) HandleCancelCheck ¶
HandleCancelCheck handles the cancel check workflow.
func (*Handler) HandlePatcher ¶
HandlePatcher handles the patching job workflow.
func (*Handler) HandleTransformer ¶
type JobCreator ¶
type JobCreator interface { Name() string Namespace() string JobLabels() map[string]string PodLabels() map[string]string Volumes() []string Container() *Container InitContainer() *Container NodeSelector() map[string]string ImagePullSecrets() []string }
Type JobCreator interface defines methods to access data required for a job creation irrespective of the driver implementation.
func NewAnalysisDriverJob ¶
func NewAnalysisDriverJob(run *artifact.AnalysisRun, check artifact.Check, opts *AnalysisOpts) (JobCreator, error)
func NewAutofixDriverJob ¶
func NewAutofixDriverJob(run *artifact.AutofixRun, opts *AutofixOpts) (JobCreator, error)
func NewPatcherDriverJob ¶
func NewPatcherDriverJob(run *artifact.PatcherRun, opts *PatcherJobOpts) (JobCreator, error)
NewPatcherDriverJob is responsible for creating the patcher run config and then returning an instance of the patcher job.
func NewTransformerJob ¶
func NewTransformerJob(run *artifact.TransformerRun, opts *TransformerOpts) (JobCreator, error)
type JobDeleter ¶
Type JobDeleter interface defines methods to access data required for a job deletion irrespective of the driver implementation.
func NewCancelCheckDriverJob ¶
func NewCancelCheckDriverJob(run *artifact.CancelCheckRun, opts *CancelCheckOpts) (JobDeleter, error)
type K8sDriver ¶
type K8sDriver struct {
// contains filtered or unexported fields
}
func (*K8sDriver) CleanExpiredJobs ¶
func (*K8sDriver) DeleteJob ¶
func (d *K8sDriver) DeleteJob(ctx context.Context, job JobDeleter) error
DeleteJob deletes the kubernetes job supplied as a parameter.
func (*K8sDriver) TriggerJob ¶
func (d *K8sDriver) TriggerJob(ctx context.Context, job JobCreator) error
TriggerJob creates the kubernetes job supplied as a parameter.
type K8sPrinterDriver ¶
type K8sPrinterDriver struct{}
func (*K8sPrinterDriver) CleanExpiredJobs ¶
func (*K8sPrinterDriver) DeleteJob ¶
func (*K8sPrinterDriver) DeleteJob(_ context.Context, _ JobDeleter) error
func (*K8sPrinterDriver) TriggerJob ¶
func (*K8sPrinterDriver) TriggerJob(_ context.Context, job JobCreator) error
type KubernetesOpts ¶
type MarvinAnalysisConfig ¶
type MarvinAnalysisConfig struct {
*artifact.MarvinAnalysisConfig
}
func NewMarvinAnalysisConfig ¶
func NewMarvinAnalysisConfig(run *artifact.AnalysisRun, check artifact.Check) *MarvinAnalysisConfig
func (*MarvinAnalysisConfig) Bytes ¶
func (c *MarvinAnalysisConfig) Bytes() ([]byte, error)
type MarvinK8sJob ¶
type MarvinK8sJob struct {
JobCreator
}
type PatcherDriverJob ¶
type PatcherDriverJob struct {
// contains filtered or unexported fields
}
PatcherDriverJob represents the patcher job and the data required by it in the form of config or opts.
func (*PatcherDriverJob) Container ¶
func (j *PatcherDriverJob) Container() *Container
func (*PatcherDriverJob) ImagePullSecrets ¶
func (j *PatcherDriverJob) ImagePullSecrets() []string
func (*PatcherDriverJob) InitContainer ¶
func (*PatcherDriverJob) InitContainer() *Container
func (*PatcherDriverJob) JobLabels ¶
func (j *PatcherDriverJob) JobLabels() map[string]string
func (*PatcherDriverJob) Name ¶
func (j *PatcherDriverJob) Name() string
func (*PatcherDriverJob) Namespace ¶
func (j *PatcherDriverJob) Namespace() string
func (*PatcherDriverJob) NodeSelector ¶
func (j *PatcherDriverJob) NodeSelector() map[string]string
func (*PatcherDriverJob) PodLabels ¶
func (j *PatcherDriverJob) PodLabels() map[string]string
func (*PatcherDriverJob) Volumes ¶
func (*PatcherDriverJob) Volumes() []string
type PatcherJobOpts ¶
type PatcherJobOpts struct { PublisherURL string PublisherToken string SnippetStorageType string SnippetStorageBucket string KubernetesOpts *KubernetesOpts }
PatcherJobOpts represents the data that needs to be passed to the patcher job like the results URL.
type PatcherRunRequest ¶
type PatcherRunRequest struct { Run *artifact.PatcherRun AppID string InstallationID string }
PatcherRunRequest represents the data corresponding to the patcher run including the AppID and InstallationID of the client.
type PatcherTask ¶
type PatcherTask struct {
// contains filtered or unexported fields
}
PatcherTask represents the patcher job task structure.
func NewPatcherTask ¶
func NewPatcherTask(runner *Runner, opts *TaskOpts, driver Driver, provider Provider, signer Signer) *PatcherTask
NewPatcherTask creates a new patching job task based on PatcherTask structure and returns it.
func (*PatcherTask) Run ¶
func (p *PatcherTask) Run(ctx context.Context, req *PatcherRunRequest) error
PatcherTask.Run creates a new patcher job based on the data passed to it and then triggers that job using the specified driver in the task.
type TaskOpts ¶
type TaskOpts struct { RemoteHost string SnippetStorageType string SnippetStorageBucket string KubernetesOpts *KubernetesOpts }
type TransformerJob ¶
type TransformerJob struct {
// contains filtered or unexported fields
}
func (*TransformerJob) Container ¶
func (j *TransformerJob) Container() *Container
func (*TransformerJob) ImagePullSecrets ¶
func (j *TransformerJob) ImagePullSecrets() []string
func (*TransformerJob) InitContainer ¶
func (j *TransformerJob) InitContainer() *Container
func (*TransformerJob) JobLabels ¶
func (j *TransformerJob) JobLabels() map[string]string
func (*TransformerJob) Name ¶
func (j *TransformerJob) Name() string
func (*TransformerJob) Namespace ¶
func (j *TransformerJob) Namespace() string
func (*TransformerJob) NodeSelector ¶
func (j *TransformerJob) NodeSelector() map[string]string
func (*TransformerJob) PodLabels ¶
func (j *TransformerJob) PodLabels() map[string]string
func (*TransformerJob) Volumes ¶
func (*TransformerJob) Volumes() []string
type TransformerMarvinConfig ¶
type TransformerMarvinConfig struct {
*artifact.MarvinTransformerConfig
}
func NewTransformerMarvinConfig ¶
func NewTransformerMarvinConfig(run *artifact.TransformerRun) *TransformerMarvinConfig
func (*TransformerMarvinConfig) Bytes ¶
func (c *TransformerMarvinConfig) Bytes() ([]byte, error)
type TransformerOpts ¶
type TransformerOpts struct { PublisherURL string PublisherToken string KubernetesOpts *KubernetesOpts }
type TransformerRunRequest ¶
type TransformerRunRequest struct { Run *artifact.TransformerRun AppID string InstallationID string }
type TransformerTask ¶
type TransformerTask struct {
// contains filtered or unexported fields
}
func NewTransformerTask ¶
func (*TransformerTask) Run ¶
func (t *TransformerTask) Run(ctx context.Context, req *TransformerRunRequest) error
Source Files ¶
- analysis.go
- analysis_config.go
- analysis_job.go
- autofix.go
- autofix_config.go
- autofix_job.go
- cancel_check.go
- cancel_check_job.go
- cleanup.go
- constants.go
- driver.go
- driver_request.go
- facade.go
- handler.go
- k8s_driver.go
- k8s_printer.go
- marvin_k8s_job.go
- patcher.go
- patcher_job.go
- provider.go
- runner.go
- transformer.go
- transformer_config.go
- transformer_job.go
- types.go