Documentation ¶
Index ¶
- Constants
- Variables
- 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 Package(ctx context.Context, name, componentFolder string, draconVersion string, ...) (err error)
- func ProcessTasks(draconVersion string, taskList ...*tektonv1beta1api.Task) error
- type Component
- type ComponentType
- func (ct ComponentType) Equal(other any) (bool, error)
- func (ct ComponentType) MarshalJSON() ([]byte, error)
- func (ct ComponentType) MarshalText() ([]byte, error)
- func (ct ComponentType) String() string
- func (ct *ComponentType) UnmarshalJSON(b []byte) error
- func (ct *ComponentType) UnmarshalText(text []byte) error
- type OrchestrationType
Constants ¶
const LabelKey string = "v1.dracon.ocurity.com/component"
LabelKey is the key of the label where the value must be a string of the ComponentType enum
const NoImagePinning string = ""
NoImagePinning signals to the ProcessTasks function that the Task images should not be modified.
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") )
Functions ¶
func GatherTasks ¶ added in v0.14.0
GatherTasks returns the paths of all the Tekton Tasks discovered
func LabelValueOneOf ¶ added in v0.13.0
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 Package ¶ added in v0.2.0
func Package(ctx context.Context, name, componentFolder string, draconVersion string, chartVersion string) (err error)
Package explores the components folder provided and gathers all the Tekton Tasks into one Helm chart.
func ProcessTasks ¶ added in v0.13.0
func ProcessTasks(draconVersion string, 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. If the draconVersion is set to any value other than `NoImagePinning`, the tag of every Task image will be set to that version.
Types ¶
type Component ¶ added in v0.2.0
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 or not the component manifest has been loaded // or not. 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 Dracon 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 int
ComponentType represents all the types of components that Dracon supports
const ( // Unknown is the default component type value Unknown ComponentType = iota // Base represents the base component of a pipeline Base // Source represents the source component of a pipeline Source // Producer represents the producer component of a pipeline Producer // ProducerAggregator represents the producer aggregator component of a // pipeline ProducerAggregator // Enricher represents the enricher component of a pipeline Enricher // EnricherAggregator represents the enricher aggregator component of a // pipeline EnricherAggregator // Consumer represents the consumer component of a pipeline Consumer )
func MustGetComponentType ¶
func MustGetComponentType(cts string) ComponentType
MustGetComponentType converts a string into a ComponentType enum value or panics
func ToComponentType ¶
func ToComponentType(cts string) (ComponentType, error)
ToComponentType converts a string into a ComponentType enum value or returns an error
func ValidateTask ¶
func ValidateTask(task *tektonV1Beta1.Task) (ComponentType, error)
func (ComponentType) Equal ¶ added in v0.13.0
func (ct ComponentType) Equal(other any) (bool, error)
Equal checks if the other is a ComponentType or some type that can be parsed and then checks for equality.
func (ComponentType) MarshalJSON ¶ added in v0.13.0
func (ct ComponentType) MarshalJSON() ([]byte, error)
MarshalJSON marshals a `ComponentType` into JSON bytes
func (ComponentType) MarshalText ¶ added in v0.13.0
func (ct ComponentType) MarshalText() ([]byte, error)
MarshalText marshals the `ComponentType` into text bytes
func (ComponentType) String ¶
func (ct ComponentType) String() string
String converts the ComponentType enum value to a string
func (*ComponentType) UnmarshalJSON ¶ added in v0.13.0
func (ct *ComponentType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshalls bytes into a `ComponentType`
func (*ComponentType) UnmarshalText ¶ added in v0.13.0
func (ct *ComponentType) UnmarshalText(text []byte) error
UnmarshalText unmarshalls bytes into a `ComponentType`
type OrchestrationType ¶ added in v0.2.0
type OrchestrationType int
const ( // UnknownOrchestration is the default value for the enum UnknownOrchestration OrchestrationType = iota // Naive means that a component is deployed on the cluster automatically // before a Pipeline is deployed without checking if it's a newer or older // version. Naive // ExternalHelm means that a component is deployed on the cluster using // Helm but the orchestrator itself is not involved in this process. ExternalHelm )
func ToOrchestrationType ¶ added in v0.13.0
func ToOrchestrationType(cts string) (OrchestrationType, error)
ToOrchestrationType converts a string into an OrchestrationType enum value or returns an error
func (OrchestrationType) MarshalJSON ¶ added in v0.13.0
func (ot OrchestrationType) MarshalJSON() ([]byte, error)
MarshalJSON marshals an `OrchestrationType` into JSON bytes
func (OrchestrationType) MarshalText ¶ added in v0.13.0
func (ot OrchestrationType) MarshalText() ([]byte, error)
MarshalText marshals the `OrchestrationType` into text bytes
func (OrchestrationType) String ¶ added in v0.13.0
func (ot OrchestrationType) String() string
String converts the OrchestrationType to a string
func (*OrchestrationType) UnmarshalJSON ¶ added in v0.13.0
func (ot *OrchestrationType) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshalls bytes into an `OrchestrationType`
func (*OrchestrationType) UnmarshalText ¶ added in v0.13.0
func (ot *OrchestrationType) UnmarshalText(text []byte) error
UnmarshalText unmarshalls bytes into an `OrchestrationType`