jenkins - 将参数从 cloudformation 作为变量传递到 jenkins 实例中

标签 jenkins aws-cloudformation

我正在尝试传递一个参数,该参数已由用户在创建云信息模板的堆栈时收到,例如下面

Parameters:
  EnvironmentName:
    Type: String
    Description: The name of the environment
    AllowedPattern: "[a-z0-9-]+"

我想将该参数传递给 jenkins(它是作为此堆栈的一部分创建的),以用作全局变量,可能使用 Global Variable String Parameter Plugin .

有没有办法纯粹使用 cloudformation 来做到这一点?有人告诉我,我可能需要 Ansible 或 Terraform 之类的东西,但如果可能的话,我更愿意仅使用 cloudformation。

最佳答案

如果你想在另一个CF脚本中使用它,有一个export将导出变量的输出部分的选项。

Outputs:
  EnvironmentName:
    Type: String
    Description: The name of the environment
    Export: !Sub EnvironmentName
    Value: EnvironmentName 

然后您可以使用 list-stack-resources 从 Jenkings 或 sh 脚本进行询问功能。

关于jenkins - 将参数从 cloudformation 作为变量传递到 jenkins 实例中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44885837/

相关文章:

aws-cloudformation - 如何在 yaml 中引用我定义的队列

amazon-web-services - 事件类型 : viewer-request results in 503 for lambda edge

Jenkinsfile - 如何检测拉取请求的目的地

jenkins - 如何在声明式管道中定义多个容器?

amazon-web-services - 在 AWS CloudFormation 中定义表、 View 和索引

aws-cloudformation - 如何使用 pyplate 宏配置大量资源

amazon-web-services - 如何修复漂移的 AWS CloudFormation 堆栈?

python - 使用 Jenkins REST API 将 Jenkins 节点暂时标记为离线

maven - Jenkins 中的增量构建

ssh - Jenkins,SSH 插件,传输了 0 个文件