MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / getUpgradeCompose

Function getUpgradeCompose

agent/app/service/app_utils.go:572–603  ·  view source on GitHub ↗
(install model.AppInstall, detail model.AppDetail)

Source from the content-addressed store, hash-verified

570}
571
572func getUpgradeCompose(install model.AppInstall, detail model.AppDetail) (string, error) {
573 if detail.DockerCompose == "" {
574 return "", nil
575 }
576 composeMap, err := handleUpgradeCompose(install, detail)
577 if err != nil {
578 return "", err
579 }
580 envs := make(map[string]interface{})
581 if err := json.Unmarshal([]byte(install.Env), &envs); err != nil {
582 return "", err
583 }
584 config := getAppCommonConfig(envs)
585 if config.ContainerName == "" {
586 config.ContainerName = install.ContainerName
587 envs[constant.ContainerName] = install.ContainerName
588 }
589 config.Advanced = true
590 if err := addDockerComposeCommonParam(composeMap, install.ServiceName, config, envs); err != nil {
591 return "", err
592 }
593 paramByte, err := json.Marshal(envs)
594 if err != nil {
595 return "", err
596 }
597 install.Env = string(paramByte)
598 composeByte, err := yaml.Marshal(composeMap)
599 if err != nil {
600 return "", err
601 }
602 return string(composeByte), nil
603}
604
605func buildNginx(parentTask *task.Task) error {
606 nginxInstall, err := getAppInstallByKey(constant.AppOpenresty)

Callers 4

GetUpdateVersionsMethod · 0.85
GetParamsMethod · 0.85
upgradeInstallFunction · 0.85
isEditComposeFunction · 0.85

Calls 3

handleUpgradeComposeFunction · 0.85
getAppCommonConfigFunction · 0.85

Tested by

no test coverage detected