MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / hasChanged

Function hasChanged

cli/cmd/start/k8s.go:548–570  ·  view source on GitHub ↗

是否改变

(workspaceInfo workspace.WorkspaceInfo, originK8sConfig config.SmartIdeK8SConfig)

Source from the content-addressed store, hash-verified

546
547// 是否改变
548func hasChanged(workspaceInfo workspace.WorkspaceInfo, originK8sConfig config.SmartIdeK8SConfig) (bool, error) {
549 if workspaceInfo.ConfigYaml.IsNil() {
550 return true, nil
551 }
552
553 // 配置文件是否相同
554 currentConfigYaml, err := originK8sConfig.ConvertToConfigYaml()
555 if err != nil {
556 return false, err
557 }
558 if oldConfigYaml, _ := workspaceInfo.ConfigYaml.ToYaml(); oldConfigYaml != currentConfigYaml {
559 return true, err
560 }
561
562 // 关联的k8s yaml文件是否相同
563 oldK8sYaml, _ := workspaceInfo.K8sInfo.OriginK8sYaml.ConvertToK8sYaml()
564 currentK8sYaml, _ := originK8sConfig.ConvertToK8sYaml()
565 if oldK8sYaml != currentK8sYaml {
566 return true, nil
567 }
568
569 return false, err
570}
571
572// 复制config文件到pod
573func copyConfigToPod(k k8s.KubernetesUtil, pod coreV1.Pod, containerName string, podDestGitRepoPath string, configFileLocalPath string, runAsUserName string) error {

Callers 1

ExecuteK8sStartCmdFunction · 0.85

Calls 4

ConvertToConfigYamlMethod · 0.80
ConvertToK8sYamlMethod · 0.80
IsNilMethod · 0.45
ToYamlMethod · 0.45

Tested by

no test coverage detected