这不起作用,因为它发生在 因无法检索版本而失败的代码 之后。可行的方法是在 web.template.yml 旁边创建一个名为 version.template.yml 的文件,内容如下:
params:
home: /var/www/discourse
run:
- exec:
cd: $home
hook: code
cmd:
- git fetch --tags
然后在 containers/app.yml 中将该文件包含在 web.template.yml 之前,如下所示:
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/version.template.yml"
- "templates/web.template.yml"