pipelinegit

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RepositoryActionValidate  = "validate"
	RepositoryActionBootstrap = "bootstrap"
	RepositoryActionDelete    = "delete"
)
View Source
const MaxRemoteSourceSnapshotFiles = 10_000

Variables

View Source
var ErrCreationTargetExists = xerror.New(
	xerror.KindAlreadyExists,
	"PIPELINE_CREATION_TARGET_EXISTS",
	"pipeline creation cannot replace an existing repository file",
)
View Source
var ErrProposalAuthorityInvalid = xerror.New(
	xerror.KindUnauthorized,
	"PROPOSAL_AUTHORITY_INVALID",
	"provider authority is unavailable, revoked, or does not match the repository",
)
View Source
var ErrProposalBranchHeadConflict = xerror.New(
	xerror.KindAlreadyExists,
	"PROPOSAL_BRANCH_HEAD_CONFLICT",
	"proposal branch head changed",
)
View Source
var ErrProviderProposalUnsupported = xerror.New(
	xerror.KindInvalidInput,
	"PROVIDER_PROPOSAL_UNSUPPORTED",
	"provider proposal is unsupported",
)
View Source
var ErrRepositoryBootstrapUnsupported = xerror.InvalidInput(xerror.RepoFile).
	Detail("repository bootstrap is supported only for GitHub connections")
View Source
var ErrSourceRequired = xerror.New(
	xerror.KindInvalidInput,
	"PIPELINE_RECONCILE_SOURCE_REQUIRED",
	"pipeline reconcile source required",
)

Functions

func ExecuteResolvedGitDelete

func ExecuteResolvedGitDelete(ctx context.Context, request RemoteDeleteRequest) error

ExecuteResolvedGitDelete runs one pre-resolved operation on an isolated host.

func ExecuteResolvedGitWrite

func ExecuteResolvedGitWrite(ctx context.Context, request RemoteWriteRequest) error

ExecuteResolvedGitWrite runs one pre-resolved operation on an isolated host.

func NewSnapshotRepoStore

func NewSnapshotRepoStore(files map[string][]byte) repostore.RepoStore

NewSnapshotRepoStore creates a read-only in-memory repository from an executor-produced snapshot. Callers can reconcile Git content without materializing tenant-controlled files in the control-plane process.

func RepositoryTemplate

func RepositoryTemplate(pipelineDir string) []gitprovider.RepositoryFile

RepositoryTemplate initializes the same Git-owned layout for each supported provider.

Types

type DataSourceGitAuthResolver

type DataSourceGitAuthResolver interface {
	ResolveGitAuth(
		ctx context.Context,
		orgSlug, dsSlug slug.Slug,
	) (*datasourcessvc.GitDataSourceAuth, error)
}

DataSourceGitAuthResolver resolves git authentication for data sources.

type DeleteFileOperation

type DeleteFileOperation struct {
	OrganizationSlug slug.Slug
	DataSourceSlug   slug.Slug
	PipelineSlug     slug.Slug
	Branch           *string
	Path             string
	CommitMessage    string
}

DeleteFileOperation describes one outbound pipeline file delete.

type FileExecutor

type FileExecutor interface {
	WriteFile(ctx context.Context, op WriteFileOperation) error
	DeleteFile(ctx context.Context, op DeleteFileOperation) error
}

FileExecutor applies outbound pipeline file changes to a git data source.

func NewFileExecutor

func NewFileExecutor(gitAuthResolver DataSourceGitAuthResolver) (FileExecutor, error)

NewFileExecutor creates the production executor for outbound pipeline git file operations.

func NewRemoteFileExecutor

func NewRemoteFileExecutor(resolver GitExecutionAuthResolver, executor RemoteExecutor) (FileExecutor, error)

type GitExecutionAuthResolver

type GitExecutionAuthResolver interface {
	ResolveGitExecutionAuth(context.Context, slug.Slug, slug.Slug) (*datasourcessvc.GitExecutionAuth, error)
}

GitExecutionAuthResolver decrypts only operation-scoped inputs on control workers.

