Documentation
¶
Overview ¶
Package generic provides a fallback CI provider for when --ci flag is used but no specific CI platform is detected.
Index ¶
- Constants
- type OutputWriter
- type Provider
- func (p *Provider) AddPath(dir string) error
- func (p *Provider) Annotate(annotations []provider.Annotation) error
- func (p *Provider) BindOutput(w io.Writer) provider.Provider
- func (p *Provider) Context() (*provider.Context, error)
- func (p *Provider) CreateCheckRun(_ context.Context, opts *provider.CreateCheckRunOptions) (*provider.CheckRun, error)
- func (p *Provider) Detect() bool
- func (p *Provider) EndLogGroup() error
- func (p *Provider) GetStatus(_ context.Context, _ provider.StatusOptions) (*provider.Status, error)
- func (p *Provider) Name() string
- func (p *Provider) OutputWriter() provider.OutputWriter
- func (p *Provider) PostComment(_ context.Context, opts *provider.PostCommentOptions) (*provider.Comment, error)
- func (p *Provider) PostCommitComment(_ context.Context, opts *provider.PostCommitCommentOptions) (*provider.Comment, error)
- func (p *Provider) ReportSARIF(_ context.Context, report provider.SARIFReport) error
- func (p *Provider) ResolveBase() (*provider.BaseResolution, error)
- func (p *Provider) StartLogGroup(title string) error
- func (p *Provider) UpdateCheckRun(_ context.Context, opts *provider.UpdateCheckRunOptions) (*provider.CheckRun, error)
- func (p *Provider) WriteEnv(key, value string) error
Constants ¶
const (
// ProviderName is the name of the generic CI provider.
ProviderName = "generic"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OutputWriter ¶
type OutputWriter struct {
// contains filtered or unexported fields
}
OutputWriter writes CI outputs for the generic provider.
func (*OutputWriter) WriteOutput ¶
func (w *OutputWriter) WriteOutput(key, value string) error
WriteOutput writes a key-value pair to CI outputs. Without ATMOS_CI_OUTPUT it renders the line to the UI channel, using the heredoc form for multiline values.
func (*OutputWriter) WriteSummary ¶
func (w *OutputWriter) WriteSummary(content string) error
WriteSummary writes content to the job summary.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a fallback CI provider for when --ci flag is used but no specific CI platform is detected. It writes summaries to stdout and outputs to environment file or stdout.
func NewProvider ¶
func NewProvider() *Provider
NewProvider creates a new generic CI provider. ATMOS_CI_OUTPUT and ATMOS_CI_SUMMARY are read when OutputWriter is called, not here, so a change to the environment after construction is honored.
func (*Provider) AddPath ¶
AddPath prepends dir to PATH for later steps. With ATMOS_CI_PATH set it appends dir to that file; otherwise it renders a shell `export PATH=` line.
func (*Provider) Annotate ¶
func (p *Provider) Annotate(annotations []provider.Annotation) error
Annotate renders each annotation as one line: path:line: level: message, locating it by path and line when known.
func (*Provider) BindOutput ¶
BindOutput returns a copy of the provider whose local renderings go to w instead of the global UI channel. The copy shares the check-run and comment counters and the comment ledger.
func (*Provider) CreateCheckRun ¶
func (p *Provider) CreateCheckRun(_ context.Context, opts *provider.CreateCheckRunOptions) (*provider.CheckRun, error)
CreateCheckRun writes check run status to stderr and returns a synthetic CheckRun.
func (*Provider) Detect ¶
Detect returns false - this provider is never auto-detected. It's only used when CI mode is forced via --ci flag.
func (*Provider) EndLogGroup ¶
EndLogGroup is a no-op: a plain terminal has nothing to close.
func (*Provider) OutputWriter ¶
func (p *Provider) OutputWriter() provider.OutputWriter
OutputWriter returns an OutputWriter for the generic provider.
func (*Provider) PostComment ¶ added in v1.218.0
func (p *Provider) PostComment(_ context.Context, opts *provider.PostCommentOptions) (*provider.Comment, error)
PostComment renders a preview of the PR comment locally instead of posting it. A laptop run usually has no pull request number and often no owner/repo, so unlike platform providers this does not require them; it validates only the body and the marker-in-body invariant, then renders the masked body (raw when the provider is unbound, as terminal markdown when bound via BindOutput).
The provider remembers the markers it rendered, so behavior=update fails with ErrCICommentNotFound when no earlier comment in the process carries the marker, as it does on GitHub.
func (*Provider) PostCommitComment ¶
func (p *Provider) PostCommitComment(_ context.Context, opts *provider.PostCommitCommentOptions) (*provider.Comment, error)
PostCommitComment renders a preview of a commit comment locally instead of posting it. Like PostComment it needs no owner or repository, only a body and the marker-in-body invariant.
func (*Provider) ReportSARIF ¶
ReportSARIF notes that the report was produced but not uploaded. It names the report's file when known, and says why: the switch that is off when the reporter routed here because of a gate, otherwise that no CI provider is detected.
func (*Provider) ResolveBase ¶ added in v1.214.0
func (p *Provider) ResolveBase() (*provider.BaseResolution, error)
ResolveBase returns the base commit for affected detection in the generic provider. It reads the ATMOS_CI_BASE_REF environment variable for explicit base override. Returns nil when no env var is set (falls through to default behavior).
func (*Provider) StartLogGroup ¶
StartLogGroup renders the group title as a heading line.
func (*Provider) UpdateCheckRun ¶
func (p *Provider) UpdateCheckRun(_ context.Context, opts *provider.UpdateCheckRunOptions) (*provider.CheckRun, error)
UpdateCheckRun writes check run status to stderr and returns an updated CheckRun.
func (*Provider) WriteEnv ¶
WriteEnv exports key=value for later steps. With ATMOS_CI_ENV set it appends to that file in GitHub Actions format; otherwise it renders a shell `export` line.
ATMOS_CI_ENV and ATMOS_CI_PATH are read at call time, as are ATMOS_CI_OUTPUT and ATMOS_CI_SUMMARY (when OutputWriter is called).