Skip to content

Commit

Permalink
Added include_patterns, exclude_patterns, workflow, iac_type, workspa…
Browse files Browse the repository at this point in the history
…ce to project
  • Loading branch information
ZIJ committed Sep 16, 2024
1 parent 562a65c commit 322af55
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
7 changes: 5 additions & 2 deletions next/dbgen/dbgen.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package main

import (
"os"

"gorm.io/driver/postgres"
"gorm.io/gen"
"gorm.io/gorm"
"os"
)

// Dynamic SQL
Expand Down Expand Up @@ -52,7 +53,9 @@ func main() {
)

g.ApplyBasic(
g.GenerateModel("projects", gen.FieldType("team_id", "*int64")),
g.GenerateModel("projects",
gen.FieldType("team_id", "*int64"),
),
)

// Generate the code
Expand Down
24 changes: 18 additions & 6 deletions next/dbmodels/projects.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package dbmodels

import (
"strings"

"github.com/diggerhq/digger/libs/digger_config"
"github.com/diggerhq/digger/next/model"
)
Expand All @@ -9,13 +11,23 @@ func ToDiggerProject(p *model.Project) digger_config.Project {
return digger_config.Project{
Name: p.Name,
Dir: p.TerraformWorkingDir,
Workspace: "default",
Terragrunt: false,
OpenTofu: false,
Workspace: func() string {
if p.Workspace == "" {
return "default"
}
return p.Workspace
}(),
Terragrunt: (p.IacType == "terragrunt"),
OpenTofu: (p.IacType == "opentofu"),
Workflow: "default",
WorkflowFile: "digger_workflow.yml",
IncludePatterns: []string{},
ExcludePatterns: []string{},
WorkflowFile: func() string {
if p.WorkflowFile == "" {
return "digger_workflow.yml"
}
return p.WorkflowFile
}(),
IncludePatterns: strings.Split(p.IncludePatterns, ","),
ExcludePatterns: strings.Split(p.ExcludePatterns, ","),
DependencyProjects: []string{},
DriftDetection: false,
AwsRoleToAssume: nil,
Expand Down
Binary file removed next/main
Binary file not shown.
5 changes: 5 additions & 0 deletions next/model/projects.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion next/models_generated/projects.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 322af55

Please sign in to comment.