type ManagedRepositoryBootstrapper

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

ManagedRepositoryBootstrapper uses the organization grant before a repository source exists.

func NewManagedRepositoryBootstrapper

func NewManagedRepositoryBootstrapper(credentials managedRepositoryCredentials, config gitprovider.Config) (*ManagedRepositoryBootstrapper, error)

func (*ManagedRepositoryBootstrapper) BootstrapGitLabRepository

type ProjectBackendService

type ProjectBackendService interface {
	GetProject(
		ctx context.Context,
		orgSlug, projectSlug slug.Slug,
	) (*model.Project, error)
}

ProjectBackendService resolves project-level pipeline backend configuration.

type ProposalBranchHeadConflictError

type ProposalBranchHeadConflictError struct {
	Expected string
	Actual   string
}

ProposalBranchHeadConflictError reports only safe commit identities for an externally changed proposal branch.

func (*ProposalBranchHeadConflictError) Error

func (*ProposalBranchHeadConflictError) Unwrap

type ProposalCompletion

type ProposalCompletion struct {
	CreationSlug     slug.Slug
	OrganizationSlug slug.Slug
	ProjectSlug      slug.Slug
	PipelineSlug     slug.Slug
	MemberSlug       slug.Slug
	Provider         string
	ProposalID       string
	ProposalURL      string
	ProposalState    string
	BranchName       string
	BranchHeadSHA    string
	DraftSpecHash    string
	PublishAttemptID string
	Authority        model.PipelineProposalAuthorityPayload
}

ProposalCompletion carries safe proposal metadata plus draft identity for persistence.

type ProposalExecutor

type ProposalExecutor interface {
	PublishProposal(ctx context.Context, op ProposalOperation) (*ProposalResult, error)
	RefreshProposal(ctx context.Context, op ProposalRefreshOperation) (*ProposalResult, error)
}

ProposalExecutor applies a pipeline draft to a branch and opens or updates a provider PR/MR.

func NewProposalExecutor

func NewProposalExecutor(gitAuthResolver DataSourceGitAuthResolver) (ProposalExecutor, error)

NewProposalExecutor creates the production executor for provider-native proposal publish.

func NewRemoteProposalExecutor

func NewRemoteProposalExecutor(
	resolver GitExecutionAuthResolver,
	executor RemoteExecutor,
) (ProposalExecutor, error)

type ProposalFailure

type ProposalFailure struct {
	CreationSlug     slug.Slug
	OrganizationSlug slug.Slug
	ProjectSlug      slug.Slug
	PipelineSlug     slug.Slug
	MemberSlug       slug.Slug
	PublishAttemptID string
	FailureCode      string
	FailureMessage   string
}

ProposalFailure identifies a member-scoped proposal attempt without retaining private provider diagnostics.

type ProposalOperation

type ProposalOperation struct {
	CreateOnly       bool
	OrganizationSlug slug.Slug
	DataSourceSlug   slug.Slug
	PipelineSlug     slug.Slug
	BaseRef          *string
	BaseCommitSHA    *string
	ExpectedHeadSHA  *string
	BranchName       string
	Path             string
	Content          []byte
	CommitMessage    string
	ProposalTitle    string
	ProposalBody     string
	Authority        model.PipelineProposalAuthorityPayload
}

ProposalOperation describes one outbound Git-authored draft proposal publish.

type ProposalRefreshCompletion

type ProposalRefreshCompletion struct {
	OrganizationSlug slug.Slug
	ProjectSlug      slug.Slug
	PipelineSlug     slug.Slug
	MemberSlug       slug.Slug
	Provider         string
	ProposalID       string
	ProposalURL      string
	ProposalState    string
	BranchName       string
	BranchHeadSHA    string
	RefreshAttemptID string
}

ProposalRefreshCompletion carries safe provider state refreshed by exact proposal ID.

type ProposalRefreshFailure

type ProposalRefreshFailure struct {
	OrganizationSlug slug.Slug
	ProjectSlug      slug.Slug
	PipelineSlug     slug.Slug
	MemberSlug       slug.Slug
	ProposalID       string
	RefreshAttemptID string
	FailureCode      string
	FailureMessage   string
}

