Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ReportCmd = &cobra.Command{ Use: "report", Short: "Run the report", Long: `Runs the report. Takes it name and namespace as args`, Run: func(cmd *cobra.Command, args []string) { log.Info("running the report command") if name == "" || namespace == "" { log.Error(errors.New("name or namespace not provided"), "namespace or name not provided") os.Exit(1) } ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) defer cancel() tmpDir := os.TempDir() targets := uploaders.UploaderTargets{} for _, uploadTarget := range uploadTargets { uploadTarget := uploaders.MustParseUploaderTarget(uploadTarget) log.Info("upload target", "target set to", uploadTarget.Name()) switch v := uploadTarget.(type) { case *uploaders.LocalFilePathUploader: v.LocalFilePath = localFilePath } targets = append(targets, uploadTarget) } cfg := &reporter.Config{ OutputDirectory: tmpDir, Retry: ptr.Int(retry), CaFile: cafile, TokenFile: tokenFile, DataServiceTokenFile: dataServiceTokenFile, DataServiceCertFile: dataServiceCertFile, Local: local, Upload: upload, UploaderTargets: targets, DeployedNamespace: deployedNamespace, ReporterSchema: reporterSchema, } err := cfg.SetDefaults() if err != nil { log.Error(err, "error default config") os.Exit(1) } task, err := reporter.NewTask( ctx, reporter.ReportName{Namespace: namespace, Name: name}, cfg, ) if err != nil { log.Error(err, "couldn't initialize task") os.Exit(1) } err = task.Run(ctx) if err != nil { log.Error(err, "error running task") os.Exit(1) } os.Exit(0) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.