pipelines

package
v0.59.2 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BasePipeline used to build all pipelines
	BasePipeline = &tektonv1beta1api.Pipeline{
		TypeMeta: metav1.TypeMeta{
			Kind:       "Pipeline",
			APIVersion: tektonv1beta1api.SchemeGroupVersion.String(),
		},
		ObjectMeta: metav1.ObjectMeta{Name: "smithy"},
		Spec: tektonv1beta1api.PipelineSpec{
			Description: "Base pipeline for all Smithy pipelines",
		},
	}

	// BaseTask used to inject tags and timestamps to a pipeline
	BaseTask = &tektonv1beta1api.Task{
		ObjectMeta: metav1.ObjectMeta{
			Name: "base",
			Labels: map[string]string{
				"v1.smithy.smithy-security.com/component": "base",
			},
		},
		Spec: tektonv1beta1api.TaskSpec{
			Params: tektonv1beta1api.ParamSpecs{
				tektonv1beta1api.ParamSpec{
					Name: "base-scan-tags",
					Type: "string",
					Default: &tektonv1beta1api.ParamValue{
						Type:      tektonv1beta1api.ParamTypeString,
						StringVal: "",
					},
				},
			},
			Steps: []tektonv1beta1api.Step{
				{
					Name:   "generate-scan-id-start-time",
					Image:  "docker.io/busybox:1.35.0",
					Script: "cat /proc/sys/kernel/random/uuid | tee $(results.smithy-scan-id.path)\ndate +\"%Y-%m-%dT%H:%M:%SZ\" | tee $(results.smithy-scan-start-time.path)\necho \"$(params.base-scan-tags)\" | tee $(results.smithy-scan-tags.path)\n",
					Results: []tektonv1api.StepResult{
						{
							Name:        "smithy-scan-start-time",
							Description: "The scan start time",
						},
						{
							Name:        "smithy-scan-id",
							Description: "The scan unique id",
						},
						{
							Name:        "smithy-scan-tags",
							Description: "serialized map[string]string of tags for this scan",
						},
					},
				},
			},
		},
	}
)
View Source
var (
	// ErrNoComponentsInKustomization is returned when a kustomization has no
	// components listed
	ErrNoComponentsInKustomization = errors.New("no components listed in kustomization")
	// ErrNoTasks is returned when no tasks are provided to the Tekton backend
	ErrNoTasks = errors.New("no tasks provided")
	// ErrNotResolved is returned when a component that has not been resolved
	// is passed to the Orchestrator
	ErrNotResolved = errors.New("component has not been resolved")
)

Functions

func ResolveBase

func ResolveBase(ctx context.Context, kustomizationDir string, kustomization kustomizetypes.Kustomization) (*tektonv1beta1api.Pipeline, error)

ResolveBase checks the resources section to find the base pipeline, If its not listed, default ones will be used.

Types

type Orchestrator

type Orchestrator[P runtime.Object] interface {
	// Prepare checks if the expected components are present in the cluster and
	// performs any operations to ensure that the workflow can be deployed.
	Prepare(context.Context, []components.Component) error

	// Deploy will generate a Pipeline based on the components and return it.
	// If dry run is set to false, the pipeline will also be applied to the
	// cluster.
	Deploy(context.Context, P, []components.Component, string, bool) (P, error)
}

Orchestrator represents a piece of code that orchestrates the deployment of components and pipelines on a backend. The backend could be a cluster with a Tekton operator for example, or some other system.

func NewTektonV1Beta1Orchestrator

func NewTektonV1Beta1Orchestrator(clientset k8s.ClientInterface, namespace string) Orchestrator[*tektonv1beta1api.Pipeline]

NewTektonV1Beta1Orchestrator returns an Orchestrator implementation for TektonV1Beta1

Jump to

Keyboard shortcuts

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