Reputation: 6791
Why does the buildspec file support multiple build phases? install, pre_build, build, post_build
? Am I doing something wrong if I put all of my build steps into a single phase? Is there something very useful, except for keeping some kind of structure, with these phases?
Upvotes: 3
Views: 2725
Reputation: 191
Yeah, we can do all the things in one phase (i.e build phase). But it is not recommended, if any thing fails it will be hard to debug especially when there is lot of things going on your build stage.
INSTALL STAGE - install or upgrate something like java version, node version, gatsby.. etc
PRE_BUILD - node modules, composer packages.. etc
BUILD - your build commands.
POST_BUILD - things to do after build. Like uploading to S3.
If your Build is just one or two commands, Just go with the BUILD phase alone.
Note: Uploading to s3 can also be done using ARTIFACT section.
Upvotes: 2
Reputation: 8887
Failures in some phases will cause the build to exit, whilst others will not. This article spells it out pretty well: https://docs.aws.amazon.com/codebuild/latest/userguide/view-build-details.html#view-build-details-phases
Upvotes: 6