fix: overwrite the in-repo Procfile with the desired Procfile

Without this change, herokuish and pack builds would not run the correct command as the Procfile could still be the old Procfile.
This commit is contained in:
Jose Diaz-Gonzalez
2022-12-28 15:36:34 -05:00
parent 514a3efa5c
commit e01730857c

View File

@@ -77,6 +77,7 @@ func TriggerCorePostExtract(appName string, sourceWorkDir string) error {
b, _ := common.PlugnTriggerOutput("git-get-property", []string{appName, "source-image"}...)
appSourceImage := strings.TrimSpace(string(b[:]))
repoDefaultProcfilePath := path.Join(sourceWorkDir, "Procfile")
if appSourceImage == "" {
repoProcfilePath := path.Join(sourceWorkDir, procfilePath)
if !common.FileExists(repoProcfilePath) {
@@ -91,6 +92,12 @@ func TriggerCorePostExtract(appName string, sourceWorkDir string) error {
if err := copy.Copy(repoProcfilePath, processSpecificProcfile); err != nil {
return fmt.Errorf("Unable to extract Procfile: %v", err.Error())
}
if procfilePath != "Procfile" {
if err := copy.Copy(repoProcfilePath, repoDefaultProcfilePath); err != nil {
return fmt.Errorf("Unable to move Procfile into place: %v", err.Error())
}
}
} else {
if err := common.CopyFromImage(appName, appSourceImage, procfilePath, processSpecificProcfile); err != nil {
return common.TouchFile(fmt.Sprintf("%s.missing", processSpecificProcfile))