1

I'm creating a AWS CodePipeline with the following phases:

  1. Source: Get code from Github when some change occurs in the staging branch.
  2. Build:Read the buildspec.yml to execute "mvn clean package", docker build and docker push.
  3. Deploy: Deploy to ECS Cluster

Now I need to create a 4 phase (AfterDeploy Phase) that should commit some files in github. So, after all these phases completed with success, the AfterDeploy Phase should commit some files generated by Build phase in github.

Any idea how can I do it?

2
  • 1
    You can use another CodeBuild action to do that. Commented Aug 7, 2020 at 4:03
  • Do you have a example using a buildspec file ? Should I have 2 buildspec files, because I have 2 build phases ? Commented Aug 7, 2020 at 12:15

1 Answer 1

3

Should I have 2 buildspec files, because I have 2 build phases ?

Yes, you can do this. For example, you can have primary buildspec.yml for your first build, and secondary buildspec_postdeploy.yml for the second build stage.

How to use multiple buildspec files is documented at:

I don't have an example to share, but it would just execute any git commint and git push commands that are needed. Its exact structure is very use-case specific, thus it is difficult to speculate on it.

https://docs.aws.amazon.com/codebuild/latest/userguide/build-spec-ref.html#build-spec-ref-name-storage

Sign up to request clarification or add additional context in comments.

1 Comment

@userdevexp No problem. Hopefully it will work out :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.