Documentation ¶
Index ¶
- Constants
- Variables
- type RunEvent
- type RunMetadata
- type RunPollingTask
- type Stream
- func (s *Stream) AddRunMeta(rmd RunMetadata) error
- func (s *Stream) GetRunMeta(runID string) (RunMetadata, error)
- func (s *Stream) HealthCheck() error
- func (s *Stream) NewTFRunPollingTask(meta RunMetadata, delay time.Duration) RunPollingTask
- func (s *Stream) PublishTFRunEvent(re RunEvent) error
- func (s *Stream) SubscribeTFRunEvents(vcsProvider string, cb func(run RunEvent) bool) (closer func(), err error)
- func (s *Stream) SubscribeTFRunPollingTasks(cb func(task RunPollingTask) bool) (closer func(), err error)
- type StreamClient
- type TFRunEvent
- type TFRunMetadata
- func (r *TFRunMetadata) GetAction() string
- func (r *TFRunMetadata) GetCommitSHA() string
- func (r *TFRunMetadata) GetDiscussionID() string
- func (r *TFRunMetadata) GetMRInternalID() int
- func (r *TFRunMetadata) GetMRProjectNameWithNamespace() string
- func (r *TFRunMetadata) GetOrganization() string
- func (r *TFRunMetadata) GetRootNoteID() int64
- func (r *TFRunMetadata) GetRunID() string
- func (r *TFRunMetadata) GetVcsProvider() string
- func (r *TFRunMetadata) GetWorkspace() string
- type TFRunPollingTask
- func (task *TFRunPollingTask) Completed() error
- func (task *TFRunPollingTask) GetLastStatus() string
- func (task *TFRunPollingTask) GetRunID() string
- func (task *TFRunPollingTask) GetRunMetaData() RunMetadata
- func (task *TFRunPollingTask) Reschedule() error
- func (task *TFRunPollingTask) Schedule() error
- func (task *TFRunPollingTask) SetLastStatus(status string)
Constants ¶
View Source
const RunEventsStreamName = "RUN_EVENTS"
View Source
const RunMetadataKvBucket = "RUN_METADATA"
View Source
const RunPollingKvName = "POLLING_TASKS"
View Source
const RunPollingStreamNameV0 = "RUN_POLLING"
View Source
const TaskPollingDelayDefault = 10 * time.Second
View Source
const TaskPollingDelayMinimum = 1 * time.Second
Variables ¶
View Source
var FailedResponse = []byte("failed")
View Source
var SuccessDoneResponse = []byte("done")
View Source
var SuccessResponse = []byte("success")
Functions ¶
This section is empty.
Types ¶
type RunEvent ¶
type RunEvent interface { GetRunID() string GetNewStatus() string GetMetadata() RunMetadata SetMetadata(RunMetadata) }
type RunMetadata ¶
type RunPollingTask ¶
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
func (*Stream) AddRunMeta ¶
func (s *Stream) AddRunMeta(rmd RunMetadata) error
func (*Stream) GetRunMeta ¶
func (s *Stream) GetRunMeta(runID string) (RunMetadata, error)
func (*Stream) HealthCheck ¶
func (*Stream) NewTFRunPollingTask ¶
func (s *Stream) NewTFRunPollingTask(meta RunMetadata, delay time.Duration) RunPollingTask
func (*Stream) PublishTFRunEvent ¶
func (*Stream) SubscribeTFRunEvents ¶
func (*Stream) SubscribeTFRunPollingTasks ¶
func (s *Stream) SubscribeTFRunPollingTasks(cb func(task RunPollingTask) bool) (closer func(), err error)
type StreamClient ¶
type StreamClient interface { HealthCheck() error PublishTFRunEvent(re RunEvent) error AddRunMeta(rmd RunMetadata) error GetRunMeta(runID string) (RunMetadata, error) NewTFRunPollingTask(meta RunMetadata, delay time.Duration) RunPollingTask SubscribeTFRunPollingTasks(cb func(task RunPollingTask) bool) (closer func(), err error) SubscribeTFRunEvents(queue string, cb func(run RunEvent) bool) (closer func(), err error) }
func NewStream ¶
func NewStream(js nats.JetStreamContext) StreamClient
type TFRunEvent ¶
type TFRunEvent struct { RunID string Organization string Workspace string NewStatus string Metadata RunMetadata }
TFRunEvent represents a status change on a run
func (*TFRunEvent) GetMetadata ¶
func (e *TFRunEvent) GetMetadata() RunMetadata
func (*TFRunEvent) GetNewStatus ¶
func (e *TFRunEvent) GetNewStatus() string
func (*TFRunEvent) GetRunID ¶
func (e *TFRunEvent) GetRunID() string
func (*TFRunEvent) SetMetadata ¶
func (e *TFRunEvent) SetMetadata(meta RunMetadata)
type TFRunMetadata ¶
type TFRunMetadata struct { // RunID is the ID generated by TFC for the run RunID string // Organization is the TFC organization name Organization string // Workspace is the TFC workspace name Workspace string // Source is the trigger source of the TFC run // options include: // "merge_request" - for runs started via MR push or comment // "merge" - for runs started when MR is merged (apply after merge repos) (NOT IMPLEMENTED) // "slack" - for runs started via ChatOps (NOT IMPLEMENTED) Source string // Action is the triggered action (i.e. plan / apply) Action string // The git Commit SHA for which the run has been triggered CommitSHA string // MergeRequestProjectNameWithNamespace is the fully qualified Gitlab project name (e.g. /group/subgroup/project) MergeRequestProjectNameWithNamespace string // MergeRequestIID is the Gitlab Merge Request IID for which the Run has been triggered MergeRequestIID int // DiscussionID is the MergeRequest discussion thread where status updates should be written (optional) DiscussionID string // RootNoteID is the top level note of the discussion thread. It will be updated with progress info. RootNoteID int64 VcsProvider string }
func (*TFRunMetadata) GetAction ¶
func (r *TFRunMetadata) GetAction() string
func (*TFRunMetadata) GetCommitSHA ¶
func (r *TFRunMetadata) GetCommitSHA() string
func (*TFRunMetadata) GetDiscussionID ¶
func (r *TFRunMetadata) GetDiscussionID() string
func (*TFRunMetadata) GetMRInternalID ¶
func (r *TFRunMetadata) GetMRInternalID() int
func (*TFRunMetadata) GetMRProjectNameWithNamespace ¶
func (r *TFRunMetadata) GetMRProjectNameWithNamespace() string
func (*TFRunMetadata) GetOrganization ¶
func (r *TFRunMetadata) GetOrganization() string
func (*TFRunMetadata) GetRootNoteID ¶
func (r *TFRunMetadata) GetRootNoteID() int64
func (*TFRunMetadata) GetRunID ¶
func (r *TFRunMetadata) GetRunID() string
func (*TFRunMetadata) GetVcsProvider ¶
func (r *TFRunMetadata) GetVcsProvider() string
func (*TFRunMetadata) GetWorkspace ¶
func (r *TFRunMetadata) GetWorkspace() string
type TFRunPollingTask ¶
type TFRunPollingTask struct { RunMetadata LastStatus string NextPoll time.Time Processing bool LastUpdate time.Time // Revision is the NATS KV entry revision Revision uint64 // contains filtered or unexported fields }
func (*TFRunPollingTask) Completed ¶
func (task *TFRunPollingTask) Completed() error
func (*TFRunPollingTask) GetLastStatus ¶
func (task *TFRunPollingTask) GetLastStatus() string
func (*TFRunPollingTask) GetRunID ¶
func (task *TFRunPollingTask) GetRunID() string
func (*TFRunPollingTask) GetRunMetaData ¶
func (task *TFRunPollingTask) GetRunMetaData() RunMetadata
func (*TFRunPollingTask) Reschedule ¶
func (task *TFRunPollingTask) Reschedule() error
func (*TFRunPollingTask) Schedule ¶
func (task *TFRunPollingTask) Schedule() error
func (*TFRunPollingTask) SetLastStatus ¶
func (task *TFRunPollingTask) SetLastStatus(status string)
Click to show internal directories.
Click to hide internal directories.