Go API documentation
github.com/rotari-dev/rotari/internal/bugreport
Overview
package bugreport // import "github.com/rotari-dev/rotari/internal/bugreport"
Package bugreport collects the evidence a rotari bug report needs: the build,
the host and filesystem, configuration, the supervisor log, and the state files
of a run, with secrets removed. It reads state and runs only read-only scheduler
commands.
Functions
func WriteTarGz(target, root string, bundle Bundle, modified time.Time) (err error)
WriteTarGz writes bundle to a new file at target as a gzip-compressed tar
archive under a top directory named root. The summary is root/README.md.
An existing file is not replaced.
Types
type Bundle struct {
Summary string
Files []File
}
Bundle is a collected bug report: a Markdown summary and the files it draws
on.
func Collect(options Options) (Bundle, error)
Collect gathers a bug report. It fails only for a selection that cannot be
read, such as a missing run or job; anything else it cannot collect is noted
in the summary.
type File struct {
Name string
Data []byte
}
File is one entry of a bundle, named by a slash-separated relative path.
type Options struct {
Version string
ExecutableSHA256 string
ExecutableModified time.Time
BaseDir string
// Project and RunID select the run to collect; either may be empty.
Project string
RunID string
// JobIDs selects jobs of the run; empty selects its jobs that did not
// succeed.
JobIDs []string
Output OutputMode
// Redact replaces paths and hostnames. Secrets are removed regardless.
Redact bool
// Facts are files the caller produced, such as `rotari info --json`.
Facts []File
Environ []string
// WebLogPath and RegisteredBaseDirs are master-directory evidence. When
// resolution fails, WebEvidenceError explains why neither is available.
WebLogPath string
RegisteredBaseDirs []string
RegisteredBaseDirsKnown bool
RegisteredBaseDirsError error
WebEvidenceError error
Now func() time.Time
}
Options select what Collect gathers.
type OutputMode int
OutputMode says how much of each included job's own output to collect.
const (
// OutputTail collects the last outputTailBytes of each output file.
OutputTail OutputMode = iota
// OutputFull collects each output file up to outputFullBytes.
OutputFull
// OutputNone collects no job output.
OutputNone
)