Documentation ¶
Index ¶
- Constants
- Variables
- func ADifferenceFromB(componentTypeA ComponentType, componentTypeB ComponentType) int
- func AGreaterThanB(componentTypeA ComponentType, componentTypeB ComponentType) bool
- func ComponentTypeNames() []string
- func GatherTasks(folder string) ([]string, error)
- func LabelValueOneOf(labels map[string]string, componentTypes ...ComponentType) (bool, error)
- func LoadTasks(ctx context.Context, taskPaths []string) ([]*tektonv1beta1api.Task, error)
- func OrchestrationTypeNames() []string
- func Package(ctx context.Context, name, componentFolder string, smithyVersion string, ...) (err error)
- func ProcessTasks(taskList ...*tektonv1beta1api.Task) error
- type Component
- type ComponentType
- type NullComponentType
- type NullOrchestrationType
- type OrchestrationType
- func (x OrchestrationType) IsValid() bool
- func (x OrchestrationType) MarshalText() ([]byte, error)
- func (x OrchestrationType) Ptr() *OrchestrationType
- func (x *OrchestrationType) Scan(value interface{}) (err error)
- func (x OrchestrationType) String() string
- func (x *OrchestrationType) UnmarshalText(text []byte) error
- func (x OrchestrationType) Value() (driver.Value, error)
Constants ¶
const LabelKey string = "v1.smithy.smithy-security.com/component"
LabelKey is the key of the label where the value must be a string of the ComponentType enum
Variables ¶
var ( // ErrCouldNotStatPath is returned when the path to the components doesn't // exist or is inaccesbile ErrCouldNotStatPath = errors.New("could not stat path") // ErrNotADirectory is returned when the path is not pointing to a // directory ErrNotADirectory = errors.New("path is not a directory") )
var ErrInvalidComponentType = fmt.Errorf("not a valid ComponentType, try [%s]", strings.Join(_ComponentTypeNames, ", "))
var ErrInvalidOrchestrationType = fmt.Errorf("not a valid OrchestrationType, try [%s]", strings.Join(_OrchestrationTypeNames, ", "))
Functions ¶
func ADifferenceFromB ¶
func ADifferenceFromB(componentTypeA ComponentType, componentTypeB ComponentType) int
ADifferenceFromB returns the difference in position between ComponentType A and ComponentType B e.g. Enricher is 2 steps further along the pipeline than Producer
func AGreaterThanB ¶
func AGreaterThanB(componentTypeA ComponentType, componentTypeB ComponentType) bool
AGreaterThanB returns whether ComponentType A is further along the pipeline than ComponentType B e.g. Enricher is further along the pipeline than Producer
func ComponentTypeNames ¶
func ComponentTypeNames() []string
ComponentTypeNames returns a list of possible string values of ComponentType.
func GatherTasks ¶
GatherTasks returns the paths of all the Tekton Tasks discovered
func LabelValueOneOf ¶
func LabelValueOneOf(labels map[string]string, componentTypes ...ComponentType) (bool, error)
LabelValueOneOf checks if the labels map has the expected key set and if that key has any one of the expected values
func OrchestrationTypeNames ¶
func OrchestrationTypeNames() []string
OrchestrationTypeNames returns a list of possible string values of OrchestrationType.
func Package ¶
func Package(ctx context.Context, name, componentFolder string, smithyVersion string, chartVersion string) (err error)
Package explores the components folder provided and gathers all the Tekton Tasks into one Helm chart.
func ProcessTasks ¶
func ProcessTasks(taskList ...*tektonv1beta1api.Task) error
ProcessTasks adds anchors, environment variables, parameters and any extra infrastructure required for a Task to become a useful part of a pipeline.
Types ¶
type Component ¶
type Component struct { // Name of the component. Should be unique Name string // Reference is the original reference to the component in the pipeline // description Reference string // Repository is the repository from where this component was fetched Repository string // Type of the component (base, source, producer, etc...) Type ComponentType // Resolved shows whether the component manifest has been loaded. // Before this is set to true, the Type and Manifest are not known. Resolved bool // OrchestrationType shows how the component deployment is managed OrchestrationType OrchestrationType // Manifest is the K8s manifest of the object Manifest runtime.Object }
Component represents a Smithy component. At the moment it can only be a Tekton Task, but in the future it might represent other things too.
type ComponentType ¶
type ComponentType string
ComponentType represents all the types of components that Smithy supports ENUM(unknown, base, source, producer, producer-aggregator, enricher, enricher-aggregator, consumer)
const ( // Unknown is a ComponentType of type unknown. Unknown ComponentType = "unknown" // Base is a ComponentType of type base. Base ComponentType = "base" // Source is a ComponentType of type source. Source ComponentType = "source" // Producer is a ComponentType of type producer. Producer ComponentType = "producer" // ProducerAggregator is a ComponentType of type producer-aggregator. ProducerAggregator ComponentType = "producer-aggregator" // Enricher is a ComponentType of type enricher. Enricher ComponentType = "enricher" // EnricherAggregator is a ComponentType of type enricher-aggregator. EnricherAggregator ComponentType = "enricher-aggregator" // Consumer is a ComponentType of type consumer. Consumer ComponentType = "consumer" )
func ComponentTypeValues ¶
func ComponentTypeValues() []ComponentType
ComponentTypeValues returns a list of the values for ComponentType
func GetPrevious ¶
func GetPrevious(componentType ComponentType) ComponentType
GetPrevious returns previous component type e.g. If we want the previous component type of Producer, we get Source
func MustParseComponentType ¶
func MustParseComponentType(name string) ComponentType
MustParseComponentType converts a string to a ComponentType, and panics if is not valid.
func ParseComponentType ¶
func ParseComponentType(name string) (ComponentType, error)
ParseComponentType attempts to convert a string to a ComponentType.
func ValidateTask ¶
func ValidateTask(task *tektonV1Beta1.Task) (ComponentType, error)
func (ComponentType) IsValid ¶
func (x ComponentType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ComponentType) MarshalText ¶
func (x ComponentType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (*ComponentType) Scan ¶
func (x *ComponentType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (ComponentType) String ¶
func (x ComponentType) String() string
String implements the Stringer interface.
func (*ComponentType) UnmarshalText ¶
func (x *ComponentType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type NullComponentType ¶
type NullComponentType struct { ComponentType ComponentType Valid bool Set bool }
func NewNullComponentType ¶
func NewNullComponentType(val interface{}) (x NullComponentType)
func (NullComponentType) MarshalJSON ¶
func (n NullComponentType) MarshalJSON() ([]byte, error)
MarshalJSON correctly serializes a NullComponentType to JSON.
func (*NullComponentType) Scan ¶
func (x *NullComponentType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (*NullComponentType) UnmarshalJSON ¶
func (n *NullComponentType) UnmarshalJSON(b []byte) error
UnmarshalJSON correctly deserializes a NullComponentType from JSON.
type NullOrchestrationType ¶
type NullOrchestrationType struct { OrchestrationType OrchestrationType Valid bool Set bool }
func NewNullOrchestrationType ¶
func NewNullOrchestrationType(val interface{}) (x NullOrchestrationType)
func (NullOrchestrationType) MarshalJSON ¶
func (n NullOrchestrationType) MarshalJSON() ([]byte, error)
MarshalJSON correctly serializes a NullOrchestrationType to JSON.
func (*NullOrchestrationType) Scan ¶
func (x *NullOrchestrationType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (*NullOrchestrationType) UnmarshalJSON ¶
func (n *NullOrchestrationType) UnmarshalJSON(b []byte) error
UnmarshalJSON correctly deserializes a NullOrchestrationType from JSON.
type OrchestrationType ¶
type OrchestrationType string
ENUM(unknown, naive, external-helm)
const ( // OrchestrationTypeUnknown is a OrchestrationType of type unknown. OrchestrationTypeUnknown OrchestrationType = "unknown" // OrchestrationTypeNaive is a OrchestrationType of type naive. OrchestrationTypeNaive OrchestrationType = "naive" // OrchestrationTypeExternalHelm is a OrchestrationType of type external-helm. OrchestrationTypeExternalHelm OrchestrationType = "external-helm" )
func MustParseOrchestrationType ¶
func MustParseOrchestrationType(name string) OrchestrationType
MustParseOrchestrationType converts a string to a OrchestrationType, and panics if is not valid.
func ParseOrchestrationType ¶
func ParseOrchestrationType(name string) (OrchestrationType, error)
ParseOrchestrationType attempts to convert a string to a OrchestrationType.
func (OrchestrationType) IsValid ¶
func (x OrchestrationType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (OrchestrationType) MarshalText ¶
func (x OrchestrationType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (OrchestrationType) Ptr ¶
func (x OrchestrationType) Ptr() *OrchestrationType
func (*OrchestrationType) Scan ¶
func (x *OrchestrationType) Scan(value interface{}) (err error)
Scan implements the Scanner interface.
func (OrchestrationType) String ¶
func (x OrchestrationType) String() string
String implements the Stringer interface.
func (*OrchestrationType) UnmarshalText ¶
func (x *OrchestrationType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.