(ctx context.Context, appId string, builderEnv map[string]string)
| 157 | } |
| 158 | |
| 159 | func (bc *BuilderController) Start(ctx context.Context, appId string, builderEnv map[string]string) error { |
| 160 | if err := bc.waitForBuildDone(ctx); err != nil { |
| 161 | return err |
| 162 | } |
| 163 | bc.lock.Lock() |
| 164 | defer bc.lock.Unlock() |
| 165 | |
| 166 | if bc.appId != appId && bc.process != nil { |
| 167 | log.Printf("BuilderController: stopping previous app %s for builder %s", bc.appId, bc.builderId) |
| 168 | bc.stopProcess_nolock() |
| 169 | } |
| 170 | |
| 171 | bc.appId = appId |
| 172 | bc.outputBuffer = utilds.MakeMultiReaderLineBuffer(1000) |
| 173 | bc.setStatus_nolock(BuilderStatus_Building, 0, 0, "") |
| 174 | |
| 175 | bc.publishOutputLine("", true) |
| 176 | |
| 177 | bc.outputBuffer.SetLineCallback(func(line string) { |
| 178 | bc.publishOutputLine(line, false) |
| 179 | }) |
| 180 | |
| 181 | buildCtx, cancel := context.WithTimeout(context.Background(), 60*time.Second) |
| 182 | go func() { |
| 183 | defer cancel() |
| 184 | defer func() { |
| 185 | panichandler.PanicHandler(fmt.Sprintf("buildercontroller[%s].buildAndRun", bc.builderId), recover()) |
| 186 | }() |
| 187 | bc.buildAndRun(buildCtx, appId, builderEnv, nil) |
| 188 | }() |
| 189 | |
| 190 | return nil |
| 191 | } |
| 192 | |
| 193 | func (bc *BuilderController) buildAndRun(ctx context.Context, appId string, builderEnv map[string]string, resultCh chan<- *BuildResult) { |
| 194 | appNS, _, err := waveappstore.ParseAppId(appId) |
nothing calls this directly
no test coverage detected