applicationsnapshot

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SummaryMarkdown = "summary-markdown"
	JSON            = "json"
	YAML            = "yaml"
	APPSTUDIO       = "appstudio"
	// Deprecated. Remove when hacbs output is removed
	HACBS       = "hacbs"
	Summary     = "summary"
	JUNIT       = "junit"
	DATA        = "data"
	ATTESTATION = "attestation"
	PolicyInput = "policy-input"
	VSA         = "vsa"
)

Possible formats the report can be written as.

View Source
const (
	// Make it visible elsewhere
	PredicateVSAProvenance = "https://enterprisecontract.dev/verification_summary/v1"
	StatmentVSA            = "https://in-toto.io/Statement/v1"
)

Variables

This section is empty.

Functions

func DetermineInputSpec

func DetermineInputSpec(ctx context.Context, input Input) (*app.SnapshotSpec, error)

func OutputAppstudioReport

func OutputAppstudioReport(t TestReport)

Types

type Component

type Component struct {
	app.SnapshotComponent
	Violations   []evaluator.Result          `json:"violations,omitempty"`
	Warnings     []evaluator.Result          `json:"warnings,omitempty"`
	Successes    []evaluator.Result          `json:"successes,omitempty"`
	Success      bool                        `json:"success"`
	SuccessCount int                         `json:"-"`
	Signatures   []signature.EntitySignature `json:"signatures,omitempty"`
	Attestations []attestation.Attestation   `json:"attestations,omitempty"`
}

type Input

type Input struct {
	File     string // Deprecated: replaced by images
	JSON     string // Deprecated: replaced by images
	Image    string
	Snapshot string
	Images   string
}

type ProvenanceStatementVSA

type ProvenanceStatementVSA struct {
	in_toto.StatementHeader
	Predicate Report `json:"predicate"`
}

func NewVSA

func NewVSA(report Report) (ProvenanceStatementVSA, error)

type RemoteClientKey added in v0.4.0

type RemoteClientKey struct{}

type Report

type Report struct {
	Success bool `json:"success"`

	Snapshot      string                           `json:"snapshot,omitempty"`
	Components    []Component                      `json:"components"`
	Key           string                           `json:"key"`
	Policy        ecc.EnterpriseContractPolicySpec `json:"policy"`
	EcVersion     string                           `json:"ec-version"`
	Data          any                              `json:"-"`
	EffectiveTime time.Time                        `json:"effective-time"`
	PolicyInput   [][]byte                         `json:"-"`
	// contains filtered or unexported fields
}

func NewReport

func NewReport(snapshot string, components []Component, policy policy.Policy, data any, policyInput [][]byte) (Report, error)

WriteReport returns a new instance of Report representing the state of components from the snapshot.

func (Report) WriteAll

func (r Report) WriteAll(targets []string, p format.TargetParser) (allErrors error)

WriteAll writes the report to all the given targets.

type TestReport

type TestReport struct {
	Timestamp string `json:"timestamp"`
	Namespace string `json:"namespace"`
	Successes int    `json:"successes"`
	Failures  int    `json:"failures"`
	Warnings  int    `json:"warnings"`
	Result    string `json:"result"`
	Note      string `json:"note,omitempty"`
}

TestReport represents the standardized TEST_OUTPUT format. The `Namespace` attribute is required for the appstudio results API. However, it is always an empty string from the ec-cli as a way to indicate all namespaces were used.

func AppstudioReportForError

func AppstudioReportForError(prefix string, err error) TestReport

func (*TestReport) DeriveNote

func (r *TestReport) DeriveNote()

It's redundant and perhaps not very useful, but let's produce some kind of a human readable note. We could perhaps make this more sophisticated in future, e.g. by including an abbreviated list of failure or warning messages.

func (*TestReport) DeriveResult

func (r *TestReport) DeriveResult(hasFailures bool)

Jump to

Keyboard shortcuts

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