github.com/diggerhq/digger/libs@v0.0.0-20240604170430-9d61cdf01cc5/digger_config/config.go (about) 1 package digger_config 2 3 const CommentRenderModeBasic = "basic" 4 const CommentRenderModeGroupByModule = "group_by_module" 5 6 type DiggerConfig struct { 7 ApplyAfterMerge bool 8 AllowDraftPRs bool 9 CommentRenderMode string 10 DependencyConfiguration DependencyConfiguration 11 Projects []Project 12 AutoMerge bool 13 Telemetry bool 14 Workflows map[string]Workflow 15 MentionDriftedProjectsInPR bool 16 TraverseToNestedProjects bool 17 } 18 19 type DependencyConfiguration struct { 20 Mode string 21 } 22 23 type AssumeRoleForProject struct { 24 AwsRoleRegion string 25 State string 26 Command string 27 } 28 29 type Project struct { 30 Name string 31 Dir string 32 Workspace string 33 Terragrunt bool 34 OpenTofu bool 35 Workflow string 36 WorkflowFile string 37 IncludePatterns []string 38 ExcludePatterns []string 39 DependencyProjects []string 40 DriftDetection bool 41 AwsRoleToAssume *AssumeRoleForProject 42 } 43 44 type Workflow struct { 45 EnvVars *TerraformEnvConfig 46 Plan *Stage 47 Apply *Stage 48 Configuration *WorkflowConfiguration 49 } 50 51 type WorkflowConfiguration struct { 52 OnPullRequestPushed []string 53 OnPullRequestClosed []string 54 OnPullRequestConvertedToDraft []string 55 OnCommitToDefault []string 56 } 57 58 type TerraformEnvConfig struct { 59 State []EnvVar 60 Commands []EnvVar 61 } 62 63 type EnvVar struct { 64 Name string 65 ValueFrom string 66 Value string 67 } 68 69 type Step struct { 70 Action string 71 Value string 72 ExtraArgs []string 73 Shell string 74 } 75 76 type Stage struct { 77 Steps []Step 78 } 79 80 func defaultWorkflow() *Workflow { 81 return &Workflow{ 82 Configuration: &WorkflowConfiguration{ 83 OnCommitToDefault: []string{"digger unlock"}, 84 OnPullRequestPushed: []string{"digger plan"}, 85 OnPullRequestConvertedToDraft: []string{}, 86 OnPullRequestClosed: []string{"digger unlock"}, 87 }, 88 Plan: &Stage{ 89 Steps: []Step{ 90 { 91 Action: "init", ExtraArgs: []string{}, 92 }, 93 { 94 Action: "plan", ExtraArgs: []string{}, 95 }, 96 }, 97 }, 98 Apply: &Stage{ 99 Steps: []Step{ 100 { 101 Action: "init", ExtraArgs: []string{}, 102 }, 103 { 104 Action: "apply", ExtraArgs: []string{}, 105 }, 106 }, 107 }, 108 EnvVars: &TerraformEnvConfig{}, 109 } 110 }