workflowtemplate

package
v0.53.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LoadInstanceOptions = struct {
	WithTemplate LoadInstanceOptionFunc
	WithAudits   LoadInstanceOptionFunc
}{
	WithTemplate: loadInstanceTemplate,
	WithAudits:   loadInstanceAudits,
}

LoadInstanceOptions provides all options on workflow template instance loads functions

View Source
var LoadOptions = struct {
	Default    LoadOptionFunc
	WithAudits LoadOptionFunc
	WithGroup  LoadOptionFunc
}{
	Default:    loadDefault,
	WithAudits: loadAudits,
	WithGroup:  loadGroup,
}

LoadOptions provides all options to load workflow template.

View Source
var TemplateRequestModifiers = struct {
	Detached                   TemplateRequestModifierFunc
	DefaultKeys                func(proj sdk.Project) TemplateRequestModifierFunc
	DefaultNameAndRepositories func(proj sdk.Project, repoURL string) TemplateRequestModifierFunc
}{
	Detached:                   requestModifyDetached,
	DefaultKeys:                requestModifyDefaultKeysfunc,
	DefaultNameAndRepositories: requestModifyDefaultNameAndRepositories,
}

Functions

func CheckAndExecuteTemplate

CheckAndExecuteTemplate will execute the workflow template if given workflow components contains a template instance. When detached is set this will not create/update any template instance in database (this is useful for workflow ascode branches).

func CreateAuditAdd

func CreateAuditAdd(db gorp.SqlExecutor, wt sdk.WorkflowTemplate, u sdk.Identifiable) error

CreateAuditAdd create an audit for template add.

func CreateAuditInstanceAdd

func CreateAuditInstanceAdd(db gorp.SqlExecutor, wti sdk.WorkflowTemplateInstance, u sdk.Identifiable) error

CreateAuditInstanceAdd create an audit for template instance add.

func CreateAuditInstanceUpdate

func CreateAuditInstanceUpdate(db gorp.SqlExecutor, oldI, newI sdk.WorkflowTemplateInstance, u sdk.Identifiable) error

CreateAuditInstanceUpdate create an audit for template instance update.

func CreateAuditUpdate

func CreateAuditUpdate(db gorp.SqlExecutor, oldT, newT sdk.WorkflowTemplate, changeMessage string, u sdk.Identifiable) error

CreateAuditUpdate create an audit for template update.

func Delete

func Delete(db gorp.SqlExecutor, wt *sdk.WorkflowTemplate) error

Delete template in database.

func DeleteInstance

func DeleteInstance(db gorp.SqlExecutor, wti *sdk.WorkflowTemplateInstance) error

DeleteInstance for workflow template in database.

func DeleteInstanceNotIDAndWorkflowID

func DeleteInstanceNotIDAndWorkflowID(db gorp.SqlExecutor, id, workflowID int64) error

DeleteInstanceNotIDAndWorkflowID removes all instances of a template where not id and workflow id equal in database.

func Execute

Execute returns yaml file from template.

func GetAndLockBulkByID added in v0.53.0

func GetAndLockBulkByID(ctx context.Context, db gorpmapper.SqlExecutorWithTx, id int64) (*sdk.WorkflowTemplateBulk, error)

GetAndLockBulkByID returns an bulk from database for given id.

func GetBulkByIDAndTemplateID

func GetBulkByIDAndTemplateID(ctx context.Context, db gorp.SqlExecutor, id, templateID int64) (*sdk.WorkflowTemplateBulk, error)

GetBulkByIDAndTemplateID returns the workflow template bulk for given id and template id.

func GetBulksPending added in v0.53.0

func GetBulksPending(ctx context.Context, db gorp.SqlExecutor) ([]sdk.WorkflowTemplateBulk, error)

GetBulksPending returns the workflow template bulks with pending status.

func GetInstanceAuditsByInstanceIDsAndEventTypes

func GetInstanceAuditsByInstanceIDsAndEventTypes(db gorp.SqlExecutor, instanceIDs []int64, eventTypes []string) ([]sdk.AuditWorkflowTemplateInstance, error)

GetInstanceAuditsByInstanceIDsAndEventTypes returns all workflow template instance audits by instance ids and event types.

func Insert

func Insert(db gorp.SqlExecutor, wt *sdk.WorkflowTemplate) error

Insert template in database.

func InsertAudit

func InsertAudit(db gorp.SqlExecutor, awt *sdk.AuditWorkflowTemplate) error

InsertAudit for workflow template in database.

func InsertBulk

func InsertBulk(db gorp.SqlExecutor, wtb *sdk.WorkflowTemplateBulk) error

InsertBulk task for workflow template in database.

func InsertInstance

func InsertInstance(db gorp.SqlExecutor, wti *sdk.WorkflowTemplateInstance) error

InsertInstance for workflow template in database.

func InsertInstanceAudit

func InsertInstanceAudit(db gorp.SqlExecutor, awti *sdk.AuditWorkflowTemplateInstance) error

InsertInstanceAudit for workflow template instance in database.

func LoadAll

func LoadAll(ctx context.Context, db gorp.SqlExecutor, opts ...LoadOptionFunc) ([]sdk.WorkflowTemplate, error)

LoadAll workflow templates from database.

func LoadAllByGroupIDs

func LoadAllByGroupIDs(ctx context.Context, db gorp.SqlExecutor, groupIDs []int64, opts ...LoadOptionFunc) ([]sdk.WorkflowTemplate, error)

LoadAllByGroupIDs returns all workflow templates by group ids.

func LoadAllByIDs

func LoadAllByIDs(ctx context.Context, db gorp.SqlExecutor, ids []int64, opts ...LoadOptionFunc) ([]sdk.WorkflowTemplate, error)

