Documentation
¶
Index ¶
- Constants
- func GenerateWorkflowsFromServerConfig(serverDesc *api.ServerDescriptor, stackName, outputPath string) error
- func GetWorkflowTemplateNames() []string
- func PreviewWorkflow(serverDesc *api.ServerDescriptor, stackName, templateName string) (string, error)
- func ReadCiCdConfig(config *api.Config) (api.Config, error)
- func ReadEnhancedCiCdConfig(config *api.Config) (api.Config, error)
- func SyncWorkflows(serverDesc *api.ServerDescriptor, stackName, workflowsPath string) error
- func ValidateConfiguration(config *api.Config) error
- type ActionsCiCdConfig
- type ConcurrencyConfig
- type DiscordNotificationConfig
- type EnhancedActionsCiCdConfig
- func (r *EnhancedActionsCiCdConfig) CredentialsValue() string
- func (c *EnhancedActionsCiCdConfig) GetEnvironmentsByType(envType string) map[string]EnvironmentConfig
- func (c *EnhancedActionsCiCdConfig) GetPreviewEnvironments() map[string]EnvironmentConfig
- func (c *EnhancedActionsCiCdConfig) GetProductionEnvironments() map[string]EnvironmentConfig
- func (c *EnhancedActionsCiCdConfig) GetRequiredSecrets() []string
- func (c *EnhancedActionsCiCdConfig) GetStagingEnvironments() map[string]EnvironmentConfig
- func (c *EnhancedActionsCiCdConfig) IsWorkflowGenerationEnabled() bool
- func (r *EnhancedActionsCiCdConfig) ProjectIdValue() string
- func (r *EnhancedActionsCiCdConfig) ProviderType() string
- func (c *EnhancedActionsCiCdConfig) SetDefaults()
- func (c *EnhancedActionsCiCdConfig) Validate() error
- type EnvironmentConfig
- type ExecutionConfig
- type FileUpdate
- type GitHubActionsCiCdConfig
- type GitHubEnvironmentConfig
- type GitHubNotificationConfig
- type GitHubWorkflowConfig
- type JobInfo
- type NotificationConfig
- type OrganizationConfig
- type PRPreviewConfig
- type Permission
- type RetryConfig
- type SecurityConfig
- type SlackNotificationConfig
- type SonarConfig
- type StepInfo
- type SyncPlan
- type TelegramNotificationConfig
- type ValidationConfig
- type ValidationResults
- type WorkflowGenerationConfig
- type WorkflowGenerator
- func (wg *WorkflowGenerator) GenerateWorkflows() error
- func (wg *WorkflowGenerator) GetSyncPlan() (*SyncPlan, error)
- func (wg *WorkflowGenerator) LoadTemplates() error
- func (wg *WorkflowGenerator) PreviewWorkflow() (*WorkflowPreview, error)
- func (wg *WorkflowGenerator) SyncWorkflows(plan *SyncPlan) error
- func (wg *WorkflowGenerator) ValidateWorkflows() (*ValidationResults, error)
- type WorkflowInfo
- type WorkflowPreview
- type WorkflowTemplateData
Constants ¶
const CiCdTypeGithubActions = "github-actions"
const ProviderType = "github"
Variables ¶
This section is empty.
Functions ¶
func GenerateWorkflowsFromServerConfig ¶
func GenerateWorkflowsFromServerConfig(serverDesc *api.ServerDescriptor, stackName, outputPath string) error
GenerateWorkflowsFromServerConfig generates workflows from server.yaml configuration
func GetWorkflowTemplateNames ¶
func GetWorkflowTemplateNames() []string
GetWorkflowTemplateNames returns available workflow template names
func PreviewWorkflow ¶
func PreviewWorkflow(serverDesc *api.ServerDescriptor, stackName, templateName string) (string, error)
PreviewWorkflow generates a workflow without writing to file (for preview)
func ReadCiCdConfig ¶
ReadCiCdConfig reads CI/CD configuration using SC's standard pattern
func ReadEnhancedCiCdConfig ¶
ReadEnhancedCiCdConfig specifically reads enhanced CI/CD configuration
func SyncWorkflows ¶
func SyncWorkflows(serverDesc *api.ServerDescriptor, stackName, workflowsPath string) error
SyncWorkflows updates existing workflows based on configuration changes
func ValidateConfiguration ¶
ValidateConfiguration validates the enhanced CI/CD configuration
Types ¶
type ActionsCiCdConfig ¶
type ActionsCiCdConfig struct {
AuthToken string `json:"auth-token" yaml:"auth-token"`
}
Legacy ActionsCiCdConfig for backward compatibility
func (*ActionsCiCdConfig) CredentialsValue ¶
func (r *ActionsCiCdConfig) CredentialsValue() string
func (*ActionsCiCdConfig) ProjectIdValue ¶
func (r *ActionsCiCdConfig) ProjectIdValue() string
func (*ActionsCiCdConfig) ProviderType ¶
func (r *ActionsCiCdConfig) ProviderType() string
type ConcurrencyConfig ¶
type ConcurrencyConfig struct {
Group string `json:"group" yaml:"group"`
CancelInProgress bool `json:"cancel-in-progress" yaml:"cancel-in-progress"`
}
ConcurrencyConfig defines concurrency control
type DiscordNotificationConfig ¶
type DiscordNotificationConfig struct {
WebhookURL string `json:"webhook-url" yaml:"webhook-url"`
Enabled bool `json:"enabled" yaml:"enabled"`
}
DiscordNotificationConfig defines Discord notification settings
type EnhancedActionsCiCdConfig ¶
type EnhancedActionsCiCdConfig struct {
// Basic authentication (existing)
AuthToken string `json:"auth-token" yaml:"auth-token"`
// Organization settings
Organization OrganizationConfig `json:"organization" yaml:"organization"`
// Workflow generation settings
WorkflowGeneration WorkflowGenerationConfig `json:"workflow-generation" yaml:"workflow-generation"`
// Environment-specific deployment configurations
Environments map[string]EnvironmentConfig `json:"environments" yaml:"environments"`
// Notification settings
Notifications NotificationConfig `json:"notifications" yaml:"notifications"`
// Custom runners and execution settings
Execution ExecutionConfig `json:"execution" yaml:"execution"`
// Validation and testing
Validation ValidationConfig `json:"validation" yaml:"validation"`
}
Enhanced ActionsCiCdConfig for organizational workflow generation
func ConvertToEnhancedConfig ¶
func ConvertToEnhancedConfig(config *api.Config) (*EnhancedActionsCiCdConfig, error)
ConvertToEnhancedConfig converts a generic config to enhanced CI/CD config
func (*EnhancedActionsCiCdConfig) CredentialsValue ¶
func (r *EnhancedActionsCiCdConfig) CredentialsValue() string
Enhanced config also implements the same interface
func (*EnhancedActionsCiCdConfig) GetEnvironmentsByType ¶
func (c *EnhancedActionsCiCdConfig) GetEnvironmentsByType(envType string) map[string]EnvironmentConfig
GetEnvironmentByType returns environments of a specific type
func (*EnhancedActionsCiCdConfig) GetPreviewEnvironments ¶
func (c *EnhancedActionsCiCdConfig) GetPreviewEnvironments() map[string]EnvironmentConfig
GetPreviewEnvironments returns all preview environments
func (*EnhancedActionsCiCdConfig) GetProductionEnvironments ¶
func (c *EnhancedActionsCiCdConfig) GetProductionEnvironments() map[string]EnvironmentConfig
GetProductionEnvironments returns all production environments
func (*EnhancedActionsCiCdConfig) GetRequiredSecrets ¶
func (c *EnhancedActionsCiCdConfig) GetRequiredSecrets() []string
GetRequiredSecrets returns all required secrets across environments
func (*EnhancedActionsCiCdConfig) GetStagingEnvironments ¶
func (c *EnhancedActionsCiCdConfig) GetStagingEnvironments() map[string]EnvironmentConfig
GetStagingEnvironments returns all staging environments
func (*EnhancedActionsCiCdConfig) IsWorkflowGenerationEnabled ¶
func (c *EnhancedActionsCiCdConfig) IsWorkflowGenerationEnabled() bool
IsWorkflowGenerationEnabled checks if workflow generation is enabled
func (*EnhancedActionsCiCdConfig) ProjectIdValue ¶
func (r *EnhancedActionsCiCdConfig) ProjectIdValue() string
func (*EnhancedActionsCiCdConfig) ProviderType ¶
func (r *EnhancedActionsCiCdConfig) ProviderType() string
func (*EnhancedActionsCiCdConfig) SetDefaults ¶
func (c *EnhancedActionsCiCdConfig) SetDefaults()
Default configuration values
func (*EnhancedActionsCiCdConfig) Validate ¶
func (c *EnhancedActionsCiCdConfig) Validate() error
Validate ensures the configuration is valid
type EnvironmentConfig ¶
type EnvironmentConfig struct {
Type string `json:"type" yaml:"type"`
Runner string `json:"runner" yaml:"runner"`
Protection bool `json:"protection" yaml:"protection"`
Reviewers []string `json:"reviewers" yaml:"reviewers"`
Secrets []string `json:"secrets" yaml:"secrets"`
Variables map[string]string `json:"variables" yaml:"variables"`
DeployFlags []string `json:"deploy-flags" yaml:"deploy-flags"`
AutoDeploy bool `json:"auto-deploy" yaml:"auto-deploy"`
ValidationCmd string `json:"validation-command" yaml:"validation-command"`
PRPreview PRPreviewConfig `json:"pr-preview" yaml:"pr-preview"`
Concurrency ConcurrencyConfig `json:"concurrency" yaml:"concurrency"`
}
EnvironmentConfig defines environment-specific deployment settings
type ExecutionConfig ¶
type ExecutionConfig struct {
DefaultTimeout string `json:"default-timeout" yaml:"default-timeout"`
Concurrency ConcurrencyConfig `json:"concurrency" yaml:"concurrency"`
RetryPolicy RetryConfig `json:"retry-policy" yaml:"retry-policy"`
CustomRunners map[string]string `json:"custom-runners" yaml:"custom-runners"`
Permissions map[string]Permission `json:"permissions" yaml:"permissions"`
}
ExecutionConfig defines workflow execution settings
type FileUpdate ¶
FileUpdate represents a file that needs to be updated
type GitHubActionsCiCdConfig ¶
type GitHubActionsCiCdConfig struct {
// Organization settings
Organization string `json:"organization" yaml:"organization"`
// Environment-specific configurations
Environments map[string]GitHubEnvironmentConfig `json:"environments" yaml:"environments"`
// Notification settings
Notifications GitHubNotificationConfig `json:"notifications" yaml:"notifications"`
// Workflow generation settings
WorkflowGeneration GitHubWorkflowConfig `json:"workflow-generation" yaml:"workflow-generation"`
}
GitHubActionsCiCdConfig represents the GitHub Actions CI/CD configuration
func ConvertToGitHubActionsCiCdConfig ¶
func ConvertToGitHubActionsCiCdConfig(config *api.Config) (*GitHubActionsCiCdConfig, error)
ConvertToGitHubActionsCiCdConfig converts a generic config to GitHub Actions specific config Following the same pattern as other SC resources using api.ConvertConfig
type GitHubEnvironmentConfig ¶
type GitHubEnvironmentConfig struct {
Type string `json:"type" yaml:"type"`
Runner string `json:"runner" yaml:"runner"`
Protection bool `json:"protection" yaml:"protection"`
Reviewers []string `json:"reviewers" yaml:"reviewers"`
Secrets []string `json:"secrets" yaml:"secrets"`
Variables map[string]string `json:"variables" yaml:"variables"`
DeployFlags []string `json:"deploy-flags" yaml:"deploy-flags"`
AutoDeploy bool `json:"auto-deploy" yaml:"auto-deploy"`
}
GitHubEnvironmentConfig defines environment-specific settings
type GitHubNotificationConfig ¶
type GitHubNotificationConfig struct {
Slack SlackNotificationConfig `json:"slack" yaml:"slack"`
Discord DiscordNotificationConfig `json:"discord" yaml:"discord"`
Telegram TelegramNotificationConfig `json:"telegram" yaml:"telegram"`
}
GitHubNotificationConfig defines notification settings
type GitHubWorkflowConfig ¶
type GitHubWorkflowConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
OutputPath string `json:"output-path" yaml:"output-path"`
Templates []string `json:"templates" yaml:"templates"`
AutoUpdate bool `json:"auto-update" yaml:"auto-update"`
CustomActions map[string]string `json:"custom-actions" yaml:"custom-actions"`
SCVersion string `json:"sc-version" yaml:"sc-version"`
}
GitHubWorkflowConfig defines workflow generation settings
type NotificationConfig ¶
type NotificationConfig struct {
SlackWebhook string `json:"slack-webhook" yaml:"slack-webhook"`
DiscordWebhook string `json:"discord-webhook" yaml:"discord-webhook"`
TelegramChatID string `json:"telegram-chat-id" yaml:"telegram-chat-id"`
TelegramToken string `json:"telegram-token" yaml:"telegram-token"`
UserMappings map[string]string `json:"user-mappings" yaml:"user-mappings"`
CCOnStart bool `json:"cc-on-start" yaml:"cc-on-start"`
Channels map[string]string `json:"channels" yaml:"channels"`
}
NotificationConfig defines notification settings
type OrganizationConfig ¶
type OrganizationConfig struct {
Name string `json:"name" yaml:"name"`
DefaultRunner string `json:"default-runner" yaml:"default-runner"`
RequiredSecrets []string `json:"required-secrets" yaml:"required-secrets"`
BranchProtection bool `json:"branch-protection" yaml:"branch-protection"`
Reviewers []string `json:"reviewers" yaml:"reviewers"`
DefaultBranch string `json:"default-branch" yaml:"default-branch"`
}
OrganizationConfig defines organization-wide CI/CD policies
type PRPreviewConfig ¶
type PRPreviewConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
DomainBase string `json:"domain-base" yaml:"domain-base"`
LabelTrigger string `json:"label-trigger" yaml:"label-trigger"`
AutoCleanup bool `json:"auto-cleanup" yaml:"auto-cleanup"`
}
PRPreviewConfig defines PR preview deployment settings
type Permission ¶
type Permission struct {
Actions string `json:"actions" yaml:"actions"`
Contents string `json:"contents" yaml:"contents"`
Deployments string `json:"deployments" yaml:"deployments"`
PullRequests string `json:"pull-requests" yaml:"pull-requests"`
Statuses string `json:"statuses" yaml:"statuses"`
}
Permission defines GitHub workflow permissions
type RetryConfig ¶
type RetryConfig struct {
MaxAttempts int `json:"max-attempts" yaml:"max-attempts"`
BackoffDelay time.Duration `json:"backoff-delay" yaml:"backoff-delay"`
RetryOn []string `json:"retry-on" yaml:"retry-on"`
}
RetryConfig defines retry behavior
type SecurityConfig ¶
type SecurityConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
VulnScan bool `json:"vuln-scan" yaml:"vuln-scan"`
LicenseScan bool `json:"license-scan" yaml:"license-scan"`
SecretScan bool `json:"secret-scan" yaml:"secret-scan"`
ExcludePaths []string `json:"exclude-paths" yaml:"exclude-paths"`
FailThreshold string `json:"fail-threshold" yaml:"fail-threshold"`
}
SecurityConfig defines security scanning
type SlackNotificationConfig ¶
type SlackNotificationConfig struct {
WebhookURL string `json:"webhook-url" yaml:"webhook-url"`
Enabled bool `json:"enabled" yaml:"enabled"`
}
SlackNotificationConfig defines Slack notification settings
type SonarConfig ¶
type SonarConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
ProjectKey string `json:"project-key" yaml:"project-key"`
URL string `json:"url" yaml:"url"`
Token string `json:"token" yaml:"token"`
}
SonarConfig defines SonarQube integration
type SyncPlan ¶
type SyncPlan struct {
FilesToCreate []string
FilesToUpdate []FileUpdate
FilesToRemove []string
}
SyncPlan contains the plan for synchronizing workflows
func (*SyncPlan) IsUpToDate ¶
IsUpToDate returns true if no changes are needed
type TelegramNotificationConfig ¶
type TelegramNotificationConfig struct {
BotToken string `json:"bot-token" yaml:"bot-token"`
ChatID string `json:"chat-id" yaml:"chat-id"`
Enabled bool `json:"enabled" yaml:"enabled"`
}
TelegramNotificationConfig defines Telegram notification settings
type ValidationConfig ¶
type ValidationConfig struct {
Required bool `json:"required" yaml:"required"`
Commands map[string]string `json:"commands" yaml:"commands"`
HealthChecks map[string]string `json:"health-checks" yaml:"health-checks"`
TestSuites []string `json:"test-suites" yaml:"test-suites"`
SonarQube SonarConfig `json:"sonarqube" yaml:"sonarqube"`
Security SecurityConfig `json:"security" yaml:"security"`
}
ValidationConfig defines validation and testing settings
type ValidationResults ¶
type ValidationResults struct {
IsValid bool
ValidFiles []string
MissingFiles []string
OutdatedFiles []string
InvalidFiles map[string][]string
Differences map[string][]string
}
ValidationResults contains the results of workflow validation
func (*ValidationResults) TotalIssues ¶
func (vr *ValidationResults) TotalIssues() int
TotalIssues returns the total number of validation issues
type WorkflowGenerationConfig ¶
type WorkflowGenerationConfig struct {
Enabled bool `json:"enabled" yaml:"enabled"`
OutputPath string `json:"output-path" yaml:"output-path"`
Templates []string `json:"templates" yaml:"templates"`
AutoUpdate bool `json:"auto-update" yaml:"auto-update"`
CustomActions map[string]string `json:"custom-actions" yaml:"custom-actions"`
SCVersion string `json:"sc-version" yaml:"sc-version"`
}
WorkflowGenerationConfig controls workflow generation behavior
type WorkflowGenerator ¶
type WorkflowGenerator struct {
// contains filtered or unexported fields
}
WorkflowGenerator generates GitHub Actions workflows from Simple Container configuration
func NewWorkflowGenerator ¶
func NewWorkflowGenerator(config *EnhancedActionsCiCdConfig, stackName, outputPath string) *WorkflowGenerator
NewWorkflowGenerator creates a new workflow generator
func (*WorkflowGenerator) GenerateWorkflows ¶
func (wg *WorkflowGenerator) GenerateWorkflows() error
GenerateWorkflows generates all configured workflow files
func (*WorkflowGenerator) GetSyncPlan ¶
func (wg *WorkflowGenerator) GetSyncPlan() (*SyncPlan, error)
GetSyncPlan creates a synchronization plan for workflows
func (*WorkflowGenerator) LoadTemplates ¶
func (wg *WorkflowGenerator) LoadTemplates() error
LoadTemplates loads workflow templates from embedded templates
func (*WorkflowGenerator) PreviewWorkflow ¶
func (wg *WorkflowGenerator) PreviewWorkflow() (*WorkflowPreview, error)
PreviewWorkflow generates a preview of workflows without writing files
func (*WorkflowGenerator) SyncWorkflows ¶
func (wg *WorkflowGenerator) SyncWorkflows(plan *SyncPlan) error
SyncWorkflows executes the synchronization plan
func (*WorkflowGenerator) ValidateWorkflows ¶
func (wg *WorkflowGenerator) ValidateWorkflows() (*ValidationResults, error)
ValidateWorkflows validates existing workflow files against configuration
type WorkflowInfo ¶
type WorkflowInfo struct {
Name string
FileName string
Description string
Content string
Triggers []string
Jobs []JobInfo
}
WorkflowInfo contains information about a workflow
type WorkflowPreview ¶
type WorkflowPreview struct {
StackName string
Config *EnhancedActionsCiCdConfig
Workflows []WorkflowInfo
}
WorkflowPreview contains preview data for workflows
type WorkflowTemplateData ¶
type WorkflowTemplateData struct {
StackName string
Organization OrganizationConfig
Environments map[string]EnvironmentConfig
CustomActions map[string]string
RequiredSecrets []string
DefaultBranch string
DefaultEnvironment string
Notifications NotificationConfig
Execution ExecutionConfig
Validation ValidationConfig
SCVersion string
}
WorkflowTemplateData contains data passed to workflow templates