gpt4 book ai didi

heroku - 如何调试自定义 Heroku buildpack : release script not being driven

转载 作者:行者123 更新时间:2023-12-04 05:08:47 24 4
gpt4 key购买 nike

我正在开发 Eclipse Virgo buildpack但是当我用 Heroku 尝试并推送 trivial app 时,检测失败:

-----> Fetching custom git buildpack... done
! Heroku push rejected, no Cedar-supported app detected

buildpack 的检测脚本在应用程序的根目录中本地运行良好:

$[...]virgo-buildpack/bin/detect .
Virgo Web

关于如何调试这个的任何提示?我尝试将检测脚本写入 stdout 和 stderr,但输出没有出现在“heroku logs”下。

我正在运行 Mac OS X 10.8.2、Ruby 1.9.3p374 和 gems 1.8.23。

更新:根据前两个答案,我在驱动 detect.rb 脚本之前使用了 bash 检测脚本来安装丢失的 gem。我还更改了 buildpack 脚本以写入标准输出。

heroku 推送更进一步,但仍然失败。我可以看到编译脚本正在退出,但是发布 bash 脚本在开始时有一个 echo 命令,并且它没有出现在输出中。

看来发布脚本没有被调用。

输出结果如下(#表示注释以避免困惑):

-----> Fetching custom git buildpack... done
# detect script enter and exit
Virgo Web app detected
# compile script enter and exit
-----> Discovering process types
Procfile declares types


-> (none)
# detect script enter and exit (again)
Virgo Web -> web

-----> Compiled slug size: 60.4MB
-----> Launching... ! Heroku push rejected, failure releasing code

heroku logs --tail 简单地显示:

2013-03-06T10:53:48+00:00 heroku[slugc]: Slug compilation started
2013-03-06T10:54:27+00:00 heroku[slugc]: Slug compilation failed: failure releasing code

最佳答案

对于自定义 buildpack,detect 脚本实际上不需要那么复杂,因为无论如何用户都将使用 BUILDPACK_URL 手动指定它。复杂的 detect 脚本实际上只对默认的 Heroku buildpacks 有意义,因为它们需要检测 buildpack 是否适用于任何给定的应用程序。

如果你想完全赌上检测,你可以逃避这样的事情:

#!/usr/bin/env bash
# bin/detect <build-dir>

echo "Vergo"
exit 0

一旦你开始工作(并解决了 compilerelease 的任何问题),你可以让它更智能一些。例如,您可以检测某个文件模式是否存在:

#!/usr/bin/env bash
# bin/detect <build-dir>
if [ -f $1/index.jsp ]; then
echo "Vergo" && exit 0
else
echo "no" && exit 1
fi

此外,说到简单性,您的构建包似乎是基于 Ruby buildpack ,这是目前最复杂的问题之一。您可能想看看 list of third-party buildpacks看看大多数是如何在简单的 bash 中完成的。

关于heroku - 如何调试自定义 Heroku buildpack : release script not being driven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15161296/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com