Documentation
¶
Overview ¶
Package htmlreport generates a static HTML viewer for artifact directories collected by dpfdev collect. Artifacts have the structure:
<artifactDir>/<cluster>/Resources/<Kind>/[<namespace>/]<name>.yaml <artifactDir>/<cluster>/Events/<Kind>/<namespace>/<name>.events
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiscoverDumps ¶
DiscoverDumps walks root and returns the resource dump directories found underneath it. A dump is a directory whose <cluster> children contain a Resources/ or Events/ section directory, i.e. the grandparent of any such section directory (<dump>/<cluster>/Resources). The returned paths are de-duplicated and sorted.
Pointing DiscoverDumps at a single dump directory returns that directory itself, so callers can pass either an artifact root containing many dumps (e.g. .../data with pre-/post-cleanup dumps) or one dump directory directly.
func DiscoverLogDirs ¶
DiscoverLogDirs walks root and returns every directory named "logs" found underneath it, sorted. Multi-phase jobs run each phase with its own ARTIFACTS_DIR (e.g. artifacts/before, artifacts/after), so a single artifact root can hold several log trees rather than just <root>/logs. Nested logs/ directories are not descended into, and resource dump sections are skipped.
func Generate ¶
Generate builds a single artifacts-browser.html at outputPath covering every resource dump in dumps (as returned by DiscoverDumps). File references in the page are relative to root, so the generated HTML must be served from root with the dump directories beneath it.
All paths are resolved to absolute before use so that relative inputs work.
Types ¶
type CILog ¶
type CILog struct {
Path string `json:"p"` // path relative to the traversed root, used for fetch()
Name string `json:"n"` // file name
}
CILog is a top-level *.log file (CI job step log) directly under the root.
func DiscoverCILogs ¶
DiscoverCILogs lists the *.log files under root that are not container logs (CI job step logs). Container logs live under logs/ directories and are indexed by buildLogs instead, so those trees are skipped. Everything else is walked because multi-phase jobs write their step logs into per-phase subdirectories. Names are the paths relative to root.
type ClusterIndex ¶
type ClusterIndex struct {
Name string `json:"name"`
Resources []*KindGroup `json:"resources"`
Events []*KindGroup `json:"events"`
}
ClusterIndex holds the resource and event index for one cluster directory.
type DumpEntry ¶
type DumpEntry struct {
Name string `json:"name"` // dump path relative to the traversed root
Clusters []*ClusterIndex `json:"clusters"`
}
DumpEntry is one resource dump (e.g. "pre-dpf-operator-config-cleanup") and the clusters captured within it.
type FileEntry ¶
type FileEntry struct {
Path string `json:"p"`
Namespace string `json:"ns,omitempty"`
Name string `json:"n"`
ConditionMessages int `json:"cm,omitempty"` // 1 if a Ready condition is not True
}
FileEntry represents a single resource or event file.
type Index ¶
type Index struct {
Dir string `json:"dir"` // base name of the traversed root directory
Entries []*DumpEntry `json:"entries"`
Logs []*LogCluster `json:"logs,omitempty"`
CILogs []*CILog `json:"cilogs,omitempty"`
}
Index is the top-level data structure serialised into the HTML page. It holds one entry per resource dump discovered under the traversed root directory, optionally the container logs found under logs/, and any top-level CI logs.
type KindGroup ¶
type KindGroup struct {
Kind string `json:"k"`
Domain string `json:"d"` // e.g. "core", "k8s.io", "nvidia.com"
Sub string `json:"s,omitempty"` // e.g. "admissionregistration", "svc.dpu"
APIVersion string `json:"av,omitempty"` // e.g. "v1", "apps/v1", "provisioning.dpu.nvidia.com/v1alpha1"
Files []*FileEntry `json:"f"`
}
KindGroup groups files of the same Kind within a cluster section.
type LogCluster ¶
LogCluster groups container logs for one cluster directory under logs/.
type LogEntry ¶
type LogEntry struct {
Path string `json:"p"` // path relative to the traversed root, used for fetch()
Namespace string `json:"ns,omitempty"`
Pod string `json:"pod,omitempty"`
Container string `json:"c"` // container name (log file stem)
}
LogEntry is a single container log file collected under logs/.