Error in AWS codepipeline when deploying ElasticBeanstalk
Asked Answered
R

3

12

I've created a pipeline which does the following:

  1. Git changes trigger next action (code build)
  2. Codebuild initiates & builds a docker image from git source
  3. Set latest docker container up on Elasticbeanstalk

The first 2 steps are working fine, git changes initiate a codebuild, the codebuild builds a docker image, and then tries to set it up on Elasticbeanstalk (which fails). The following error is thrown:

Invalid action configuration The action failed because either the artifact or the Amazon S3 bucket could not be found. Name of artifact bucket: MY_BUCKET_NAME. Verify that this bucket exists. If it exists, check the life cycle policy, then try releasing a change.

In my codebuild project, I've set the artifact location to MY_BUCKET_NAME & named it aws-test-artifact. Is this all I have to do?

I've tried looking around and am unable to find anything on this issue.

Rager answered 11/12, 2016 at 20:18 Comment(0)
E
7

As Adam Loving commented we must add artifacts section.

Adding this section to your buildspec.yml file will make this work.

artifacts:
  files:
    - '**/*'

From documentation https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec.artifacts.files adding '**/*' will include all files into the build target.

Enameling answered 13/6, 2021 at 16:47 Comment(0)
R
2

So I found the fix to this issue! What I had to do was goto codebuild => edit project => Show advanced settings => Artifacts packaging

From here I changed Artifacts packaging to Zip!

Advanced settings section

Rager answered 11/12, 2016 at 20:52 Comment(2)
There is no option for artifacts packagingUpside
Also, make sure your Buildspec has an artifacts section. Otherwise the build will succeed and link to an artifacts file that doesn't exist and was never uploaded.Empale
K
2

I had the same problem. Just changed Input artifacts from BuildArtifact to SourceArtifact in the build stage, and everything worked.

Kianakiang answered 18/7, 2019 at 16:26 Comment(2)
Can you please explain your answer?Lentigo
This does will exclude any changes to the artifact done during the build step.Enameling

© 2022 - 2024 — McMap. All rights reserved.