简体   繁体   English

在 AWS CodePipeline for NodeJS 应用程序中部署阶段失败

[英]Deploy stage failing in AWS CodePipeline for NodeJS app

This is my first time working with AWS CodePipeline (and actually CI/CD in general) and I'm having issues deploying my NodeJS/Express app to Elastic Beanstalk.这是我第一次使用 AWS CodePipeline(实际上是 CI/CD),我在将 NodeJS/Express 应用程序部署到 Elastic Beanstalk 时遇到了问题。

I've set up a pipeline with three steps:我已经建立了一个包含三个步骤的管道:

  1. Source from my GitHub repo来自我的 GitHub 存储库
  2. Build using CodeBuild使用 CodeBuild 构建
  3. Deploy to ElasticBeanstalk部署到 ElasticBeanstalk

My Source and Build stages are completing successfully, but the deploy step fails with the following message:我的 Source 和 Build 阶段已成功完成,但部署步骤失败并显示以下消息:

The action failed because either the artifact or the Amazon S3 bucket could not be found.操作失败,因为找不到工件或 Amazon S3 存储桶。 Name of artifact bucket: codepipeline-us-east-1-[long-string-of-numbers].工件存储桶的名称:codepipeline-us-east-1-[long-string-of-numbers]。 Verify that this bucket exists.验证此存储桶是否存在。 If it exists, check the life cycle policy, then try releasing a change.如果存在,请检查生命周期策略,然后尝试发布更改。

I have verified that the S3 bucket exists, and there is no life cycle policy on it.我已经验证了 S3 存储桶存在,并且上面没有生命周期策略。

I also checked the policy attached to the service-role being used and it has full S3 access.我还检查了附加到正在使用的服务角色的策略,它具有完整的 S3 访问权限。

The Deploy stage has the following settings:部署阶段具有以下设置:

  • Action Name: Deploy操作名称:部署
  • Action Provider: Elastic Beanstalk动作提供者:Elastic Beanstalk
  • Region: US East (N. Virginia)地区:美国东部(弗吉尼亚北部)
  • Input Artifacts: BuildArtifact输入工件:BuildArtifact
  • Application Name & Environment Name are the appropriate values for my Elastic Beanstalk set up应用程序名称和环境名称是我的 Elastic Beanstalk 设置的适当值
  • Variable Namespace: DeployVariables变量命名空间:DeployVariables

I've confirmed that the Output Artifact name of the Build stage is "BuildArtifact", which matches the Input Artifact for my Deploy stage.我已经确认构建阶段的 Output 工件名称是“BuildArtifact”,它与我的部署阶段的输入工件匹配。

The pipeline originally did not have a build step in it, and it was previously using a different S3 bucket: elasticbeanstalk-us-east-1-[long-string-of-numbers], not sure if that is a factor or not.该管道最初没有构建步骤,并且之前使用的是不同的 S3 存储桶:elasticbeanstalk-us-east-1-[long-string-of-numbers],不确定这是否是一个因素。

Any idea on how I can get this deployment to work?关于如何让这个部署工作的任何想法?

I think I figured it out.我想我想通了。

I realized I didn't have an Artifact set up in CodeBuild.我意识到我没有在 CodeBuild 中设置工件。 To resolve, I went to CodeBuild, went into my BuildProject, selected "Artifacts" from the "Edit" menu, and filled out the corresponding data.为了解决,我去了CodeBuild,进入我的BuildProject,从“Edit”菜单中选择“Artifacts”,并填写了相应的数据。

Then, in the buildspec.yaml for my nodejs project, I added the following: artifacts: files: - '**/*'然后,在我的 nodejs 项目的 buildspec.yaml 中,我添加了以下内容: artifacts: files: - '**/*'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM