Documentation
¶
Index ¶
- Variables
- func UserCacheDir() (string, error)
- type CampaignSpec
- type CampaignSpecID
- type ChangesetSpec
- type ChangesetSpecID
- type ChangesetTemplate
- type CreatedChangeset
- type ExecutionCache
- type ExecutionCacheKey
- type ExecutionDiskCache
- type ExecutionNoOpCache
- type Executor
- type ExecutorOpts
- type ExecutorUpdateCallback
- type ExpandedGitCommitDescription
- type ExternalChangeset
- type GitCommitDescription
- type ImportChangeset
- type LogManager
- type OnQueryOrRepository
- type Service
- func (svc *Service) ApplyCampaign(ctx context.Context, spec CampaignSpecID) (*graphql.Campaign, error)
- func (svc *Service) CreateCampaignSpec(ctx context.Context, namespace, spec string, ids []ChangesetSpecID) (CampaignSpecID, string, error)
- func (svc *Service) CreateChangesetSpec(ctx context.Context, spec *ChangesetSpec) (ChangesetSpecID, error)
- func (svc *Service) ExecuteCampaignSpec(ctx context.Context, x Executor, spec *CampaignSpec, ...) ([]*ChangesetSpec, error)
- func (svc *Service) NewExecutionCache(dir string) ExecutionCache
- func (svc *Service) NewExecutor(opts ExecutorOpts, update ExecutorUpdateCallback) Executor
- func (svc *Service) ParseCampaignSpec(in io.Reader) (*CampaignSpec, string, error)
- func (svc *Service) ResolveNamespace(ctx context.Context, namespace string) (string, error)
- func (svc *Service) ResolveRepositories(ctx context.Context, spec *CampaignSpec) ([]*graphql.Repository, error)
- func (svc *Service) ResolveRepositoriesOn(ctx context.Context, on *OnQueryOrRepository) ([]*graphql.Repository, error)
- func (svc *Service) SetDockerImages(ctx context.Context, spec *CampaignSpec, progress func(i int)) error
- type ServiceOpts
- type Step
- type Task
- type TaskLogger
- type TaskStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrMalformedOnQueryOrRepository = errors.New("malformed 'on' field; missing either a repository name or a query")
)
Functions ¶
func UserCacheDir ¶
Types ¶
type CampaignSpec ¶
type CampaignSpec struct {
Name string `json:"name,omitempty" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description"`
On []OnQueryOrRepository `json:"on,omitempty" yaml:"on"`
Steps []Step `json:"steps,omitempty" yaml:"steps"`
ImportChangesets []ImportChangeset `json:"importChangesets,omitempty" yaml:"importChangesets"`
ChangesetTemplate *ChangesetTemplate `json:"changesetTemplate,omitempty" yaml:"changesetTemplate"`
}
func ParseCampaignSpec ¶
func ParseCampaignSpec(data []byte) (*CampaignSpec, error)
func (*CampaignSpec) Validate ¶
func (spec *CampaignSpec) Validate() error
type CampaignSpecID ¶
type CampaignSpecID string
type ChangesetSpec ¶
type ChangesetSpec struct {
BaseRepository string `json:"baseRepository"`
*ExternalChangeset
*CreatedChangeset
}
type ChangesetSpecID ¶
type ChangesetSpecID string
type ChangesetTemplate ¶
type ChangesetTemplate struct {
Title string `json:"title,omitempty" yaml:"title"`
Body string `json:"body,omitempty" yaml:"body"`
Branch string `json:"branch,omitempty" yaml:"branch"`
Commit ExpandedGitCommitDescription `json:"commit,omitempty" yaml:"commit"`
Published bool `json:"published" yaml:"published"`
}
type CreatedChangeset ¶
type CreatedChangeset struct {
BaseRef string `json:"baseRef"`
BaseRev string `json:"baseRev"`
HeadRepository string `json:"headRepository"`
HeadRef string `json:"headRef"`
Title string `json:"title"`
Body string `json:"body"`
Commits []GitCommitDescription `json:"commits"`
Published bool `json:"published"`
}
type ExecutionCache ¶
type ExecutionCache interface {
Get(ctx context.Context, key ExecutionCacheKey) (result *ChangesetSpec, err error)
Set(ctx context.Context, key ExecutionCacheKey, result *ChangesetSpec) error
Clear(ctx context.Context, key ExecutionCacheKey) error
}
type ExecutionCacheKey ¶
type ExecutionCacheKey struct {
*Task
}
type ExecutionDiskCache ¶
type ExecutionDiskCache struct {
Dir string
}
func (ExecutionDiskCache) Clear ¶
func (c ExecutionDiskCache) Clear(ctx context.Context, key ExecutionCacheKey) error
func (ExecutionDiskCache) Get ¶
func (c ExecutionDiskCache) Get(ctx context.Context, key ExecutionCacheKey) (*ChangesetSpec, error)
func (ExecutionDiskCache) Set ¶
func (c ExecutionDiskCache) Set(ctx context.Context, key ExecutionCacheKey, result *ChangesetSpec) error
type ExecutionNoOpCache ¶
type ExecutionNoOpCache struct{}
ExecutionNoOpCache is an implementation of actionExecutionCache that does not store or retrieve cache entries.
func (ExecutionNoOpCache) Clear ¶
func (ExecutionNoOpCache) Clear(ctx context.Context, key ExecutionCacheKey) error
func (ExecutionNoOpCache) Get ¶
func (ExecutionNoOpCache) Get(ctx context.Context, key ExecutionCacheKey) (result *ChangesetSpec, err error)
func (ExecutionNoOpCache) Set ¶
func (ExecutionNoOpCache) Set(ctx context.Context, key ExecutionCacheKey, result *ChangesetSpec) error
type Executor ¶
type Executor interface {
AddTask(repo *graphql.Repository, steps []Step, template *ChangesetTemplate) *TaskStatus
LogFiles() []string
Start(ctx context.Context)
Wait() ([]*ChangesetSpec, error)
}
type ExecutorOpts ¶
type ExecutorUpdateCallback ¶
type ExecutorUpdateCallback func(*Task, TaskStatus)
type ExpandedGitCommitDescription ¶
type ExpandedGitCommitDescription struct {
Message string `json:"message,omitempty" yaml:"message"`
}
type ExternalChangeset ¶
type ExternalChangeset struct {
ExternalID string `json:"externalID"`
}
type GitCommitDescription ¶
type ImportChangeset ¶
type ImportChangeset struct {
Repository string `json:"repository" yaml:"repository"`
ExternalIDs []interface{} `json:"externalIDs" yaml:"externalIDs"`
}
type LogManager ¶
type LogManager struct {
// contains filtered or unexported fields
}
func NewLogManager ¶
func NewLogManager(keepLogs bool) *LogManager
func (*LogManager) AddTask ¶
func (lm *LogManager) AddTask(task *Task) (*TaskLogger, error)
func (*LogManager) Close ¶
func (lm *LogManager) Close() error
func (*LogManager) LogFiles ¶
func (lm *LogManager) LogFiles() []string
type OnQueryOrRepository ¶
type OnQueryOrRepository struct {
RepositoriesMatchingQuery string `json:"repositoriesMatchingQuery,omitempty" yaml:"repositoriesMatchingQuery"`
Repository string `json:"repository,omitempty" yaml:"repository"`
Branch string `json:"branch,omitempty" yaml:"branch"`
}
func (*OnQueryOrRepository) String ¶
func (on *OnQueryOrRepository) String() string
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(opts *ServiceOpts) *Service
func (*Service) ApplyCampaign ¶
func (*Service) CreateCampaignSpec ¶
func (svc *Service) CreateCampaignSpec(ctx context.Context, namespace, spec string, ids []ChangesetSpecID) (CampaignSpecID, string, error)
func (*Service) CreateChangesetSpec ¶
func (svc *Service) CreateChangesetSpec(ctx context.Context, spec *ChangesetSpec) (ChangesetSpecID, error)
func (*Service) ExecuteCampaignSpec ¶
func (svc *Service) ExecuteCampaignSpec(ctx context.Context, x Executor, spec *CampaignSpec, progress func([]*TaskStatus)) ([]*ChangesetSpec, error)
func (*Service) NewExecutionCache ¶
func (svc *Service) NewExecutionCache(dir string) ExecutionCache
func (*Service) NewExecutor ¶
func (svc *Service) NewExecutor(opts ExecutorOpts, update ExecutorUpdateCallback) Executor
func (*Service) ParseCampaignSpec ¶
func (*Service) ResolveNamespace ¶
func (*Service) ResolveRepositories ¶
func (svc *Service) ResolveRepositories(ctx context.Context, spec *CampaignSpec) ([]*graphql.Repository, error)
func (*Service) ResolveRepositoriesOn ¶
func (svc *Service) ResolveRepositoriesOn(ctx context.Context, on *OnQueryOrRepository) ([]*graphql.Repository, error)
func (*Service) SetDockerImages ¶
type ServiceOpts ¶
type Task ¶
type Task struct {
Repository *graphql.Repository
Steps []Step
Template *ChangesetTemplate `json:"-"`
}
type TaskLogger ¶
type TaskLogger struct {
// contains filtered or unexported fields
}
func (*TaskLogger) Close ¶
func (tl *TaskLogger) Close() error
func (*TaskLogger) Log ¶
func (tl *TaskLogger) Log(s string)
func (*TaskLogger) Logf ¶
func (tl *TaskLogger) Logf(format string, a ...interface{})
func (*TaskLogger) MarkErrored ¶
func (tl *TaskLogger) MarkErrored()
func (*TaskLogger) Path ¶
func (tl *TaskLogger) Path() string
func (*TaskLogger) PrefixWriter ¶
func (tl *TaskLogger) PrefixWriter(prefix string) io.Writer
Source Files
¶
Click to show internal directories.
Click to hide internal directories.