Documentation
¶
Index ¶
- type AttachVCSConfigsParams
- type ConnectedGithubVCSConfigRequest
- type GithubClient
- type Helpers
- func (h *Helpers) AttachVCSConfigs(ctx context.Context, params AttachVCSConfigsParams) error
- func (h *Helpers) AttachVCSConfigsWithTx(tx *gorm.DB, params AttachVCSConfigsParams) error
- func (h *Helpers) BuildConnectedGithubVCSConfig(ctx context.Context, req *ConnectedGithubVCSConfigRequest, org *app.Org) (*app.ConnectedGithubVCSConfig, error)
- func (h *Helpers) BuildPublicGitVCSConfig(ctx context.Context, req *PublicGitVCSConfigRequest) (*app.PublicGitVCSConfig, error)
- func (h *Helpers) CreateConnectionQueue(ctx context.Context, vcsConn *app.VCSConnection) (*app.Queue, error)
- func (h *Helpers) CreateInstallationToken(ctx context.Context, vcsConn *app.VCSConnection, repoName string) (string, error)
- func (h *Helpers) CreateOrgWebhook(ctx context.Context, vcsConn *app.VCSConnection, webhookURL string, ...) (int64, error)
- func (h *Helpers) CreateSubscriptionQueue(ctx context.Context, sub *app.VCSWebhookSubscription) (*app.Queue, error)
- func (h *Helpers) DeleteInstallation(ctx context.Context, installID string) error
- func (h *Helpers) EnqueueWebhookSubscriptionSignal(ctx context.Context, vcsConn *app.VCSConnection) error
- func (h *Helpers) EnsureConnectionQueue(ctx context.Context, vcsConn *app.VCSConnection) error
- func (h *Helpers) GetConnectedGithubVCSConfigLatestCommit(ctx context.Context, vcsCfg *app.ConnectedGithubVCSConfig) (*github.RepositoryCommit, error)
- func (h *Helpers) GetGitSource(ctx context.Context, cfg *app.ConnectedGithubVCSConfig) (*plantypes.GitSource, error)
- func (h *Helpers) GetGitSourceAtCommit(ctx context.Context, cfg *app.ConnectedGithubVCSConfig, commitSHA string) (*plantypes.GitSource, error)
- func (h *Helpers) GetInstallation(ctx context.Context, installID string) (*github.Installation, error)
- func (h *Helpers) GetInstallationAccount(ctx context.Context, installID string) (*github.User, error)
- func (H *Helpers) GetJWTVCSConnectionClient() (*github.Client, error)
- func (h *Helpers) GetPubliGitSource(ctx context.Context, cfg *app.PublicGitVCSConfig) (*plantypes.GitSource, error)
- func (h *Helpers) GetPublicGitSourceAtCommit(cfg *app.PublicGitVCSConfig, commitSHA string) (*plantypes.GitSource, error)
- func (h *Helpers) GetPublicGitVCSConfigLatestCommit(ctx context.Context, cfg *app.PublicGitVCSConfig) (*github.RepositoryCommit, error)
- func (H *Helpers) GetVCSConnectionClient(ctx context.Context, vcsConn *app.VCSConnection) (*github.Client, error)
- func (h *Helpers) GithubCommitToVCSConnectionCommit(ghCommit *github.RepositoryCommit, ownerID, ownerType string, ...) *app.VCSConnectionCommit
- func (h *Helpers) ListInstallationRepos(ctx context.Context, vcsConn *app.VCSConnection) ([]*github.Repository, error)
- func (h *Helpers) LookupVCSConnection(ctx context.Context, owner, name string, vcsConnections []app.VCSConnection) (string, error)
- func (h *Helpers) SplitRepoSlug(val string) (string, string, error)
- func (h *Helpers) StopConnectionQueue(ctx context.Context, queueID string) error
- type Params
- type PublicGitVCSConfigRequest
- type VCSConfigRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttachVCSConfigsParams ¶ added in v0.19.850
type AttachVCSConfigsParams struct {
OwnerID string
OwnerType interface{} // Used to get the table name for polymorphic relationship
ConnectedGithubVCS *app.ConnectedGithubVCSConfig
PublicGitVCS *app.PublicGitVCSConfig
}
AttachVCSConfigsParams contains parameters for attaching VCS configs to an owner
type ConnectedGithubVCSConfigRequest ¶ added in v0.19.850
type ConnectedGithubVCSConfigRequest struct {
Repo string `validate:"required"`
Directory string `validate:"required"`
PathFilter string
Branch string `validate:"required_without=GitRef"`
GitRef string `validate:"required_without=Branch"`
}
ConnectedGithubVCSConfigRequest represents a request to create a connected GitHub VCS configuration
type GithubClient ¶ added in v0.19.807
type GithubClient interface {
GetInstallationAccount(ctx context.Context, installID string) (*github.User, error)
GetInstallation(ctx context.Context, installID string) (*github.Installation, error)
DeleteInstallation(ctx context.Context, installID string) error
ListInstallationRepos(ctx context.Context, vcsConn *app.VCSConnection) ([]*github.Repository, error)
CreateOrgWebhook(ctx context.Context, vcsConn *app.VCSConnection, webhookURL string, secret string) (int64, error)
}
GithubClient defines the GitHub API operations used by the VCS service. The *Helpers struct implements this interface. Tests can provide a fake.
type Helpers ¶
type Helpers struct {
// contains filtered or unexported fields
}
func (*Helpers) AttachVCSConfigs ¶ added in v0.19.850
func (h *Helpers) AttachVCSConfigs(ctx context.Context, params AttachVCSConfigsParams) error
AttachVCSConfigs attaches VCS configurations to an owner entity (polymorphic relationship) This handles creating the VCS config records with proper ownership fields set
func (*Helpers) AttachVCSConfigsWithTx ¶ added in v0.19.850
func (h *Helpers) AttachVCSConfigsWithTx(tx *gorm.DB, params AttachVCSConfigsParams) error
AttachVCSConfigsWithTx is the same as AttachVCSConfigs but accepts a custom transaction
func (*Helpers) BuildConnectedGithubVCSConfig ¶ added in v0.19.850
func (h *Helpers) BuildConnectedGithubVCSConfig( ctx context.Context, req *ConnectedGithubVCSConfigRequest, org *app.Org, ) (*app.ConnectedGithubVCSConfig, error)
BuildConnectedGithubVCSConfig creates a ConnectedGithubVCSConfig from the request
func (*Helpers) BuildPublicGitVCSConfig ¶ added in v0.19.850
func (h *Helpers) BuildPublicGitVCSConfig( ctx context.Context, req *PublicGitVCSConfigRequest, ) (*app.PublicGitVCSConfig, error)
BuildPublicGitVCSConfig creates a PublicGitVCSConfig from the request
func (*Helpers) CreateConnectionQueue ¶ added in v0.19.894
func (h *Helpers) CreateConnectionQueue(ctx context.Context, vcsConn *app.VCSConnection) (*app.Queue, error)
CreateConnectionQueue creates a queue for the given VCS connection with a cron health check emitter that fires every minute, a fire-once webhook subscription emitter, and enqueues an immediate health check signal.
func (*Helpers) CreateInstallationToken ¶ added in v0.19.850
func (h *Helpers) CreateInstallationToken(ctx context.Context, vcsConn *app.VCSConnection, repoName string) (string, error)
CreateInstallationToken creates a GitHub installation token for the given VCS connection and repo.
func (*Helpers) CreateOrgWebhook ¶ added in v0.19.894
func (*Helpers) CreateSubscriptionQueue ¶ added in v0.19.1012
func (h *Helpers) CreateSubscriptionQueue(ctx context.Context, sub *app.VCSWebhookSubscription) (*app.Queue, error)
CreateSubscriptionQueue creates a queue for the given VCS webhook subscription. This queue processes github_event signals that fan out to VCS connections.
func (*Helpers) DeleteInstallation ¶ added in v0.19.807
func (*Helpers) EnqueueWebhookSubscriptionSignal ¶ added in v0.19.1012
func (*Helpers) EnsureConnectionQueue ¶ added in v0.19.894
EnsureConnectionQueue creates the VCS connection queue if it doesn't exist. Safe to call multiple times — queue creation is idempotent, and the emitter is only created if it doesn't already exist. Existing emitters and queues are updated to match current settings (cron schedule, signal expiry, idle timeout).
func (*Helpers) GetConnectedGithubVCSConfigLatestCommit ¶ added in v0.19.850
func (h *Helpers) GetConnectedGithubVCSConfigLatestCommit(ctx context.Context, vcsCfg *app.ConnectedGithubVCSConfig) (*github.RepositoryCommit, error)
func (*Helpers) GetGitSource ¶
func (*Helpers) GetGitSourceAtCommit ¶ added in v0.19.850
func (h *Helpers) GetGitSourceAtCommit(ctx context.Context, cfg *app.ConnectedGithubVCSConfig, commitSHA string) (*plantypes.GitSource, error)
GetGitSourceAtCommit returns a git source for a connected GitHub repo at a specific commit SHA. Unlike GetGitSource, it does not look up the latest commit — it uses the provided SHA directly.
func (*Helpers) GetInstallation ¶ added in v0.19.807
func (*Helpers) GetInstallationAccount ¶ added in v0.19.807
func (*Helpers) GetJWTVCSConnectionClient ¶
func (*Helpers) GetPubliGitSource ¶
func (*Helpers) GetPublicGitSourceAtCommit ¶ added in v0.19.850
func (h *Helpers) GetPublicGitSourceAtCommit(cfg *app.PublicGitVCSConfig, commitSHA string) (*plantypes.GitSource, error)
GetPublicGitSourceAtCommit returns a git source for a public repo at a specific commit SHA.
func (*Helpers) GetPublicGitVCSConfigLatestCommit ¶ added in v0.19.850
func (h *Helpers) GetPublicGitVCSConfigLatestCommit(ctx context.Context, cfg *app.PublicGitVCSConfig) (*github.RepositoryCommit, error)
func (*Helpers) GetVCSConnectionClient ¶
func (*Helpers) GithubCommitToVCSConnectionCommit ¶ added in v0.19.850
func (h *Helpers) GithubCommitToVCSConnectionCommit(ghCommit *github.RepositoryCommit, ownerID, ownerType string, vcsConnectionID string) *app.VCSConnectionCommit
GithubCommitToVCSConnectionCommit converts a GitHub API commit response to a VCSConnectionCommit struct. The struct is not saved to the database - caller is responsible for persistence.
func (*Helpers) ListInstallationRepos ¶ added in v0.19.807
func (h *Helpers) ListInstallationRepos(ctx context.Context, vcsConn *app.VCSConnection) ([]*github.Repository, error)
func (*Helpers) LookupVCSConnection ¶
func (h *Helpers) LookupVCSConnection(ctx context.Context, owner, name string, vcsConnections []app.VCSConnection) (string, error)
LookupVCSConnection: lookup a VCS connection from a list of vcs conns, for the one that has access to the repo provided.
func (*Helpers) SplitRepoSlug ¶
SplitRepoSlug splits a url that is of the format owner/name into proper values.
type PublicGitVCSConfigRequest ¶ added in v0.19.850
type PublicGitVCSConfigRequest struct {
Repo string `validate:"required"`
Directory string `validate:"required"`
Branch string `validate:"required"`
PathFilter string
}
PublicGitVCSConfigRequest represents a request to create a public git VCS configuration
type VCSConfigRequest ¶ added in v0.19.850
type VCSConfigRequest struct {
PublicGitVCSConfig *PublicGitVCSConfigRequest `json:"public_git_vcs_config"`
ConnectedGithubVCSConfig *ConnectedGithubVCSConfigRequest `json:"connected_github_vcs_config"`
}
VCSConfigRequest is an embeddable type for endpoints that accept VCS configuration
func (VCSConfigRequest) Validate ¶ added in v0.19.850
func (b VCSConfigRequest) Validate() error
Validate ensures that only one VCS config type is provided