ProposalRefreshFailure identifies an exact refresh without changing proposal lifecycle state.

type ProposalRefreshOperation

type ProposalRefreshOperation struct {
	OrganizationSlug slug.Slug
	DataSourceSlug   slug.Slug
	ProposalID       string
}

ProposalRefreshOperation identifies one provider proposal whose last-known state should be refreshed.

type ProposalResult

type ProposalResult struct {
	Provider      string
	ProposalID    string
	ProposalURL   string
	ProposalState string
	BranchName    string
	BranchHeadSHA string
}

ProposalResult contains safe provider metadata for persistence.

func ExecuteResolvedGitProposal

func ExecuteResolvedGitProposal(
	ctx context.Context,
	request RemoteProposalRequest,
) (*ProposalResult, error)

ExecuteResolvedGitProposal runs one pre-resolved proposal operation on an isolated host.

func ExecuteResolvedGitProposalRefresh

func ExecuteResolvedGitProposalRefresh(
	ctx context.Context,
	request RemoteProposalRefreshRequest,
) (*ProposalResult, error)

ExecuteResolvedGitProposalRefresh reads one exact provider proposal on an isolated host.

func (*ProposalResult) ValidatePublication

func (r *ProposalResult) ValidatePublication(authority model.PipelineProposalAuthorityPayload, branch string) error

ValidatePublication keeps branch-only results distinct from provider review objects.

type ProviderProposalRequest

type ProviderProposalRequest struct {
	BaseRef       string
	BaseCommitSHA string
	BranchName    string
	Title         string
	Body          string
}

ProviderProposalRequest is the provider-native PR/MR upsert request.

type RemoteDeleteRequest

type RemoteDeleteRequest struct {
	Auth      datasourcessvc.GitExecutionAuth `json:"auth"`
	Operation DeleteFileOperation             `json:"operation"`
}

type RemoteExecutor

type RemoteExecutor interface {
	ExecuteGitWrite(context.Context, RemoteWriteRequest) error
	ExecuteGitDelete(context.Context, RemoteDeleteRequest) error
	ExecuteGitProposal(context.Context, RemoteProposalRequest) (*ProposalResult, error)
	ExecuteGitProposalRefresh(context.Context, RemoteProposalRefreshRequest) (*ProposalResult, error)
}

RemoteExecutor crosses the filesystem and outbound-network execution boundary.

type RemoteProposalRefreshRequest

type RemoteProposalRefreshRequest struct {
	Auth      datasourcessvc.GitExecutionAuth `json:"auth"`
	Operation ProposalRefreshOperation        `json:"operation"`
}

type RemoteProposalRequest

type RemoteProposalRequest struct {
	Auth      datasourcessvc.GitExecutionAuth `json:"auth"`
	Operation ProposalOperation               `json:"operation"`
}

type RemoteRepositoryExecutor

type RemoteRepositoryExecutor interface {
	ExecuteGitRepository(context.Context, RemoteRepositoryRequest) (*RepositoryBootstrapResult, error)
}

type RemoteRepositoryRequest

type RemoteRepositoryRequest struct {
	Auth      datasourcessvc.GitExecutionAuth `json:"auth"`
	Action    string                          `json:"action"`
	Operation RepositoryBootstrapOperation    `json:"operation"`
}

type RemoteSourceExecutor

type RemoteSourceExecutor interface {
	ExecuteGitSourceSnapshot(context.Context, RemoteSourceRequest) (*RemoteSourceSnapshot, error)
}

type RemoteSourceRequest

type RemoteSourceRequest struct {
	OrganizationSlug slug.Slug                       `json:"organization_slug"`
	DataSourceSlug   slug.Slug                       `json:"data_source_slug"`
	Auth             datasourcessvc.GitExecutionAuth `json:"auth"`
	Branch           string                          `json:"branch"`
	MaxBytes         int64                           `json:"max_bytes"`
	MaxFiles         int                             `json:"max_files"`
}

