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:
Jose Diaz-Gonzalez
2025-10-19 23:33:04 -04:00
parent 959c93b95b
commit 9d711cbb44
2 changed files with 24 additions and 3 deletions

View File

@@ -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)

View File

@@ -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
}