mirror of
https://github.com/dokku/dokku.git
synced 2026-02-23 19:50:34 +01:00
fix: expand variables for release tasks
Procfile commands need to be expanded with actual environment variables as procfile-util will otherwise empty them out. This doesn't happen for app.json scripts as they are never expanded until the docker container gets created. Closes #8050
This commit is contained in:
@@ -18,14 +18,35 @@ func canScaleApp(appName string) bool {
|
||||
return common.ToBool(canScale)
|
||||
}
|
||||
|
||||
func getProcfileCommand(procfilePath string, processType string, port int) (string, error) {
|
||||
func getProcfileCommand(appName string, procfilePath string, processType string, port int) (string, error) {
|
||||
if !common.FileExists(procfilePath) {
|
||||
return "", errors.New("No procfile found")
|
||||
}
|
||||
|
||||
configResult, err := common.CallPlugnTrigger(common.PlugnTriggerInput{
|
||||
Trigger: "config-export",
|
||||
Args: []string{appName, "false", "true", "envfile"},
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
// write the envfile to a temporary file
|
||||
tempFile, err := os.CreateTemp("", "envfile-*.env")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer os.Remove(tempFile.Name())
|
||||
if _, err := tempFile.Write(configResult.StdoutBytes()); err != nil {
|
||||
return "", err
|
||||
}
|
||||
if err := tempFile.Close(); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
result, err := common.CallExecCommand(common.ExecCommandInput{
|
||||
Command: "procfile-util",
|
||||
Args: []string{"show", "--procfile", procfilePath, "--process-type", processType, "--default-port", strconv.Itoa(port)},
|
||||
Args: []string{"show", "--procfile", procfilePath, "--process-type", processType, "--default-port", strconv.Itoa(port), "--env-file", tempFile.Name()},
|
||||
})
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Error running procfile-util: %s", err)
|
||||
|
||||
@@ -274,7 +274,7 @@ func TriggerProcfileGetCommand(appName string, processType string, port int) err
|
||||
return nil
|
||||
}
|
||||
|
||||
command, err := getProcfileCommand(getProcessSpecificProcfilePath(appName), processType, port)
|
||||
command, err := getProcfileCommand(appName, getProcessSpecificProcfilePath(appName), processType, port)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user