service

package
v0.0.0-...-b2e0f1d Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMalformedOnQueryOrRepository = errors.New("malformed 'on' field; missing either a repository name or a query")
)

Functions

This section is empty.

Types

type BatchSpecWorkspaceResolution

type BatchSpecWorkspaceResolution struct {
	FailureMessage string `json:"failureMessage"`
	State          string `json:"state"`
	Workspaces     struct {
		TotalCount int `json:"totalCount"`
	} `json:"workspaces"`
}

type Namespace

type Namespace struct {
	ID  string
	URL string
}

type Opts

type Opts struct {
	Client api.Client
}

type RepoWorkspace

type RepoWorkspace struct {
	Repo               *graphql.Repository
	Path               string
	OnlyFetchWorkspace bool
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func New

func New(opts *Opts) *Service

func (*Service) ApplyBatchChange

func (svc *Service) ApplyBatchChange(ctx context.Context, spec graphql.BatchSpecID) (*graphql.BatchChange, error)

func (*Service) BuildTasks

func (svc *Service) BuildTasks(attributes *templatelib.BatchChangeAttributes, steps []batcheslib.Step, workspaces []RepoWorkspace) []*executor.Task

func (*Service) CreateBatchSpec

func (svc *Service) CreateBatchSpec(ctx context.Context, namespace, spec string, ids []graphql.ChangesetSpecID) (graphql.BatchSpecID, string, error)

func (*Service) CreateBatchSpecFromRaw

func (svc *Service) CreateBatchSpecFromRaw(
	ctx context.Context,
	batchSpec string,
	namespaceID string,
	allowIgnored bool,
	allowUnsupported bool,
	noCache bool,
	batchChange string,
) (string, error)

func (*Service) CreateChangesetSpec

func (svc *Service) CreateChangesetSpec(ctx context.Context, spec *batcheslib.ChangesetSpec) (graphql.ChangesetSpecID, error)

func (*Service) CreateImportChangesetSpecs

func (svc *Service) CreateImportChangesetSpecs(ctx context.Context, batchSpec *batcheslib.BatchSpec) ([]*batcheslib.ChangesetSpec, error)

func (*Service) DetermineLicenseAndFeatureFlags

func (svc *Service) DetermineLicenseAndFeatureFlags(ctx context.Context, skipErrors bool) (*batches.LicenseRestrictions, *batches.FeatureFlags, error)

DetermineLicenseAndFeatureFlags returns the enabled features and license restrictions configured for the Sourcegraph instance.

func (*Service) EnsureDockerImages

func (svc *Service) EnsureDockerImages(
	ctx context.Context,
	imageCache docker.ImageCache,
	steps []batcheslib.Step,
	parallelism int,
	progress func(done, total int),
) (map[string]docker.Image, error)

EnsureDockerImages iterates over the steps within the batch spec to ensure the images exist and to determine the exact content digest to be used when running each step, including any required by the service itself.

Progress information is reported back to the given progress function.

func (*Service) ExecuteBatchSpec

func (svc *Service) ExecuteBatchSpec(
	ctx context.Context,
	batchSpecID string,
	noCache bool,
) (string, error)

func (*Service) GenerateExampleSpec

func (svc *Service) GenerateExampleSpec(ctx context.Context, fileName string) error

func (*Service) GetBatchSpecWorkspaceResolution

func (svc *Service) GetBatchSpecWorkspaceResolution(ctx context.Context, id string) (*BatchSpecWorkspaceResolution, error)

func (*Service) ParseBatchSpec

func (svc *Service) ParseBatchSpec(dir string, data []byte) (*batcheslib.BatchSpec, error)

func (*Service) ResolveNamespace

func (svc *Service) ResolveNamespace(ctx context.Context, namespace string) (Namespace, error)

func (*Service) ResolveWorkspacesForBatchSpec

func (svc *Service) ResolveWorkspacesForBatchSpec(ctx context.Context, spec *batcheslib.BatchSpec, allowUnsupported, allowIgnored bool) ([]RepoWorkspace, []*graphql.Repository, error)

func (*Service) UploadBatchSpecWorkspaceFiles

func (svc *Service) UploadBatchSpecWorkspaceFiles(ctx context.Context, workingDir string, batchSpecID string, steps []batches.Step) error

UploadBatchSpecWorkspaceFiles uploads workspace files to the server.

func (*Service) UpsertBatchChange

func (svc *Service) UpsertBatchChange(
	ctx context.Context,
	name string,
	namespaceID string,
) (string, string, error)

func (*Service) ValidateChangesetSpecs

func (svc *Service) ValidateChangesetSpecs(repos []*graphql.Repository, specs []*batcheslib.ChangesetSpec) error

ValidateChangesetSpecs validates that among all branch changesets there are no duplicates in branch names in a single repo.

Jump to

Keyboard shortcuts

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