LoadAllByIDs returns all workflow templates by ids.

func LoadAuditByTemplateIDAndVersion

func LoadAuditByTemplateIDAndVersion(ctx context.Context, db gorp.SqlExecutor, templateID, version int64) (*sdk.AuditWorkflowTemplate, error)

LoadAuditByTemplateIDAndVersion returns workflow template audit by template id and version.

func LoadAuditLatestByTemplateID

func LoadAuditLatestByTemplateID(ctx context.Context, db gorp.SqlExecutor, templateID int64) (*sdk.AuditWorkflowTemplate, error)

LoadAuditLatestByTemplateID returns workflow template latest audit by template id.

func LoadAuditOldestByTemplateID

func LoadAuditOldestByTemplateID(ctx context.Context, db gorp.SqlExecutor, templateID int64) (*sdk.AuditWorkflowTemplate, error)

LoadAuditOldestByTemplateID returns workflow template oldtest audit by template id.

func LoadAuditsByTemplateIDAndVersionGTE

func LoadAuditsByTemplateIDAndVersionGTE(db gorp.SqlExecutor, templateID, version int64) ([]sdk.AuditWorkflowTemplate, error)

LoadAuditsByTemplateIDAndVersionGTE returns all workflow template audits by template id and version greater or equal.

func LoadByID

func LoadByID(ctx context.Context, db gorp.SqlExecutor, id int64, opts ...LoadOptionFunc) (*sdk.WorkflowTemplate, error)

LoadByID retrieves in database the workflow template with given id.

func LoadBySlugAndGroupID

func LoadBySlugAndGroupID(ctx context.Context, db gorp.SqlExecutor, slug string, groupID int64, opts ...LoadOptionFunc) (*sdk.WorkflowTemplate, error)

LoadBySlugAndGroupID returns the workflow template for given slug and group id.

func LoadInstanceByIDForTemplateIDAndProjectIDs

func LoadInstanceByIDForTemplateIDAndProjectIDs(ctx context.Context, db gorp.SqlExecutor, id, templateID int64, projectIDs []int64, opts ...LoadInstanceOptionFunc) (*sdk.WorkflowTemplateInstance, error)

LoadInstanceByIDForTemplateIDAndProjectIDs returns a workflow template instance by id, template id in project ids.

func LoadInstanceByTemplateIDAndProjectIDAndRequestWorkflowName

func LoadInstanceByTemplateIDAndProjectIDAndRequestWorkflowName(ctx context.Context, db gorp.SqlExecutor, templateID, projectID int64, workflowName string, opts ...LoadInstanceOptionFunc) (*sdk.WorkflowTemplateInstance, error)

LoadInstanceByTemplateIDAndProjectIDAndRequestWorkflowName return a workflow template instance by template id, project id and request workflow name.

func LoadInstanceByWorkflowID

func LoadInstanceByWorkflowID(ctx context.Context, db gorp.SqlExecutor, workflowID int64, opts ...LoadInstanceOptionFunc) (*sdk.WorkflowTemplateInstance, error)

LoadInstanceByWorkflowID returns a workflow template instance by workflow id.

func LoadInstanceByWorkflowIDs

func LoadInstanceByWorkflowIDs(ctx context.Context, db gorp.SqlExecutor, workflowID []int64, opts ...LoadInstanceOptionFunc) ([]sdk.WorkflowTemplateInstance, error)

LoadInstanceByWorkflowIDs returns a workflow template instance by workflow ids.

func LoadInstancesByTemplateIDAndProjectIDs

func LoadInstancesByTemplateIDAndProjectIDs(ctx context.Context, db gorp.SqlExecutor, templateID int64, projectIDs []int64, opts ...LoadInstanceOptionFunc) ([]sdk.WorkflowTemplateInstance, error)

LoadInstancesByTemplateIDAndProjectIDs returns all workflow template instances by template id and project ids.

func LoadInstancesByWorkflowIDs

func LoadInstancesByWorkflowIDs(ctx context.Context, db gorp.SqlExecutor, workflowIDs []int64, opts ...LoadInstanceOptionFunc) ([]sdk.WorkflowTemplateInstance, error)

LoadInstancesByWorkflowIDs returns all workflow template instances by workflow ids.

func Parse

Parse return a template with parsed content.

func Pull

Pull writes the content of a template inside the given writer.

func Push

Push creates or updates a workflow template from a tar.

func Update

func Update(db gorp.SqlExecutor, wt *sdk.WorkflowTemplate) error

Update template in database.

func UpdateBulk

func UpdateBulk(db gorp.SqlExecutor, wtb *sdk.WorkflowTemplateBulk) error

UpdateBulk task for workflow template in database.

func UpdateInstance

func UpdateInstance(db gorp.SqlExecutor, wti *sdk.WorkflowTemplateInstance) error

UpdateInstance for workflow template in database.

func UpdateTemplateInstanceWithWorkflow

func UpdateTemplateInstanceWithWorkflow(ctx context.Context, db gorp.SqlExecutor, w sdk.Workflow,
	u sdk.Identifiable, wti *sdk.WorkflowTemplateInstance) error

UpdateTemplateInstanceWithWorkflow will perform some action after a successful workflow push, if it was generated from a template we want to set the workflow id on generated template instance.

Types

type LoadInstanceOptionFunc

type LoadInstanceOptionFunc func(context.Context, gorp.SqlExecutor, ...*sdk.WorkflowTemplateInstance) error

LoadInstanceOptionFunc for workflow template instance.

type LoadOptionFunc

type LoadOptionFunc func(context.Context, gorp.SqlExecutor, ...*sdk.WorkflowTemplate) error

LoadOptionFunc for workflow template.

Jump to

Keyboard shortcuts

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