在CodeBuild buildspec中引用CodeCommit文件名

问题描述 投票:2回答:1

我正在尝试从CodeCommit存储库创建一个cloudformation堆栈。我在CodeBuild中创建了构建项目。

我的Build Command是这样的:

build:
    commands:
    - aws cloudformation create-stack 
        --stack-name SGStack 
        --template-body file://security_groups.template 
        --parameters ParameterKey=VPCID,ParameterValue=vpc-77092d1

我想我的'--template-body'命令有问题。

如何在codebuild构建命令中引用codecommit repo的文件?

amazon-web-services amazon-cloudformation aws-cli aws-codebuild aws-codecommit
1个回答
0
投票

在您的buildspec中,尝试使用pwd或使用CODEBUILD_SRC_DIR环境变量访问模板:

e.g:

build:命令: - aws cloudformation create-stack --stack-name SGStack --template-body file:// $(pwd)/security_groups.template --parameters ParameterKey = VPCID,ParameterValue = vpc-77092d1

© www.soinside.com 2019 - 2024. All rights reserved.