diff --git a/client/projects.go b/client/projects.go index 1af9073..ce6f6cd 100755 --- a/client/projects.go +++ b/client/projects.go @@ -104,6 +104,7 @@ type ProjectDetail struct { // FeatureBranchInfiniteRetention holds a value that disables the feature branch retention period. FeatureBranchInfiniteRetention bool `json:"feature_branch_no_retention"` DefaultBranch string `json:"default_branch"` + CriticalityLevel int `json:"criticality_level"` } type ProjectSource struct { diff --git a/cmd/createProjects.go b/cmd/createProjects.go index 0d63a22..a12d8a8 100644 --- a/cmd/createProjects.go +++ b/cmd/createProjects.go @@ -27,6 +27,7 @@ func init() { createCmd.AddCommand(createProjectCmd) createProjectCmd.Flags().String("project-name", "", "name of the project") + createProjectCmd.Flags().Int("criticality-level", 0, "business criticality of the project, possible values are [ 4 = Major, 3 = High, 2 = Medium, 1 = Low, 0 = None, -1 = Auto ]. Default is [0]") createProjectCmd.Flags().Bool("force-create", false, "ignore if the URL is used by another Kondukto project") createProjectCmd.Flags().StringP("overwrite", "w", "", "rename the project name when creating a new project") createProjectCmd.Flags().StringP("labels", "l", "", "comma separated label names") @@ -192,6 +193,22 @@ func (p *Project) createProject(repo, projectName string, force bool, overwrite qwe(ExitCodeError, err, "failed to parse the scope-included-files flag") } + criticality, err := p.cmd.Flags().GetInt("criticality-level") + if err != nil { + qwe(ExitCodeError, err, "failed to parse the criticality flag") + } + + businessCriticalityLevel, err := func() (int, error) { + if criticality < -1 || criticality > 4 { + return 0, fmt.Errorf("invalid criticality level: %d", criticality) + } + + return criticality, nil + }() + if err != nil { + qwe(ExitCodeError, err, "business criticality level must be between -1, 0, 1, 2, 3 or 4") + } + projectSource := func() client.ProjectSource { s := client.ProjectSource{Tool: tool} u, err := url.Parse(repo) @@ -235,6 +252,7 @@ func (p *Project) createProject(repo, projectName string, force bool, overwrite FeatureBranchRetention: featureBranchRetention, FeatureBranchInfiniteRetention: featureBranchNoRetention, DefaultBranch: defaultBranch, + CriticalityLevel: businessCriticalityLevel, } project, err := p.client.CreateProject(pd)