|
32 | 32 | const (
|
33 | 33 | // Split char to separate path from pipeline and name
|
34 | 34 | pipelinePathSplitChar = "/"
|
35 |
| - |
36 |
| - // Percent of pipeline creation progress after git clone |
37 |
| - pipelineCloneStatus = 25 |
38 |
| - |
39 |
| - // Percent of pipeline creation progress after compile process done |
40 |
| - pipelineCompileStatus = 75 |
41 |
| - |
42 |
| - // Completed percent progress |
43 |
| - pipelineCompleteStatus = 100 |
44 | 35 | )
|
45 | 36 |
|
46 | 37 | // PipelineGitLSRemote checks for available git remote branches.
|
@@ -89,81 +80,7 @@ func CreatePipeline(ctx iris.Context) {
|
89 | 80 | }
|
90 | 81 |
|
91 | 82 | // Cloning the repo and compiling the pipeline will be done async
|
92 |
| - go createPipelineExecute(p) |
93 |
| -} |
94 |
| - |
95 |
| -// createPipelineExecute clones the given git repo and compiles |
96 |
| -// the pipeline. After every step, the status will be stored. |
97 |
| -// This method is designed to be called async. |
98 |
| -func createPipelineExecute(p *gaia.CreatePipeline) { |
99 |
| - // Define build process for the given type |
100 |
| - bP := pipeline.NewBuildPipeline(p.Pipeline.Type) |
101 |
| - if bP == nil { |
102 |
| - // Pipeline type is not supported |
103 |
| - gaia.Cfg.Logger.Debug("create pipeline failed. Pipeline type is not supported", "type", p.Pipeline.Type) |
104 |
| - return |
105 |
| - } |
106 |
| - |
107 |
| - // Setup environment before cloning repo and command |
108 |
| - err := bP.PrepareEnvironment(p) |
109 |
| - if err != nil { |
110 |
| - gaia.Cfg.Logger.Error("cannot prepare build", "error", err.Error()) |
111 |
| - return |
112 |
| - } |
113 |
| - |
114 |
| - // Clone git repo |
115 |
| - err = pipeline.GitCloneRepo(&p.Pipeline.Repo) |
116 |
| - if err != nil { |
117 |
| - // Add error message and store |
118 |
| - p.Output = err.Error() |
119 |
| - storeService.CreatePipelinePut(p) |
120 |
| - gaia.Cfg.Logger.Debug("cannot clone repo", "error", err.Error()) |
121 |
| - return |
122 |
| - } |
123 |
| - |
124 |
| - // Update status of our pipeline build |
125 |
| - p.Status = pipelineCloneStatus |
126 |
| - err = storeService.CreatePipelinePut(p) |
127 |
| - if err != nil { |
128 |
| - gaia.Cfg.Logger.Error("cannot put create pipeline into store", "error", err.Error()) |
129 |
| - return |
130 |
| - } |
131 |
| - |
132 |
| - // Run compile process |
133 |
| - err = bP.ExecuteBuild(p) |
134 |
| - if err != nil { |
135 |
| - // Add error message and store |
136 |
| - p.Output = err.Error() |
137 |
| - storeService.CreatePipelinePut(p) |
138 |
| - gaia.Cfg.Logger.Debug("cannot compile pipeline", "error", err.Error()) |
139 |
| - return |
140 |
| - } |
141 |
| - |
142 |
| - // Update status of our pipeline build |
143 |
| - p.Status = pipelineCompileStatus |
144 |
| - err = storeService.CreatePipelinePut(p) |
145 |
| - if err != nil { |
146 |
| - gaia.Cfg.Logger.Error("cannot put create pipeline into store", "error", err.Error()) |
147 |
| - return |
148 |
| - } |
149 |
| - |
150 |
| - // Copy compiled binary to plugins folder |
151 |
| - err = bP.CopyBinary(p) |
152 |
| - if err != nil { |
153 |
| - // Add error message and store |
154 |
| - p.Output = err.Error() |
155 |
| - storeService.CreatePipelinePut(p) |
156 |
| - gaia.Cfg.Logger.Debug("cannot copy compiled binary", "error", err.Error()) |
157 |
| - return |
158 |
| - } |
159 |
| - |
160 |
| - // Set create pipeline status to complete |
161 |
| - p.Status = pipelineCompleteStatus |
162 |
| - err = storeService.CreatePipelinePut(p) |
163 |
| - if err != nil { |
164 |
| - gaia.Cfg.Logger.Error("cannot put create pipeline into store", "error", err.Error()) |
165 |
| - return |
166 |
| - } |
| 83 | + go pipeline.CreatePipeline(p) |
167 | 84 | }
|
168 | 85 |
|
169 | 86 | // CreatePipelineGetAll returns a json array of
|
|
0 commit comments