Skip to content

Commit

Permalink
Fix pimcore-cloud stack
Browse files Browse the repository at this point in the history
  • Loading branch information
Theosakamg committed Aug 30, 2024
1 parent 35987fd commit 2e70234
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
9 changes: 7 additions & 2 deletions cmd/repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,13 @@ func ImportRepository(projectContext entity.ProjectGlobal, wsFolder string) {
}

// Remove remote repository
payload := append([]string{"remote", "remove"}, projectContext.Provider)
callVCS(wsFolder, payload...)
payload := append([]string{"-c", "git remote | xargs -n1 git remote remove"}, projectContext.Provider)
fmt.Println(strings.Join(payload[1:], " "))

_, _, err := utils.CallExePath("sh", "", wsFolder, payload...)
if err != nil {
log.Print(err)
}
}

func ShallowCloneRepository(url string, version string, wsFolder string) {
Expand Down
8 changes: 4 additions & 4 deletions cmd/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ func sshPath(sshUrl string, path string) string {
return sshUrl + ":/app" + path + "/"
}

func getSshUrl(projectCtx entity.ProjectGlobal, mount entity.EnvMount) string {
func getSshUrl(projectCtx entity.ProjectGlobal, appName string) string {
payload := []string{
"--environment=" + projectCtx.DefaultEnv,
"--app=" + mount.Application,
"--app=" + appName,
"--pipe",
}
sshUrl, err := utils.CallCLIString(projectCtx, "ssh", payload...)
Expand All @@ -36,7 +36,7 @@ func MountsExport(projectContext entity.ProjectGlobal, ws utils.PathTmp) {
folder := ws.MakeDataFolder(key) + "/"
log.Printf("Dump data for %v on %v", mount.Path, mount.Application)

sshUrl := getSshUrl(projectContext, mount)
sshUrl := getSshUrl(projectContext, mount.Application)
payload := []string{
"-azP",
sshPath(sshUrl, mount.Path),
Expand Down Expand Up @@ -69,7 +69,7 @@ func MountsImport(projectContext entity.ProjectGlobal) {
for _, mount := range projectContext.Mounts {
log.Printf("Restore dump data for %v on %v", mount.Path, mount.Application)

sshUrl := getSshUrl(projectContext, mount)
sshUrl := getSshUrl(projectContext, mount.Application)
payload := []string{
"-azP",
mount.DumpPath,
Expand Down
9 changes: 6 additions & 3 deletions cmd/variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,17 @@ func VariablesEnvWrite(projectContext entity.ProjectGlobal) {
// TODO : Remove old variables
}

func PopulateSensitive(projectContext entity.ProjectGlobal) {
func PopulateSensitive(projectContext entity.ProjectGlobal, appName string) {
log.Print("Get sensitive value from SSH container...")

payload := []string{
"--environment=" + projectContext.DefaultEnv,
//"--app=" + mount.Application, //TODO(mick) cannot be work for multi app
"env",
}
if appName != "" {
payload = append(payload, "--app="+appName)
}
payload = append(payload, "env")

output, err := utils.CallCLIString(projectContext, "ssh", payload...)
if err != nil {
log.Printf("command execution failed: %v \n", err)
Expand Down
2 changes: 1 addition & 1 deletion utility/cli_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func InitLogger(appName string) {
// Hack need case without log file
mw = io.MultiWriter(os.Stdout)
} else {
logFile, err := os.OpenFile(fmt.Sprintf(app.Args.PathLog+"/log-%v-%v.log", appName, TimeStamp()), os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666)
logFile, err := os.OpenFile(fmt.Sprintf(app.Args.PathLog+"log-%v-%v.log", appName, TimeStamp()), os.O_CREATE|os.O_APPEND|os.O_RDWR, 0666)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 2e70234

Please sign in to comment.