forked from nocalhost/nocalhost
/
dev_end.go
32 lines (26 loc) · 890 Bytes
/
dev_end.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
* This source code is licensed under the Apache License Version 2.0.
*/
package controller
import (
"github.com/lsutils/nocalhost/internal/nhctl/utils"
"github.com/lsutils/nocalhost/pkg/nhctl/log"
"os"
)
func (c *Controller) DevEnd(reset bool) error {
if err := c.StopSyncAndPortForwardProcess(true); err != nil {
if !reset && !os.IsNotExist(err) {
return err // `dev end` must make sure syncthing is terminated
}
log.WarnE(err, "StopSyncAndPortForwardProcess failed")
}
if err := c.BuildPodController().RollBack(reset); err != nil {
//if !reset {
// return err
//}
log.WarnE(err, "something incorrect occurs when rolling back")
}
utils.ShouldI(c.AppMeta.SvcDevEnd(c.Name, c.Identifier, c.Type, c.DevModeType), "something incorrect occurs when updating secret")
return nil
}