我正在尝试在Gitlab流水线中执行我的packer构建,但在互联网上没有找到相关示例,不过我看到有一个Docker镜像,因此我希望这个YAML文件可以完成任务:
image: hashicorp/packer
stages:
- build
build:
stage: build
script:
- echo "Hello world"
- packer build ./definition.json
only:
- master
但我不理解这种行为,CI拉取镜像、克隆存储库,最终结果却是这样:
Skipping Git submodules setup
Usage: packer [--version] [--help] <command> [<args>]
Available commands are:
build build image(s) from template
console creates a console for testing variable interpolation
fix fixes templates from old versions of packer
inspect see components of a template
validate check that a template is valid
version Prints the Packer version
Usage: packer [--version] [--help] <command> [<args>]
Available commands are:
build build image(s) from template
console creates a console for testing variable interpolation
fix fixes templates from old versions of packer
inspect see components of a template
validate check that a template is valid
version Prints the Packer version
ERROR: Job failed: exit code 127
它甚至没有打印我的 echo Hello World
,并且打印了2次如何与CLI交互,为什么会出现这种情况?