publish

package
v0.125.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package publish delivers rendered reports (report.Artifact) to destinations. A Publisher is the "where" of reporting, separate from the Reporter (the "what", pkg/report). So a scan can render several formats once and deliver them to several destinations.

Each publisher is configured from a saga.PublisherConfig and named by its kind; Kinds lists the built-in set.

Index

Constants

View Source
const DiffMarker = defaultDiffPRMarker

DiffMarker identifies the sticky comment `draugr diff --publish` maintains.

Exported so the diff command asks for it by name rather than restating the string. It is deliberately not the marker a Saga's PR-comment publisher uses: a run that posts both a report and a delta wants two comments, not one that overwrites the other.

View Source
const ReportMarker = defaultPRMarker

ReportMarker identifies the sticky comment a Saga's PR-comment publisher maintains.

Variables

This section is empty.

Functions

func Distinguishes added in v0.117.0

func Distinguishes(kind string) string

Distinguishes returns the field that makes a second entry of kind a second destination, empty for a kind this build does not have.

func DistinguishingValue added in v0.117.0

func DistinguishingValue(cfg saga.PublisherConfig) string

DistinguishingValue returns what cfg wrote in the field that tells two entries of its kind apart.

What the descriptor wrote, not what it resolves to. `repo`, `pr` and `url` all default from the environment, so two entries that write nothing are the same entry twice however they resolve, and that is the case worth catching.

func Kinds

func Kinds() []string

Kinds lists the available publisher kinds, sorted.

func Renders added in v0.118.0

func Renders(kind string) []string

Renders returns the formats kind produces for itself, nil for a kind with none and for one this build does not have.

func Run

func Run(ctx context.Context, publishers []saga.PublisherConfig, data report.Data) error

Run renders each configured report format once, then delivers every rendered artifact to every configured publisher. It returns the first error encountered; a publisher that fails does not prevent the others from being attempted.

Types

type Publisher

type Publisher interface {
	// Kind is the publisher's config selector, e.g. "file".
	Kind() string
	// Publish delivers the artifacts. A publisher may use only the artifacts it cares about
	// (e.g. a code-scanning publisher would take the SARIF one), ignoring the rest.
	Publish(ctx context.Context, artifacts []report.Artifact) error
}

Publisher delivers rendered report artifacts to one destination.

func For

func For(cfg saga.PublisherConfig) (Publisher, error)

For resolves a configured publisher, validating its kind and required fields.

Jump to

Keyboard shortcuts

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