从 Gitlab 管道构建 Packer
Packer build from a Gitlab pipeline
我正在尝试将我的打包程序构建到 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
,它打印 2 次我应该如何使用 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'
我正在尝试将我的打包程序构建到 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
,它打印 2 次我应该如何使用 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'