如何将Jenkins变量传递给Packer?
在詹金斯中,它的设置如下:
environment {
VARIABLE_1 = credentials('variable-1')
}
在打包机中,我打算如何做到这一点,我已经有了一个简短的想法,但它似乎从未获得价值:
provisioner "powershell" {
environment_vars = ["VARIABLE_1={$env:VARIABLE_1}"]
inline = ["Write-Host \"Secret Text is: ${Env:VARIABLE_1}\""]
所以我的问题是,通过的最佳方式是什么这个变量并确保打包机从詹金斯那里获取这个变量?
我已经尝试过上述方法,但我也尝试更改环境变量格式,但无济于事。
我期望将 Jenkins 的秘密文本值导入 Packer(HCL 格式)。
In Jenkins it is set like:
environment {
VARIABLE_1 = credentials('variable-1')
}
In packer how am I meant to do this, I've had a brief idea how to do it but it never seems to pick up the value:
provisioner "powershell" {
environment_vars = ["VARIABLE_1={$env:VARIABLE_1}"]
inline = ["Write-Host \"Secret Text is: ${Env:VARIABLE_1}\""]
So my question is, what's the best way to pass through this variable and ensure packer picks this up from Jenkins?
I have tried the above but I have also tried changing the environment variable format to no avail.
I was expecting the secret text value from Jenkins to be imported into Packer(HCL format).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论