Skip to content

Commit fb6789b

Browse files
miltalexteo
authored andcommitted
[core] CreateEnvironment avoid overwrite error on failed deployment
1 parent f0f518c commit fb6789b

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

core/environment/manager.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,10 @@ func (envs *Manager) CreateEnvironment(workflowPath string, userVars map[string]
158158

159159
envTasks := env.Workflow().GetTasks()
160160
// TeardownEnvironment manages the envs.mu internally
161-
err = envs.TeardownEnvironment(env.Id(), true/*force*/)
161+
// We do not get the error here cause it overwrites the failed deployment error
162+
// with <nil> which results to server.go to report back
163+
// cannot get newly created environment: no environment with id <env id>
164+
_ = envs.TeardownEnvironment(env.Id(), true/*force*/)
162165

163166
killedTasks, _, rlsErr := envs.taskman.KillTasks(envTasks.GetTaskIds())
164167
if rlsErr != nil {
@@ -468,7 +471,7 @@ func (envs *Manager) CreateAutoEnvironment(workflowPath string, userVars map[str
468471

469472
envTasks := env.Workflow().GetTasks()
470473
// TeardownEnvironment manages the envs.mu internally
471-
err = envs.TeardownEnvironment(env.Id(), true/*force*/)
474+
_ = envs.TeardownEnvironment(env.Id(), true/*force*/)
472475

473476
killedTasks, _, rlsErr := envs.taskman.KillTasks(envTasks.GetTaskIds())
474477
if rlsErr != nil {

0 commit comments

Comments
 (0)