gpt4 book ai didi

amazon-web-services - 使用无服务器框架部署时,从 Codebuild 构建规范的第一行中删除新行

转载 作者:行者123 更新时间:2023-12-04 07:19:25 25 4
gpt4 key购买 nike

我正在使用无服务器框架部署 AWS codebuild 的构建规范。当我部署时,构建规范中不存在第一行之后的新行。该资源之前部署时没有出现任何问题,我看不到我所做的任何事情来破坏它。这是我的问题还是 Serverless/CloudFormation 的错误?

下面是 CloudFormation 模板以及从 AWS 控制台复制的生成的构建规范。

    Resources:
CodeBuild:
Type: 'AWS::CodeBuild::Project'
Properties:
Name: sls-retrobase-frontend-CodeBuild-${opt:stage}
ServiceRole: !GetAtt CodeBuildRole.Arn
Artifacts:
Type: CODEPIPELINE
Name: sls-retrobase
Environment:
Type: LINUX_CONTAINER
ComputeType: BUILD_GENERAL1_SMALL
Image: "aws/codebuild/amazonlinux2-x86_64-standard:3.0"
Source:
Type: CODEPIPELINE
BuildSpec: !Sub
- >
version: 0.2
phases:
pre_build:
commands:
- echo List directory files...
- ls
- echo Installing source NPM dependencies...
- npm install
build:
commands:
- echo List active directory...
- ls
- echo Inserting Api Url into config.json from environment
- node makeConfig.js ${apiUrl} ${auth0Audience} ${auth0Domain} ${auth0ClientId}
- echo Build started on `date`
- npm run build
post_build:
commands:
- echo List build directory...
- ls ./build
- aws s3 cp --recursive --acl public-read ./build s3://${Website}
artifacts:
files:
- '**/*'
- apiUrl: !Join ['', [ "https://", !Ref QueryRestApi, ".execute-api.us-east-1.amazonaws.com/${opt:stage}/sls-retrobase-${opt:stage}"]]
websiteUrl: !GetAtt Website.WebsiteURL
auth0Audience: '***'
auth0Domain: '***'
auth0ClientId: '***'

构建规范:

    version: 0.2 phases:
pre_build:
commands:
- echo List directory files...
- ls
- echo Installing source NPM dependencies...
- npm install
build:
commands:
- echo List active directory...
- ls
- echo Inserting Api Url into config.json from environment
- node makeConfig.js https://h0suk54yw0.execute-api.us-east-1.amazonaws.com/test/sls-retrobase-test https://sls-retrobase https://dev-y33gimcf.eu.auth0.com/ Xn6SDc43vE8P0sQHkVLtiBSBVFT5rJMU
- echo Build started on `date`
- npm run build
post_build:
commands:
- echo List build directory...
- ls ./build
- aws s3 cp --recursive --acl public-read ./build s3://serverless-retrobase-resources-test-website-7cvhqlgbkfj7
artifacts:
files:
- '**/*'

最佳答案

这可能是因为您使用了>。请将其更改为|:

            BuildSpec: !Sub
- |
version: 0.2
phases:

或者,在使用 > 时修复空格。 > 和您的代码未对齐。

关于amazon-web-services - 使用无服务器框架部署时,从 Codebuild 构建规范的第一行中删除新行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68596791/

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