gpt4 book ai didi

gitlab-ci - 从 Gitlab 管道构建 Packer

转载 作者:行者123 更新时间:2023-12-03 19:43:59 24 4
gpt4 key购买 nike

我正在尝试将我的打包器构建执行到 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-ci - 从 Gitlab 管道构建 Packer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58564430/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com