在 Bosh Job Spec文件中,您可以列出要复制的模板,如下所示。
templates:
ctl.sh: bin/ctl
config.json: config/config.json
有没有办法复制多个文件,可能使用通配符或其他东西?
像这样的方式...
templates:
*.sh: bin/
*.xml: config/
在 Bosh Job Spec文件中,您可以列出要复制的模板,如下所示。
templates:
ctl.sh: bin/ctl
config.json: config/config.json
有没有办法复制多个文件,可能使用通配符或其他东西?
像这样的方式...
templates:
*.sh: bin/
*.xml: config/
工作规范中的模板部分是 1:1 映射,并且(当前)不支持通配符,尽管我认为可以假设目标路径,但它们是明确的。但这些文件仅适用于您需要 ERB 配置文件以从 manifest/yml 中获取属性的情况,从而允许使用之间的灵活性。
但是如果你想要很多不需要动态属性的文件,你可以考虑这些是模板还是依赖项。您可以使用包来包含作为依赖项所需的整个存档或文件夹,包括使用通配符,并且这些可以作为作业生命周期的一部分自动提取。请参阅https://bosh.io/docs/create-release.html#pkg-skeletons
每个包都有一个打包脚本来告诉 bosh 将文件放在哪里。
# abort script on any command that exits with a non zero value
set -e
tar -xzf $BOSH_COMPILE_TARGET/xml/all-files.tar.gz
cp -a all-files/* $BOSH_INSTALL_TARGET
并且该文件在包规范中定义
---
name: xml-files
dependencies:
files:
- xml/all-files.tar.gz
files :此包包含的文件列表,其中可以包含 glob。* 匹配任何文件并且可以被 glob 中的其他值限制,例如 *.rb 只匹配以 .rb 结尾的文件。** 递归匹配目录。
你只是参考你的工作规范。
---
name: myjob
templates:
ctl.sh: bin/ctl
config.json: config/config.json
packages:
- xml-files