type RemoteSourceSnapshot

type RemoteSourceSnapshot struct {
	Files             map[string][]byte `json:"files"`
	SourceRepo        *string           `json:"source_repo,omitempty"`
	SourceRef         *string           `json:"source_ref,omitempty"`
	LastAppliedCommit *string           `json:"last_applied_commit,omitempty"`
}

func ExecuteGitSourceSnapshot

func ExecuteGitSourceSnapshot(ctx context.Context, request RemoteSourceRequest) (*RemoteSourceSnapshot, error)

type RemoteWriteRequest

type RemoteWriteRequest struct {
	Auth      datasourcessvc.GitExecutionAuth `json:"auth"`
	Operation WriteFileOperation              `json:"operation"`
}

type RepositoryBootstrapOperation

type RepositoryBootstrapOperation struct {
	OrganizationSlug slug.Slug
	DataSourceSlug   slug.Slug
	Owner            string
	Name             string
	RepositoryID     string
	DefaultBranch    string
	PipelineDir      string
}

type RepositoryBootstrapResult

type RepositoryBootstrapResult struct {
	Provider        string
	Owner           string
	OwnerKind       string
	Repository      string
	RepositoryID    string
	RemoteURL       string
	DefaultBranch   string
	PipelineDir     string
	FirstCommitSHA  string
	TemplateVersion string
}

func ExecuteResolvedGitRepository

func ExecuteResolvedGitRepository(
	ctx context.Context,
	request RemoteRepositoryRequest,
) (*RepositoryBootstrapResult, error)

type RepositoryManager

type RepositoryManager interface {
	ValidateRepository(context.Context, slug.Slug, slug.Slug, string) error
	BootstrapRepository(context.Context, RepositoryBootstrapOperation) (*RepositoryBootstrapResult, error)
	DeleteRepository(context.Context, RepositoryBootstrapOperation) error
}

func NewRemoteRepositoryManager

func NewRemoteRepositoryManager(
	resolver GitExecutionAuthResolver,
	executor RemoteRepositoryExecutor,
) (RepositoryManager, error)

func NewRepositoryManager

func NewRepositoryManager(resolver DataSourceGitAuthResolver) (RepositoryManager, error)

type Source

type Source struct {
	RepoStore         repostore.RepoStore
	Cleanup           func()
	DataSourceSlug    slug.Slug
	SourceRepo        *string
	SourceRef         *string
	LastAppliedCommit *string
}

Source is a resolved git source ready for pipeline reconciliation.

Cleanup belongs to the current synchronous reconcile source lifecycle. Outbound worker-owned repository lifecycles do not leak to service callers.

type SourceRequest

type SourceRequest struct {
	ProjectSlug slug.Slug
}

SourceRequest selects the project whose configured pipeline backend should be used.

type SourceResolver

type SourceResolver interface {
	Resolve(ctx context.Context, orgSlug slug.Slug, req SourceRequest) (*Source, error)
}

SourceResolver resolves the git repository used by inbound pipeline reconciliation.

This is intentionally limited to git-to-DB reconcile. Outbound DB-to-git side effects use the async pipeline git executor path.

func NewRemoteSourceResolver

func NewRemoteSourceResolver(
	projectBackend ProjectBackendService,
	gitAuthResolver GitExecutionAuthResolver,
	executor RemoteSourceExecutor,
	maxBytes int64,
) (SourceResolver, error)

func NewSourceResolver

func NewSourceResolver(
	projectBackend ProjectBackendService,
	gitAuthResolver DataSourceGitAuthResolver,
) (SourceResolver, error)

NewSourceResolver creates a production git source resolver.

type WriteFileOperation

type WriteFileOperation struct {
	OrganizationSlug slug.Slug
	DataSourceSlug   slug.Slug
	PipelineSlug     slug.Slug
	Branch           *string
	Path             string
	Content          []byte
	CommitMessage    string
	FailIfExists     bool
}

WriteFileOperation describes one outbound pipeline file write.

Jump to

Keyboard shortcuts

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