从Gitlab管道构建Packer



我正试图将我的packer构建执行到Gitlab管道中,我在互联网上没有找到例子,但我看到了一个docker图像,所以我希望这个yaml能完成任务:

image: hashicorp/packer
stages:
- build
build:
stage: build
script:
- echo "Hello world"
- packer build ./definition.json
only:
- master

但我不理解这种行为,CI提取映像,克隆repo,然后它就这样结束了:

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,而且它打印了两次我应该如何使用CLI进行迭代,为什么会出现这种行为?

我找到了如何修复它,我不得不更改:

image: hashicorp/packer

进入:

image:
name: hashicorp/packer
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'

相关内容

  • 没有找到相关文章

最新更新