简体   繁体   English

如何在Heroku上的Clojure应用程序内部访问git版本信息?

[英]How can I access git version information from inside my Clojure app on Heroku?

I have working code on my personal machine that executes git describe via clojure.java.shell and shows that version info on the settings page. 我的个人计算机上有工作代码,该代码通过clojure.java.shell执行git describe ,并在设置页面上显示该版本信息。 But when this runs on Heroku, even adjusting the path to the same one I get from which git on a heroku run bash prompt, I get this error: 但是当它在Heroku上运行时,即使将路径调整为我在heroku run bash提示符下从which git获得的路径,我也会收到此错误:

{:exit 128, :out , :err fatal: Not a git repository (or any parent up to mount point /app)} {:退出128,:out,:err致命:不是git存储库(或任何挂载到/ app的父级)}

And checking from the heroku bash prompt again, I see no .git directory. 并再次从heroku bash提示检查,我看不到.git目录。

How could I access the current git tag and SHA from inside my Clojure app? 如何从Clojure应用程序内部访问当前的git标签和SHA?

Heroku doesn't give you access to this directory, the slug compiler strips it before build time. Heroku不允许您访问此目录,slug编译器会在构建之前将其删除。

Step 2: Remove unused files, including .git directories, .gitmodules files, anything in log and tmp, and anything specified in a top-level .slugignore file. 步骤2:删除未使用的文件,包括.git目录,.gitmodules文件,log和tmp中的所有内容以及顶级.slugignore文件中指定的所有内容。

https://devcenter.heroku.com/articles/slug-compiler https://devcenter.heroku.com/articles/slug-compiler

There are some circuitous workarounds suggested in Heroku - Display hash of current commit . Heroku中建议使用一些circuit回的变通方法-显示当前提交的哈希值

See also https://github.com/heroku/heroku-cli/issues/14 for discussion about why providing the .gif folder could be a bad idea. 另请参阅https://github.com/heroku/heroku-cli/issues/14,以获取有关为什么提供.gif文件夹可能不是一个好主意的讨论。 Short answer: size, and that the .git directory is not always provided by the user in different deploy modes. 简短的答案:大小,并且.git目录并非总是由用户以不同的部署模式提供。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM