Documentation
¶
Index ¶
- Variables
- type GeneratedFile
- type Preview
- type ProjectDelivery
- type ProvisionResult
- type RepositoryEndpoints
- type RepositoryPlan
- type SecretKeyReference
- type Server
- type ServerAliasCheck
- type ServerInput
- type Service
- func (s *Service) Activate(ctx context.Context, project string, input ProjectDelivery) (ProvisionResult, error)
- func (s *Service) CheckServerAlias(ctx context.Context, project, rawBaseURL string) (ServerAliasCheck, error)
- func (s *Service) CheckSourceRepositoryFile(ctx context.Context, project string, projectID int64, branch, path string) (SourceFileCheck, error)
- func (s *Service) DeleteServer(ctx context.Context, key string) error
- func (s *Service) DeliveryRepositoryEndpoints(ctx context.Context, project string) ([]RepositoryEndpoints, error)
- func (s *Service) DetachDelivery(ctx context.Context, project string) error
- func (s *Service) EnsureSourceRepository(ctx context.Context, project, serviceKey string, files []SourceFile) (SourceRepositoryResult, error)
- func (s *Service) GetDelivery(ctx context.Context, project string) (ProjectDelivery, error)
- func (s *Service) ListServers(ctx context.Context) ([]Server, error)
- func (s *Service) ListSourceRepositories(ctx context.Context, project, search string) ([]SourceRepositoryOption, error)
- func (s *Service) ListSourceRepositoryBranches(ctx context.Context, project string, projectID int64) ([]SourceBranchOption, error)
- func (s *Service) Preview(ctx context.Context, project string) (Preview, error)
- func (s *Service) ProjectDeletionBlocker(ctx context.Context, project string) (string, error)
- func (s *Service) Provision(ctx context.Context, project string) (result ProvisionResult, resultErr error)
- func (s *Service) RelayCloneTarget(ctx context.Context, project, kind, serviceKey string) (string, error)
- func (s *Service) SaveDelivery(ctx context.Context, project string, input ProjectDelivery) (ProjectDelivery, error)
- func (s *Service) SaveServer(ctx context.Context, key string, input ServerInput) (Server, error)
- func (s *Service) SourceRelayTarget(ctx context.Context, project, serviceKey string) (string, string, []byte, error)
- func (s *Service) SyncDeliveryCredential(ctx context.Context, project, connectionKey string, cicdService *cicd.Service) (cicd.Credential, error)
- func (s *Service) SyncJobJenkinsfile(ctx context.Context, project string, job cicd.Job) (created, updated int, err error)
- func (s *Service) SyncSourceCredential(ctx context.Context, project, connectionKey string, serviceKeys []string, ...) (cicd.Credential, error)
- func (s *Service) TestServer(ctx context.Context, key string) (Server, error)
- func (s *Service) ValidateSourceRepository(ctx context.Context, project, serviceKey string) error
- type ServiceSpec
- type SourceBranchOption
- type SourceFile
- type SourceFileCheck
- type SourceRepositoryOption
- type SourceRepositoryResult
- type Store
- type StoredServer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type GeneratedFile ¶
type Preview ¶
type Preview struct {
ProjectKey string `json:"project_key"`
Repositories []RepositoryPlan `json:"repositories"`
Files []GeneratedFile `json:"files"`
}
type ProjectDelivery ¶
type ProjectDelivery struct {
ProjectKey string `json:"project_key"`
ServerKey string `json:"server_key"`
RootGroup string `json:"root_group"`
SourceServerKey string `json:"source_server_key,omitempty"`
SourceRootGroup string `json:"source_root_group,omitempty"`
DefaultBranch string `json:"default_branch"`
JenkinsfilesProjectID int64 `json:"jenkinsfiles_project_id,omitempty"`
JenkinsfilesProjectPath string `json:"jenkinsfiles_project_path"`
JenkinsfilesCloneURL string `json:"jenkinsfiles_clone_url,omitempty"`
ManifestsProjectID int64 `json:"manifests_project_id,omitempty"`
ManifestsProjectPath string `json:"manifests_project_path"`
ManifestsCloneURL string `json:"manifests_clone_url,omitempty"`
Services []ServiceSpec `json:"services"`
ProvisionStatus string `json:"provision_status,omitempty"`
ProvisionError string `json:"provision_error,omitempty"`
LastProvisionedAt time.Time `json:"last_provisioned_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ProvisionResult ¶
type ProvisionResult struct {
Delivery ProjectDelivery `json:"delivery"`
Repositories []RepositoryPlan `json:"repositories"`
CreatedFiles int `json:"created_files"`
UpdatedFiles int `json:"updated_files"`
DeletedFiles int `json:"deleted_files"`
}
type RepositoryEndpoints ¶
type RepositoryPlan ¶
type SecretKeyReference ¶
type SecretKeyReference struct {
SecretName string `json:"secret_name"`
SecretKey string `json:"secret_key"`
}
SecretKeyReference points at an existing Kubernetes Secret. The platform persists only this reference; the secret value never enters MySQL, GitLab, Jenkins parameters, generated files, or build logs.
type Server ¶
type Server struct {
Key string `json:"key"`
DisplayName string `json:"display_name"`
BaseURL string `json:"base_url"`
RootGroup string `json:"root_group"`
RootGroups []string `json:"root_groups"`
DefaultBranch string `json:"default_branch"`
Visibility string `json:"visibility"`
AllowInsecureHTTP bool `json:"allow_insecure_http"`
Configured bool `json:"configured"`
LastCheckStatus string `json:"last_check_status,omitempty"`
LastCheckError string `json:"last_check_error,omitempty"`
LastCheckedAt time.Time `json:"last_checked_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ServerAliasCheck ¶
type ServerAliasCheck struct {
BaseURL string `json:"base_url"`
Authenticated bool `json:"authenticated"`
JenkinsfilesProjectID int64 `json:"jenkinsfiles_project_id,omitempty"`
JenkinsfilesCloneURL string `json:"jenkinsfiles_clone_url,omitempty"`
ManifestsProjectID int64 `json:"manifests_project_id,omitempty"`
ManifestsCloneURL string `json:"manifests_clone_url,omitempty"`
MatchesCurrentProjects bool `json:"matches_current_projects"`
}
type ServerInput ¶
type ServerInput struct {
Key string `json:"key"`
DisplayName string `json:"display_name"`
BaseURL string `json:"base_url"`
AccessToken string `json:"access_token"`
RootGroup string `json:"root_group"`
RootGroups []string `json:"root_groups"`
DefaultBranch string `json:"default_branch"`
Visibility string `json:"visibility"`
AllowInsecureHTTP bool `json:"allow_insecure_http"`
}
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Activate ¶
func (s *Service) Activate(ctx context.Context, project string, input ProjectDelivery) (ProvisionResult, error)
Activate saves the project bindings and provisions the delivery repository in one API operation. A failed GitLab write intentionally keeps the validated binding and failed status so the same request can be retried without re-entering configuration.
func (*Service) CheckServerAlias ¶
func (s *Service) CheckServerAlias(ctx context.Context, project, rawBaseURL string) (ServerAliasCheck, error)
CheckServerAlias verifies that an alternate public hostname reaches the same GitLab repositories using the already encrypted server token. It does not persist the alias or expose the token.
func (*Service) CheckSourceRepositoryFile ¶
func (*Service) DeleteServer ¶
func (*Service) DeliveryRepositoryEndpoints ¶
func (s *Service) DeliveryRepositoryEndpoints(ctx context.Context, project string) ([]RepositoryEndpoints, error)
DeliveryRepositoryEndpoints returns clone endpoints reported by GitLab for the two project-owned delivery repositories. It contains no credentials.
func (*Service) DetachDelivery ¶
func (*Service) EnsureSourceRepository ¶
func (s *Service) EnsureSourceRepository(ctx context.Context, project, serviceKey string, files []SourceFile) (SourceRepositoryResult, error)
EnsureSourceRepository creates or updates one platform-owned source repository without ever taking over an unrelated GitLab project. Existing repositories must contain a matching ownership marker before files can be changed.
func (*Service) GetDelivery ¶
func (*Service) ListSourceRepositories ¶
func (*Service) ListSourceRepositoryBranches ¶
func (*Service) ProjectDeletionBlocker ¶
func (*Service) RelayCloneTarget ¶
func (s *Service) RelayCloneTarget(ctx context.Context, project, kind, serviceKey string) (string, error)
RelayCloneTarget resolves only repositories already owned or registered by the selected project. It never accepts an arbitrary upstream URL.
func (*Service) SaveDelivery ¶
func (s *Service) SaveDelivery(ctx context.Context, project string, input ProjectDelivery) (ProjectDelivery, error)
func (*Service) SaveServer ¶
func (*Service) SourceRelayTarget ¶
func (s *Service) SourceRelayTarget(ctx context.Context, project, serviceKey string) (string, string, []byte, error)
SourceRelayTarget returns the project-registered source repository and an in-memory upstream token. Jenkins only sees the project-scoped relay credential; the business GitLab API token is never copied to Jenkins.
func (*Service) SyncDeliveryCredential ¶
func (s *Service) SyncDeliveryCredential(ctx context.Context, project, connectionKey string, cicdService *cicd.Service) (cicd.Credential, error)
SyncDeliveryCredential creates a group-scoped, read_repository-only deploy token and writes it directly into the selected Jenkins credential store. The higher-privilege GitLab API token is never copied to Jenkins.
func (*Service) SyncJobJenkinsfile ¶
func (s *Service) SyncJobJenkinsfile(ctx context.Context, project string, job cicd.Job) (created, updated int, err error)
SyncJobJenkinsfile writes the generated pipeline only for the selected Job. Deployment manifests remain owned by the project service catalog and are synchronized separately, so a Job may safely reference multiple services.
func (*Service) SyncSourceCredential ¶
func (s *Service) SyncSourceCredential(ctx context.Context, project, connectionKey string, serviceKeys []string, cicdService jenkinsCredentialSyncer) (cicd.Credential, error)
SyncSourceCredential issues a project/connection-scoped read_repository deploy token and synchronizes it to the Jenkins used by the Job. When a GitLab gateway blocks deploy-token creation, a previously validated compatibility credential remains usable and is retried for least-privilege rotation on subsequent explicit synchronizations.
func (*Service) TestServer ¶
type ServiceSpec ¶
type ServiceSpec struct {
Key string `json:"key"`
DisplayName string `json:"display_name"`
WorkloadType string `json:"workload_type"`
Language string `json:"language"`
RuntimeVersion string `json:"runtime_version"`
SourceRepository string `json:"source_repository"`
SourceBranch string `json:"source_branch"`
SourceCredentialID string `json:"source_credential_id,omitempty"`
ManifestCredentialID string `json:"manifest_credential_id,omitempty"`
BuildCommand string `json:"build_command,omitempty"`
BuildContext string `json:"build_context"`
DockerfileSource string `json:"dockerfile_source,omitempty"`
Dockerfile string `json:"dockerfile"`
DockerfileContent string `json:"dockerfile_content,omitempty"`
DockerfileContents map[string]string `json:"dockerfile_contents,omitempty"`
ManifestMode string `json:"manifest_mode,omitempty"`
DockerTarget string `json:"docker_target,omitempty"`
RunEnvironment string `json:"run_environment,omitempty"`
ImageRepository string `json:"image_repository"`
ImagePullSecrets []string `json:"image_pull_secrets,omitempty"`
ImagePullPolicy string `json:"image_pull_policy"`
Namespace string `json:"namespace"`
WorkloadClass string `json:"workload_class,omitempty"`
ContainerPort int `json:"container_port"`
Replicas int `json:"replicas"`
RevisionHistoryLimit int `json:"revision_history_limit"`
Timezone string `json:"timezone"`
JavaOptions []string `json:"java_options,omitempty"`
EnvironmentVariables map[string]string `json:"environment_variables,omitempty"`
SecretEnvironmentVariables map[string]SecretKeyReference `json:"secret_environment_variables,omitempty"`
CPURequest string `json:"cpu_request"`
MemoryRequest string `json:"memory_request"`
CPULimit string `json:"cpu_limit"`
MemoryLimit string `json:"memory_limit"`
HealthPath string `json:"health_path,omitempty"`
EtcdConfigEnabled bool `json:"etcd_config_enabled,omitempty"`
EtcdHosts []string `json:"etcd_hosts,omitempty"`
EtcdConfigKey string `json:"etcd_config_key,omitempty"`
EtcdUsername string `json:"etcd_username,omitempty"`
EtcdPasswordCredentialID string `json:"etcd_password_credential_id,omitempty"`
EtcdConfigFile string `json:"etcd_config_file,omitempty"`
EtcdMountPath string `json:"etcd_mount_path,omitempty"`
NginxServerConfig string `json:"nginx_server_config,omitempty"`
}
type SourceBranchOption ¶
type SourceFile ¶
type SourceFileCheck ¶
type SourceRepositoryOption ¶
type SourceRepositoryResult ¶
type Store ¶
type Store interface {
ListGitLabServers(context.Context) ([]StoredServer, error)
GetGitLabServer(context.Context, string) (StoredServer, error)
SaveGitLabServer(context.Context, StoredServer) error
DeleteGitLabServer(context.Context, string) error
GitLabServerBindingCount(context.Context, string) (int, error)
GitLabServerBindingRootGroups(context.Context, string) ([]string, error)
GitLabServerSourceRepositories(context.Context, string) ([]string, error)
GetProjectGitLabDelivery(context.Context, string) (ProjectDelivery, error)
SaveProjectGitLabDelivery(context.Context, ProjectDelivery) error
DetachProjectGitLabDelivery(context.Context, string) error
GetCICDRepository(context.Context, string, string) (cicd.Repository, error)
SaveCICDRepository(context.Context, cicd.Repository) error
}