release

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: MPL-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package release provides the release service. A release is composed of a set of assets, a snapshot of the automation used to deploy the assets, and the state of the automation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateReleaseInput

type CreateReleaseInput struct {
	DueDate             *time.Time
	VariableSetRevision *string
	ProjectID           string
	LifecycleID         string
	SemanticVersion     string
	Notes               string
	DeploymentTemplates []DeploymentTemplateInput
	Variables           []VariableInput
	UserParticipantIDs  []string
	TeamParticipantIDs  []string
}

CreateReleaseInput is the input for creating a release.

type DataStore

type DataStore interface {
	UploadReleaseNotes(ctx context.Context, releaseID string, data string) error
	GetReleaseNotes(ctx context.Context, releaseID string) (io.ReadCloser, error)
}

DataStore interface encapsulates the logic for saving and retrieving pipeline template data

func NewDataStore

func NewDataStore(objectStore objectstore.ObjectStore) DataStore

NewDataStore creates an instance of the DataStore interface

type DeleteReleaseInput

type DeleteReleaseInput struct {
	MetadataVersion *int
	ID              string
}

DeleteReleaseInput is the input for deleting a release.

type DeploymentTemplateInput

type DeploymentTemplateInput struct {
	EnvironmentName    string
	PipelineTemplateID string
}

DeploymentTemplateInput is the input for supplying a deployment template.

type GetReleasesInput

type GetReleasesInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.ReleaseSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// ProjectID filters the releases by the specified project
	ProjectID *string
	// UserParticipantID filters the releases by the specified user participant
	UserParticipantID *string
	// Latest filters the releases to only the latest release
	Latest *bool
}

GetReleasesInput is the input for querying a list of releases.

type MockDataStore

type MockDataStore struct {
	mock.Mock
}

MockDataStore is an autogenerated mock type for the DataStore type

func NewMockDataStore

func NewMockDataStore(t mockConstructorTestingTNewMockDataStore) *MockDataStore

NewMockDataStore creates a new instance of MockDataStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockDataStore) GetReleaseNotes

func (_m *MockDataStore) GetReleaseNotes(ctx context.Context, releaseID string) (io.ReadCloser, error)

GetReleaseNotes provides a mock function with given fields: ctx, releaseID

func (*MockDataStore) UploadReleaseNotes

func (_m *MockDataStore) UploadReleaseNotes(ctx context.Context, releaseID string, data string) error

UploadReleaseNotes provides a mock function with given fields: ctx, releaseID, data

type ParticipantInput

type ParticipantInput struct {
	UserID    *string
	TeamID    *string
	ReleaseID string
}

ParticipantInput is the input for adding a participant to a release.

type Service

type Service interface {
	GetReleaseByID(ctx context.Context, id string) (*models.Release, error)
	GetReleaseByPRN(ctx context.Context, prn string) (*models.Release, error)
	GetReleasesByIDs(ctx context.Context, idList []string) ([]*models.Release, error)
	GetReleaseNotes(ctx context.Context, releaseID string) (string, error)
	GetReleases(ctx context.Context, input *GetReleasesInput) (*db.ReleasesResult, error)
	CreateRelease(ctx context.Context, input *CreateReleaseInput) (*models.Release, error)
	UpdateRelease(ctx context.Context, input *UpdateReleaseInput) (*models.Release, error)
	DeleteRelease(ctx context.Context, input *DeleteReleaseInput) error
	UpdateDeploymentPipeline(ctx context.Context, input *UpdateDeploymentPipelineInput) (*models.Pipeline, error)
	AddParticipantToRelease(ctx context.Context, input *ParticipantInput) (*models.Release, error)
	RemoveParticipantFromRelease(ctx context.Context, input *ParticipantInput) (*models.Release, error)
}

Service is the interface that provides release methods.

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	lifecycleTemplateDataStore lifecycletemplate.DataStore,
	pipelineTemplateDataStore pipelinetemplate.DataStore,
	pipelineTemplateService pipelinetemplate.Service,
	pipelineService pipeline.Service,
	limitChecker limits.LimitChecker,
	activityService activityevent.Service,
	releaseDataStore DataStore,
) Service

NewService returns an instance of Service

type TemplateBuilder

type TemplateBuilder struct{}

TemplateBuilder builds a template from a release.

func NewTemplateBuilder

func NewTemplateBuilder() *TemplateBuilder

NewTemplateBuilder creates a new TemplateBuilder.

func (*TemplateBuilder) Build

func (b *TemplateBuilder) Build(rawLifecycleHCL []byte) ([]byte, error)

Build builds a pipeline template from raw release lifecycle HCL. It converts all lifecycle blocks to pipeline blocks and updates the template ID and variables for each deployment block.

type UpdateDeploymentPipelineInput

type UpdateDeploymentPipelineInput struct {
	ReleaseID          string
	EnvironmentName    string
	PipelineTemplateID *string
	Variables          []pipeline.Variable
}

UpdateDeploymentPipelineInput is the input for updating a release deployment.

type UpdateReleaseInput

type UpdateReleaseInput struct {
	Notes     *string
	DueDate   *time.Time
	ReleaseID string
}

UpdateReleaseInput is the input for updating a release.

type VariableInput

type VariableInput struct {
	EnvironmentName *string
	Key             string
	Value           string
	Category        models.VariableCategory
}

VariableInput represents a release variable.

Jump to

Keyboard shortcuts

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