@@ -67,9 +67,10 @@ KubeSphere supports multiple types Pipeline. Currently, this CLI only support th
6767 "The SCM type of pipeline, could be gitlab, github" )
6868 flags .BoolVarP (& opt .Batch , "batch" , "b" , false , "Create pipeline as batch mode" )
6969
70- _ = cmd .RegisterFlagCompletionFunc ("template" , common .ArrayCompletion ("java" , "go" , "simple" , "multi-branch-gitlab" ))
70+ _ = cmd .RegisterFlagCompletionFunc ("template" , common .ArrayCompletion ("java" , "go" , "simple" ,
71+ "multi-branch-gitlab" , "multi-branch-github" , "multi-branch-git" ))
7172 _ = cmd .RegisterFlagCompletionFunc ("type" , common .ArrayCompletion ("pipeline" , "multi-branch-pipeline" ))
72- _ = cmd .RegisterFlagCompletionFunc ("scm-type" , common .ArrayCompletion ("gitlab" , "github" ))
73+ _ = cmd .RegisterFlagCompletionFunc ("scm-type" , common .ArrayCompletion ("gitlab" , "github" , "git" ))
7374
7475 if client != nil {
7576 // these features rely on the k8s client, ignore it if the client is nil
@@ -102,7 +103,8 @@ func (o *pipelineCreateOption) wizard(_ *cobra.Command, _ []string) (err error)
102103 }
103104
104105 if o .Template == "" {
105- if o .Template , err = chooseOneFromArray ([]string {"java" , "go" , "simple" , "multi-branch-gitlab" }); err != nil {
106+ if o .Template , err = chooseOneFromArray ([]string {"java" , "go" , "simple" ,
107+ "multi-branch-gitlab" , "multi-branch-github" , "multi-branch-git" }); err != nil {
106108 return
107109 }
108110 }
@@ -149,9 +151,15 @@ func (o *pipelineCreateOption) preRunE(cmd *cobra.Command, args []string) (err e
149151 o .Jenkinsfile = jenkinsfileTemplateForGo
150152 case "simple" :
151153 o .Jenkinsfile = jenkinsfileTemplateForSimple
154+ case "multi-branch-git" :
155+ o .Type = "multi-branch-pipeline"
156+ o .SCMType = "git"
152157 case "multi-branch-gitlab" :
153158 o .Type = "multi-branch-pipeline"
154159 o .SCMType = "gitlab"
160+ case "multi-branch-github" :
161+ o .Type = "multi-branch-pipeline"
162+ o .SCMType = "github"
155163 default :
156164 err = fmt .Errorf ("%s is not support" , o .Template )
157165 }
@@ -344,19 +352,36 @@ spec:
344352 discarder:
345353 days_to_keep: "-1"
346354 num_to_keep: "-1"
355+ {{if eq .SCMType "gitlab"}}
347356 gitlab_source:
348357 discover_branches: 1
349358 discover_pr_from_forks:
350359 strategy: 2
351360 trust: 2
352361 discover_pr_from_origin: 2
353362 discover_tags: true
354- owner: LinuxSuRen1
355- repo: LinuxSuRen1 /learn-pipeline-java
363+ owner: devops-ws
364+ repo: devops-ws /learn-pipeline-java
356365 server_name: https://gitlab.com
357- name: gitlab
366+ repo: learn-pipeline-java
367+ {{else if eq .SCMType "github" -}}
368+ github_source:
369+ discover_branches: 1
370+ discover_pr_from_forks:
371+ strategy: 2
372+ trust: 2
373+ discover_pr_from_origin: 2
374+ discover_tags: true
375+ owner: devops-ws
376+ repo: learn-pipeline-java
377+ {{else if eq .SCMType "git" -}}
378+ git_source:
379+ discover_branches: true
380+ url: https://gitee.com/devops-ws/learn-pipeline-java
381+ {{end -}}
382+ name: "{{.Name}}"
358383 script_path: Jenkinsfile
359- source_type: gitlab
384+ source_type: {{.SCMType}}
360385 {{end -}}
361386 type: {{.Type}}
362387status: {}
0 commit comments